Shop OBEX P1 Docs P2 Docs Learn Events
Incredibly simple nooby circuit — Parallax Forums

Incredibly simple nooby circuit

servelloservello Posts: 113
edited 2008-08-26 03:19 in BASIC Stamp
Forgive me guys, I'm a real time novice.

I wanted to make a metronome for myself to help with my guitar studies. I looked fairly well and found nothing in these forums that mentions how to use a BASIC Stamp II as a metronome.

So, I thought I'd try my hand at it, and came up with the attached circuit and code.

Please note three things:

1. I am new
2. I did do a metronome search before making this post.
3. I am aware that I should add a potentiometer so I could vary the speed of the 'clicks'

Take care.

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Deus tantum me iudicabit

Comments

  • SRLMSRLM Posts: 5,045
    edited 2008-08-24 06:06
    Why not also add either a computer terminal (for DEBUGIN) or an LCD with a pair of buttons? Then you could do bpm in digital, rather than an analog format (as you propose with the pot) If you are going to use a digital system, might as well have input be digital too.
  • Dan TaylorDan Taylor Posts: 207
    edited 2008-08-24 15:27
    What are the LED's for?

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Dan Taylor
  • servelloservello Posts: 113
    edited 2008-08-24 19:18
    SRLM said...
    Why not also add either a computer terminal (for DEBUGIN) or an LCD with a pair of buttons? Then you could do bpm in digital, rather than an analog format (as you propose with the pot) If you are going to use a digital system, might as well have input be digital too.

    Thanks for the suggestion SRLM. However, as my initial post states, I am really new at this. If you could point me to an example or maybe post an example yourself, I would definitely appreciate it. I do have a Parallax LCD to play with, so I'd be eager to try it out.

    Thanks again.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Deus tantum me iudicabit
  • servelloservello Posts: 113
    edited 2008-08-24 19:43
    Dan Taylor said...
    What are the LED's for?

    There are two LED's. One is RED and one is GREEN.

    They alternate blinking each time there is a 'click' sound.

    This adds a visual effect to compliment the audible sound of the metronome. It really does help.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Deus tantum me iudicabit
  • ZootZoot Posts: 2,227
    edited 2008-08-24 20:13
    SRLM means using the DEBUGIN and DEBUG commands in your program -- these let you send and receive text and numbers using your PC (a screen pops up when you are in the Stamp Editor). It would let you enter a number (say a speed) and then that number can used in your Stamp program. This will require zero hardware or extra wiring, but do read about DEBUGIN and DEBUG in the Pbasic Manual -- they are the most useful commands for finding out what's going on inside your Stamp and for telling it to do things (while hooked up to your PC).

    I like metronomes. Good idea. Makes me want to build one, with maybe a motor so it has lights, sound, and a waving arm.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    When the going gets weird, the weird turn pro. -- HST

    1uffakind.com/robots/povBitMapBuilder.php
    1uffakind.com/robots/resistorLadder.php
  • Beau SchwabeBeau Schwabe Posts: 6,563
    edited 2008-08-24 20:42
    servello,

    Can I suggest adding a resistor (at least 220 Ohms) or capacitor (10uF ; observe polarity... positive to I/O pin) between pin9 and your 8 Ohm speaker?

    Otherwise, you run the possibility of damaging your I/O pin.


    Option #1:
    With a 220 Ohm resistor, you limit the maximum current to the I/O pin to about 22mA.... otherwise, the 8 Ohm speaker is demanding about 625mA

    Option #2
    With a 10uF you have a 625mA surge that is very short lived between each transition from LOW to HIGH or HIGH to LOW.... When the pin is not in transition, the
    current is virtually zero Amps.


    Option #2, will provide the best volume.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Beau Schwabe

    IC Layout Engineer
    Parallax, Inc.
  • servelloservello Posts: 113
    edited 2008-08-25 00:19
    Thanks for the clarification, Zoot. I'll definitely look into using those commands.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Deus tantum me iudicabit
  • servelloservello Posts: 113
    edited 2008-08-25 00:22
    Beau Schwabe (Parallax) said...
    servello,

    Can I suggest adding a resistor (at least 220 Ohms) or capacitor (10uF ; observe polarity... positive to I/O pin) between pin9 and your 8 Ohm speaker?

    <snip>


    Thanks for the heads-up. I'll try both to see the difference in volume.

    Speaking of volume, how can I make the 'clicks' louder?

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Deus tantum me iudicabit
  • Beau SchwabeBeau Schwabe Posts: 6,563
    edited 2008-08-25 02:55
    servello,

    To make the clicks louder, you need to send your signal through an amplifier of some kind.... because of the nature of this project, a simple transistor amplifier would work.
    You still need to take into consideration the current requirements. Using a transistor would basically allow you to go beyond the 25mA barrier of directly driving it from an I/O pin.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Beau Schwabe

    IC Layout Engineer
    Parallax, Inc.
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2008-08-25 04:54
    I will second Beau's suggestion for a simple transistor amp. Since the speaker's impedance is so low and since the drive voltage is likely high enough, an emitter follower would work by giving you a necessary current boost. Also, a bare speaker without some sort of housing will never reach its volume potential. You might experiment with various housings for it. You may be surprised how much such a simple addition can increase loudness!

    -Phil

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    'Still some PropSTICK Kit bare PCBs left!
  • servelloservello Posts: 113
    edited 2008-08-25 14:38
    Thanks for the tip, Beau and Phil. Is the attached image what you are talking about? If it is, then I would just have to figure out the actual resistor sizes to use, right?

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Deus tantum me iudicabit
  • servelloservello Posts: 113
    edited 2008-08-25 14:54
    oops, forgot the image.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Deus tantum me iudicabit
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2008-08-25 17:19
    Servello,

    your post is off topic in this forum which is for Completed Projects only, not support. It is being moved to the BASIC Stamp Forum. Please post in the appropriate forum in the future.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Engineering
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2008-08-25 17:43
    The circuit that you've posted is a "common-emitter" amplifier. The circuit I recommended was an "emitter follower". My recommendation, now that I've actually tried it, wasn't such a good one, though. A circuit that worked well for me is the following:

    attachment.php?attachmentid=55328

    It uses a MOSFET transistor in a "common source" configuration. I used a 16-ohm speaker and got the best volume by connecting the high end of the speaker to Vin, rather than +5V. However, this may overdrive an 8-ohm speaker, so proceed with caution. The IRLZ34N is a "logic" MOSFET with a low gate threshold and is a real workhorse. No parts collection is complete without one. I also tried the circuit with a 2N7000 in a TO92 package. It worked fine with 5V (16-ohm speaker) but overheated at Vin, so I would not recommend it — especially with an 8-ohm speaker.

    -Phil

    P.S. Chris: Something really got screwed up here. I was working on this reply when you moved the thread, and I submitted it to the original forum after the thread was moved. My original reply (and the one that actually contains the referenced schematic) is now off in la-la land somewhere, unattached to any forum. I hope this doesn't mess up the forum software...

    P.P.S.: Orphaned post deleted; image reposted here.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    'Still some PropSTICK Kit bare PCBs left!

    Post Edited (Phil Pilgrim (PhiPi)) : 8/25/2008 10:55:05 PM GMT
    306 x 280 - 2K
  • servelloservello Posts: 113
    edited 2008-08-25 19:41
    Chris Savage (Parallax) said...
    Servello,

    your post is off topic in this forum which is for Completed Projects only, not support. It is being moved to the BASIC Stamp Forum. Please post in the appropriate forum in the future.

    Sorry, Chris. I do try to follow the forum rules.

    My initial message was indeed a completed project. Other members then replied with suggestions to improve it.

    I'll try not to let my future posts veer off course.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Deus tantum me iudicabit
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2008-08-25 22:35
    Phil,

    I have removed the orphan post.

    Servello,

    Your original message did not appear as a Completed Project. When it is, you should post it with an appropriate subject line and complete description. We just want the forums to be clean and easy for members to find things. If I am confused about a post, imagine what others will think.

    By all means, once you’ve perfected your project feel free to post it, but please provide details including the subject. Take care.

    P.S. - Interesting tagline...hopefully you don't feel we were judging you.· =)

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Engineering


    Post Edited (Chris Savage (Parallax)) : 8/25/2008 10:40:42 PM GMT
  • SRLMSRLM Posts: 5,045
    edited 2008-08-26 00:02
    The LCD and buttons setup would allow you to move your metronome wherever you need it. It would be easier to use with several buttons, but you can get by with just two. (One technically, but that is even more difficult). Anyway, I'll describe a system with two buttons and an LCD.

    The basic premise is that one button will cycle through the available beats (with whatever step values you want to give it [noparse][[/noparse]1,5,10, etc]), while the second button will select that value. If you want to omit the second, then a hold on the first would do the same thing.

    The LCD is just to display what beat value you are viewing/using, and possibly other information like button labels. See the documentation on how to use it.

    Anyway, the psuedo code to select based on two buttons is like the following:

    Display a BPM value
    DO
    Check button 1
    If true (pressed) increment BPM and go back to begining
    Check button 2
    If true (pressed) begin metronome sequence with the current BPM
    LOOP


    Then, once you have the BPM, you can use a mathematical formula to relate the BPM to the correct length of the pause statements. Remember that if you have two lights (red and green) it will only really be effective for time signatures with two beats per measure, or some multiple thereof (4,6,8,10,12, etc.) If you try to use it with something like 3/4 time, then on one measure the green light will be the downbeat, on the next the red light will be the downbeat.

    The presents an opportunity. You can use a single LED and toggle it, and display the count on the LCD. Of course, you'll have to give it the code to select between all the common time signatures, but the code is essentially the same as the BPM stuff.

    Once you have it all setup and doing its metronome stuff, you can assign functions to the buttons like stop metronome (pauses until you start again), select new BPM, a dynamic higher or lower BPM, and new time signatures.

    You should make a list of all the things that you want it to do. Don't omit anything, no matter how far off. Then just go down your list and realistically evauluate each option, and see how you can incorporate it. That way you'll have a tool that you can use for a long time, not just until you can buy one from the store.

    Post Edited (SRLM) : 8/26/2008 4:31:32 AM GMT
  • servelloservello Posts: 113
    edited 2008-08-26 02:46
    Chris Savage (Parallax) said...

    P.S. - Interesting tagline...hopefully you don't feel we were judging you. =)


    Hehe. Good catch!

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Deus tantum me iudicabit
  • servelloservello Posts: 113
    edited 2008-08-26 03:19
    Wow SRLM,

    Thank you very much for taking the time to post such an informative reply. There is quite a bit there for me to go over. I think if I go over it a few times I may grasp what can be done.

    Thanks again,
    servello

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Deus tantum me iudicabit
Sign In or Register to comment.