Introduction: Electronic Metronome
Please note that in this instructable I assume you have some experience with AVRs and the C programming language.
Step 1: Parts
- ATmega328p Microcontroller (Jameco #2139111)
- IC Socket (Jameco #112300)
- 150 Ohm Resistor (Jameco #690662)
- 10k Ohm Resistor (Jameco #691104)
- 0.1 uF Capacitor (Jameco #151116)
- Three Digit Seven Segment Display (Jameco #1956493)
- Red 5mm LED (Jameco #333973)
- Tactile Switch (3x) (Jameco #119011)
- Piezo Speaker (Jameco #1874543)
- ISP Header (Jameco #115035)
- 3xAA Battery Holder with Switch (Jameco #216144)
- AA Battery (3x)
- Velcro (Optional)
- Soldering Iron
- Solder
- Wire Cutters
- Needle Nose Pliers
- AVR Programmer
Step 2: The Hardware
The hardware set up for the metronome is pretty simple. Since I designed it as a kit, I tried to keep the number of parts to a minimum while still having all the features I wanted.
As you can see from the schematic, all the functions are separated by ports so programming is nice and simple. Control of anodes for each digit is handled by port C. These pins will control the multiplexing of the display. Port D will control the cathodes of the display, essentially setting what segments of each digit to light up. And lastly, our generic I/O, things like the LED, speaker, and buttons, is handled by port B. The remaining connections are standard for operating the ATmega; like the 10k Ohm resistor on the reset pin and the decoupling capacitor between Vcc and ground.
Be sure to check out the third image above to see pin locations of the seven segment display. They can be a little tricky to figure out. Also, in the schematic the pins of the display block match the real world layout, so pin 1 is in the lower left corner and twelve is directly above it.
Step 3: The Software
In the interest if space, and for readers not particularly interested in the software that runs this, I have decided to forgo explaining the code here, and instead thoroughly commented it. The code is available for download below. I think it's actually better to look at it this way as the seeing the comments and the complete code together will make more sense then me trying to explain small snippets here anyway.
Also, I have provided two images from the Seven Segment Display's datasheet that should help you in better understanding that aspect of the code.
For details on how to upload your code to the microcontroller, see you your AVR programmer's manual; or if you're using Adafruit's USBtinyISP see their detailed tutorial here: http://www.ladyada.net/learn/avr/avrdude.html
Step 4: PCB Design
The board was designed with size in mind. I wanted to keep it as small as possible while still having all the components laid out in an easy to use way. I decided to make the width of the board match that of the height of the battery holder since I knew I would like to attach the two together. The results came out as follows.
I've attached the Eagle files for this project below for you to download. I used ITeadStudios to make the boards and I was really happy with the way they came out.
Attachments
Step 5: Assembly
There are a few parts that you need to be careful with, especially of you're fairly new to electronics.
- Make sure that when you're installing the IC socket and the ATmega you matches the notches with the notch outline on the PCB. If you don't, the proper pins won't connect to else where on the board and you're metronome will not work.
- The only component that is polarized here is the LED. Make sure that you put the shorter lead of the LED in the whole closest to the outside edge of the board matching the flat edge of the epoxy case to the flat marking on the PCB.
- It does not matter which directions your speakers leads are.
- When connecting the battery holder, be sure that he red lead goes in the hole marked V+ and the black lead goes in the hole marked ground.
- When inserting the ATmega, you may need to bend the pins so they are perpendicular to the IC's body. To do this safely, lay the ATmega on it's side on a flat surface and use your index fingers on the underside of the body and your thumbs on the top as seen in the photo. Then rock the chip forward to bend all the pins on that side evenly. Do this to both sides.
Step 6: Use and Enjoy
After I put the batteries in the holder I attached a piece of velcro the holder and the back of the PCB so that I could attach the two together.
And there you have it, a simple yet functional electronic metronome.Thanks for reading!

Participated in the
Pocket-Sized Contest

Participated in the
Hurricane Lasers Contest

Participated in the
LED Contest with Elemental LED
14 Comments
8 years ago on Introduction
10 years ago on Introduction
HI cmonaco3!!
Great job! This stuff is awesome...
I hope you dont mind if I ask a couple of questions about your device.
Can I attach a led strip instead of the speaker and the single led? I want to cover all roof corners of my band practice room so everyone facing any direction can see the leds going on with the beat.
Will it need more power than the batteries can supply? Is it difficult to adapt a power supply instead of the batteries?
Thanks!!
11 years ago on Introduction
I have programmed my first atmega :) thanks to you cmonaco3 :)
if you have others program, you can post it, it would be great! :)
thanks a lot!
marC:)
11 years ago on Introduction
thank you for the .hex file awesome job! i'm just beginning avr i used to do some pic's :)
thank you!
marC:)
11 years ago on Introduction
what about the fuse?
how to program it using ? :
http://www.ebay.ca/itm/130682846209?ssPageName=STRK:MEWNX:IT&_trksid=p3984.m1439.l2649
thank you so much!
marC:)
Reply 11 years ago on Introduction
I'm sorry what do you mean by fuse? If you're referring to the fuses on the ATmega, you shouldn't have to worry about them as I'm using it in its default configuration for this project.
You're going to have to consult any documentation that comes with that specific programmer, though I suspect it may work with AVRDUDE. Here's a tutorial from Adafruit on using that software: http://www.ladyada.net/learn/avr/avrdude.html
Reply 11 years ago on Introduction
what's the command line for programming this chip?
thank you!
marC:)
Reply 11 years ago on Introduction
I used AVRDUDE to program the chip. It's a command line utility you can download for free. Please see this tutorial for using it: http://www.ladyada.net/learn/avr/avrdude.html
Reply 11 years ago on Introduction
Hi! Is it possible to have the .hex file and also the 3 7 segment display is a CA or CC ?
thank you soo much! :)
marC:)
Reply 11 years ago on Introduction
Sorry about not back to you sooner. The hex file should be uploaded and can be downloaded on the software step. The display being used here is common anode.
Reply 11 years ago on Introduction
no documentation comes with this chineese programmer :((
i don't ever know how to connect it.. im into pic microcontroller.. now's day!
thank you!
marC:)
11 years ago on Introduction
thank you !
11 years ago on Introduction
that is absolutely awesome! good job!
Reply 11 years ago on Introduction
Thank you!