Picaxe Metronome



(click images for better view)


I'm helping someone learn to play piano and wanted to work on their sense of rhythm. This simple metronome does just the trick by providing an adjustable tempo with slightly stronger first beat of each measure. It features:

  • Adjustable tempo between 60-240 BPM
  • Selectable 3/4 and 4/4 time
  • First beat of each measure is accentuated

The 2 button interface works as follows:

  • Push both buttons simultaneously to toggle metronome on/off
  • Push button 1 to increase metronome rate
  • Push button 2 to decrease metronome rate

Accentuating the first beat of each measure was a little tricky since the picaxe doesn't have true D/A; it's emulated with pulse-width-modulation which doesn't help if you just want to produce a "click" by toggling the piezo output pins once. I came across a few strategies (also described in schematic):

  • Use 2 different piezo elements and mount them so that they have slightly different mechanical properties. At $0.25 each, this is reasonable even though it adds an extra component. I think if one piezo was attached to the case with super-glue and the other with elmer's glue then the sound characteristics would be sufficiently different for this strategy to work fine.
  • Connect the lower side of the piezo to a second picaxe pin and then connect this node to ground through a resistor. By setting this pin as an input, it becomes high impedance and piezo current is shunted through the resistor. If the pin is set as an output at low (ground) state, the piezo sees maximum potential drop and the sound is slightly louder.
  • Use software to somehow drive the piezo slightly different for the first beat of each measure. This is the method I ultimately used in the device because of its simplicity. The first beat uses a brief resonant sound (i.e. a tone), whereas all other beats are white noise. Thus, the first beat of each measure sounds slightly different from other beats.
  • Abandon the "click" sound and just go with a short piezo beep.

 

(click to enlarge)

Parts count:

  • 1 Picaxe 08M microcontroller
  • 2 resistors
  • 2 piezo element
  • 2 pushbutton microswitchs
  • 1 3-pin programming header
  • misc wire, project case, a piecce of protoboard, a battery holder

The metronome schematic is shown above and the source code is here. The total cost is under $5. Note that the picture about is wired on a picaxe development board (see the projects page) which costs about $20; still very reasonable.

This code is explicitly released under the GPL. And this page is licensed under a Creative Commons Attribution 2.5 License.  

Write me if you find this project useful. Link to this page if it is relevant..

You may require more than this metronome to become a tolerable musician. This project is provided without any warranty.

Read or write a comment on the hardware projects

Back to Picaxe Projects