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.
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
https://www.canakit.com/raspberry-pi-4-starter-kit.html
https://www.amazon.com/gp/product/B07D9NVJPZ/ref=ppx_yo_dt_b_asin_title_o00_s00?ie=UTF8&psc=1
https://www.waveshare.com/wiki/Libraries_Installation_for_RPi
https://www.waveshare.com/wiki/File:1.5inch_RGB_OLED_Module_Code.7z
https://www.waveshare.com/w/upload/5/5b/1.5inch_RGB_OLED_Module_User_Manual_EN.pdf
https://www.waveshare.com/wiki/1.5inch_RGB_OLED_Module
Pinout |
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
cd
sudo apt-get install wiringpi
wget
https://project-downloads.drogon.net/wiringpi-latest.deb
sudo dpkg
-i wiringpi-latest.deb
gpio -v
cd
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
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
cd
sudo apt-get update
sudo apt-get install
python3-pip
sudo pip3 install RPi.GPIO
Next you will want to install the demo code
cd
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
cd
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 &