# Need Help! LM386 with Automatic gain from 20 to 200

#### Ron H

Joined Apr 14, 2005
7,014
Do you have signal at the output of the op amp?
What pin are you monitoring on the HT9170?

#### Ron H

Joined Apr 14, 2005
7,014
It appears that you have swapped pins 4 and 5.

You need to add a 0.1uF cap between pins 2 and 5, after you get the wiring corrected.

I'm assuming that you are mounting the op amp upside down, also known as "dead bug".

Last edited:

#### Ron H

Joined Apr 14, 2005
7,014
Why did you post an inaccurate drawing for us to critique? Did you forget that you had made the error on the drawing?

Is the op amp mounted upside down, so that the orientation dimple is hidden?

You need to test the amplifier by applying a signal generator in place of the microphone.

Last edited:

#### WBahn

Joined Mar 31, 2012
26,398
Have you studied the data sheet for the HT9170?

#### Ramussons

Joined May 3, 2013
1,068
The terminals of the input opamp is clearly indicated. You can set the gain by selecting the feedback / input resistor combination.

Ramesh

#### Ron H

Joined Apr 14, 2005
7,014
Either the gain is set at gain of 10+1=11 or a gain of 10-1=-9
for the circuit in post 1 of the HT9170 circuit.Is this correct.if not

Gain = R1/R2+1
Gain = -(Rf/Rs)=-(10k/1k)=-10.
See the links in post #5.

EDIT: corrected equation

Last edited:

#### rogs

Joined Aug 28, 2009
279
This HT9170 circuit. Can you tell me what is the gain set at.
And what resistor do i change to set the gain lower or
higher.Is it the 10Kohm connect to the 100kohm.
pins 2&3. How do i calculate for a gain of 1 to 20.

Gain is set to 10 (inverting mode).
To increase gain to 20 (actually 22) change 100K to 220K

To set gain to 1 change 100K to 10K.

Do not confuse yourself with the non inverting mode calculations you seem to be writing about.

#### Ron H

Joined Apr 14, 2005
7,014
Question 11 in this link that you provided. In post #5 of my tread.

States voltage gain for feedback divider for non-inverting op-amp.

Is Av=R2/R1+1

But in the circuit i posted in post #1 the only two resistor are
the 10k thats connected to pin2 and the 100k that connected
to pins 2&3. Do these set the gain for the HT9170 decoder IC.

yes or no if no then how do i set the gain for this part.
Sorry, I screwed up in post #8. I have corrected it. It now shows the correct equation for the inverting amp, which is what you have in your schematic.

#### Ron H

Joined Apr 14, 2005
7,014
inverting amp input is on the HT9170.

Ok! You are right.About the amp But? the audio amp.That was posted
in the original tread that closed.I just left that audio amp part out in post one of this tread.So not to be confuse on the two circuits.

I Enclosed the two Circuits together.Which i got the audio part to work correctly.Since i posted in the original thread that closed.

Im trying to understand all this.Circuit by circuit.Its confusing since
The input amp has a gain of (1+R2/R1), so, with R2 being variable from 0 to 20k, and R1=1k, the gain of that stage can be varied from 1 to 21. Multiply that by the gain of 10 in the HT9170, and your overall gain can be varied from 10 to 210.

#### Ron H

Joined Apr 14, 2005
7,014
I like to know what can i do to prevent the LED from coming on
when i power up the circuit.I only want pin 15 to come on when
there is only a valid tone.Not when i power up the circuit.

Any idea. Eclosed circuit.
How long does the LED stay on when you power up the circuit? Maybe we can design a fix for you.

Also what resistor values can i use for leds on pins 11-14. Im using 330ohms on pin15 will
the same value work or should i use a higher value say 1K.
You can use the same resistors for all LEDs. See the table at the top of p.5 in the datasheet. The values for source and sink current are pretty low.

#### DerStrom8

Joined Feb 20, 2011
2,390
Just wanted to mention, if your thread is "closed" (not locked) due to inactivity, you can still post to it. You just have to click the little checkbox saying you understand it's old and want to post anyway, down at the bottom before actually posting.

