Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

beginners. some help with sound sensor (lm386+microcontollers)

Status
Not open for further replies.
The jumper must be in place for the LM386 to have enough gain.
in my town I can buy in market only electret mic xf-18d (china), may be it "bad" ?
I setup max gain for lm386
The output of the circuit is an AC signal. Its negative swings are limited by the input protection diode of the ADC input. But the max positive swing is only about +1.5V since the supply voltage of the LM386 is only 5V.
The input of the LM386 could be biased so that its output pin5 swings from +1V with no signal to a max of +4V at a loud signal.
Great! thks!
I must use some resistor to +5v ?

I don't understand why in circuit from my post exists C3 and
**broken link removed**
https://randomskk.net/projects/lightstrip/schematic.pdf
don't use similar capacitor ?
 
Last edited:
again, it depends on how you program the mcu.

if you want the adc to see 0v when no sound, and some voltage with sound, you need ac couple the lm386 to the mcu. thus you need C3.

if you want the adc to see 1/2 vcc when no sound, and more or less than that with sound, you need to DC couple the lm386 to the mcu. thus you do NOT need C3.

it is up to you to decide which approach to take and program the mcu accordingly.
 
But he would be feeding a negative voltage into the ADC, is that a good idea?.

no... I find circuit from my post on web and made it. but after made, appear quiestion how its work on "physics level".
this forum is great, and i post my topic.

i simple want to get indication of sound present in my mcu unit
i don't want 100% accuracy in measure
 
But he would be feeding a negative voltage into the ADC, is that a good idea?.

in general, no. But that doesn't mean it is fatal.

PICs, for example, can take -0.3vdc on its gpio pins safely; so do the chips using the ARM core.

Having that 1k resistor and a smallish capacitor (0.1u) also helps limit the damage.

and negative voltages on adc will just show up as zero on the pic.

if you are really concerned about it, you can rectify the output with a 1n4148.
 
i simple want to get indication of sound present in my mcu unit
i don't want 100% accuracy in measure

if you want to detect sound and don't care about its levels, you can simply a transistor to do that, and tie the output to digital input on the mcu - much simpler.
 
if you want to detect sound and don't care about its levels, you can simply a transistor to do that, and tie the output to digital input on the mcu - much simpler.

i tried use lm386 with analog comparator, but when power is decreased (batarry discharged) circuit don't work properly
i want adjustable sound level by mcu's adc
 
Last edited:
a simple transistor can easily amplify a signal from an electret mic 200x - the max you can reach with a lm386, and can work down to a couple volts, way after your mcu has stop'd working.
 
another route to take is to use a lm317L as the amplifier. Put the electret mic between the output and adj pins of lm317L and ground its adj pin through a resistor (100k). adjusting the resistor to get desired gain. Only three parts and are extreme ripple proof.
 
another route to take is to use a lm317L as the amplifier. Put the electret mic between the output and adj pins of lm317L and ground its adj pin through a resistor (100k). adjusting the resistor to get desired gain. Only three parts and are extreme ripple proof.

ok, thks
I tried remove capacitor from originally post circuit, its worked
but another advice need
I _must_ place mic on board for minimum length of wires or I can use mic with wires and which length of wires from board to mic can be acceptable ?
 
You can connect the microphone with shielded audio cable.
it has two pins. One pin is connected to its metal case and it should connect the the cable's shield.
 
You can connect the microphone with shielded audio cable.
it has two pins. One pin is connected to its metal case and it should connect the the cable's shield.

thks!
5cm audio cable from cd-rom to soundIN will be acceptable for noise level ?
and can i place two lm386 on _one_ board - for 2-channel sound sensor ?
 
Last edited:
5cm audio cable from cd-rom to soundIN will be acceptable for noise level ?
Before you used a microphone with a very low output level and a fairly high impedance. then the peramp needs a gain of 200.
Now you have a CD-ROM? It has a high output level that will severely overload the mic preamp. It needs an attenuator or it might not even need any amplification.
 
Before you used a microphone with a very low output level and a fairly high impedance. then the peramp needs a gain of 200.
Now you have a CD-ROM? It has a high output level that will severely overload the mic preamp. It needs an attenuator or it might not even need any amplification.

