Adjusting a MIC input to AD

Go To Last Post
12 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Guyzz

I have a little project M168 based, where i have to switch off some equipment at a certain soundpressure (ADC0 10-bit).

I use this MIC board http://www.sparkfun.com/products... (VCC/2 output idle).
Schem: http://www.sparkfun.com/datashee...

And basically it works fine (after i put 2200uF after the 10uH on the AVCC , as it was jumping a lot in idle).

The trig level has to be "easy" adjustable , and i was thinking about putting a 10K pot on VCC-ADC1-GND , and just read that at startup.

I have a little challenge ... The MIC level on the ADC0 is hitting Max (0 or 1023) , at a to low soundpressure. And i would like to be able to adjust the inputlevel to the ADC0. But i'd like to do it with a POT "10K or ??" , between the MICboard and ADC0 , not by changing the Micboard.

How should i connect that pot ?

MIC-ADC-GND or just MIC-ADC-"NC" or ... "And now to something completely different" :-)

Any hints appreciated

Ps: regulators has to be a Pot , there is just 2 leds and no buttons on the board.

/Bingo

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Well, i'd say first you'd need to rectify your microphone signal (watch out for the diode forward voltage, use something like a BAT41/42/43). Then you need to somewhat smoothen (integrate) your input samples to make sure that transient spikes won't give false triggers. This could be done in software by just collecting several samples and averaging over them.

For the Pot, you want to build a voltage divider, which always requires the MIC-ADC-GND witring.

Did you think of using a digital POT like i.e. the X9C103? Then the whole thing could be set up to do self-calibration: you just apply exactly the sound pressure you want the circuit to trigger at, press a button, and the AVR will trim the digital Pot exactly to the point where the ADC resolution is still at maximum, while at the same time storing the ADC reading where the triggering should occur.

Einstein was right: "Two things are unlimited: the universe and the human stupidity. But i'm not quite sure about the former..."

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

DO1THL wrote:
Well, i'd say first you'd need to rectify your microphone signal (watch out for the diode forward voltage, use something like a BAT41/42/43). Then you need to somewhat smoothen (integrate) your input samples to make sure that transient spikes won't give false triggers. This could be done in software by just collecting several samples and averaging over them.

For the Pot, you want to build a voltage divider, which always requires the MIC-ADC-GND witring.

Did you think of using a digital POT like i.e. the X9C103? Then the whole thing could be set up to do self-calibration: you just apply exactly the sound pressure you want the circuit to trigger at, press a button, and the AVR will trim the digital Pot exactly to the point where the ADC resolution is still at maximum, while at the same time storing the ADC reading where the triggering should occur.

Thank you for the input.

I do the "Rectifying" in SW (centers around adc-val 511), Averaging "8-point moving average" is done in sw (Thnx Lee).

I think "Soundpressure" triggering could be done with the comparator AIN , but i needed some A/D experience in the above 2 diciplines :-)

Thanx for the hint about a digital pot , i'll consider.
But this has to be cheap and easy to assemble.

I'll implement the MIC voltage divider as MIC-ADC-GND.

/Bingo

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Quote:
I do the "Rectifying" in SW (centers around adc-val 511)

Ok, but you only center around ADCsteps/2 if the input will fully swing from GND to VCC. As soon as you introduce a voltage divider, not only the absolute amplitude, but also your midpoint (DC offset of an idle input) shifts downwards. All this assumes that you use VCC as the ADC reference.

What about scaling the ADC by a Pot between the allowed minimum ov 2V and Vcc? That's at least a range of 1:2.5 for setting the trigger point.

Einstein was right: "Two things are unlimited: the universe and the human stupidity. But i'm not quite sure about the former..."

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

If you full wave rectify and average the mic output using an 'ideal diode' opamp in front of the a/d, you dont need to worry so much about sampling fast enough to catch hi freq peaks, which also contribute to the full range spl.

Imagecraft compiler user

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

