Need Help! LM386 with Automatic gain from 20 to 200

Thread Starter

Etronic

Joined Oct 7, 2011
127
When you press key#1 again, does the DV led light up, even if the key#1 led doesn't?.....
Yes! Sometimes that will happen.I also put a new LED for LED #1 to make
sure the LED works.



If not, then the decoder is not seeing a valid code pair... or at least not for long enough continuously to update the latch.
This also happens radomly.

If the microphone preamp is 'clipping' (because the input signal level is too high) then that may be seen as an invalid state.
How do i stop the amp from clipping if that is one of the problems.
How do i keep the signal level going to high.If thats preventable.




[QUOTEWhen you press a new key that does not update the latch as you expect, I assume the existing 'state' is maintained? .... ][/QUOTE]

Thats correct! Help!:eek: What should i do?
 

Ron H

Joined Apr 14, 2005
7,014

How do i stop the amp from clipping if that is one of the problems.
Turn down the gain using the pot. You were originally thinking you needed AGC. If your signal source is not fixed relative to the mic, or is not nearly constant amplitude, you might need AGC.
 

rogs

Joined Aug 28, 2009
279
As Ron suggests, reduce the gain. The HT9170 will accept signals with a 30dB amplitude range as valid, so you probably shouldn't need AGC, if you've selected a useful gain range. Indeed , if an AGC circuit 'hunts down', it may pick up more room noise, which can cause problems.

You might be surprised just how little signal the device will accept as valid.

What it won't accept as valid are signals that are too large in amplitude, and which clip the analogue input before it is processed within the decoder.

One further thing that may be casuing a problem. The decoder is looking for a 'valid' tone pair. Not only will that need to be within the amplitude range described above, but it will need to be free from any other spurious noise introduced into the signal path. If the room acoustic is noisy, the device will not be able to 'hear' the tone pair accurately, and can reject the tone pair as invalid.

So to start with, reduce the gain,and make sure the 'room' is quiet!
 

Thread Starter

Etronic

Joined Oct 7, 2011
127
[QUOTESo to start with, reduce the gain,and make sure the 'room' is quiet! ][/QUOTE]

This is really strange i got the circuit working at 2.5ft with the volume at its highest level away from my computer.Then it stop outputing some of the tone as i pushed any key on the online dmtf generator.And the gain on the audio amp was a gain of 20,and a gain of 10 on the decoder.In my
first in this thread that i want to be 10ft away.How could i do this with out an AGC in the circuit.

So Now I.
Reduced the audio's gain.The resistance on the Pot is now 14K instead of the 19K i had. I also put in another new LED on the DV pin.

I also changed the steering resistor from 300K to 100K as rogs suggested.
This change didn't make to much of a difference.So put back the 300K resistor back in.

And the room is very quiet!

What else could i do?
 

rogs

Joined Aug 28, 2009
279
The next step is to confirm whether the unreliabiblity problem is with your 'online generated' DTMF source, or the microphone audio path.

Disconnect the audio amplifier, and connect your DTMF source output directly to the 1uf capacitor point that was the audio amplifier output point. Reduce the signal gain if necessary, and confirm that the system works reliably.
If it does, the problem is in the audio path. If not, then the problem is with the DTMF source generator.....
 

Thread Starter

Etronic

Joined Oct 7, 2011
127
Disconnect the audio amplifier, and connect your DTMF source output directly to the 1uf capacitor point that was the audio amplifier output point. Reduce the signal gain if necessary, and confirm that the system works reliably.
If it does, the problem is in the audio path. If not, then the problem is with the DTMF source generator
I've disconnected the audio amp from the circuit.And i connected the dtmf source generators output directly to the input of the decoder and the decoders output tones worked perfectly.
Each time a key is press the DV pin lights up and the decoders tone LEDs light up for each key that was pressed. Now we know its not the decoder.

I also tested the audio amps output for a signal.Thats good too.

So! further testing.
I connected the two circuits back up.And adjusted the gain on the audio amp from a gain of 9 to a gain of 20.What i found was the distance from
the dtmf source generator to the computer vs gain makes a big difference
in whether you get a signal for the audio amp to amplify that signal for the decoder to process it and for the DV to light up and to output a tone from the decoder.
Also the microphone has alot to do with picking up the signal before its
amplified.

