Making a Cockoo-Clock with teensy.
Hi, perhaps this is an idea for a project of some other people. At least I had some fun with it…
A cockoo clock is a clock hanging at a wall. It has a small window which opens every full hour. A little bird comes out of the window and calls "Kuckuck". These clocks have a great tradition in the Blackforest in South Germany. I live some 150km from this region. When I saw such clocks at a tourist shop there some weeks ago, I thought this would be fun.
Normally everything is done by mechanics which would be a very big task. But with microcontrollers everything is much simpler at least when you can reuse a lot of the work of others - many thanks to all!
So the goal was to make a clock (shows time), which mechanicly opens a small window every full hour, shows a bird and lets the bird sing. And closes the window shutter again.
I was very happy, when I discovered that you can buy rings with 12 multicolour Neopixels from adafruit. These give a nice display. I think this has more style than a digital text display and it is much simpler than a mechanical clock face.
The bird normally moves with a linear movement on a kind of sled. This was simplified to circular movement. A small platform has the shutter of the window fixed to it and carries the bird. It is directly fixed to a rc-servo axle. So the swing of the servo opens the shutter and brings the bird forward at the same time.
Of course the bird must sing at full hours, so you need a possibility to output sound, which is done using *.wav files together with the DAC of the teensy and with the sound library.
Function Hardware Library Comment (The following lines should be a table)
Time: Built-In Timer TimeLib
Set time accurately: Receiver for time broadcast DCF77 (Pollin) DCF77 Library hat to be modified slightly because of different interrupts. Because of automatic time setting, no user buttons are needed.
LED (13) for indication of reception
LED blinks 3 times, if the last correct reception was within last hour
2 times if it was within one day and
1 time per signal (signal is copied to LED) if the reception was not yet correct or if it was longer ago than one day.
Open/Close Shutter: show bird Rc-servo, high quality for low noise PWMservo
The servo brings noise into the audio output. To minimise this, the pwm signal is shut down after movement (make pin input). In addition a RC filter of 47 Ohms and 470µF is used at the 5V supply of the LM386.
Clock face: Adafruit Neopixel Ring, WS2812Serial Small addition to deal with 4 LEDs per pixel. See function "setPixel".
The LEDs are very bright, so they are used only with 1/255 (White) and 10/255 (others) of their power.
Red indicates hours.
Green indicates minutes in steps of 5.
Blue shows at 5 seconds intervals.
White shows the 12 positions of the face constantly.
Let bird sing: SD-card to hold wav- Files, See example WAV player There are nice WAV files on the internet. To convert them to 16bit, 44.1kHz you can use Audacity. So the bird is not allways a cockoo…. https://www.vogelstimmen.info/Vogelstimmen_Hoerproben_GRATIS.html
DAC 12-bit
Small amp with LM386 and small loud speaker The amp is as included in the datasheet of LM386.
Multitasking TeensyThreads Simplifies programming a lot and is easy to use! There are 4 tasks:
1. Check DCF77 reception and indicate its status
2. Set the clock if new broadcast available
3. Display the time
4. Normal loop: Show bird and start to play WAV
I took some time to consider, which controller would be best to use. (Original Arduino, Arduino with BASCOM, Arduino M0, Raspi, Parallax Propeller, Teensy 3.2, 3.5)
I choose Teensy 3.5 mainly because of the audio library, the DAC and the SD-card, DCF77-library for Arduino. Fallback would have been the audio shield. With a raspi I would have used internet time with wlan instead of DCF77. Of course Teensy 3.5 needs only about 7% of its memory and you could solder a SD-card to 3.2….
Hi, perhaps this is an idea for a project of some other people. At least I had some fun with it…
A cockoo clock is a clock hanging at a wall. It has a small window which opens every full hour. A little bird comes out of the window and calls "Kuckuck". These clocks have a great tradition in the Blackforest in South Germany. I live some 150km from this region. When I saw such clocks at a tourist shop there some weeks ago, I thought this would be fun.
Normally everything is done by mechanics which would be a very big task. But with microcontrollers everything is much simpler at least when you can reuse a lot of the work of others - many thanks to all!
So the goal was to make a clock (shows time), which mechanicly opens a small window every full hour, shows a bird and lets the bird sing. And closes the window shutter again.
I was very happy, when I discovered that you can buy rings with 12 multicolour Neopixels from adafruit. These give a nice display. I think this has more style than a digital text display and it is much simpler than a mechanical clock face.
The bird normally moves with a linear movement on a kind of sled. This was simplified to circular movement. A small platform has the shutter of the window fixed to it and carries the bird. It is directly fixed to a rc-servo axle. So the swing of the servo opens the shutter and brings the bird forward at the same time.
Of course the bird must sing at full hours, so you need a possibility to output sound, which is done using *.wav files together with the DAC of the teensy and with the sound library.
Function Hardware Library Comment (The following lines should be a table)
Time: Built-In Timer TimeLib
Set time accurately: Receiver for time broadcast DCF77 (Pollin) DCF77 Library hat to be modified slightly because of different interrupts. Because of automatic time setting, no user buttons are needed.
LED (13) for indication of reception
LED blinks 3 times, if the last correct reception was within last hour
2 times if it was within one day and
1 time per signal (signal is copied to LED) if the reception was not yet correct or if it was longer ago than one day.
Open/Close Shutter: show bird Rc-servo, high quality for low noise PWMservo
The servo brings noise into the audio output. To minimise this, the pwm signal is shut down after movement (make pin input). In addition a RC filter of 47 Ohms and 470µF is used at the 5V supply of the LM386.
Clock face: Adafruit Neopixel Ring, WS2812Serial Small addition to deal with 4 LEDs per pixel. See function "setPixel".
The LEDs are very bright, so they are used only with 1/255 (White) and 10/255 (others) of their power.
Red indicates hours.
Green indicates minutes in steps of 5.
Blue shows at 5 seconds intervals.
White shows the 12 positions of the face constantly.
Let bird sing: SD-card to hold wav- Files, See example WAV player There are nice WAV files on the internet. To convert them to 16bit, 44.1kHz you can use Audacity. So the bird is not allways a cockoo…. https://www.vogelstimmen.info/Vogelstimmen_Hoerproben_GRATIS.html
DAC 12-bit
Small amp with LM386 and small loud speaker The amp is as included in the datasheet of LM386.
Multitasking TeensyThreads Simplifies programming a lot and is easy to use! There are 4 tasks:
1. Check DCF77 reception and indicate its status
2. Set the clock if new broadcast available
3. Display the time
4. Normal loop: Show bird and start to play WAV
I took some time to consider, which controller would be best to use. (Original Arduino, Arduino with BASCOM, Arduino M0, Raspi, Parallax Propeller, Teensy 3.2, 3.5)
I choose Teensy 3.5 mainly because of the audio library, the DAC and the SD-card, DCF77-library for Arduino. Fallback would have been the audio shield. With a raspi I would have used internet time with wlan instead of DCF77. Of course Teensy 3.5 needs only about 7% of its memory and you could solder a SD-card to 3.2….