Go Down

Topic: Adc question (Read 695 times) previous topic - next topic


I made a amplifre microphone by lm386
When it connected to 5 volt arduino and read maximum value will be 420 ,if sound be more stronge the adc dont increase . If conected to 3.3 volt ,maximum value adc will be 320
Why adc increase to 1024?


You probably have a DC offset.

Where is your schematic?
Do you have access to an oscilloscope?


I dont have osciliscope

I dont know my amplifire have offset or not
But i change some in circuit
I add 2 potentiometer  in it


Jun 10, 2018, 10:31 am Last Edit: Jun 10, 2018, 10:35 am by Noisecontrol
Just instead c3 0.05 micro farad i use 10 nf
And i use a potentiometer before c2

I am beginer


Jun 10, 2018, 07:56 pm Last Edit: Jun 10, 2018, 08:01 pm by DVDdoug
In general, you can't get the full power supply voltage from an amplifier.   There is some voltage drop across the output transistors.   If you want 0-5V out, the power supply needs to be higher than 5V,     But, you have to be careful because the Arduino can be damaged if you go over 5V or by negative voltages.   

The LM386 datasheet says you can get 4V peak-to-peak with a 5V power supply and a higher-impedance load.*   If you're using the 5V ADC range and the signal is properly biased, that should give you 4/5ths of the ADC range and readings between 102 and 921.   Without the bias you'd be getting about +2V peak  (and -2V negative-peak) for a maximum reading of ~410.

I use an op-amp powered by positive & negative 12V or 15V so I can all the way down to 0V and all the way up to 5V.  Then I add an over-voltage protection circuit so I don't kill the Arduino.

There are "rail-to-rail" op-amps that will give you nearly the full voltage-swing.

The LM386 can "work" but it's designed to drive a speaker.

The input should be biased at 2.5V because the Arduino can't read the negative half of the AC waveform and the Arduino can be damaged by negative voltages.   With the bias, the Arduino should read about 512 with silence. 

The LM386 output is biased at about half the supply voltage but C2 removes/blocks the bias because you don't want DC bias in the speaker.   But with the capacitor you need the speaker or a resistor to keep the output from "floating".     With the Arduino it's BAD to remove the bias because the voltage out of C2 swings negative and the LM386 can supply enough current to fry your Arduino.   

* With a 4 or 8 Ohm speaker you'll get less voltage.


Jun 11, 2018, 04:27 pm Last Edit: Jun 11, 2018, 04:31 pm by Noisecontrol
What is your idea about this?

How can i baias to get adc 102-921?


Jun 11, 2018, 05:40 pm Last Edit: Jun 11, 2018, 05:48 pm by DVDdoug
How can i baias to get adc 102-921?
Since the amplifier runs fro a +5V supply (there is no negative power supply voltage) the amplifiers output already is biased.   Connect the Arduino's analog input directly to pin 5 on the amplifier chip.  (Don't go through the capacitor which blocks DC the bias from the speaker).   If you have a multimeter you can check that voltage with no signal.

Or if it's easier for you, you can use two equal-value resistors to make a voltage divider that supplies 2.5V as shown on this page.   (If you do that, first check it without the amplifier connected to confirm you're getting about 2.5V and a reading of about 512.)

Note that 102-921 range is approximate.   Again, with silence you should get readings around 512 (half the 1023 range).  But that probably won't be exact and you can't get "pure silence" from a microphone and amplifier.   

With quiet sounds you should get readings close to 512.  With loud sounds you should get "random looking" readings between about 102 and 921. 

Or if you subtract-out the bias in software, you should get "random" readings between about -410 and +410 with loud sounds.   This is more representative of the "real" sound wave which goes positive and negative.  But, the hardware won't allow you to read the "natural" unbiased waveform.   So we can add bias it for the hardware and then if we want, we can optionally subtract it out in software, depending on what we are doing.

If you are doing FFT you can simply ignore the bin that contains the DC (zero Hz) component.


Why 5 voltage and GND connected to out put by resistore?


Why 5 voltage and GND connected to out put by resistore?
It is not an output but an input. It biases the signal at 2.5V, so you can cope with the negative parts of the waveform.

Go Up