First i set the audio gain to 9 then moved the mic at different distances
so at 1'' away form the computer i get perfect output tones.All LEDs
lit up when each key that was pressed.At 2'' only some lit up. Like keys 9,8,A,B,C,0.. Any thing pass the 2'' distance none of the LEDs lit up.
Then i increased the gain as i got farther away from the computer.
vs the distance from the microphone and found that at a gain of 12 to
20 i got a max distance of 6'' and all outputs tones worked perfectly.
Anything beyond the 6'' at a gain of 20...No lights will light up and no output tones on the decoder.

So i'm thinking i will need a much better low noise higher gain microphone for longer distances.Increase audio gain on amp But? could increase the noise factor of the amp.And also maybe increasing the gain on the decoder. Or a AGC low noise low current audio amp with high bandwith.

If this is the problem and increase the distance to 10ft. Any thoughts on this.
 

rogs

Joined Aug 28, 2009
279
It would be useful to hear a recording of the output of your mic and audio amplifier.. preferably a recording of your DTMF generator.
Then at least we might get an idea whether the problem is with noise, distortion or extraneous noise pick up.
You can find a short sample of the sort of thing you should be hearing here:
www.jp137.com/las/DTMF.mp3

(I would upload as an attachment, but for some reason I can't seem to upload an mp3 as an attachment????:confused: .. and it's only a small file! (about 150K)...

Anyway, this is a recording of DTMF from the 'handsfree' speaker output of my study phone, made at a distance of just over 10 feet.
It is using a cheap WM61A Panasonic electret mic capsule, and is recorded into my portable Olympus audio recorder. That recording should decode accurately.
If your audio amp sounds like that, I can't see why you have problems decoding accurately....even at a distance of 10 feet......
 

rogs

Joined Aug 28, 2009
279
I don't have a portable Olympus audio recorder to record too.
those recoders have filtering and dps in them to help the sound
come in clearer.I think thats way you recorded that dtmf tone sound
over ten feet.
No -- no filters or 'DSP' added to the recording. Just the internal mic preamp in the recorder, and the cheap electret mic capsule I mentioned. Recorded as linear PCM, to show a 'typical' audio ampifier response in a reasonably quiet room at 10 feet.

I have no idea what op-amp you are using? There is no reference number on your schematic.

There is no 'magic' about what I recorded. If you use a reasonable quality electret capsule (like the Panasonic WM61A I used --very cheap) and a reasonable audio preamplifier, you will get similar results.
You have to understand that analogue audio electronics is not the 'yes' and 'no' world of digital electronics. You still have to experiment to get the best results.
Without an oscilloscope -- or, at the very least, the ability to 'listen' to the output of your amplifier, you will have no idea where the reason for your false decoding lies....
A good way is to record the output........
 

rogs

Joined Aug 28, 2009
279
Where did you get yours.WM61A Panasonic electret mic capsule.
It looks like digikey don't stock them anymore.

Maybe i got a defected Mic.And its working but not correctly if that makes
any sense.
I'm in the UK, so I got mine from here:

http://www.felmicamps.co.uk/products/felconnectorsand.html


so that doesn't help you much I'm afraid...

I believe the WM61A is going obselete, so although it's simple enough to find them on ebay, you can't be sure they're not fakes... especially if the price starts to rise because of rarity.

It was just a suggestion.... most cheap electrets should be able to produce similar results.

As I say, you need to listen (and/or record) the output from your audio amp to get a real idea of what's happening. It doesn't have to be DTMF at this stage... even speech or music will do.....just plug the output from your audio amplifier into the 'line in' on your computer sound card (not 'mic in'), and record onto that....
 

Thread Starter

Etronic

Joined Oct 7, 2011
127
As I say, you need to listen (and/or record) the output from your audio amp to get a real idea of what's happening. It doesn't have to be DTMF at this stage... even speech or music will do.....just plug the output from your audio amplifier into the 'line in' on your computer sound card (not 'mic in'), and record onto that....

What will this tell me about the amp. Say for instants the music i record.
If it sound OK...What will that tell me.

Also? What audio amp circuit did you use.To pick up the sound with.
Do you have a schematic for the amp.

Did you look at my amp.Is there anything out of the norm that i need to change.Or what needs to be added or removed to fix it.if you think that is the problem.
 

rogs

Joined Aug 28, 2009
279
What will this tell me about the amp. Say for instants the music i record.
If it sound OK...What will that tell me.

Also? What audio amp circuit did you use.To pick up the sound with.
Do you have a schematic for the amp.

Did you look at my amp.Is there anything out of the norm that i need to change.Or what needs to be added or removed to fix it.if you think that is the problem.

What it will tell you about your amp is whether there is any noise or hum being picked up via the supply rails, and distorting the output.

I haven't used an amplifer in a non inverting mode that you have chosen. I tend to use the inverting mode for this type of unit. Your circuit has a very high input impedance (not really necessary for an an electret mic) and the half rail supply to the non inverting input is not decoupled. Neither is the DC feed to the microphone.

It may work OK......listening to an actual recording would tell you a lot more. If there is any hum or distortion you will hear it.

I didn't use any amplifier other than the mic preamp within my Olympus recorder. I just connected the electret mic to the recorder.

If you connect the output of your sound card and replay my recording directly to the input of your decoder, and it decodes OK then you know that it can be made to work at a distance of 10 feet.. because that's how far away that recording was made.

I've attached a quick sketch of how I would have started out my experiments for a project like this. Not saying it will work OK first time, but it should keep out any hum or noise that might be introduced into the input via the DC supply.
It's just a suggestion. I've not built it.
As I say, you can tell a lot more about audio amplifiers by listening to them, rather than relying on the circuit diagram as just being 'right'.
As I said before, analogue audio is not like digital electronics... it's not just 'on/off ' or '1 or 0'. There are lots of 'shades of grey' in between, and they need to be tried out with practical circuits.....
 

Attachments

Thread Starter

Etronic

Joined Oct 7, 2011
127
If you connect the output of your sound card and replay my recording directly to the input of your decoder, and it decodes OK then you know that it can be made to work at a distance of 10 feet.. because that's how far away that recording was made.
I took a mono plug with wire on other end.Pluged THE PLUG into the output of ear phone on my computer. AND took the wire side and connected that to the 1uF cap thats connected to my decoder on pin 2.And then replay back your DTMF recording.The DV LED did not lightup nor did any of the output LEDs light up. So It didn't work.

I then played the DTMF app that i used online.Each key that i pressed
the DV LED lit up and the LEDs corresponded to that key lit up. So i know the decoder is working alright.

For some reason your DTMF recording that was recorded at 10ft,Just didn't work. I'm :confused:

NEXT! I'm GOING to add the parts to my audio circuit to what you
have in your schematic and see what happens when connected to the decoder.
Should i use the LVM796 audio amp with the parts added in your schematic.
With an inverting set up. THIS might not work.
>Look at all Audio gurus POSTS ABOUT USING AN INVERTING SET-UP IN THIS THREAD.
with this audio amp.This is way i chose this part for the high impedance.In a non-inverting set up.

I just don't want to go backwards and have to start all over again with a different audio amp.

Also what are these values that i circled in RED In your schematic.Are they, 2.2k, 2.2k,10uF,1uF,and .1uF
 

Attachments

Last edited:

rogs

Joined Aug 28, 2009
279
Yes - those are the values in the red circled items.

I have chosen the input resistor value as 2.2k to match the effective output impedance of (now) decoupled microphone feed resistor. You could make that value higher -- it is often recommended that the input impedance of the preamp needs to be higher.. although other commentators suggest matching the impedances offers the best results.
If you do go higher, then your pot value will need to be higher too, to maintain the gain.
With an input resistor of say 10k you would need the pot to then be 200k, to get your maximum gain of 20.

With your non-inverting circuit you set the input impedance at 50k (the two 100k resistors connected to your non inverting input are seen in parallel from an AC (signal) point of view).
The disadvantage of that configuration is that any noise or hum on the supply rails will be subject to the full gain of the pre-amp. Hence my suggestion to record the output from your amplifier, so that you could check.

I think maybe I should now stand back a little and let someone else offer you some suggestions...I don't want you to feel you are going 'backwards'!
I just thought I'd suggest one or two ideas that I've used myself ( and which worked for me!) but I do understand that you may not believe me.
After all, this is the internet, and you have no idea whether I know what I am doing or not! :)

