Raspberry Pi Christmas Countdown Clock


I am assuming you already have the RaspberryPi setup with the base OS and booting only to console (you do not need the full Gui) (https://www.raspberrypi.org/downloads/ ).  This also requires that the Raspberry Pi also has Internet.


Parts List

Raspberry Pi 3B or greater (providing pinout based on 3B or greater)  (https://www.raspberrypi.org/)


Recommend getting a starter kit.  It will include case, storage memory card, heat sink and/or fan


RBG OLED Display



Library and Driver List



Demo Code







Pin Connections from Waveshare RGB OLED model listed above (other displays may vary)



Raspberry Pi

VCC (Red Wire)

3V Pin 1

GND (Black Wire)

GND Pin 39

DIN (Blue Wire)

MOSI Pin 19

CLK (Yellow Wire)

SCLK Pin 23

CS (Orange Wire)

CE0 Pin 24

DC (Teal Wire)

24(BCM) Pin 18

RST (White Wire)

25(BCM) Pin 22





Login into the Raspberry Pi though SSH (I start up two sessions, one for coding and one for testing the program)

First thing after logging, in you will need to download the libraries and install them.

Install WiringPi Library


sudo apt-get install wiringpi

wget https://project-downloads.drogon.net/wiringpi-latest.deb

sudo dpkg -i wiringpi-latest.deb

gpio -v


wget http://www.airspayce.com/mikem/bcm2835/bcm2835-1.60.tar.gz
tar zxvf bcm2835-1.60.tar.gz 
cd bcm2835-1.60/
sudo ./configure
sudo make && sudo make check && sudo make install


Install Python Library

sudo pip3 install pillow
sudo pip3 install numpy
sudo apt-get install libopenjp2-7
sudo apt install libtiff
sudo apt install libtiff5
sudo apt-get install libatlas-base-dev


For python3


sudo apt-get update

sudo apt-get install python3-pip

sudo pip3 install RPi.GPIO


Next you will want to install the demo code


sudo apt-get install p7zip-full

wget https://www.waveshare.com/w/upload/e/eb/1.5inch_RGB_OLED_Module_Code.7z

7z x 1.5inch_RGB_OLED_Module_Code.7z


Test Display with Demo Code

cd RaspberryPi/python/

sudo python3 main.py


You should see the demo.  If it is working, press Control-C to break the program and return back to the command prompt.


Now that you know the screen is working, you can begin with setting up your Christmas Countdown Clock


mkdir christmas

cd christmas

wget https://www.planetmars.org/christmas-clock.gz

tar -zxf christmas-clock.gz


Run the clock

python3 christmas.py


Press Control-C to break out of the program

Next you may want to have it start up every time you boot your Raspberry Pi.  The easiest way is the edit the rc.l.ocal script, however, your clock may be off for the first few minutes because the Raspberry Pi does not have a battery backed clock and it takes a bit for the time to re-sync with NTP sources.


sudo nano /etc/rc.local


Right before the exit 0 copy and paste in the following command


python3 /home/pi/Christmas/Christmas.py &