Halloween talking clock that plays sounds every Oāclock hour. Only a few external components (easy to source and solder) needed. The single
Things used in this project
Hardware components
Ā
PCB Mounting, Screw Mount Lock-In Support
Story
Ā
Halloween talking clock that plays sounds every Oāclock hour. Only a few external components (easy to source and solder) needed. The single side board could be manufactured at home. Very customizable project than involves multiple knowledge areas (STEAM): Electronics, programming, woodworking, arts, etc.
Ā
Key component: Quartz clock movement with trigger
Ā
Concept:
Ā
A lot of musical wall clocks on the market lacks the possibility of change original sounds. A clock with that capability can be built with an embedded system. But which one to choose? Raspberry Pi Pico was chosen for the 3 following reasons:
Ā
Thereās no need to install software for initial firmware downloadĀ Onboard memory 2 MegaBytes of flash can store some amount of sounds without requiring external memoryCan be powered by 2xAA batteries without additional componentsĀRpi Pico draws about 1.6 mA in itās lowest power mode (deep sleep). Seems not much, but is too high for a battery powered circuit, because they will exhaust in around two months. For that reason an external power circuit that can shut off the board completely was added. After that, power consumption lowered to 70 uA, so batteries will last for a year.
Ā
The Rpi Pico acts as sound storage and player. To show the time and generate an Oāclock signal, a quartz clock movement with trigger was used. Combining these 2 elements a talking sound clock was born
Ā
Key features:
Ā
Two versions of the (almost) same application: One developed in CircuitPython and the other in the C/C++ SDK.Compatible with the most common operating systems.Ā No need to install apps for initial firmware downloadĀ Thereās no need to recompile code (in the app developed in CircuitPython) to change soundsĀ Up to 3 years in standby mode using a pair of AA batteries.Ā Easy to source, and solder componentsĀ
Ā
Ā
Software:
Ā
Right after power on, Rpi Pico puts a low level on the GPIO that is wired to the power circuit to keep it powered, then decides which file should be played, and after the sound finishes, a high level is put on the GPIO powering off the Pico. Additionally a light sensor is read to not play sound when is dark (night).
Ā
Sound files are played sequentially, one by one on each power on. A pointer to the next file is stored in nonvolatile memory, be carefully modifying the program to keep writing at a minimum.
Ā
Ā
Ā
PECULIARITIES OF THE SDK C/C++ VERSION:
Ā
Sounds to be played must be converted first to WAV format 16 bit mono @ 44100 Hz, then converted to C arrays[] before compiling. The application uses a PWM via digital output and interrupts to play sounds.
Ā
The program execution starts almost immediately after power on. The main disadvantage of the application for now, it only supports.WAV files which are big, and cannot be changed without recompiling code
Ā
Ā
Ā
PECULIARITIES OF THE CIRCUITPYTHON VERSION:
Ā
Sounds to be played must be converted to MP3 mono format, The app uses audiomp3 and audiopwmio modules to output audio out of a digital pin (PWM). These files are stored in the filesystem provided by CP, so modifying them is straightforward, just drag and drop.
Ā
MP3 files can store about 10 more sound time than WAV for the same file size, however CircuitPython runtime execution takes more than a second after power on, so probably it wonāt be a good thing for any kind of final application
Ā
Ā
Ā
Hardware:
Ā
External components are part of one of the three different functionalities:
Ā
On/Off : The circuit is made up by a MOSFET, Drain terminal connected to 3V3_EN and the Source terminal connected to GND. Connected to the gate are 2 elements: A capacitor to ground, and a resistor to V+. The circuit works in the following way:
Ā
Step 1: Capacitor is fully charged, turning on the MOSFET and tying 3V3_EN to ground totally powering off Rpi Pico boardĀStep 2: Capacitor is quickly discharged by the brief closure of the contacts of the clock movement, turning off the MOSFET, and powering on the Rpi Pico. The first thing to do after power up, is keeping the capacitor discharged with the aid of a GPIO output in low level.
Ā
Step 3: While sound is played, low level on the GPIO is kept. Once sound finishes, GPIO output turned high level, so MOSFET turns on again, powering off the Rpi Pico until the next switch closureĀ On/Off : The circuit is made up by a MOSFET, Drain terminal connected to 3V3_EN and the Source terminal connected to GND. Connected to the gate are 2 elements: A capacitor to ground, and a resistor to V+. The circuit works in the following way:Step 1: Capacitor is fully charged, turning on the MOSFET and tying 3V3_EN to ground totally powering off Rpi Pico boardStep 2: Capacitor is quickly discharged by the brief closure of the contacts of the clock movement, turning off the MOSFET, and powering on the Rpi Pico. The first thing to do after power up, is keeping the capacitor discharged with the aid of a GPIO output in low level.Step 3: While sound is played, low level on the GPIO is kept. Once sound finishes, GPIO output turned high level, so MOSFET turns on again, powering off the Rpi Pico until the next switch closureĀAudio amplifier: Single-stage, single NPN transistor powers a small 8 Ohm speaker. There is also an input RC low pass filter to smooth noise due to the PWM output.
Ā
Audio amplifier: Single-stage, single NPN transistor powers a small 8 Ohm speaker. There is also an input RC low pass filter to smooth noise due to the PWM output.ĀDay/night detection: Visible light sensor to avoid playing sounds at night. Connected to an ADC pin
Ā
Day/night detection: Visible light sensor to avoid playing sounds at night. Connected to an ADC pinĀ
Board assembly:
Ā
Rpi Pico, speaker, light sensor, and clock contacts could be soldered directly to the PCB to get a very small height profile, or add pin headers and female sockets for a more flexible option.
Ā
The single sided board can be etched at home. There are some free gpio pads for experimentation and also mounting holes near the corners
To build the wall clock, choose a plate or disk made of plastic or wood, with enough diameter to hide the clock movement and the sound board. Fix all electronic components and then decorative accessories like LED lights. Finish it with the paint work
For hour adjustment, remove all batteries and clock hands (hour, minute, second). Slowly turn clock adjustment knob until a āclickā sound is heard. Put all clock hands pointing to 12 Oāclock. Put the batteries. Sounds can be shifted pressing the momentary push button switch on the board.
Ā
Bill of materials
Female header 2.54mm shop now
Male pin header 2.54mm shop now
1/4W 1% TH Resistors shop now
Push button 6x6mm shop now
Raspberry Pi Pico shop now
2xAA battery holder for PCB shop now
8 Ohm speaker 29 mm 0.25W shop now
MOSFET 2N7000 shop now
NPN BIPOLAR TRANSISTOR 2N2222A shop now
TH Radial Electrolytic Capacitor shop now
TH Ceramic Disc Capacitor shop now
Quartz clock movement with trigger shop now
Wall Clock hooks DIY shop now
TEPT5700 visible light photodiode shop now
LED Copper Wire with battery box shop now
Ā
Ā
Ā
Optional components:
3 pc step drill bit 3-20 mm + centerpunchĀ
