Amplifier switching

eggie

Member
I have two LM386 audio amplifiers being fed from an MP3 module. Everything is working well on the prototype apart from the switching arrangements. I have a 5v supply to the picaxe and a 9v supply for the LM386

I need a picaxe to turn on the power supply to the amplifier so that it can be used as an alarm clock/player. I have tried the standard interface of a transistor on the ground connection and controlled through a resistor from the picaxe. This does not appear to work – when the transistor is turned off there is a loud continuous clicking from the speakers and I suspect that power is being grounded by all the other earth connections on the audio circuit and also pin 2 of the chip.

I therefore tried to switch the power side but that failed miserably – my knowledge of transistor function was extremely basic at that stage. I know a little more now (knowledge upgraded now to just very basic) and realise that such a proposal was doomed from the beginning.

My latest attempts involve the use of a relay on the power supply side but this is not ideal as it clicks every time it operates (presumably from contact bounce) and I would prefer to have a silent action. I will also have problems fitting the relay in the limited space available in the enclosure.

I have tried to search the forum but have not found any search combination that comes up with anything meaninful so sorry if this has been discussed before. Can anyone offer any suggestions? Can a MOSFET be put on the supply side?? - I have never worked with a MOSFET before.

Thanks in anticipation

Eggie
 

Andrew Cowan

Senior Member
You can use a P chanel MOSFET to switch the positive side.

To switch on the MOSFET, you pull the gate down to 0v. To switch off the MOSFET, you pull the gate up to Vss (in this case 9v).

As the PICAXE's maximum output is 5v, not 9v, that means the MOSFET would permanantly be on.

The solution? Add a pullup resistor to 9v on the gate, then switch the PICAXE output between high impedance (input state) and ground (switched low). Remember a diode to stop the PICAXE being damaged by 9v. Use the command 'input pin' to turn off the MP3 module, and 'low pin' to turn it back on.

See the attached schematic.


A
 

Attachments

Last edited:

hippy

Technical Support
Staff member
Is the diode needed ? You'll still be getting 9V ( less diode Vforward ) to the PICAXE pin but it will be current limited by the 10K.
 

Andrew Cowan

Senior Member
Good point Hippy.

My reason for the diode (which I now think is incorrect) was that without the diode, the internal clamping diode in the PICAXE will clamp the input (and thus the MOSFET's gate) to 5v, thus always keeping the MOSFET switched on.

However, that would need the diode the other way round, and that would then stop the PICAXE ever switching on the FET. Hmm.
 

Pauldesign

Senior Member
Hey Eggie, just some quick thoughts in a rush. :D

Please post your complete schematic.

I have a 5v supply to the picaxe and a 9v supply for the LM386
Which LM386N-X?

Why use two different PSU voltages. If i were u, i'll run both amp and PICAXE from a single 5V source. Except you're trying to isolate PIACXE psu from amp.

Alternatively, for future use, you may replace the x2 LM386 amp with a single IC minimum components 12W TI stereo amp. (forgot part number) :rolleyes:

I need a picaxe to turn on the power supply to the amplifier so that it can be used as an alarm clock/player.
Can you please elaborate on this?


Instead of using a transistor or relay, you may use a simple dedicated load management switch (forgot part number also :rolleyes:) to bridge the PICAXE and the Amp Vcc power line.
Your PICAXE can then be easily used to toggle the load management switch control line hence power-cycling the amp the way u want it.

Note, using a relay in your app might need added snubbers circuits.

a loud continuous clicking from the speakers
The the continuous sound might be due to ground loops, ac mains 60Hz or 50 Hz hums, or DC reaching the speakers. Use appropriate audio signal coupling and PSU decoupling caps.

I'll post the TI amp and load management switch part numbers.
Maybe you might find it useful for future use.
 

eggie

Member
Thanks to everyone for their responses - I am at work at the moment and so do not have access to any diagrams and only intermittent access to the forum.

Andrew

Your suggestion sounds hopeful. I had an NPN transistor switch working on the supply side when I was feeding in 9v to it's base pin from the supply line. Would I be wrong in using a transistor instead of a mosfet? (I have suitable transistors in stock but would need to get hold of a mosfet) My worry was damage to the picaxe but if you think that 9V in these circumstances will not cause damage then I will give it a try.

Paul

I am using an LM386N-4 to give that little bit more power. I do not need anything super loud - just enough to wake me up without distorting the signal. As the minimum voltage for this amp is 5V I opted for 9V.

I am using a picaxe to monitor a clock and when the alarm goes off, the picaxe selects a random track on the MP3 player and turns on the power to the amplifer. End result - random music to wake up to.

As I have already had extensive experience in the art of blowing up MP3 modules I now have numerous decoupling capacitors on the audio links and the power supply.

Thanks for your suggestion. I will try the Mosfet/transistor alternaive in the first instance but your suggestions are really appreciated and are lodged in my memory banks!
 

Andrew Cowan

Senior Member
Andrew

Your suggestion sounds hopeful. I had an NPN transistor switch working on the supply side when I was feeding in 9v to it's base pin from the supply line. Would I be wrong in using a transistor instead of a mosfet? (I have suitable transistors in stock but would need to get hold of a mosfet) My worry was damage to the picaxe but if you think that 9V in these circumstances will not cause damage then I will give it a try.
With an NPN transistor or N channel FET you would need about 9.6v to switch it on - you will need to use a P channel FET or NPN PNP transistor.

You can't damage the PICAXE as long as that 10K resistor is there - it stops excess current flowing into the PICAXE and blowing it up.

Edit - NPN changed to PNP as pointed out by eggie (post 8)
 
Last edited:

eggie

Member
Thanks Andrew

you will need to use a P channel FET or NPN transistor.
I presume you mean PNP, although I am not worried if I only get a little over 8V - I have some leeway there. This is looking very hopeful and so out with the breadboard again!!

Thanks again
 

MPep

Senior Member
@Andrew,

To be certain, you could control the P channel MOSFET with a NPN BJT.
This makes more sense to most people I suspect.

MPep.
 

1968neil

Senior Member
if you choose the FET route, i personally put a 10k resistor between gate and source to "Make Sure" its off when it's meant to be by pulling the gate low when not in use.
Maybe in your original Transistor idea you have a similar problem, scope the base when its off and make sure the pin isn't being held in limbo, this may explain the clicking noise ? or you could use the mute pin on the LM386, that would be a simpler option !

A circuit as the other guy's state might give us a better idea of the problem

Regards
Neil

another idea:

You could consider a ULN2003A - 18 pin IC containing 8 darlington buffers with input resistors built in so it can be connected directly to the PICAXE. would also give you more output choices.

Output capabilty is 50V max, 500mA per channel max, 2.5A total max.
Very little wiring / soldering required and they are nice and cheap.

They also have built-in freewheeling diodes to allow them to drive inductive loads!
 
Last edited:

vttom

Senior Member
A couple thoughts after looking up the datasheet for the LM386 (found here -> http://www.national.com/mpf/LM/LM386.html)...

1) Why switch the supply to the LM386 on/off at all? National claims low quiescent power consumption (4mA, or 24mW @ 6V), "making the LM386 ideal for battery operation".

2) Why use a separate 9V power supply? The data sheet says you can power it with 4-12V, so why not put it on the same 5V supply as the PICAXE?

