Introduction: Presidential Inauguration Countdown Clock (Wifi)
Overview: Countdown clock is similar to commercial products, with a few twists:
a) When target event time is reached, the countdown clock: displays a scrolling announcement,and plays sound effects and an mp3 song - in this case, the R.E.M. song: “It's the End of the World as We Know It (And I Feel Fine)." Play on Youtube
b) You can specify the exact time of a future event down to the minute and second.
c) Wifi clock function eliminates time drift, and allow easy over-the-air reprogramming for future event dates.
Major components: Raspberry Pi, 16 x 2 LCD, and powered speaker mounted in a dollar store 5x7 picture frame.
Skill Level: Familiar with setting up Raspberry Pi and running headless, Linux basic commands and python programs, and a little bit of soldering (3 wires).
Step 1: Parts and Tools
- Raspberry Pi model B+ or later and case
- USB powered speaker with 3.5 mm audio input. The speaker I used was a free promotional item, but this speaker looks pretty close ... speaker . Ideally something with a square form factor.
- 2 micro USB cables and dual port charger - optional red coil wire harness
- 5x7 picture frame
- Sparkfun Audio Cable TRRS - 18" (pigtail) CAB-11580
- Digikey CP-3502-ND 3.5 mm stereo plug
- 3/4" thick hardboard or plywood about 5" by 8"
- I2C 2X16 LCD display module
- 4 female to female dupont jumper wires (100 or 200 mm long is ok)
- USB wifi adapter
- Hot glue gun
- Soldering iron
- Wire striper
- Band or jig saw
Step 2: Construct TRRS Audio Cable
Solder the yellow, red, and green leads of Sparkfun Audio Cable TRRS - 18" (pigtail) CAB-11580 to Digikey CP-3502-ND 3.5 mm stereo plug as shown in the diagram
Step 3: Setup Raspberry PI
a) Setup the Raspberry Pi, be sure to enable I2C and SHH, also setup wifi and be sure you can connect to raspberry pi in "headless mode". Reference guide.
b) Create a project subdirectory - I called mine "trump" to put the required files into.
pwd command should yield /home/pi/trump
c) Copy your sound effect and song files into /home/pi/trump. The file names must be DRUMROLL.wav and the song remsong.mp3 to work with the as-is python program we'll add later. You can use different file names, but then you'll need to edit the python file. I can't provide these files for copyright reasons - but you can find many sound effect files included included in Windows OS, and of course download songs from iTunes, Amazon ...
Hint - for moving files back and forth between my PC and RasPi, I use the utility program winSCP
Step 4: Connect LCD Display to Raspberry Pi, Setup and Test.
a) Connect the LCD to Raspberry PI using the 4 female to female jumper. Connect the SDA pin on the RasPi to the GPIO SDA pin on the LCD, and the SCL pin on the RasPi to the SCL pin on the LCD, also connect the 5 volt and ground pins from RasPi to LCD.
b) To get your RasPi talking to the LCD - access Raspberry Pi in the headless mode, and see the guide PROGRAMMING THE LCD WITH PYTHON by Circuit Basics . You need to complete at least sections titled: INSTALLING THE RPLCD LIBRARY and WRITE TO DISPLAY IN 8 BIT MODE. Ensure you can display "Hello World" on the LCD. Don't go any further until this is done.
Step 5: System Test
a) Keeping the LCD connected, also connect TRRS audio cable between speaker and RasPi (TRRS cable end to RasPi). Connect both RasPi and speaker to power. See diagram above.
b) Copy the file cntDwnSng.py into your trump directory. For test purposes, edit the file to change the date values to sometime about 10 minutes out from whenever you're running the test:
Command summary -
change to trump directory"
change python program date values:
# enter target time and date here
c) save python program and run with command:
d) The expected result is: LCD counts down the time until it reaches zero time, then the sound effect plays, then the LCD message scrolls, and finally the mp3 song plays. If all goes well you can reset the date values.
Step 6: Modify Picture Frame and Final Assembly
a) Wiggle the stock picture frame support arm side-to-side to detach from backboard.
b) Print the Inauguration Image file (either jpg or pptx). Cut to fit inside picture frame, use the blue box to cut a "LCD window" in frame backboard
c) Cut down all the pins sticking up near the display to get a more flush mount. Attach LCD to frame backboard with hot glue and corner cardboard strips. Don't mount the LCD upside down!
d) With a band or jig saw, cut out frame support per drawing and attach to picture frame backboard with hot glue - take care to ensure it's attached squarely.
e) Insert the 4 dupont wires onto RasPi GPIO pins before snapping the RasPi case together.
f) Attach Raspi and speaker to frame support arm with hot glue. Complete the other connects per previous step. Optional - tie the USB power cable together with red coil wire harness.
g) To auto-run the python program on startup enter command:
sudo nano /etc/profile
Scroll to the bottom and add the following line:
sudo python /home/pi/trump/cntDwnSng.py
Type Ctrl-X to exit, then "Y" to save followed by "Enter" twice.
h) Going further - now that you have RasPi control capabilities, you can easily add even more celebration functions, see New Year’s Eve Countdown Timer With Fireworks Launching Ability
We have a be nice policy.
Please be positive and constructive.