Raspberry Pi Christmas Countdown!

by mlarovere in Circuits > Raspberry Pi

358 Views, 1 Favorites, 0 Comments

Raspberry Pi Christmas Countdown!

Raspberry pi Christmas Countdown!

I have created a Christmas Countdown for Advent using a Raspberry pi and Circuit Playground Bluefruit! Controlled by two buttons, one plays on a speaker the number of days to Christmas, with the other button playing a light animation.

Supplies

  • Raspberry pi
  • Circuit Playground Bluefruit
  • Neopixel strand (I used one with 20 lights)
  • Two external buttons
  • Four alligator clips
  • Two jumper wires (to attach button to pins on Raspberry pi)
  • Battery pack
  • Portable Phone Charger
  • Baltic Birch 1/4' wood
  • iPad with Procreate
  • Paint and paint pens
  • Wood glue
  • Adobe Illustrator
  • Parchment Paper
  • Makercase (for box templates)

Design Your Countdown

Untitled-Artwork.png
Untitled-Artwork (1).png
Untitled-Artwork 1 (1).png

To begin designing my board, I drew illustrations in Procreate using my iPad. I then vectorized these images in Adobe Illustrator and added them to a small box template I got from makercase. This will act as the cubes for the numbers of the countdown. One box will have the numbers 0-5 with the other box having the numbers 0,1,2,6,7,8. I also then drew the reindeer in procreate seen on the main box of the countdown.

Create Your Boxes on the Laser Cutter

69205627432--44DAF517-341B-49EA-82A0-CD537B192732.jpg
IMG-4346.jpg
IMG-4345.jpg
IMG-4356.jpg

Using a laser cutter, you will create the following boxes necessary for the countdown; two boxes with numbers for the days, thinner box that will act as the stand for the countdown, larger box with cut out embellishments to house the components, and a few smaller pieces to hold the days countdown. On the side of the embellished box, I added a circle for the speaker to play out of. Once the pieces are all cut out, glue together with wood glue and let dry.

Get Your WAV Files

In order for the speaker to play how many days are left until Christmas, you will need to make a SantaSounds folder. My roommate wanted to help me bring Santa to my project, so she recorded M4A files using the voice memos app on her iPhone. I then converted these to WAV files online using a free converter. You can also use a voice generator online to create your sounds.

Code


#CPB code for lights-there are extra animations in here so the annimation can be changed
import board
import usb_hid
import neopixel
from adafruit_hid.keyboard import Keyboard
from adafruit_hid.keycode import Keycode
from digitalio import DigitalInOut, Direction, Pull
from adafruit_led_animation.sequence import AnimationSequence
from adafruit_led_animation.animation.blink import Blink
from adafruit_led_animation.animation.colorcycle import ColorCycle
from adafruit_led_animation.animation.chase import Chase
from adafruit_led_animation.animation.comet import Comet
from adafruit_led_animation.animation.pulse import Pulse
from adafruit_led_animation.animation.sparkle import Sparkle
from adafruit_led_animation.animation.SparklePulse import SparklePulse
from adafruit_led_animation.animation.rainbow import Rainbow
from adafruit_led_animation.animation.rainbowchase import RainbowChase
from adafruit_led_animation.sequence import AnimationSequence
from adafruit_led_animation.animation.solid import Solid
from adafruit_led_animation.color import BLACK


BLACK=(0,0,0)
 


button_a = DigitalInOut(board.A1)
button_a.direction = Direction.INPUT
button_a.pull = Pull.UP


strip_pin=board.A3
strip_num_of_lights= 20
strip= neopixel.NeoPixel(strip_pin, strip_num_of_lights, brightness=1,auto_write=True)

chase_strip = Chase(strip, speed=0.1, color=WHITE, size=1, spacing=1)
solid = Solid(strip, color=BLACK)


strip.fill((0,0,0))
touched=False
animating= False


while True:
    if not button_a.value:
        touched=True
        chase_strip.animate()
    if button_a.value:
        solid.animate()
        

#Code for Raspberry pi

from datetime import date
from adafruit_debouncer import Debouncer
import time
import board
import digitalio
import pygame


today= date.today().strftime('%d')
today=int(today)
christmas=int(25)
days_to_go=christmas-today


print("There are",days_to_go,"days to christmas")


button_input = digitalio.DigitalInOut(board.D23)
button_input.switch_to_input(pull=digitalio.Pull.UP)
button = Debouncer(button_input)


path = "/home/pi/SantaSounds/"


pygame.mixer.init()
music = pygame.mixer.music
speaker_volume = 1
pygame.mixer.music.set_volume(speaker_volume)


def play_sound(file):
    pygame.mixer.music.load(path + file)
    pygame.mixer.music.play()
    while pygame.mixer.music.get_busy() == True:
        continue


while True:
    button.update()#checks debounced button's state
    if button.fell: #if button is pressed
        print("button pressed")
        if music.get_busy(): #if music is already playing, stop
            music.stop()
        else: #else play the sound
            play_sound("There are.wav")
            play_sound(f"{days_to_go}.wav")
            play_sound("Days till Christmas.wav")
            play_sound ("Ho ho ho.wav")

Paint Your Box and Put Everything Together!

IMG-4364.jpg
IMG-4359.jpg

I decided to paint my box red and white with some gold accents to make everything pop. I used acrylic paint, and then once everything is dry, tape parchment paper on every side. This will help diffuse the lights. Then, place your components in the box and tape the speaker to the side.

Enjoy Your Christmas Countdown During Advent!

christmas.jpg

Now your project is complete! Use it every day to see how close we are to Christmas :)