Hi, i am trying to use the arduino to control the volume of a line out of an mp3 player. i am working with one mp3 player at the moment but eventually i want to have four independent players all with their outputs being able to be toggled on/off by the arduino. I would like to be able to control the volume level through PWM but for the time being i am happy to switch the audio signal ON of OFF.
I have constructed a circuit using a transistor to switch the positive wire of the line out from the mp3 player. The output is an Active speaker it takes a power input of 9v AC. The transistor i'm using is a BC548B, the resistor from the pin out is 2.4k Ohms. The mp3 player is the mp3 trigger v2 from sparkfun. Here is a circuit diagram
http://www.flickr.com/photos/32581221@N04/4600054864/sizes/o/
Using the simple led blink program to test the circuit, when the pin is HIGH the track plays at full volume and is a clear sound. When the pin is LOW the sound doesn't go off as i expected but the volume drops and the sound distorts and crackles.
Does anyone have any advice on how to get the circuit to switch fully off when the pin is LOW? Am i going about trying to control the on/off of the volume in the right way? or should i be trying a different method altogether? Thanks in advance for any help.
ps i saw that i could control the volume on the mp3 trigger via serial commands but as i will be running four mp3 triggers from one arduino i could not think of a way to have them all connected via a serial connection at once...
Does anyone have any advice on how to get the circuit to switch fully off when the pin is LOW?
Don't use a transistor use a FET. Transistors do not work like switches in the arrangement you have. Also you have omitted to show where you have connected the emitter in that diagram.
updated circuit diagram, you can see where the emitter is now;
http://farm4.static.flickr.com/3631/4600473549_ee3cd427a0_o.jpg
Ok that defiantly won't work. Use a FET.
thanks for the advice Mike, I'll try that out.
Just tried the circuit with a 2N7000 MOSFET and it has the same problem. the song plays fine when the pin is HIGH, but is quiet and distorted when the pin is LOW.
data sheet for the MOSFET here 2N7000 Datasheet(PDF) - NXP Semiconductors
would you suggest a change of transistor again or a change of circuit?
hi richard, thanks for your patience. I'll try that out as a test on one mp3 player, I guess the reason i didnt attempt this approach sooner was that i am still not sure how to communicate individually from one arduino to four mp3 triggers via serial, the four players will need to be doing different things at the same time. would you be able to give me an example of how i could do this? would it mean each mp3 player has a different address so it only receives the command destined for it? and is this possible? sorry if what im proposing doesnt make sense i dont really know what the possibilities/limits of using serial command in this way are?
Also here is some more background on the project just so the parameters are clearer. I am trying making an interactive sound piece which involves playing four audio tracks, usually more than one or all will be playing at the same time. the interface for each track is a button which will toggle its corresponding track on/off. when a button is pressed once it will activate the track when a button is pressed for a second time it will deactivate the track. I initially thought i could use one arduino pin to trigger the track on the mp3 trigger and another pin to control the 'off' by switching a transistor on to cut the sound...
The FET itself is just a high resistance when it is on. It needs to be part of a potential divider. So you need a resistor from the output to the input. Then from the input to ground you put the FET.
i tried the navigator button route and it works really well for this...too well perhaps; i hardly need to use the arduino! thanks.
i also tried the modified MOSFET circuit. it worked alot better but it still allowed a small but not distorted audio signal through.