Music Clock: Making Melody through Time
Goal
Create a clock that uses the signal that triggers a tick of the second hand to trigger a musical note, resulting in the playback of a song one second at time.
How It Works
Wires connected to the quartz clock movement are connected to an Arduino Leonardo board. The 1hz AC signal from the integrated circuit in the quartz clock movement is used as input into the Arduino board. The Arduino board is running a program that plays a note from an array of notes each clock tick. The sound is played through a piezo speaker connected to the Arduino board.
Background
As a life-long musician starting to get involved in the maker movement, I was excited when the theme “music” was revealed for my monthly maker meetup. I had actually already planned to make a normal “music” clock by decoupaging music notes onto a clock face and installing a quartz clock movement and clock hands. Why not finally do the clock but with some tech added to make it truly a musical clock?
Process
Research and Planning
I searched online for Arduino projects involving clocks, and they were all about using the Arduino to drive the clock. For example, this video by Robert Massaioli explains how to make a clock run faster than normal. I wanted the clock to still be a clock, but use the pulse as an input to something else. I did finally find a couple posts about taking out the board from inside a quartz movement and coupling it with some other components to be able to use that as a module for other projects. But I didn’t want to take the clock apart and use it for parts, I wanted it to stay a clock!
I learned a lot about quartz clock movements through watching videos online. By watching another video by Robert Massaioli I learned that the clock movement is basically a lavet-type stepping motor that works by running current through a solenoid in one direction and then the opposite direction. The current comes from an integrated circuit board inside that works in conjunction with a quartz crystal to send the current each second. Through this system a magnetic pulse is created every second. That pulse is directed at a small gear with a magnet, which causes the gear to turn 180 degrees. This turn then triggers a series of other gears to turn to rotate the second, minute and hour hands. Super cool!
Once I understood how the movement worked I was confident I could “sniff” the pulse signal as output and use it as an input to an Arduino.
Opening Up and Disassembling the Quartz Clock Movement
I had watched a bunch of videos, but now it was time to open up the movement and do some hands-on learning. I used a Flathead screwdriver to pry it open and take a look at how it worked.
In order to solder on the wires to the board inside, I had to disassemble the movement to remove the board and the attached coil.
Now that the board was free, it was time to connect some wires.
Connecting Leads to the Clock Movement
Since the current flows one way then the other way through the coil from the board, I needed to solder in two places. Basically to get both the tick and the tock! I had to be very careful not to accidentally unsolder the wire from the board so that the clock would still work as a clock afterward.
Then I needed to reassemble the clock movement with the wires attached. Luckily there happened to be existing gaps in the casing I could use for leading the wire through to the outside.
After reassembly I made sure to check that the movement still worked, in case I had damaged anything during soldering or misplaced a piece.
Getting Signal from the Clock Movement into Arduino
I connected the newly installed wires to two of the Arduino analog input pins. I also used clips to attach the ground of the Arduino to the ground of the battery compartment of the movement. By writing a script, I was able to eventually get a clean “tick” and “tock” from the board! For now this was represented as output to the Serial Monitor.
Triggering Notes Based on Clock Tick
Now that I had a clean signal to go off of, I could move on to making music! I attached a piezo speaker to the breadboard attached to the Arduino.
Then I used a combination of these three tutorials to figure out how to play music using an Arduino script and a piezo speaker:
- https://www.arduino.cc/en/Tutorial/toneMelody
- https://programmingelectronics.com/an-easy-way-to-make-noise-with-arduino-using-tone/
- https://learn.adafruit.com/adafruit-arduino-lesson-10-making-sounds/overview
After learning the basics, I connected the music playback functionality to the pulse receive script to play a note from an array of notes each time a pulse was received. The scripts are on Github here.
Creating the Clock
With the setup basically working it was finally time to make the clock!
I used acrylic paint, decoupage paper and glue, and sandpaper to decorate a wooden clock face.
Then I installed the quartz clock movement and hands.
Putting It All Together
Now it was time to put the clock and the Arduino together.
- I changed the Arduino from being plugged into my PC to running on a 9V battery to make it untethered.
- I simplified the wiring, removing the need for a breadboard. For example, due to the placement of the pins, I was able to plug the piezo speaker right into the Arduino directly! I also combined a clip wire and a male pin wire to be able to directly connect to the battery compartment ground.
- By gluing on plastic standoffs attached to the Arduino board I was able to attach the board to the back of the clock.
- I added a switch to make it easy to turn the music on/off.
- Finally I placed the clock onto a plastic display holder and it was done!
GitHub for Arduino Script: https://github.com/drummershoujo/MusicClock
Comments or questions on this article?
Leave a comment or tweet at me — @CharleneJeune
Thanks!