DO1THL wrote:
Quote:
I do the "Rectifying" in SW (centers around adc-val 511)

Ok, but you only center around ADCsteps/2 if the input will fully swing from GND to VCC. As soon as you introduce a voltage divider, not only the absolute amplitude, but also your midpoint (DC offset of an idle input) shifts downwards. All this assumes that you use VCC as the ADC reference.

What about scaling the ADC by a Pot between the allowed minimum ov 2V and Vcc? That's at least a range of 1:2.5 for setting the trigger point.

Hmm ... You are right here :oops:
Thanx for catching that "Early".

I could read the AD at startup , to find the IDLE/Center.
And use that value as "Rectifying Center".

Else the diode seems to be the easiest way to get around that.

And yes , i use AVCC (5v) as ref.

@Bob
Seems to advanced for this.
If i end up there i'll prefer to use AIN to catch the peaks.

/Bingo

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Why not simply doing a halfwave rectify, pass the signal thru a simple RC circuit, and then use a Pot whose mid-point is connected to a normal digital input port? you'd then just adjust the Pot such that the digital input will _just_ switch from reading a 0 to reading a 1.

This would avoid all the A/D hassle at all...

Einstein was right: "Two things are unlimited: the universe and the human stupidity. But i'm not quite sure about the former..."

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

He..He

Not nearly as much fun :-)

But if i'd be doing that , why shouldn't i Rectify , and use AIN0 & AIN1 with a Pot on one of them for reference.

/Bingo

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Well, I like the rectify the signal, with an ideal diode (op-amp) circuit, set the gain with a pot, and then read it. but I understand that that is not the approach you wish to take at the moment.

The SFE mic breakout board has an op amp on it, perhaps a little micro-surgery could add the needed diode to the board, but I understand your desire not to mess wth that board.

As already pointed out, if you just put the pot on the output of the mic board, then adjusting it also adjusts the "midpoint", which is now: 0 - (V+/2) range.

Just adding a diode to the output is a poor option. It would rectify the peaks, but not the lower amplitude portions of the signal. Perhaps not a problem in this application???

Another approach would be to add a Pot AND another DC Blocking Cap and its resistors. The mic board has a 4.7 uF cap to block the DC and center the signal at V+/2. You could add another cap and two resistors after the pot.

Mic board output to Pot high end. Pot low end to Gnd. Pot wiper to cap. Other end of cap to ADC input. ADC input also has 10K resistor to V+ and another 10K resistor to Gnd, which centers the DC at V+/2.

The pot now attenuates the signal, the cap blocks the DC from the mic board. The resistor divider resets the DC to midpoint.

You can actually determine the Cap and R values as they form a high pass filter. (Note that for the calculations the two resistors are in parallel). Or just try it with another 4.7 uF or 10 uF cap. Note that this cap should be a non-plolarized version.

JC

Edit: Schematic added.

Attachment(s): 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Bingo,

Do as DocCj suggested but rearange components as follows:
take the earth side of the pot to the midpoint of the divider ( the two 10K fixed resistors)
remove the capacitor from the wiper of the pot ang connect it to ground.
Take the signal to your ADC from the wiper of the pot.
This way You can use any old electrolytic cap.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

@Doc

Thanx for the nice explanation , and for the ideas.

Now it begins to be interesting to insert a 10K pot in series with R4 on the SFE schematic , thus making that a 10..20K resistor. And as i understand i can regulate the gain from 50 to 100 times , with such a mod. I want this to be low component , and an easy mod.
And it's 0603 comps , where i hopefully should be able to solder some PTFE wires on the pads.

Dammm , and i thought it would be an easy mod :-)

/Bingo

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

@Ignoramus

Thanx for that hint , i only have 100 & 200 nF non polarized caps , but quite a few 10uF Electrolytics.

But the R4 mod still seems more & more attractive.

Edit: Unless there are pittfals in that also.

/Bingo