Propeller Based Handheld Metronome

WBA ConsultingWBA Consulting Posts: 2,680
My dad is learning to play the guitar and a while back mentioned that he would like to make his own metronome. I did some searching on the forums, and the only code I found was in Harpit's thread about his Propeller for Beginners book he was writing. It had a program for controlling a metronome by means of a pot and displaying the beats per minute on an LCD. The code looked simple, but I didn't do anything with it until I recently decided to make something for my dad's birthday on March 8th. I looked at the code again and on March 6th, 2010, I created a handheld metronome based on the code. Here are the details.

The circuit is the same from the original code, but I moved some of the pin usages around to make it easier to mount things onto the prototyping board. I actually soldered the entire circuit onto the board, adjusted IO pins in the code, then downloaded the code. Believe it or not, everything but the LCD worked the very first time. (see below about the LCD fiasco). The code has been modified and cleaned up a bit. I added a startup "splash screen" that says Happy Birthday since it was for my dad's birthday. Once that clears, I display "Grmpa Roy" (Grandpa Roy) on the first line instead of the raw value which is unnecessary in a finished version. The second line shows the Beats Per Minute. This is adjusted by turning the 5k pot.

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Andrew Williams
WBA Consulting
WBA-TH1M Sensirion SHT11 Module
Special Olympics Polar Bear Plunge, Mar 20, 2010

Post Edited (WBA Consulting) : 3/14/2010 3:51:49 AM GMT
701 x 1024 - 369K
1024 x 588 - 260K