3) The data sheet says the output of the LM386 is biased to VCC/2. How are you connecting the output to your speaker? I hope you are capacitively coupling! If not, perhaps that would explain the weird behavior you're getting when you switch the ground connection on/off?
 

eggie

Member
1968Neil - thanks for the comments but unfortunately my knowledge of electronics is not great and much of what you say goes right over my head. What you say about the base of the transistor I can understand and that may have been the problem as I did allow the base of the trasistor to float - I will have to look at that as well when I get to breadboarding it.

vttom - I had not even thought of the possiblility of just leaving the amplifier on. I just assumed that it would be good to shut it down at night to avoid any interference, squeaks or bumps - again I do not know what to expect from these items and so my electonics is very much a trial and error basis. If it is turned off then there cannot be any problems of interference. I do have some good decoupling capacitors on the speaker connections.

I am using 9V because I am using the LM386N-4 which required a 5V minimum supply. 9V gives me a bit of leeway on voltage.

Thanks for both of your comments.
 

vttom

Senior Member
Here're a couple more thoughts, then...

1) Why not use a SPST relay to switch 9V on/off? Get one with a 5V coil voltage that you control with a PICAXE output.

2) Instead of switching GND at the LM386, use your bipolar transistor to switch GND at the LM386 AND the speaker. That should keep it quiet.
 

Pauldesign

Senior Member
Hi Eggie,

You might not need it for your use but as promised and since is a forum maybe others might;

The TI amp part number is TPA1517 it has unbelievable audio performance ideal for 6 Ohms speaker and all you need are just coupling caps.

The load management switch is Fairchild FPF2116 (stocked by RS components). All you need are decoupling caps.
 

eggie

Member
eclectic - I am a building surveyor by profession and always have to build in a tolerance to any building design - the leeway is a hangover from my work as I do not like to design without a tolerance unless I know in advance that it is guaranteed to work - and my knowledge of electronics does not stretch that far!!

vttom - I have the system running on a relay a the moment and it works well. There is the annoying click when it fires up which, in an ideal world, I would like to eliminate. If all else fails I will use a relay, but Andrew's switching suggestion is my prime target for this weekend when I get the breadboard out again.


Pauldesign - Thanks for the suggestions. I note from the datasheet that the load management would not work with 9V but I never cease to be amazed by the equipment that is produced by chip manufacturers. I would never have imagined that someone would produce such a useful piece of kit.
 

Pauldesign

Senior Member
I would never have imagined that someone would produce such a useful piece of kit.
That's is the wonder of today's advancement in technology.
What someone can do, someone can only imagine. :D

There is the annoying click when it fires up which, in an ideal world, I would like to eliminate.
Is this click sound heard only from the speaker or from the relay or is it from both?

If from speaker only; damping the relay with acoustic material might be a good idea.

If from speaker; isolating the relay and speaker grounds might help; connect both separately to the common PSU ground. Keep ground wires as short as possible.
Amplifiers are very sensitive; isolate their input from the relay as much as possible. Also try using a screen twisted pair speaker cables.

If from both; then try both tips.

Also, connecting the speaker in bridge or differential mode to the two audio amps output might eliminate common mode noise.

Note, that click sound is a tone (a single frequency):rolleyes:; scoping will be nice and use a narrow bandstop filter of that frequency will get rid of the noise. Depending on the filter placement in the signal path, it might also get rid of that cool audio frequency. :rolleyes:

Oops, i forgot about your electronic knowledge depth but nevertheless, try the above hints. ;)

Well, attached is a datasheet of a low noise relay. I've haven't tried it.
 

Andrew Cowan

Senior Member
The circuit I posted previously may work, depending on the exact switching voltage of the P channel FET, and how much leakage current you are okay with in the 'off' position. It is a case of try it and see.

As suggested by MPep, adding an NPN transistor makes the circuit much better, although a little more complex. The attached circuit will definatly work with almost any NPN transistor and P channel FET.

A
 

Attachments

Top