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

Parts:

  1. Raspberry Pi model B+ or later and case
  2. 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.
  3. 2 micro USB cables and dual port charger - optional red coil wire harness
  4. 5x7 picture frame
  5. Sparkfun Audio Cable TRRS - 18" (pigtail) CAB-11580
  6. Digikey CP-3502-ND 3.5 mm stereo plug
  7. 3/4" thick hardboard or plywood about 5" by 8"
  8. I2C 2X16 LCD display module
  9. 4 female to female dupont jumper wires (100 or 200 mm long is ok)
  10. USB wifi adapter

Tools:

  1. Hot glue gun
  2. Soldering iron
  3. Wire striper
  4. 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.

mkdir trump

cd trump

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"

cd trump

edit with:

nano cntDwnSng.py

change python program date values:

# enter target time and date here
day= 20

month= 1

year= 2017

hour= 12

minutes= 00

sec= 0

c) save python program and run with command:

python cntDwnSng.py

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