Comments

  • 23 Comments sorted by Date Added Votes
  • WBA ConsultingWBA Consulting Posts: 2,680
    edited March 2010 Vote Up0Vote Down
    Circuit Notes

    Speaker output: a 1k resistor, 3904 transistor, and a small speaker reclaimed from a 14" LCD screen. Pulses to the transistor create "tick" sounds on the speaker. I modified the code a bit to "blast" pulses to the transistor to give it more of an authentic metronome sound. The original circuit had a 10k resistor between the IO Pin and transistor, but the volume was less than desired. I added a 1k resistor in parallel on the bottom of the PCB after it was built to drive the 3904 a bit closer to saturation as they say. The volume improved considerably, but as an afterthought, I would have probably hunted for a larger speaker, even though this one turned out looking nice.

    Pot Input: The input consists of a basic RC time circuit with a 5k pot and a 10uF cap. Nothing special here. I picked up the pot at a local electronics surplus store called HFE (formerly an HSC franchise) for 35 cents. It was difficult to find the right value in a size that would fit the case I was using, but this one worked out excellent.

    LCD Display: Since I decided to start this venture only a couple days before my dad's birthday, I didn't have time to order an 8x2 LCD from eBay, Sparkfun, or Pololu (all places that carry all sorts of them). So, my wife ran to Parallax and picked up an LCD Appmod which has an 8x2 LCD on it and dropped it off to me at work so I could harvest the LCD using the right tools. The problem I ran into with the LCD came during the first power up test of the metronome. The LCD wasn't working and when I grabbed it to flip it over and check my wiring, it was extremely hot. First sign of a wiring error. However, after doublechecking the pinout, I was certain it was fine. However, after removing all but the power wires to the LCD, it still got hot. I looked again at the silkscreen on the LCD and realized that it didn't match the pin 1 number on the connector. Come to find out, the silkscreen on the LCD is drawn in a way that it is shown for how the mating board would be pinned. So for direct wiring, you had to look at it in a mirrored and reversed fashion (sounds redundant, but it's not). I was applying 5 volts to two of the data bit lines!!! Once re-wired, it worked perfectly, no permanent damage done.

    Power supply: The power supply is a 9 volt battery that is fed through one of my PowerTwig boards to get the 5 volts needed for the LCD and speaker as well as the 3.3 needed for the Prop. The power switch on the face is between the 9 volt and the PowerTwig.

    LEDs: To me, a ticking metronome seems useless if you are playing an instrument because you won't be able to hear it if you are playing. I figured a visual aspect for the metronome was required. I cut a recycled light pipe short enough to fit on the faceplate and drilled two small holes next to each other to squeeze in the light pipe. It worked out rather well. Then, I hotglued an RGB LED to the light pipe and ran the red and blue elements to the prop using current limiting resistors. If you are wondering why I left out the green LED, it's because I broke it's leg off just before soldering the wire into the PCB. Since I already had it glued and the other LED wires soldered, I just left it out since it wasn't part of the code. The red LED only lights up while it starts up and shows Happy Birthday on the screen. The blue LED flashes in track with the speaker ticks.

    input = P6 5k Pot/10uF RC time circuit connected here
    output = 7 Prop Pin-->1k Resistor-->base of 3904
    RegSelect = 8 LCD
    ReadWrite = 9 LCD
    Enable = 10 LCD
    blueled = 11 Prop Pin-->100ohm resistor-->Blue LED
    greenled = 12 (not connected)
    redled = 13 Prop Pin-->470ohm resistor-->Blue LED
    DataBit0 = 16 LCD databus
    DataBit7 = 23 LCD databus

    One side of Speaker is connected to 5v.
    Second side of speaker is connected to the collector of the 3904.
    The 3904 emitter is tied to ground.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Andrew Williams
    WBA Consulting
    WBA-TH1M Sensirion SHT11 Module
    Special Olympics Polar Bear Plunge, Mar 20, 2010

    Post Edited (WBA Consulting) : 3/14/2010 4:02:45 AM GMT
    1024 x 725 - 272K
    1024 x 683 - 251K
  • WBA ConsultingWBA Consulting Posts: 2,680
    edited March 2010 Vote Up0Vote Down
    Proto PCB Layout

    PCB: I used a round PCB that is from the 5 piece round proto board pack from Radio Shack. I got a pack a while back simply because the round PCBs sparked some ideas in my head. For the case I used, the round PCB made things a bit easier. I could have also used a regular prototyping board and just trimmed it with nibblers to fit the case. The circuit consists of a basic propeller circuit, a transistor driven speaker output, an RC time input circuit, a parallel LCD, and 2 LEDs. Everything was placed onto the PCB and the legs were bent to hold them in place. When everything but the LEDs were on, I soldered it all in about 3 minutes. (not including the 5 minutes of rework for the LCD) I soldered a 4 pin header on one edge of the PCB so that it would stick out into the battery bay. After notching out a slot in the battery bay wall, I had access to reprogram the board without opening the case.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Andrew Williams
    WBA Consulting
    WBA-TH1M Sensirion SHT11 Module
    Special Olympics Polar Bear Plunge, Mar 20, 2010

    Post Edited (WBA Consulting) : 3/14/2010 3:38:24 AM GMT
    717 x 1024 - 416K
    745 x 1024 - 436K
    781 x 768 - 278K
    1024 x 640 - 258K
  • WBA ConsultingWBA Consulting Posts: 2,680
    edited March 2010 Vote Up0Vote Down
    Case Design

    Many people know that I am a big fan of Polycase for enclosures. I use them as often as I can. For this metronome, I used a VM-24 handheld enclosure that has a silicone boot because I had one in my project box. It turned out to be a perfect fit. The VM-24 I had was for 2 AA batteries (rather than a 9 volt), so I had to modify the case to fit the 9 volt. (You can get the VM-24 in a 9 volt format)

    The case was cutout for the LCD and speaker using an X-acto knife. I had to adjust the position of the LCD after already cut the case, which is why there is a gap above the LCD. The modifications to the faceplate were all done with a step-drill. Everything fit snugly into the case. The LCD and speaker are hot glued to the front of the case. The PCB is secured by the faceplate since the unused leg of the pot is soldered to a few pads on the PCB as a mounting post. There is also some tension against the programming header so it is snug. The PowerTwig board fits perfectly wedged into the side of the case between the screw bosses. Almost looks like I designed it that way.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Andrew Williams
    WBA Consulting
    WBA-TH1M Sensirion SHT11 Module
    Special Olympics Polar Bear Plunge, Mar 20, 2010

    Post Edited (WBA Consulting) : 3/14/2010 3:39:36 AM GMT
    1024 x 694 - 289K
    1024 x 727 - 342K
    1023 x 768 - 308K
    1024 x 683 - 215K
    768 x 861 - 269K
  • WBA ConsultingWBA Consulting Posts: 2,680
    edited March 2010 Vote Up0Vote Down
    Final Code

    Here is the final version of the code. Version 002 is what's loaded on the metronome and version C02 is the code cleaned up for sharing. Since I cleaned it up after the metronome was given to my dad, I can't be 100% sure that I didn't accidentally break the code. The archive has both versions as well as the supporting objects for the LCD and utilities (pause) from the original code design. I did change the LCD routines file to match my pinout because the pin definitions in "program12" from Harpit's thread for the LCD are not actually used.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Andrew Williams
    WBA Consulting
    WBA-TH1M Sensirion SHT11 Module
    Special Olympics Polar Bear Plunge, Mar 20, 2010

    Post Edited (WBA Consulting) : 3/14/2010 3:31:09 AM GMT
  • WBA ConsultingWBA Consulting Posts: 2,680
    edited March 2010 Vote Up0Vote Down
    Everything is posted except the schematic, still working on drawing that up. The pinout is detailed in the code and the Circuit Notes post above.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Andrew Williams
    WBA Consulting
    WBA-TH1M Sensirion SHT11 Module
    Special Olympics Polar Bear Plunge, Mar 20, 2010
  • WBA ConsultingWBA Consulting Posts: 2,680
    edited April 2010 Vote Up0Vote Down
    was hoping for some sort of feedback by now. Anyhow, an update: I am working on V2 which will upgrade the audio output circuit with a volume control and some options for the initial beat of a measure.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Andrew Williams
    WBA Consulting
    WBA-TH1M Sensirion SHT11 Module
    Special Olympics Polar Bear Plunge, Mar 20, 2010
  • Shawn LoweShawn Lowe Posts: 576
    edited April 2010 Vote Up0Vote Down
    Andrew-

    This is a cool project! Thanks for the point to polycase, looks like an awesome site. I might be making one of these since my Elks lodge used a metronome for practicing once. Good job!

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Shawn Lowe


    When all else fails.....procrastinate!
  • logan996logan996 Posts: 281
    edited April 2010 Vote Up0Vote Down
    Wow! how much in all did this cost? and this is kind of off topic but does the propeller chip come with that sticker with the pinouts and such?

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    "When the government is afraid of the people there is liberty, when the people are afraid of the government, there is tryanny"

    · Thomas Jefferson
    ·
  • WBA ConsultingWBA Consulting Posts: 2,680
    edited April 2010 Vote Up0Vote Down
    Shawn, thanks, I use Polycase products as often as I can. I love their products and all 3 of my current projects will be in their cases.

    Logan996, Unfortunately, I would have to ballpark some of it since I recycled some items, but here goes:

    VM-24 Case with Boot: $6.49
    Propeller: $8
    EEPROM, crystal, discrete parts: $3
    PCB: $2 (5 pack of various sizes was $5 and this was the largest in the pack)
    5K Panel Mount pot: $0.60 from a local electronics surplus store
    Power Supply Parts: ~$2 (I used my PowerTwig board which will retail around $9 "soon")
    LCD: ~$9 (eBay price, but mine was harvested from the $15 LCD AppMod from Parallax)
    RGB LED: ~$0.50 (mine was actually a $2 three watt one)
    Light pipe: ~$1 (but free from my project box)
    Speaker: $1 (but free as I recycled it from a dead LCD monitor)

    So I guess an estimated total cost would be around $35. Seems a little high, but when you think of the capabilities for a customizable metronome that I haven't coded yet, it's not bad.

    The label was made by me and it is very similar to the ones that come in the DIP40 Propeller Education kit. Here's a thread with more details on the labels I made.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Andrew Williams
    WBA Consulting
    WBA-TH1M Sensirion SHT11 Module
    Special Olympics Polar Bear Plunge, Mar 20, 2010
  • davejamesdavejames Posts: 3,889
    edited May 2010 Vote Up0Vote Down
    Andrew,

    Any decent metronome will cost upwards of $35 (I've bought some). And they have funky, preset detents for fixed rates. Yours is variable and displays the actual count.

    Inna word, awesome!

    DJ

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Well-written documentation requires no explanation.
  • WBA ConsultingWBA Consulting Posts: 2,680
    edited May 2010 Vote Up0Vote Down
    Thanks, I never really looked at pricing custom metronomes, so I wasn't sure. I am now working on improving the audio circuit and user interface. I found a speaker driver object in the OBEX that will be easy to integrate into my existing design to increase the volume from the tiny speaker. I know it can be loud as it came from an old 15" LCD monitor that sounded pretty good. I now have some navigation switches too, to improve the user functions. I will probably dump the pot as well that is used for setting the BPM, so that it is all set with the nav switch. I will try to get it done before UPEW so it can be shown there.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Andrew Williams
    WBA Consulting
    WBA-TH1M Sensirion SHT11 Module
    Special Olympics Polar Bear Plunge, Mar 20, 2010
  • davejamesdavejames Posts: 3,889
    edited May 2010 Vote Up0Vote Down
    Does/Will it have the ability to set the accent of the beat?

    Meaning:

    ONE two three four, ONE two three four...
    one two THREE four, one two THREE four...
    ONE two, ONE two...
    one TWO, one TWO...
    ONE two three, ONE two three...

    And does/will it have multiple time signatures (2/4, 3/4, 4/4, 6/8, etc.)?


    Regards,

    DJ

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Well-written documentation requires no explanation.
  • WBA ConsultingWBA Consulting Posts: 2,680
    edited May 2010 Vote Up0Vote Down
    No/Yes....... It doesn't right now as the code is very basic, but that will be easy to implement with some simple code. I have thought about that quite a bit because a few of my guitarist friends have said that is what would make a metronome more useful.

    I did a quick search and metronomes that do all what I am doing range from $25-$45.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Andrew Williams
    WBA Consulting
    WBA-TH1M Sensirion SHT11 Module
    Special Olympics Polar Bear Plunge, Mar 20, 2010
  • HumanoidoHumanoido Posts: 5,770
    edited May 2010 Vote Up0Vote Down
    Andrew:

    This is a master project. Congratulations!
    I like your methodical organization, logical outlines and construction,
    and clear presentation with successful results. I should also mention
    the excellent code documentation and schematics are magnificent.

    humanoido

    Post Edited (humanoido) : 5/13/2010 6:13:18 AM GMT
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 21,403
    edited May 2010 Vote Up0Vote Down
    Of course,

    ONE two three four, ONE two three four... and one two THREE four, one two THREE four... are the same, as are
    ONE two, ONE two... and one TWO, one TWO....

    The only differences between them are where you "hop on". With the possible exception of 5/4 time (thanks to Dave Brubeck), the only setting you really need is the number of beats between accents.

    -Phil
    “Perfection is achieved not when there is nothing more to add, but when there is nothing left to take away. -Antoine de Saint-Exupery
  • WBA ConsultingWBA Consulting Posts: 2,680
    edited May 2010 Vote Up0Vote Down
    Humanoido, thanks for your comments. Even though I am still quite a newbie at the prop, I don't see any reason why things i have done shouldn't be a learning aid for others. With that thought, I try to make my completed project posts as detailed as possible. My reverse geo-cache project was my first completed post and at first I thought I went a little overboard, but looking back at it now, I am very happy with what I did.

    Phil, very good point!

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Andrew Williams
    WBA Consulting
    WBA-TH1M Sensirion SHT11 Module
    Special Olympics Polar Bear Plunge, Mar 20, 2010
  • davejamesdavejames Posts: 3,889
    edited May 2010 Vote Up0Vote Down
    Phil - beg to differ.

    The tempo is the same, but the accent gives the "feel". Some forms of Latin music have a "ONE, ONE, ONE..." accent that defines a very driving sense.

    So, some metronomes have the ability to output a different tone (or flip the color of an LED) to define which beat is accented.

    DJ

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Well-written documentation requires no explanation.
  • edited May 2010 Vote Up0Vote Down
    This is a really excellent project, thanks for sharing.
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 21,403
    edited May 2010 Vote Up0Vote Down
    davejames,

    I'm not disputing the advantages of an accent. I think that would be a great feature. I was only pointing out that there's no real difference between 1 2 3 4 1 2 3 4 and 1 2 3 4 1 2 3 4. Once either sequence starts streaming, they both sound the same. It's only where you hop onto the resulting beat that matters. In engineering terms, both accent frequencies are the same, and the phase is a matter for the musician to interpret.

    -Phil
    “Perfection is achieved not when there is nothing more to add, but when there is nothing left to take away. -Antoine de Saint-Exupery
  • davejamesdavejames Posts: 3,889
    edited May 2010 Vote Up0Vote Down
    *8)


    dj

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Well-written documentation requires no explanation.
  • WBA ConsultingWBA Consulting Posts: 2,680
    edited May 2010 Vote Up0Vote Down
    Woohoo! made it to Project of the Week!!

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Andrew Williams
    WBA Consulting
    WBA-TH1M Sensirion SHT11 Module
    My Prop projects: Reverse Geo-Cache Box, Custom Metronome, Micro Plunge Logger
    644 x 284 - 130K
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 21,403
    edited May 2010 Vote Up0Vote Down
    Congrats, Andrew! I'm not surprised: it's a great project!

    -Phil
    “Perfection is achieved not when there is nothing more to add, but when there is nothing left to take away. -Antoine de Saint-Exupery
Sign In or Register to comment.