Anyone here good with building circuits?

Yes, I’m thinking that R.S. probably still carries the LM324. They may also have the LM3900, which is similar (but NOT a substitute). If you have trouble finding one, let me know, and I can send you one.

I got the latest schematic that you mailed. You may want to try reducing the value of R6 down to the 2K to 5K range. This will give you a better ‘range’ on the A/D, since it will be starting closer to 0 V.
Also, for starters, I would change R3 and R8 to values closer to what I used the 324 - it’s better to start with too much gain rather than too little. Also, I would start with a higher value for C1 - it’s effect will be to ‘hold’ the sound-sample longer, to give your SW more time to read it.

Pete

Mike, be sure to post your results and the schematic someplace where we can all read about it! If you need someplace to park a few images, let me know.

Thanks Pete & Andy,

Pete, I went ahead and changed the schematic values to match your example you sent me as starting referance values for me to use. I printed it out so I can build the bread board circuit from it.

I will certainly post all information in regards to this project. I plan to have a revised accurate schematic with the proper values used, basic code, and the ADC documentation I have using the ADC chip. I will bundle it all up in a nice neat package so anyone else can do this also.

I appreciate the offer Andy.

My ADC part will not get to my door until January 3rd, so it will be a short while before I can test this all out.

Stay tuned…

Hello Gang,

It works! It works!

I went to RadioShack today after work to pick up a few needed components for the audio project. I had to get a diode and some caps. I meant to buy a 680k resistor but bought a 680 ohm resistor by mistake! I was using that not realizing it was only 680 ohms! Well I could not get anything to work so I changed things around. It seems to work fantastic using a 100k resistor for the gain.

For some reason, when I hook up the mic to ground, the LED that I am using for the test stays on for 1.5 seconds and then goes out and starts functioning to sounds. If I remove the mic ground lead, and then re-connect it to ground, I get another 1.5 second LED full on before it resumes normal operation.

The sense of accomplishment is very rewarding! :laughing:

Congrats!
(^.^)
And, Mike, that LED… IGNORE IT!
Take it from someone who’s just spent two days rewriting the visuals for his biped control program because he noticed that he spelled forwards “Forewards”.
Just smile, pat yourself on the back, and back away!
Besides, isn’t there that saying… “If it ain’t broke, your not trying”?
:laughing:

Here is a short video of my test circuit that I did last night. I used a Dr. Pepper can as the audio source because I didn’t think you guys would want to hear my dorky voice and I was not about to go “La la la la” :laughing: . Anyway, Dr. Pepper makes the world sound better! :smiley: .

I am still waiting on my ADC0832 part before I hook it up to the stamp and begin to write code. I just wanted to try this circuit out first to fine-tune the component values.

If you look at the video, you will see the LED go steady “ON” for about 1 to 1.5 seconds when I first attach the Mic ground wire, and then it goes out for normal operation. The mic wires are hard to keep in the breadboard because of the stranded wire, also the mic ground wire is insulated with the out put wire as a group which makes it hard to bread board also. So I just attached the red & white wires to the breadboard, and then manually hold the ground wire to the mic’s metal body.

Here is the video:

youtube.com/?v=AcivtKS9Cy8

Hi Mike,
Glad to hear you’re having some success! When you hook up the mic, the circuit is seeing a very large signal while the 10 uF cap gets charged up to it’s normal DC level. That causes your LED to stay on for a bit (I haven’t seen your latest circuit, but I gather you have an LED hooked up to the output).

I’m out of town at the moment, so my responses will be spotty for the next couple of days.

Pete

I’m having a problem understanding why pin 3 (+ Input) needs to be connected to half the supply voltage. With my test circuit, I only built half the circuit (One mic, one op amp) to make things easier. When I built it, I forgot to connect pin 3 to the 2.5v circuit. The circuit still worked fantastic with out it.

I was told by someone else that it NEEDs to be connected, but when I do connect it to the 2.5v source, the LED stays on and slightly flickers to sound, but it does not perform as nice without it hooked up. With it not connected to anything, the LED has a much better range of voltages (from nearly off to full on like in the video).

What’s its purpose, and do I need to have it hooked up? I am very confued with this.

