DIY Metronome
![2016-08-05 13.29.53.jpg](/proxy/?url=https://content.instructables.com/FQY/N0A5/J5Y7YZU4/FQYN0A5J5Y7YZU4.jpg&filename=2016-08-05 13.29.53.jpg)
![output_W5uSQp.gif](/proxy/?url=https://content.instructables.com/FZW/8H8B/J5Y7YXW5/FZW8H8BJ5Y7YXW5.gif&filename=output_W5uSQp.gif)
A metronome is a device that produces an audible beat—a click or other sound—at regular intervals that the user can set in beats per minute (BPM). It is typically used by musicians when practicing on a musical instrument in order to play at a regular pulse. Most metronomes have both an audible click sound synchronized with an inverted pendulum swing.
This uses the Arduino's built in timer to calculate when the next beat is to be played, and adjusts the servo motor to swing the inverted pendulum, as well as give the buzzer the signal to make a 'click' sound.
BoM
![2016-08-05 12.50.22.jpg](/proxy/?url=https://content.instructables.com/FIJ/9GWJ/J5Y7YZUW/FIJ9GWJJ5Y7YZUW.jpg&filename=2016-08-05 12.50.22.jpg)
- Arduino 101 or Uno
- Buzzer
- Servo Motor
- Popsicle Stick
- Jumper Wires
- Hot glue and Hot glue gun
- [Optional] Breadboard
- [Optional] Tie wire
Connecting the Buzzer
![Screen Shot 2017-08-06 at 4.17.04 PM.png](/proxy/?url=https://content.instructables.com/F92/VI65/J5Y7ZH9H/F92VI65J5Y7ZH9H.png&filename=Screen Shot 2017-08-06 at 4.17.04 PM.png)
![Screen Shot 2017-08-06 at 4.18.43 PM.png](/proxy/?url=https://content.instructables.com/FVX/VV14/J5Y7ZH82/FVXVV14J5Y7ZH82.png&filename=Screen Shot 2017-08-06 at 4.18.43 PM.png)
![2016-08-05 12.53.48.jpg](/proxy/?url=https://content.instructables.com/FU2/FKID/J5Y7YZUT/FU2FKIDJ5Y7YZUT.jpg&filename=2016-08-05 12.53.48.jpg)
- Connect one of the buzzer pins to pin 6 on the Arduino with a yellow jumper wire.
- Connect the remaining buzzer pin to the GND pin on the Arduino with an orange jumper wire.
Wiring the Servo Motor
![2016-08-05 12.55.50.jpg](/proxy/?url=https://content.instructables.com/FON/0PXQ/J5Y7YZUP/FON0PXQJ5Y7YZUP.jpg&filename=2016-08-05 12.55.50.jpg)
![2016-08-05 12.55.31.jpg](/proxy/?url=https://content.instructables.com/FEI/3QQA/J5Y7YZUR/FEI3QQAJ5Y7YZUR.jpg&filename=2016-08-05 12.55.31.jpg)
![2016-08-05 12.55.01.jpg](/proxy/?url=https://content.instructables.com/FYC/297J/J5Y7YZUS/FYC297JJ5Y7YZUS.jpg&filename=2016-08-05 12.55.01.jpg)
- Connect the brown pin from the servo motor to the GND pin on the Arduino with a black jumper wire.
- Connect the red pin from the servo motor to the 5V pin on the Arduino with a red jumper wire.
- Connect the orange pin from the servo motor to the digital pin 9 on the Arduino with a white jumper wire.
Calibrating the Metronome
![2016-08-05 13.01.41.jpg](/proxy/?url=https://content.instructables.com/F76/YZI3/J5Y7YZUO/F76YZI3J5Y7YZUO.jpg&filename=2016-08-05 13.01.41.jpg)
![2016-08-05 13.04.28.jpg](/proxy/?url=https://content.instructables.com/FX1/W1CW/J5Y7YZUM/FX1W1CWJ5Y7YZUM.jpg&filename=2016-08-05 13.04.28.jpg)
![Screen Shot 2017-08-06 at 2.00.57 PM.png](/proxy/?url=https://content.instructables.com/FPI/RKJ4/J5Y7YSU7/FPIRKJ4J5Y7YSU7.png&filename=Screen Shot 2017-08-06 at 2.00.57 PM.png)
#include // attach the servo library
// create a servo variable Servo metronome;
// declare the constants for the buzzer and servo pins const int buzz = 6; const int servo = 9;
void setup() { pinMode (buzz, OUTPUT); // set the buzzerpin as an output metronome.attach (servo); //attach the metronome var to a servo pin
//initialize the angle of the metronome metronome.write (105); }
Gluing the Metronome
![2016-08-05 13.07.13.jpg](/proxy/?url=https://content.instructables.com/FRG/OHC3/J5Y7YZUI/FRGOHC3J5Y7YZUI.jpg&filename=2016-08-05 13.07.13.jpg)
![2016-08-05 13.07.46.jpg](/proxy/?url=https://content.instructables.com/FJK/G56B/J5Y7YZUA/FJKG56BJ5Y7YZUA.jpg&filename=2016-08-05 13.07.46.jpg)
![2016-08-05 13.28.46.jpg](/proxy/?url=https://content.instructables.com/F9X/NFI4/J5Y7YZU5/F9XNFI4J5Y7YZU5.jpg&filename=2016-08-05 13.28.46.jpg)
- Once the servo arm has been calibrated such that it is 90 degrees from the horizontal, take a piece of popsicle stick and apply glue on the bottom, then stick it parallel to the servo arm.
- Glue the servo motor long side down, onto a flat surface, I chose my Arduino 101 chassis for this.
Coding
![Screen Shot 2017-08-06 at 2.30.57 PM.png](/proxy/?url=https://content.instructables.com/F2J/SQAY/J5Y7YWDO/F2JSQAYJ5Y7YWDO.png&filename=Screen Shot 2017-08-06 at 2.30.57 PM.png)
![Screen Shot 2017-08-06 at 2.36.00 PM.png](/proxy/?url=https://content.instructables.com/FBF/7L6V/J5Y7YXDM/FBF7L6VJ5Y7YXDM.png&filename=Screen Shot 2017-08-06 at 2.36.00 PM.png)
You can input the bpm of your metronome in serial monitor and send it off to the Arduino. I opted for a serial monitor signal as opposed to a trim knob since accuracy and precision is important for a metronome, thus sending a known number is more important than an arbitrary analog signal.
#include <Servo.h> // attach the servo library
// create a servo variable Servo metronome;
// declare the constants for the buzzer and servo pins const int buzz = 6; const int servo = 9;
int centre = 105;
void setup() { pinMode (buzz, OUTPUT); // set the buzzerpin as an output metronome.attach (servo); //attach the metronome var to a servo pin
//initialize the angle of the metronome metronome.write (centre); Serial.begin (9600); }
void loop() { int bpm = Serial.read();
metronome.write (105 + 10); tone (buzz, 500); delay(50); noTone (buzz); delay(bpm/60*1000); tone (buzz, 500); delay(50); noTone (buzz); metronome.write (105 -10); delay(bpm/60*1000); }
Downloads
Done!
![output_W5uSQp.gif](/proxy/?url=https://content.instructables.com/FZW/8H8B/J5Y7YXW5/FZW8H8BJ5Y7YXW5.gif&filename=output_W5uSQp.gif)
Open serial monitor and enter the BPM you want, and play some music to the beat of the metronome!