Maybe time for someone else to pitch in with some suggestions, perhaps?....
 
Last edited:

Thread Starter

Etronic

Joined Oct 7, 2011
127
Yes - those are the values in the red circled items.

I think maybe I should now stand back and let someone else offer you some suggestions...I don't want you to feel you are going 'backwards'!
I just thought I'd suggest one or two ideas that I've used myself ( and which worked for me!) but I do understand that you may not believe me.
After all, this is the internet, and you have no idea whether I know what I am doing or not! :)

Time for someone else to pitch in with ideas, I think.....
I didn't mean you were giving me wrong advice.Your help is very appreciated.And i didn't mean you were taking me 'backwards'
Not in the lease.
I ment since i got a amp that seems to be working.
I just don't want to incorporate another amp to find its not going
to work in the circuit.From some one else who might post to this thread.
And start all over again.

You and Ron H are the only ones who been there to help me out on this circuit. And i appreciated you taking your time in helping me with this project.If you didn't.I don't think i would have gotten to where iam now with this project.
I think to many more suggestions from other posters will confuse the
situation further.And no one else has posted.

I just want to know the amp in your schematic is still the amp i have
in my circuit.LMV796.

I would appreciate if you would still help on this.
 

rogs

Joined Aug 28, 2009
279
I just want to know the amp in your schematic is still the amp i have
in my circuit.LMV796.
I didn't have any specific opamp in mind when I sketched out the circuit - and as I mentioned earlier in the thread, I've not used the device you are using. But it should work OK.

