Yea thanks for clearing it up I decided to get my resistors and caps from Jameco since theirs is like 4x cheaper. And I am getting the mics, speakers, and ICs from DigiKey. I am trying to find more stuff so I can get a total of $25 so I wont need to pay $5 extra (gay thing)
Hey, Mike.
I went out to the Shack today and picked up the op-amps that Iād need.
I tried to get the 3-wire mics, but, of course, they were all out.
So, I picked up the 2-wire PC mount variety.
Luckily, I recalled Peteās post (sorry for cross-threading):
So, Iāll go breadboard it out and give it a try.
If my meterās not quick enough to catch the analog values, then Iāll just have to tie an LED in there like you did when making one of your first test circuits.
It works.
I banged out one of the two mic circuits (I didnāt see the point of testing with both mics).
My meter didnāt always seem to be fast enough for brief sounds (which makes perfect sense), but for longer, sustained sounds of a quarter of a second or greater, the reading is stable enough to see the true value.
Iām a bit confused about the reading, though.
Measuring across the cap:
The first 3-4 seconds after powerup show a value of about 1V, which sounds right.
After that, the reading jumps to 1.75V and stays there.
Methinks that delay has so something to do with the overall RC time constant of the circuit.
But, I donāt understand why it would jump to 1.75V and keep that as itās ālowā.
I tested with a piezoelectric buzzer and a pot so Iād have a steadily varying sound, and the voltage across the cap seemed to rise linearly.
I learned that piezoelectric buzzers and condenser mics seem to do weird things when placed close to each other, too.
It seems that 4V is the upper threshold of the voltage.
As to why that would be⦠Iāve no clue.
Even a horsewhistle at closerange (Iāve done that to my brother and made his ear bleed ) only registers at 4V.
Does that 1.75V to 4V range sound odd, or is that to be expected?
Yes, thatās about right Nick.
The change after startup is probably because of C3 needing to charge up to a āsteady stateā value. While thatās happening, the input of the amp sees a too-strong signal, and the output goes to itās minimum value (about 1 volt).
The range you mention is a limitation of the old 741 op-amp ā itās output will not go real close to the +/- supply rails.
The solution is to use a more modern op-amp, and one that is designed for āsingle-supply operationā. One good choice is the LM324 - itās in a 14-pin package, and you 4 op-amps to work with. Another good choice is the LM358 - it would be two op-amps (just what you need here) in a single 8-pin package. The conventional 741 has other stuff on those extra pins that you donāt care about.
Mike is using an LM358 on his newer sensor board, after I badgered him about using the old 741. Thereās no reason to use a 741 in a project any more - there are so many better choices for under a buckā¦
Pete
One more thing: The voltage across C1 is also a bit less than you might expect, because there is a voltage drop across the diode of up to 0.7 volts. Most standard silicon diodes have a drop of 0.6 to 0.7. A Schottky diode is about 0.3. An old-fashioned Germanium diode (like the famous 1N34) is about 0.2.
If you want to maximize the output range with modern parts, use an LM358 op-amp, and a 1N5817 Schottky diode (there are other choices that work just as well - those are just the most obvious examples).
Pete
Sweeeeetā¦
I had just recently reread that huge thread where you helped Mike through all this, and I remember seeing you mention those 358ās a lot.
So you finally won, eh?
Well, you wonāt need to tell me twice.
Iāll try to eek as much range out of this bugger as I can.
The more values I have at my disposal, the more accurately Iāll be able to determine the position of the sound.
By the way⦠Iām sort of confused as to why the 10k and 2.2k resistor divider makes such a nice 1V supplyā¦
Theoretically, shouldnāt it make a 1.1V supply?
Yet, my poor meter disagrees.
Really it should be closer to 0.9 V, given a 5V input.
The equation is:
5 * (2.2 / (10 + 2.2)) = 0.902
Note that this requires careful software. If you try to do it by measuring the difference in loudness, it will be difficult to determine anything other than āright or leftā. And lower-frequency sounds will probably tend to always sound the same in both mics.
I plan to solve this problem by measuring the difference in time that a sound arrives at the two mics (which is primarily how your ears work - the possible difference in loudness is secondary).
Consider:
Assume the speed of sound is about 1 foot per millisecond.
If the mics are 1 foot apart, then a given sound from directly in front (or behind) will reach each mic at the same time. A sound from directly to the side will arrive 1 mS sooner at one mic. So, the PIC code needs to do this:
The output of each audio detector goes to a separate pin on PORTB.
A signal on either input triggers an interrupt.
Keep track of which input initially heard the sound.
The interrupt starts a timer, and waits until there is a signal on both inputs (meaning both mics have now heard the sound).
Check the value in the timer to determine how much time has passed.
Calculate the direction that the sound came from.
Check this schematic of my sensor board:
geocities.com/saipan59/robots/sensor.jpg
The microphones are not shown, but everything else is correct.
Itās similar to what Mike is doing, but I added a comparator stage to allow me to cleanly detect when a sound is heard from either side. Also, a 3rd op-amp measures the overall loudness of the sound (from either side), and goes into an A/D pin on the PIC - so it can tell the difference between quieter and louder sounds.
Pete
I am using Schottky diodes in my new design as well. They work very good.
Pete, I like your design. I wish I could have made my design to also determine angles but I just did not have the knowledge to do so.
You should see some of the positional voice recognition stuff they have for cars using dash mounted microphone arrays. In the cab they can tell you who is sitting (speaking from) where and respond only to commands from the driver of the vehicle. Very cool stuff, although still expensive.
That is cool stuff. I have seen a video of a robotic head built by a group of Japanese engineers that used two simple mics, the kind you can buy from Digi-key, or any of the other popular outlets.
In the video, four of them stood directly in front of the robotic head and took turns in-- random order-- talking to it. It was able to pinpoint who spoke the words. They used a complex software analysis program that ran on a desktop computer.
hey guys ,
i think the human ear uses a delay on 1 side,and how will u tell if somethings 45degres right or 135degres,mabe use 3sensors? or 4
with a diff delay on 3 ,it should be able to pin point a single sound,
with a little tweeking it could probly even account for echoes!!??
With Peteās method, a time delay between one mic and the other is determined by the time it takes for both mics to sense sound. Via software, you can calculate angles based on these values. If you read Petes orginal post, he provides more detail on how this works.
yea but think 45 and 135 from the right side ,there both gonna apear the same right!?,or mabe i should put it like ,45+ and 45- from the right side,?
mabe if u screened the back inside of the mikes it would get u a diff,about the delay i think his delay was for somthing else could be wrong ,i once was
Are you talking about if it hears sound from this angle to start with?
What I was saying is that it determines the angle from the zero position, looking straight forward. The sound source is going to be either in the front, left, or right. The angle can be determined by the software with a formula to calculate the values.
Forgive me if Iām still misunderstanding you.
Oh, you ment the sound coming from the back side, behind the mics. Iām not sure how one would do this. Perhaps Pete can give an answer.
Well, I can answer that.
Anything on the front side of the head would be synonymous with the back side with only 2 mics.
In all honesty, this wonāt much matter.
A servo only has 180 degrees of rotation, anyhow.
If youāre behind the botās head and shout, it will turn itās head so that the back of the head points directly at you.
This would look a bit odd.
Sort of like the bot is purposefully ignoring you.
For that reason, I probably wonāt bother fixing it.
Yes, another microphone would alleviate that.
And, no, I canāt think of any way to do fix it without the aid of a third sensor of some sort.
Oh, and Mike, stop putting yourself down.
Just look at me.
::points at self::
Does it look like I know anything?!
(Really, itās OK, you donāt have to answer that. )
Pete, thatās a really neat way to do it.
I had been wondering how you were going to time the two sounds with only a single processor thatās not capable of true multitasking.
Leaving the sensing of that to the microās hardware sounds like a good way to overcome those problems.
Iāve been looking at what your speed of sound example said and it seems like even the distance of mikeās bot head would be enough to give an ample resolution with a decent micro.
Assuming only an inch of distance between the two mics, thereās still a max delay of 83uS or so, which is rather long in the micro world.
Still, though, Iām going to mount those buggers as far appart as I can on my bot.
Ahhā¦
That comparator stage looks like a nice way to save an interupt input.
Iām a bit confused about that, though.
How are you going to have your micro tell the difference between a high and a low if the inputs of the comparator stage will be varying analog levels?
Wonāt the signal coming out of the comparator be of a varying level as well, susceptible to dishing out a voltage at a level that your micro will have trouble deciding is high or low?
From looking at it, Iām assuming that the input pins will interupt on change, as it looks like youād need that, rather than them interupting on just high or low, as I had previously assumed they did.
Is that actually how they work?
Oh⦠and it looks like youāre sharing your programming pins with the audio āloudnessā inputs.
I had been told that this was a no-no for beginners like me.
How are you keeping them from messing with each other?
Are you just planning to be real quiet when programing, or is there something going on here that I donāt understand?
(Probably the latter. )
Hi Nick,
Multitasking is really a SW problem, not HW. Almost any CPU can do it, but it might be horribly inefficient on a smallish PIC.
However, multi- processing might be what you mean - it requires more than one CPU actually running at the same time.
You guys are right: A 2-mic solution does not differentiate between front and rear. Animals work it out with subtle clues such as echoes, and head movement.
Yes. But the mics and other things are imperfect, so I would expect some āslopā, which means putting the mics further apart is always a good idea.
Re: The comparators: They output essentially a ādigitalā signal - either all high or all low. The resistor divider driving one of the inputs sets the level at which the comparator will change its output from H-L or L-H. So, the output of the two comparators only indicates āa sound was detectedā. The 16F88 PIC has only one input that will do edge-sensitive interrupts; so instead I use two of the PORTB pins, and go for an āinterrupt-on-changeā.
Those two pins are indeed shared with the programming pins. This means that to burn new code, I have to remove the LM339 from its socket. In theory, it will also work to just ensure that the comparator outputs stay āhighā during the programming.
Pete
Doh!
Now I see where I went wrong.
Looky here, Mikey.
If yeh wanna learn yer smarts like I beā¦
Just ask logically-garbled questions and then hope that a kind soul like Pete will come allong, magically decode your pagefull of questions, and put things into really small words.
Thanks, Pete!
Methinks Iāll stick around with Mikeās design (with the altered components for a better range, of course) and give it a try, since he was so nice as to send me a board.
Once I get to the point where Iāve found the limitations of the āloudnessā hardware, Iāll rearrange things and make one like yours.
Theyāre both just too interesting to pass up, and definitely within my pricerange.
Who knows, maybe Iāll trip over a better way to use the āloudnessā comparison and get some decent info out of that.
Maybe theirin lies a way to guess the forewards/backwards direction of the soundā¦