Facebook Twitter Instagram Pinterest YouTube
    Trending
    • Add Kodi to RetroPie Menu
    • Disable Auto-login in Raspberry Pi OS
    • Raspberry Pi Cloud Storage with MEGA
    • RetroPie Temperature Monitor from Menu
    • Pi Pico Pinout and Power Pins
    • Install Arduino IDE on Raspberry Pi
    • Raspberry Pi 400 SSD Upgrade
    • Raspberry Pi Temperature Monitoring
    Facebook Twitter Instagram Pinterest YouTube RSS
    Raspberry Pi SpyRaspberry Pi Spy
    • Home
    • Categories
      • General
      • Hardware
      • Programming
      • Python
      • Software
      • Tutorials & Help
    • BerryClip
      • BerryClip Instructions
      • BerryClip Plus Instructions
      • Videos & Reviews
    • Buy
      • Buy Pi
      • Buy Pi Accessories
      • Buy Books
    • Tools
      • Ultimate Raspberry Pi Alexa Skill
      • Pi Power Estimator App
      • Pi-Lite 14×9 LED Matrix Sprite Editor
      • RPiREF Pin-out Reference App
      • Simple Ohm’s Law Calculator
      • Web Sites & Links
    • Tutorials & Help
        Featured
        November 9, 20200

        Raspberry Pi Temperature Monitoring

        Recent
        May 6, 2022

        Add Kodi to RetroPie Menu

        February 26, 2022

        Disable Auto-login in Raspberry Pi OS

        February 2, 2022

        Raspberry Pi Cloud Storage with MEGA

      1. Contact Us
      2. Site Map
      Raspberry Pi SpyRaspberry Pi Spy
      You are at:Home»Hardware»Add-ons»RGB LED Christmas Tree by PocketMoneyTronics
      RGB Christmas Tree

      RGB LED Christmas Tree by PocketMoneyTronics

      0
      By Matt on December 19, 2016 Add-ons

      A few years ago I wrote about his previous “Raspberry GPIO Xmas Tree Add-on” so Andrew Gale from PocketMoneyTronics.co.uk sent me his latest Christmas Tree kit for the Raspberry Pi. This version includes RGB LEDs which allow the tree to display a much larger range of colours with the benefit of adjustable brightness.

      To deal with the added complexity Andrew recommends using the libraries provided by Pimoroni which are usually used with their Unicorn HAT.

      Soldering the Tree

      The official setup guide can be found on the PocketMoneyTronics RGB tree page. This explains how to solder the components onto the PCB. Make sure the 4 leg LEDs are soldered in the correct position. I soldered my kit with the help of my nine year old son and we used some masking tape to hold the PCB in place while we worked.

      Installing Unicorn HAT libraries

      We started by writing the official Raspbian Lite image to an 8GB SD card. The library installation process was fairly straightforward and was completed with one command :

      curl -sS get.pimoroni.com/unicornhat | bash

      You may be asked for confirmation with a few y/n prompts. Answer yes until the process is completed.

      Downloading Example Script

      We used Andrew’s example Python script to test the tree after we had soldered it. The example was downloaded using :

      wget http://www.pocketmoneytronics.co.uk/downloads/rgb_tree_example.py

      and then run using :

      sudo python rgb_tree_example.py

      This created a number of sequences that lit up the LEDs and changed their colour.

      It’s hard to film LEDs but this video clip will give you an idea of the patterns and sequences that are possible.

      Brightness

      You may want to adjust the brightness of the LEDs. This can be done by editing the MASTER_BRIGHTNESS variable in the script. The default is 100 but I changed it to 50 when taking photos.

      RGB Christmas Tree

      Creating a stand alone Christmas decoration

      We wanted to create a simple system that would allow us to use the tree as a Christmas decoration. We decided to mount it on a Pi Zero, power it from a USB battery pack and use a new Python script to randomly change the LED colours in a loop.

      We got the tree working on a Pi 2 connected to my network with an Ethernet cable. This let us install the Unicorn HAT libraries and download the example script. We then created a new script that would randomly change the LED colours in an infinite loop. It also made sure no LED ever appeared to be completely off.

      You can download this script using :

      wget https://bitbucket.org/MattHawkinsUK/rpispy-misc/raw/master/python/xmastree2.py

      and then run it using :

      sudo python xmastree2.py

      As it runs in a while loop you can press CTRL-C to stop it.

      The final step was to autorun this script using “systemd”. To do this we followed the “How To Autorun A Python Script On Boot Using systemd” tutorial but just changed the ExecStart line to :

      ExecStart=/usr/bin/python /home/pi/xmastree2.py

      When the Pi was powered up the lights randomly changed.

      We then put the SD card in a Pi Zero and attached the tree. The Pi was then stuck to a USB power bank with sticky pads.

      RGB Christmas Tree

      It’s now sitting on the mantlepiece!

      RGB Christmas Tree

      Power Down

      There is no fancy method to gracefully shutdown the Pi. Given how simple this project is I just turn it off using the battery pack. This isn’t the best way to handle Pi projects but it’s only a decoration so SD card corruption isn’t a major worry. Having said that I’ve never corrupted an SD card yet!

      Happy Christmas!

      Share. Facebook Twitter Pinterest LinkedIn Tumblr Email
      Previous ArticleWaterproof Ultrasonic Distance Measuring Module
      Next Article Running PIXEL Desktop on a PC or Mac

      Related Posts

      Gameboy Zero 6 Button Board from Aliexpress

      Raspberry Pi 7-Segment LED Display Module using Python

      Kano Motion Sensor Kit for the Raspberry Pi

      Leave A Reply Cancel Reply

      This site uses Akismet to reduce spam. Learn how your comment data is processed.

      Recent Posts
      May 6, 2022

      Add Kodi to RetroPie Menu

      February 26, 2022

      Disable Auto-login in Raspberry Pi OS

      February 2, 2022

      Raspberry Pi Cloud Storage with MEGA

      January 7, 2022

      RetroPie Temperature Monitor from Menu

      January 24, 2021

      Pi Pico Pinout and Power Pins

      Categories
      • 1-wire
      • 3D Printing
      • Add-ons
      • BBC Micro:bit
      • BerryClip
      • Books
      • Camera Module
      • Cases
      • Events
      • General
      • Hardware
      • I2C
      • Infographics
      • Interfaces
      • Minecraft
      • Model A+
      • Model B+
      • News
      • Pi Models
      • Pi Zero
      • Power
      • Programming
      • Python
      • Raspberry Pi OS
      • Raspbian
      • RetroGaming
      • Robotics
      • Sensors
      • Software
      • SPI
      • Tutorials & Help
      Tags
      3D Printing Arduino audio battery berryclip Birthday bluetooth cambridge camera CamJam DigiMakers display games GPIO I2C interface Kickstarter LCD LED Linux media Minecraft Model A Model B motionEyeOS PCB photography photos Pi-Lite portable power python Raspberry Jam Raspberry Pi Bootcamp raspbian Retrogaming retroPie screen SD card security sensor SPI temperature ultrasonic video
      Raspberry PI Related
      • Adafruit Blog
      • Average Maker
      • Official RaspBerry Pi Site
      • Raspberry Pi Pod
      • RasPi.tv
      • RaspTut
      • Stuff About Code
      Tech Resources
      • MattsBits – Pi Resources
      • Microbit Spy
      • Technology Spy
      Archives
      About

      Unofficial site devoted to the Raspberry Pi credit card sized computer offering tutorials, guides, resources,scripts and downloads. We hope to help everyone get the most out of their Pi by providing clear, simple articles on configuring, programming and operating it.

      Popular Posts
      September 19, 2014

      Top 5 Reasons The Raspberry Pi Sucks

      July 27, 2012

      16×2 LCD Module Control Using Python

      October 20, 2013

      Analogue Sensors On The Raspberry Pi Using An MCP3008

      Recent Posts
      May 6, 2022

      Add Kodi to RetroPie Menu

      February 26, 2022

      Disable Auto-login in Raspberry Pi OS

      February 2, 2022

      Raspberry Pi Cloud Storage with MEGA

      Facebook Twitter Instagram Pinterest YouTube RSS

      Entries RSS | Comments RSS

      This site is not associated with the official Raspberrypi.org site or the Raspberry Pi Foundation. Raspberry Pi is a trademark of the Raspberry Pi Foundation.

      Copyright © 2022 - All Rights Reserved - Matt Hawkins

      Type above and press Enter to search. Press Esc to cancel.