Close Menu
    Facebook X (Twitter) Instagram Pinterest YouTube
    Trending
    • Disable SSH Password Login on Raspberry Pi
    • Elecrow Meteor IPS Touchscreen with RGB LEDs
    • Pi Pico Pinout Display on the Command Line
    • How to Add a Raspberry Pi Pico Reset Button
    • Pi Pico Onboard LED
    • Pi Pico W Pinout and Power Pins
    • CrowPi L Raspberry Pi Laptop and Learning Platform
    • Pi Pico W Launched
    Mastodon YouTube Facebook Instagram Pinterest 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
        February 16, 2024

        Disable SSH Password Login on Raspberry Pi

        December 23, 2022

        How to Add a Raspberry Pi Pico Reset Button

        November 20, 2022

        Pi Pico Onboard LED

      1. Contact Us
      2. Site Map
      Raspberry Pi SpyRaspberry Pi Spy
      You are at:Home»Hardware»Add-ons»Raspberry GPIO Xmas Tree Add-on
      GPIO Christmas Tree

      Raspberry GPIO Xmas Tree Add-on

      1
      By Matt on December 20, 2014 Add-ons

      Andrew Gale from PocketMoneyTronics.co.uk kindly sent me a GPIO Xmas Tree kit. Today I soldered it up with my son so we could get it set up for Christmas. The plan was to attach it to a Model A+ and power it with a USB battery pack.

      The kit includes the tree PCB, 6 red LEDs, 1 yellow LED, 4 resistors and 1 2×3 header. It’s fairly easy to solder and a great kit for someone wanting to learn soldering.

      P1020819

      P1020827With 7 LEDs you would expect the tree to require 7 GPIO pins but it uses a technique called “Charlieplexing” to control them with only 4. Andrew explains a bit more about this on his “Charlieplexing on the GPIO Xmas Tree” page.

      However you don’t really need to go into this if you don’t want to as the example Python scripts can be used to get your tree working as soon as you have soldered it.

      Software Setup

      Here’s the sequence of steps I used to get the example scripts running :

      Create and browse to a folder called “xmas” :

      mkdir xmas
      cd xmas

      Download the files from the web :

      wget http://www.pocketmoneytronics.co.uk/downloads/xmas.zip

      Extract the zip file to the current directory :

      unzip xmas.zip

      This will give you some example scripts. Type “ls” to see a list of files.

      You can run the examples using :

      sudo python example_5.py

      You should see something like this :

      https://vine.co/v/OXMzWIYAruA

      Modified Script

      P1020826In order to create a battery powered Christmas tree I needed a script that would start when the Pi was powered up and allow it to be shutdown without a keyboard or monitor.

      To do this I fitted a BerryClip and modified example_5.py to exit and shutdown when the red switch was pressed.

      You can download my modified script directly to your Pi using :

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

      Make sure you download it while in the “/home/pi/xmas” directory.

      Autorun On Boot

      To run the script automatically when the Pi boots you can use ‘cron’. To edit it we use the command :

      sudo crontab -e

      Using your cursor keys scroll to the bottom and add the following line :

      @reboot python /home/pi/xmas/xmastree.py &

      Make sure you get this line correct as the script will fail to run on boot if there are any mistakes. “xmastree.py” should be

      To save these changes click “CTRL-X”, then “Y” and finally “Return”. You should now be back at the command prompt.

      To start testing you can now reboot using :

      sudo reboot

      The tree lights should randomly illuminate and pressing the switch attached to GPIO25 will shutdown the Pi.

      GPIO Christmas Tree

      The GPIO Xmas Tree kit is available from DawnRobotics.co.uk.

      Share. Facebook Twitter Pinterest LinkedIn Tumblr Email
      Previous ArticlePi Wars – Saturday 6th December 2014
      Next Article Raspberry Pi Spy Top 10 Posts of 2014

      Related Posts

      Gameboy Zero 6 Button Board from Aliexpress

      Kano Motion Sensor Kit for the Raspberry Pi

      Controlling Energenie Power Sockets with the Pi-mote Addon

      1 Comment

      1. Zak Zebrowski on December 22, 2014 4:11 pm

        Or, in rc.local, you can do a nohup python /full/path/to/script.py & and have it start at boot up that way…

        Reply
      Leave A Reply Cancel Reply

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

      Recent Posts
      February 16, 2024

      Disable SSH Password Login on Raspberry Pi

      March 13, 2023

      Elecrow Meteor IPS Touchscreen with RGB LEDs

      December 26, 2022

      Pi Pico Pinout Display on the Command Line

      December 23, 2022

      How to Add a Raspberry Pi Pico Reset Button

      November 20, 2022

      Pi Pico Onboard LED

      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 Pico
      • Pi Zero
      • Power
      • Programming
      • Python
      • Raspberry Pi OS
      • Raspbian
      • RetroGaming
      • Robotics
      • Sensors
      • Software
      • SPI
      • Tutorials & Help
      Tags
      Arduino audio battery berryclip Birthday bluetooth cambridge camera CamJam DigiMakers display games GPIO I2C interface Kickstarter Kodi LCD LED Linux media Minecraft Model A motionEyeOS PCB photography photos Pi-Lite Pi Pico power python Raspberry Jam Raspberry Pi Bootcamp raspbian Retrogaming retroPie screen SD card security sensor SPI SSH 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

      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 © 2025 - All Rights Reserved - Matt Hawkins

      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

      Latest Posts
      February 16, 2024

      Disable SSH Password Login on Raspberry Pi

      March 13, 2023

      Elecrow Meteor IPS Touchscreen with RGB LEDs

      December 26, 2022

      Pi Pico Pinout Display on the Command Line

      Mastodon YouTube Instagram Facebook Pinterest 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 © 2025 - All Rights Reserved - Matt Hawkins

      mastodon.social@RPiSpy

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