EDIT: I just did this for you, your thread should be back. I'm wondering if the two threads should be merged, since they are regarding the same topic? http://forum.allaboutcircuits.com/showthread.php?t=76609&page=7

Regards,
Matt

#### DerStrom8

Joined Feb 20, 2011
2,390
Just resurrecting this for you, Etronic. Perhaps the moderators can merge them now?

Regards,
Matt

#### bertus

Joined Apr 5, 2008
21,560
Hello,

The other thread was never closed.
It only gave a warning for "old age".
You could still have answered by ticking the warning of "old age".

The thread can be merged, if wanted.
The posts will appear in timeline order.

Bertus

#### Etronic

Joined Oct 7, 2011
127
Just resurrecting this for you, Etronic. Perhaps the moderators can merge them now?

Regards,
Matt

Thank! For getting this back for me.

I ask Bertus to merge these two thread to become as one.

#### rogs

Joined Aug 28, 2009
279
I like to know what can i do to prevent the LED from coming on when i power up the circuit..
The MT8870 - or indeed any of it's 'clones', like the HT9170 - does not have a guaranteed 'power on' reset state integral to the chip.
Without either 'firing' a valid DTMF code into the analogue input, or adding extra power on reset logic, you cannot guarantee the state of any of the output pins on 'power up'.
You could disable the outputs by holding pin 10 'low', until a valid input code had been received, for example.

You'll need to explain what you need the device to do, in its initial 'power up' state?....

Edit: a similar query came up a couple of years ago on this forum.

Thee's a sketch attached to this post that may help:

Last edited:

#### Ron H

Joined Apr 14, 2005
7,014
Here is a circuit that should keep the LEDs off for about 1 second after power up.

#### Attachments

• 34.8 KB Views: 20
Last edited:

#### bertus

Joined Apr 5, 2008
21,560
Hello,

@RonH,
The post numbering has changed during the merge process.
When referring back to a post number, the numbers of the second thread started by Etronic will be different.

Bertus

#### rogs

Joined Aug 28, 2009
279
Here is a circuit that should keep the LEDs off for about 1 second after power up.
The resistors connected to pins 11 thru 15 may well be 300Ω ( 330Ω is a more common value) - although trying to source something like 3mA from the output of an 8870 (or 9170) is pushing it a bit. (about 3 times the specified source current!)

The resistor connected to pin 16 will need to be more like 330KΩ. ( any value between 100KΩ and 470KΩ should work OK)

As Ron points out, this mod will ensure the LED connected to pin 15 will not 'pulse' on once during power up. (It will only come on thereafter when actually receiving a valid DTMF code pair).
The LEDs connected to pins 11 to 14 will power up in an unknown latched on or off condition without a 'power on reset' of the type described in my post linked to above.
The mod Ron describes will only keep them off for a second or so after initial power up.. They may well come on after that. You simply can't tell.

Last edited:

#### Ron H

Joined Apr 14, 2005
7,014
The resistors connected to pins 11 thru 15 may well be 300Ω ( 330Ω is a more common value) - although trying to source something like 3mA from the output of an 8870 (or 9170) is pushing it a bit. (about 3 times the specified source current!)
I had pointed out the wimpy drive capability in post #84.

The resistor connected to pin 16 will need to be more like 330KΩ. ( any value between 100KΩ and 470KΩ should work OK)
Etronic originally had a 300k there, but I thought it was attached to the resistor in series with the LED on pin 15, so I changed it to 300. My bad. I have edited the schematic I posted to restore it to 300k.

As Ron points out, this mod will ensure the LED connected to pin 15 will not 'pulse' on once during power up. (It will only come on thereafter when actually receiving a valid DTMF code pair).
The LEDs connected to pins 11 to 14 will power up in an unknown latched on or off condition without a 'power on reset' of the type described in my post linked to above.
The mod Ron describes will only keep them off for a second or so after initial power up.. They may well come on after that. You simply can't tell.
Thanks for the clarification, rogs. I sorta figured that was the case.