Radioshack Special - Build your own bot ears!

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. :laughing:

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.
:stuck_out_tongue:

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.
:laughing:

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. :laughing:)

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. :laughing:)

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!
:blush:

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.
:unamused:

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.
:smiley:

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…

Heh, Nick,

Sorry, I forgot about sending you the board last weekend, I will have it out this weekend, I promise! :blush:

Sorry!

As for smarts, I think you surpassed this old geezer… :laughing:

JK

You have come a long way since the beginning though. Proves you have really taken the bull by the horn and learned a great deal on your own. Yeeeehaaawww! :laughing:

Although I’ll be playing with Mike’s loudness circuit for a while once I replace my programmer, in the meantime I’ve been putting together a circuit for my biped’s car that uses both loudness and speed as Pete did.
I’ve decided to go ahead and make it with 3 mics though, so the bot will know which direction (forewards/backwards) the sound is coming from as well.

I’ve finally come to the point where I’ve run out of ADC pins, though (and my micro has 13!).
So instead of keeping them seperate as in Mike’s circuit, I’m going to combine the three with another opamp.

In your circuit, Pete, it looks like you use 110k resistors before the 3rd opamp to divide each seperate voltage in half before smushing the two together.
So, methinks I’ll just take the output of my 3 opamps and use a 200k’s and a 100k to divide each into thirds before smushing all 3 together.

I’m a bit confused as to the gain resistor across your opamps.
Mike’s circuit uses 1M.
Did you split up the gain into two stages by using 300k in the first and 110k in the second?

If so, how do you determine the overall gain of the two stages?
I’m thinking that it’s not simply multaplicative, since that’d give you a 30M total…

well nick, considering you asked me to help out on this on AIM, heres wat i think

you need to make this thing realllllyy power, the rover i mean, so that it can carry and little perron in it, (I.E. me), from there, you have me blindfolded while you recklessy race around you house, if i scream you know you’ve hit something, and also, i would point to the noise when i hear one and from wat direction, if all works out, you shouldn’t need a new me for a day…or two

:laughing:

im jking every one

Nick, perhaps Pete can chime in on the question regarding the gain resistors for the op amp. I know that the resistor acts as a feed back loop. Higher resistance provides less feedback to the neg input of the op amp. This causes the op amp to “think” it needs to amplify more.

Best way to describe it is like our ears are the neg input and when we adjust the volume on the stereo, we “listen” for the loudness. We keep cranking up the volume till we get the desired output level. Now if you put ear muffs on your ears (the resistors) you will not hear the volume as much, so you keep cranking the output so that it’s loud enough for you to hear it through the muffs.

The resistors on the op amp take the output and “trick” the op amp into thinking it needs to crank out more and more.

This is in a nutshell how I understand it. Pete might want to put me in a straight jacket, but that’s my analogy of it. :laughing:

In my circuit, the 3rd amp does a summation of the 2 signals, but it does not amplify the summation (because of the value of the feedback R). It is a simple ‘mixer’.
On your circuit with 3 sources instead of two, you should still use 100K’s all around. The reason is that the R’s for each channel are part of the equation for each other channel.
But if you want to add overall gain to the mixer, just increase the feedback R. The gain of the circuit is about proportional to Rf/Ri, so if the Rf were 200K, the gain is doubled. [This is a simplification, but it’s close enough for now.]

My first stage has a gain of less than 300 (actually 300/1.1). Mike’s circuit is going for a rather high gain (about 1000). My own version hasn’t really been ‘road-tested’ yet, so I could end up changing the Rf values. Mike’s mics are different, as is his A/D.

It is multiplicative across the stages, but the first stage is 300, and the second stage is 1, so overall it’s still 300.

Regarding the need for the feedback resistors:
An op-amp is fundamentally a very high-gain device. Without using negative feedback, it would run ‘full throttle’ all the time - it is called “running open loop”. This may sound like a good thing, but in reality it makes it unstable, and you wouldn’t be able to predict the exact gain for each amp. If you look at U5 on my schematic, those are ‘comparators’, which are essentially a special type of op-amp that is designed to run open-loop. Why? Because a comparator is intended to have its output be either all on or all off (a digital signal). By comparison, the regular op-amps are intended to amplify signals proportionally; that is, they run “linear”.
Mathematically, you could say that the output of an op-amp is y=mx+b (remember that from basic algebra?), where x is the input, m is the gain, b is the DC offset, and y is the output.

Pete

Ahhhh!
I love when things come full circle and finally click together.
:smiley:

I had been multiplying the gain resistor values when I needed to be multiplying the calculated gain of each stage.
That makes so much sense, since gain is reported without any units, the lack of which is produced by division of Rf/Ri.

Good ol’ function of a line, how well I remember thee…
:stuck_out_tongue:

Nick, did you get the board yet?

Yes, it came in today’s mail.
^.^

Thanks, Mike!

I’ll be soldering it together tomorrow, probably.
If all goes well, I’ll be able to test it even before I get a replacement programmer for my robot PICs.
In school, the other students (slowpokes) just finished building their 16F877’s boards (which means that I’ve done that a week ago and have started programming in assembler :laughing:).
So, as soon as I learn enough assembler to multiply (there’s no multiplication built into this chip!) and access the ADC, I’ll be able to test it.

I’m glad it made it to you ok. Take your time with it. I just wanted to make sure you got it ok.

Nick,
Why do you need a replacement programmer? Did yours break?

Pete

(Sigh)
Ya gotta luv archives. Here I was, contemplating just how to add audio direction-finding without re-inventing the wheel (again), when a site search reveals this.
Exactly what I had in mind. Complete. Whole.

Just thought you should know that old posts never die… and are appreciated by the cogniscenti.

Greetings kdwyer, this circuit is old, and although it works, its performance fell a little short. I have a new circuit design that eliminates the use of the ADC chip and performs much better. You can build two copies of the new design for left and right ears and write code to do fancy things like finding angles. I will try to remember to post the updated schematic tonight if you’re interested.

Sure, an updated version would be great, especially since I don’t have all the components yet!

Ok, Ill upload a PDF tonight. This circuit has good sensitivity.

I forgot, I try to remember tonight! :blush:

Now I’m interested too… And a few days have gone by. Slacker!

if all you are doing is trying to measure the difference between left and right, could you not have used the two mics more like a comparator? one to the inverting input, one to the non? I guess the issue would then be measuring the output. You don’t want infinite gain, because that would tell you left and right, but not by how much. And if you want to measure the output, you almost need a +5v and -5v with 741 chips, but that can’t be read easily by the atom. Anywho, didn’t see the original posts so I’m not sure what you tried, but I’ve always been interested in op-amps. My first robot was a line follower using 4 op-amp comparators.