no. i want use microphone, i ask about only audio-cable which shipped with cdrom
ps sorry for poor english :(
 
Any shielded audio cable will work fine.

again very thks!
on
https://www.electro-tech-online.com/threads/lm386-mic-amp-to-led-output.34241/
You post schematic opamp lm386 (in last post).

Does your schematic better in filters (low & high) design than circuit from my post ?
I think i must use you sample for my purpose of detect human voice , or i can use circuit from my post ?
---
You circuit for level detection - good for peak detect,
and circuit from my post for gain - and i must independently calc peak/level or DSP processing.

rightly ?
 
Last edited:
on
https://www.electro-tech-online.com/threads/lm386-mic-amp-to-led-output.34241/
You post schematic opamp lm386 (in last post).

Does your schematic better in filters (low & high) design than circuit from my post ?
I think I must use you sample for my purpose of detect human voice , or i can use circuit from my post ?
The LM386 is a power amplifier, not an opamp.
It does not have filters, it has coupling capacitors that reduce very low frequencies and the LM386 with a gain of 200 has a high frequency response of -3dB at about 50kHz.
your circuit cuts frequencies below 178Hz and above 1.6kHz.
Human voice has frequencies from about 80Hz to about 14kHz.
Your circuit for level detection - good for peak detect,
and circuit from my post for gain - and i must independently calc peak/level or DSP processing.
The circuits are almost the same except mine has a peak detector diode.
Your circuit is missing the important 10 ohm resistor in series with a 0.05uF capacitor from its output to ground.
 
again thks for help !
The LM386 is a power amplifier, not an opamp.
It does not have filters, it has coupling capacitors that reduce very low frequencies and the LM386 with a gain of 200 has a high frequency response of -3dB at about 50kHz.
your circuit cuts frequencies below 178Hz and above 1.6kHz.
Human voice has frequencies from about 80Hz to about 14kHz.

in "my" circuit r4/c5 - its low pass filter for 1.6khz ?
can I safety change values for other bandwidth ? for sample, if i change r4 to 100R - I have low pass filter with freq 16khz?

and which components for high pass filter: r1/c1 - but it give ~700hz ?
or r1/c1/r2 ? or c1/r2 ?

if c1/r2 - i must use instead 10k - 20k for lower freq 80hz ? but what purpose r1 in this case ?


Your circuit is missing the important 10 ohm resistor in series with a 0.05uF capacitor from its output to ground.
yes , i see this in various samples of use lm386 :(

can I change 0.05uF (0.047) to 0.1uF ? or this value is critical ?
i don't see this component in my local market :(

The circuits are almost the same except mine has a peak detector diode.

"peak diode" == diode + capacitor 1uF - rightly ?
and i can safety bypass it , if i don't want use peak detect ?

in "my" circuit "-" of lm386 connect to GND, and in You post - some components present -which purpose it ? (some R+C on "-" input of lm386")
47kOm/1kOm - voltage divisor for 0.1v
22uF - "total" capacitor for power
100uF/1kOm - power filter
right ?
 
Last edited:
in "my" circuit r4/c5 - its low pass filter for 1.6khz ?
can I safety change values for other bandwidth ? for sample, if i change r4 to 100R - I have low pass filter with freq 16khz?
Yes, R4 and C5 make the lowpass filter. Instead of making more load current by reducing the value of R4, reduce the value of C5 to increase the cutoff frequency.

which components for high pass filter: r1/c1 - but it give ~700hz ?
or r1/c1/r2 ? or c1/r2 ?
The electret mic has an impedance of about 1k ohm in your circuit. It is in parallel with the 2.2k resistor R1 that powers it. They are in series with the parallel combination of the 10k volume control R2 and the 50k input resistor of the LM386. The total resistance is 9k ohms which makes a highpass filter with C1 with a cutoff frequency of 178Hz.

if c1/r2 - i must use instead 10k - 20k for lower freq 80hz ? but what purpose r1 in this case ?
Use 0.22uF (220nF) for C1.
R1 powers the FET transistor inside the electret mic.

can I change 0.05uF (0.047) to 0.1uF ? or this value is critical ?
A 0.1uF capacitor will be fine.

"peak diode" == diode + capacitor 1uF - rightly ?
and i can safety bypass it , if i don't want use peak detect ?
Don't use the diode and capacitor if you don't want them.

in "my" circuit "-" of lm386 connect to GND, and in You post - some components present -which purpose it ? (some R+C on "-" input of lm386")
47kOm/1kOm - voltage divisor for 0.1v
22uF - "total" capacitor for power
100uF/1kOm - power filter
right ?
The DC output of your LM386 is +2.5V and you use a coupling capacitor at the output to provide an AC signal that swings positive 2.2V and negative 2.2V.
I used the 47k and 1k resistors to bias the inverting input of the LM386 so that its output DC voltage is +0.7V then the output DC voltage of the peak detector is 0.1V without a signal.

The 1k resistor and 22uF capacitor in my circuit filter the power for the microphone.
The 100uF capacitor in my circuit is the bypass for the battery so that the LM386 does not oscillate when the internal resistance of the battery rises as it is used.
 
Last edited:
Great job ! very very very thks !!!!

I try modify my circuit from you comment's !
-----
in attachment i paint modified circuit
component values :
ñ1 = 22uF
R1 = 2.2kOm
C2 = 0.22uF
R2 = 1kOm
C3 = 100uF
R3 = 10kOm
R4 = 47k
R5 = 1kOm
C4 = 10uF
C5= 0.1uF
R6 = 10R
R7 = 1kOm
C6 = 0.01uF
C7 = 1uF
R8 = 100kOm

filter below 80hz and under 16khz
with peak detector

this is ok ?


on https://www.electro-tech-online.com/threads/lm386-mic-amp-to-led-output.34241/#post721537
you wrote:
audioguru; said:
The 10k resistor powers the FET transistor inside the electret mic.

If the 10k resistor value is less than about 4.7k then the sensitivity of the mic will be reduced. If it is more than about 22k then loud sounds might be distorted by the mic.

With the 10uF capacitor at pin 1 and pin 8 of the LM386 IC then its gain is 200.
and in my circuit 2.2k, thus sensitivity of the mic will be reduced ?
 

Attachments

  • snd.jpg
    snd.jpg
    37.3 KB · Views: 273
Last edited:
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top