With the circuit configured as we’ve been discussing, the + input’s voltage level determines the no-input output voltage. That is, with the (-) input not doing anything (no sound from the mic), the output of the op-amp will match the level on the (+) input. When the (+) is connected to the 2.5 V source, the output should be very close to 2.5 V also. If you have an LED connected directly from the op-amp output to +5 or Gnd, I would expect the LED to be on, because 2.5 V is enough to turn on most types of LEDs.

With nothing connected to the (+), it will default to something but I don’t know what it would be offhand. You don’t want to leave the circuit this way, because the op-amp will tend to be unstable.

Try connecting the (+) to about 1 V or so, by reducing the value of the ‘bottom’ resistor that you’re using to make the 2.5 V. If the ‘top’ resistor is 10K, then make the bottom one about the 2K range. The output will then be closer to 1 V, and the LED should be off (assuming you have the LED connected between the output and Gnd, with the cathode connected to Gnd). Then tap on the mic, and you should see the LED blink (assuming you have enough gain in the op-amp).
A few assumptions there, since I don’t know exactly what you’re doing with the LED…

Pete

Thanks Pete,

I am still confused as to how this works but I did connect pin 3 to a voltage source (1.6v) and it works. What I did was take 3 1k resistors (its all I have), the top 2 being 1k, (2k total) and the bottom being 1k. The op amp still behaves in the same manor where the LED dimly flickers at no sound but does react to sound.

I am using the LED between the output of the op amp and ground.

If pin 3 is supplied with 2.5v, the LED goes high and does not react to any sound.

When I have more time, I will draw up how my circuit is breadboarded. Right now the only major differance is the addition of the LED and the voltage supply going to pin 3.

It occurs to me that adding the LED on the output may be causing some confusion.

The ‘real circuit’ (which would have an A/D) has the op-amp output going to a diode, which then goes to a cap to ground. The diode/cap combo provides a ‘sample-and-hold’ effect, which gives the A/D some time to detect and measure the level. This is all good, and I’ve verified it on my breadboard, using an oscilloscope to watch the signal across the cap (the same as what the A/D would do).

However, adding an LED across the output changes things considerably:

  1. The sample-and-hold will be mostly lost, because the LED will drain the cap very quickly. At best, the LED will flicker with instantaneous sound inputs (I tried this, it works).
  2. The LED will not turn on much at all below a certain V (around 1.5 to 2.0 V probably). This means it’s real hard to see what the signal is really doing - much of the interesting stuff may be happening while the LED is off.
  3. You need a resistor in series with the LED (maybe you did this, I don’t know). Without the series R, the LED will tend to clamp the op-amp output to no more than about 2 V, and again the behavior of the LED will be misleading. Also, if you were running the circuit at much more than a few volts, it’s possible that the LED would get fried and/or the op-amp would be damaged, since there would be nothing to limit the current thru the LED. On my breadboard, I put a 470 ohm R in series with the LED, and it worked as I expected.

Instead of an LED, I suggest going back to the diode and C, and use a voltmeter or o-scope to monitor the V across the C. If possible, use a high impedance V-meter.

Pete

Thanks Pete, HAPPY NEW YEAR!

My apologies for the many questions regarding this project. Your explanations all make sense to me.

I do not have an o-scope so this is one of my main problems trying to figure out what’s going on. I have the circuit working, I just need to make sure that pin #3 is going to provide the functionality that I need, because right now, using 2.5 volts keeps the LED high with no change in its output to sound. I am using a resistor in series with the LED to help limit the current so I don’t fry any thing, also I am not using a 470ohm resistor like you are using. I am using 220ohms.

If I supply the Vref supply to pin 3 with 1.6 volts, the LED behaves in the same manor as if I have pin 3 to GND. I know you said that I cannot rely on the behavior of the LED, but it is all I have to visually see what is happening, and I just want to paint a picture for you to understand what I am doing.

My ADC part is going to arrive at my house tomorrow; perhaps I can experiment with the audio circuit using the ADC since I will be able to see some kind of output in the debug screen.

Thanks for all your help Pete, I appreciate and value your help more than you know!

Here is the breadboard circuit I am curently using with the actual values.

http://img283.imageshack.us/img283/8696/testcircuit7ev.gif

Hi Mike,
I have a very similar circuit on my breadboard at the moment.
For the time being, since you are using the LED on the output, I would recommend changing the C from 0.1 to something much larger, such as 10 uF. With only 0.1, the LED may blink faster than you can see it, because the LED is draining it very quickly. When you have the A/D hooked up, be sure to remove the LED. Your A/D has an input impedance of about 3.5K I believe, so it will also drain the C, but at a rate that should be slow enough for your SW to capture readings if you have it running in a loop of some sort.

