Breadboarding question

I've got a really beginner question that is giving me some trouble. I'm following along with the Learning Tone (http://arduino.cc/en/Tutorial/Tone) example. I've been able to successfully produce the tone example, but I am a bit confused with the breadboard layout.

The following three pictures help show what I am referring to:

The black wire you see going to the breadboard is the positive, while the black cable going to the GND is GND. The left-most photo is the first setup I begin with--unsuccessful. The middle photo was my second attempt--successful--positive, resistor, jumper stacked in same column. And the right-most photo is my "just testing to see what happens" attempt--also successful--with the positive and jumper cable in same column, while the resistor is in the same position as the left-most image.

My question is: why didn't the first layout work? From some of the basic examples with LEDs and pushbuttons, the resistor and jumper cable were oriented in this manner. From what I can gather, the middle is obviously the correct layout, while the right-most is bypassing the resistor all together. Is that correct?

It appears to me that the middle also bypasses the resistor - you have both sides of the resistor connected together (confirm this with a multimeter).
What value resistor are you using?

Draw your circuit on paper first. And share that with us if it doesn't work. Trying to figure out your photos where wires leave and come into the photo makes a difficult task even harder. :wink:

Lefty

It appears to me that the middle also bypasses the resistor - you have both sides of the resistor connected together (confirm this with a multimeter).
What value resistor are you using?

I grabbed 100K ohm but I realize now I should be using 100 ohm. Is the first actually now correct but I simply used too large of a resistor?

Draw your circuit on paper first. And share that with us if it doesn't work. Trying to figure out your photos where wires leave and come into the photo makes a difficult task even harder.

Is this more helpful?

Edit: I think I answered my own question. Popped in a 220ohm resistor and the sound was a bit muted but it worked properly with the "1st" layout.

Excellent work.
Are you trying to drive a speaker? It will be awfully quiet, you get at most 5V x 40mA = 200mW of power out. If you can connect to a powered speaker, like an amplified computer moniter speaker, the sound will be much more impressive.
Or you can build up your own amplifier, I have this circuit for my Arduino to drive with a Tone melody.

Is just a classic MOSFET AC amplifier, as found here: http://fourier.eng.hmc.edu/e84/lectures/ch4/node13.html

Only in this case, we are not worrying about trying to stay in any linear region, we are just letting the output swing peak to peak from the +12V supply ground. I only have it warble from between C6 & A5 a few times, sounds nice thru a high power 2.5" speaker. Plenty loud :slight_smile:

Ignore the 2nd RL resistor, I was playing with switching 2 resistors to make a hi/lo volume control. 68 ohm/34 ohm does not make much difference.

yea 2 and 3 are all connected to the same point bypassing the resistor

Edit: I think I answered my own question. Popped in a 220ohm resistor and the sound was a bit muted but it worked properly with the "1st" layout.

What you really need to do is to buy a digital multimeter. It's a mandatory thing if you are going to be building stuff with an arduino. Using it's ohm meter function you can tell if points are conducting as you think or not, also you can test components and measure current and voltage. Many available on-line cheap these days. Don't wait, find and order one now. OK, tomorrow at the latest. :wink:

Lefty

Thanks for the help y'all.

Are you trying to drive a speaker? It will be awful quiet, you get at most 5V x 40mA = 200mA of power out. If you can connect to a powered speaker, like an amplified computer moniter speaker, the sound will be much more impressive.

Yep, just driving a small 8ohm speaker. The sounds isn't too bad actually--I've had a great time playing with the Tone Libraries and tone.h. CrossRoads, your amplifier sounds like a project I can get behind. What sort of tone melodies do you use it for?

What you really need to do is to buy a digital multimeter. It's a mandatory thing if you are going to be building stuff with an arduino. Using it's ohm meter function you can tell if points are conducting as you think or not, also you can test components and measure current and voltage. Many available on-line cheap these days. Don't wait, find and order one now. OK, tomorrow at the latest.

You're darn right, I need to pick one up. SparkFun has their "Free Day" on the 13th so maybe I'll try my luck then!

Initially, you refer to two black wires, but I can only see one.

I just have it making a nice warble sound when a touch is made in my fencing scoring machine.
We fence in a 40'x40' room with lots of swords clashing, the amp is very hearable above that without being the obnoxious squeal that other fencing machines put out.
Found the speaker at www.mpja.com, $1.49 each.

Gento P/N ZSP99023A,
Mini, 2" , Foam edge, paper cone speaker with 1oz. ferrite magnet.
Imp: 4 ohm
Sen: 90db
Freq: 400-8KHz.

pre-setup code:

// notes in the melody to play when a touch is scored:
int thisNote = 0;
int noteDuration = 0;
int pauseBetweenNotes = 0;
int melody[] = {
NOTE_C6, NOTE_A5, NOTE_C6, NOTE_A5, NOTE_C6, NOTE_A5, NOTE_C6};
// note durations: 4 = quarter note, 8 = eighth note, etc.:
int noteDurations[] = {
12,12,12,12,12,12,4};

playing a sound when called in void loop:

    // create a warble once
    for (thisNote = 0; thisNote < 8; thisNote++) 
    {
      // to calculate the note duration, take one second 
      // divided by the note type.
      //e.g. quarter note = 1000 / 4, eighth note = 1000/8, etc.
      noteDuration = 1000/noteDurations[thisNote];
      noTone(17);       //apparent known bug - need this for the tone to play next.
      tone(17, melody[thisNote],noteDuration);
      // to distinguish the notes, set a minimum time between them.
      // using the note's duration + 10%:
      pauseBetweenNotes = noteDuration * 1.10;
      delay(pauseBetweenNotes);
      // stop the tone playing:
      noTone(17); 
    }
    digitalWrite (speakerOut, LOW); // turn off the amp -> capacitor coupled & gate pulled low, should not need this now.

That is a very cool project

Yes - only more like small scale production at this point :slight_smile:
Got to remember the camera and take some pictures of the installations tonight to show you guys.

Okay, here's links to pics showing the fencing scoring machines as currently installed.

http://www.crossroadsfencing.com/club_space12.jpg
http://www.crossroadsfencing.com/club_space13.jpg
http://www.crossroadsfencing.com/club_space14.jpg
http://www.crossroadsfencing.com/club_space15.jpg
http://www.crossroadsfencing.com/club_space16.jpg
http://www.crossroadsfencing.com/club_space17.jpg