I did make sure that I could decode my 'recorded' file, using a software DTMF decoder (I don't have access to a HT9170), and it did work OK.
But I did notice it was a bit more fussy about the threshold range it would work over.
Your online DTMF encoder was more tolerant. ( I tried to find the link to that encoder you made in one of your earlier posts, but some of those seem to have disappeared?:confused: )...

Anyway, that is perhaps to be expected...software DTMF decoders (especially freeware ones!) do not have the sophisicated band splitting and clipping algorithms that the hardware decoder has. But it does show that you are likely to find some difference between decoding 'pristine' DTMF, and that recorded over a distance.

Once you are satisfied that the preamp is producing reasonable amplified 'copies' of your generated code, I should try and find a range of input levels that will work reliably with the source and microphone at fairly close range. Then slowly increase the distance, and the gain of the preamp, to see whether you can maintain a reliable decode at further distances.
You should expect to increase the gain by 2 (6dB) for every time you double the distance.

At some distance the corruption of the recorded signal -- by amplifer noise, room acoustics etc -- will make the reception unreliable. Only by experimenting will you discover where those limits are.

If it turns out that it's no where near as far as you'd hoped, then you can look at AGC to help. But that will bring a whole new can of worms to the project, so one thing at a time!

Without access to an oscilloscope, you really are going to find 'fault finding' your audio circuits a bit difficult. As I've said before, the next best option is to listen to your amplifer output.... connect it to your sound card input and use headphones. You'll soon hear whether your DTMF 'sounds' as it should. If you can't hear it sounding 'clean', neither can your decoder!

The audio side of this is not an ideal starting project.... it really is going to need methodical testing, to discover exactly where you are with the whole signal path....
 

Thread Starter

Etronic

Joined Oct 7, 2011
127
rogs

I tryed your schematic sketch you posted in post #91.
Unfortunately it did not work with the LMV796 amp.In
the inverting setup.

So! I disconnected the circuit and connected the way i
had it.It worked perfectly then at the 6'' distance.
At 2.5ft it works But not all keys pressed from the online DTMF lit up.
The ones that did light up are A,B,C,D,8,9,.,#.. 1,3,4,5,6,7,0 did not.
Maybe the other lower FQ tones are being cutoff do to a low cc1 cap
and cc2 cap.Thats why at a shorter distance they pickup. but? cutoff the FQ at a longer distance.And the gain needs to increase as you pickup these low and higher FQ tones further away.Does this make any sence.
Also im thinging these FQs need to Be pick-up at Between 100hz
to 10,000hz. low and high frequencies.Just suggesting.

I was reading the LMV796 works better at shorter distances.
Maybe you can look at the Datasheet.Enclosed.



Once you are satisfied that the preamp is producing reasonable amplified 'copies' of your generated code, I should try and find a range of input levels that will work reliably with the source and microphone at fairly close range. Then slowly increase the distance, and the gain of the preamp, to see whether you can maintain a reliable decode at further distances.
You should expect to increase the gain by 2 (6dB) for every time you double the distance.

At some distance the corruption of the recorded signal -- by amplifer noise, room acoustics etc -- will make the reception unreliable. Only by experimenting will you discover where those limits are.

If it turns out that it's no where near as far as you'd hoped, then you can look at AGC to help. But that will bring a whole new can of worms to the project, so one thing at a time!
The best i got is 6'' Max with this Audio 0p amp
And all tones worked perfectly.So it dose work!

It did work at the 2.5ft range.But? like i said.Only certain keys
lit up. With the DTMF online encoder.


Link to the online encoder.
http://www.cs.washington.edu/education/courses/cse100/04au/misc/tones/dtmf.html
 

Attachments

Last edited:

rogs

Joined Aug 28, 2009
279
Sorry to read that the inverting version did not work. As you will see from fig 49 and fig 50 of the data sheet (page 16) both versions are suggested.

I cannot believe that any bandwidth limitations will distinguish between the upper and lower tone groups. Plus the fact that the 'twist' (different levels) permitted between the two tone groups is quite substantial.

I think you need to record the output of your amplifier -- at a working, part working and non working range -- and post those sample recordings, so that maybe we can understand better where the problem is.
I can't think of any further to suggest, without hearing a sample.
 

Thread Starter

Etronic

Joined Oct 7, 2011
127
Sorry to read that the inverting version did not work. As you will see from fig 49 and fig 50 of the data sheet (page 16) both versions are suggested
No! I didn't use the inverting circuit fig49-50 on page 16 in the datasheet.

I used your sketched schematic inverting circuit you posted #91 as you drew it.And with the parts you used. That schematic 'did not work'.

I haven't build the inverting circuit in the datasheet.With there parts.
 

rogs

Joined Aug 28, 2009
279
I used your sketched schematic inverting circuit you posted #91 as you drew it.And with the parts you used. That schematic 'did not work'.
As I mentioned before, it was only a suggestion to try. That schematic does work... but not necessarily using that opamp and that supply voltage, and using an unknown electret capsule...

As I mentioned before, I little or no experience with low voltage preamps -especially mic preamps - so to some extent you are a bit of a pioneer in that area.
All I can do is make suggestions.

For example, for this kind of project I would probably have started use a transistor front end, with a TLO71 opamp following stage, and utiltising a 12 or 24 volt DC supply. I would also choose a known mic capsule, with a low noise internal preamp.

But you don't have those options, so you're making the best of the options you do have.

From what has happened so far, it would seem as if you might be best carrying on with your non inverting amplifier.

Post a recording on what you've achieved so far, so that we can get some idea of the results you're actually getting....
 

Thread Starter

Etronic

Joined Oct 7, 2011
127
rogs

Im going to try the circuit you suggested in post #15 where you stated
keep it simple by using the LM358 circuit.And subsituting it with the
LMV358 part.R3 and R4 would need to stay in the circuit
to bias the IC with a single power supply as stated in the datesheet.
But you suggest removing them. Why? The circuit my not function
correctly with out those resistors in the circuit.

http://howcircuits.com/lm358-preamp.html

If this circuit dose not give me the results i need. Maybe you got a completed circuit schematic that you
used and build for a Preamp.With these parts.
 
Last edited:
Top