Another option, to make everything ‘work nicer’ with regards to the LED, is to add another op-amp as a buffer stage between the 0.1 uF cap and the LED. I am about to e-mail you a new SCH file which shows this setup. I’m still using an LM324, but the same thing will work with a 741 (assuming you have another one), or you can use a 1458 (two 741’s in a single package).

And meanwhile, the SCH I’m about to send you also shows another circuit which is a “light sensor” instead of a “sound sensor”. On my bot I’m going to have both (a pair of mics, and a pair of photodiodes).

Pete

I have tried every cap I have in my possession, both polarized and non polarized for the 741 output pin with no effect to the LED except charge and drain speed.

I will need to test it out with an ADC to see if things are working ok.

You mentioned the input resistor needs to equal the mic impedance, but how can I check the mic impedance? With a DMM as I would a resistor?

Thanks

No, you cannot measure the impedance of the mic with just a meter. However, you can assume that it is in the 1K to 5K range - that will be close enough.
If you were to use an input R that is much too low, it loads the signal coming from the mic, and you’ll get poor sensitivity.
If you use a value that is way too high (like 100K), then you are limiting the gain of the op-amp too much, and it may also be subject to picking up electrical noise (especially from things like flourescent lights).

Pete

I am going to try to hook up my ADC today after work and see what I get.

Wish me luck because I am going to need it.

Also, I designed the circuit board using Eagle cad and submited the gerber files to Spark Fun electronics and it passed their DRC check which means the board can be manufactured. One board will cost only $12.95, not bad for a single board run!

It’s been proven that the circuit works, I just need to get the part values worked out and make sure all is good before I send off for my board to be manufactured. I will post a pic of the board as it looks in Eagle cad.

Here is the image of the board design: (Click thumbnail to enlarge)

img289.imageshack.us/img289/3765/audioboard5uw.th.png

Well I got home from work today to see the long awaited package at my door step. I got my ADC part!

The test results are in…

IT WORKS!

I assembled the bread board based of my printed schematic and tried to be very careful with using the right values (as close as I could get them) and see if the basic stamp could read the audio output. Using my high tech testing device (my empty Dr. Pepper can) I was able to watch the values rise and fall as I made noise. I still need to get more parts that will provide better performance, such as a 740k resistor for better gain, and a 1.0uF cap instead of the one I am using now which is a 0.047uF.

I even used the 2.5v rail to pin #3 of the LM741 and it worked very well. I was concerned that this was going to be a show stopper for me since I had such bad results trying to see things work with the LED. Originally, the 2.5v supply caused the LED to just stay HIGH and nothing more. It is a relief to see it work after not seeing any results in the earlier test.

I still need to play around with the programming to utilize this output.
Thanks for all your help Pete; you really helped me stay on coarse.

Tsk, tsk, tsk…
“course”, Mike, not “coarse”
:laughing:
Gotcha back!
:wink:

I was testing you Nick :unamused:

JK, you got me back.

Congrats Mike,
Regarding that 720K resistor and such: Any value in that rough neighborhood should be fine. For example, at the moment I’ve got a 1 Meg resistor in there. In “real operation” you will be able to find a value that is really best. Note that a really large value might not work so well with a 741-type op-amp (by really large I mean several megohms).

And regarding the 2.5V value: The main advantage of using a somewhat lower voltage here is that it gives your A/D reading more ‘headroom’. That is, if you start at 2.5V, then the max it can go to is 5V, which is a range of 2.5V. But your A/D can measure a wider range than that. So, using a smaller reference V, you would have measurements that are more ‘precise’. I’ll be setting mine at around 0.25 volts. For me the A/D will be the one inside a PIC 12F675 (I think that’s the right part #?), because I have a couple of them that I got at work.

Meanwhile, on the optical version of this circuit: The TIL412 PIN photodiode is really sensitive when followed by a X100 amp (one of the amps in the LM324). With the circuit sitting on the bench under a flourescent light, I get a strong 60 Hz output signal - I will need to consider filtering out that sort of ‘noise’. Shining a flashlight in it’s general direction causes an obvious change in the output.

Pete