Hello,
i'm trying to hack the play/pause button on an MP3 board (image below), so that i can control the play and pause from and arduino pin.
this pushbutton just grounds a pin of the main chip, which voltage is 3.3V.
i welded a wire to the 3.3v side of the pushbutton and tried to mimic the pushbutton with a PNP 2n3906, which didnt succeeded (maybe cause it doesnt completely grounds due the voltage drop over the transistor). Any suggestion??
In your diagram, the MP3 board power would be shorted every time the Play/pause button is pushed. But let's assume that there is a resistor in the actual MP3 board circuit.
Your circuit might work, but you have chosen the wrong type of transistor, a PNP. You need an NPN such as 2N2904 for that. No other changes to the circuit are required.
You probably do not need the transistor at all,depending on how your power is applied and of course granted that your grounds are common, the Nano can switch the MP3 device directly, or with a diode for isolation.
Incidentally, as you are not an English speaker, note that we do not "weld" electrical circuits (other than spot welding tags to batteries). This is welding:
Electronic components are generally assembled by soldering.
Two problems:
1: Use an NPN instead of a PNP - or better yet, an N-channel MOSFET. Essentially you're making a low-side switch.
2: Most importantly: this is never going to work with just one wire between the MP3 player and the Arduino. Your setup will work in essence (I'd use an N-MOS), but you'll have to connect the MP3 player's GND to the Arduino GND.
OK! it works! just sticked an NPN 2n9013 instead of the PNP, changed the code to send the "pause" as a HIGH pulse, and everything works. Sad that i suck so much at electronics to not have been able to figure it out myself (i still dont really get the difference between NPN and PNP, beside the fact that one is high-activated and the other is low-activated... the voltage drop in my case?)
thank you everybody for the wonderful answers, and taking the time, its deeply appreciated.
And... ive got a special question about the N-channel mosfet, and Koraks:
I've tried to use a 2n7000 (N-Channel Enhancement) in place of the NPN in this new setup, and its working fine with the BJT but not with the MOSFET. According to what i've read about it, it should work. What is it that i'm doing wrong?
and thanx Paul-B, as well, for the answer
i tried at first to sink the 3.3V coming from the MP3 board directly through the pin, with my "welded" cable hooked to D7 (configured as OUTPUT with LOW pulses, blink-style) via a voltage divider (10k--20k). it didnt worked. any idea why?
and thanx also for the english lesson. in spanish we dont make the difference between soldering and welding, and i get it wrong all the time hahaha... plus: i work as a welder...
Hi aarg and "killzone"...
i obviously read again about NPNs and PNPs on the net before coming here and waste your time... and its not because i suck at electronics that i havent been using BJT succesfully, every now and then, for ages. i know the basics of the differences and still i dont get it.
My question was: beside the fact that one is high-activated and the other is low-activated... whats the difference that make NPN work in my case and the other not?
sorry, maybe this question has such a simple and short answer that i sound stupid, but im genuinely not getting it... please help.
thanx
in my first setup (PNP) i simulated a pressure on the pushbutton with a LOW pulse on D7 output. Which didnt work.
in my second setup (NPN) i simulated a pressure on the pushbutton with a HIGH pulse on D7 output. Which worked.
The NPN is in a common emitter configuration, the PNP is in a common collector configuration. In this case, the important difference is that the common emitter configuration does not place the transistor base-emitter junction in the output circuit. Thus it can produce a lower output voltage when active. The common collector configuration does not "pull" the load voltage "down" far enough.
The "3.3V" side of the button is likely an input pin with a pull-up resistor. To control it with an Arduino pin, use "pinMode(pin, OUTPUT); digitalWrite(pin, LOW);" to 'press' the button and "pinMode(pin, INPUT);" to 'release' the button. If you make the pin an OUTPUT and digitalWrite(pin, HIGH); your Arduino output will be shorted to Ground if anyone presses the button.
It's a borderline case; a 2n7000 won't turn on entirely if you put 3.3V on its gate. Usually this is not a problem; its drain to source resistance drops sufficiently to act as a switch that is 'on'. But not all circuits may be happy with it.
However, I think it's more likely a connection/implementation problem; perhaps you swapped some pins or forgot to connect that common GND between the Arduino and the MP3 player.
More specifically, with a direct connection (no resistors) you start by putting "digitalWrite(pin, LOW);" in setup(), then whenever you want to 'press' the button, you use "pinMode(pin, OUTPUT);" and "pinMode(pin, INPUT);" to 'release' the button.
And possibly more to the point, it would feed 5 V from the Arduino into the 3.3 V system. Not good!
You can however put a diode with cathode to the Arduino and anode to the switch (grounds always connected together of course) which protects against all mis-programming. Of course if the Arduino was not powered, it would appear as a button press.
Thank you everyone!! its great to have so much feedback, and definitely VERY useful for me and this project.
So, the ground is common, yes, and theres two different power supplies.
Paul_B and johnwasser, i'll try your software trick ASAP, sounds great.
And no need for more PNP/NPN education, aarg took care of that.
Thanx again to everyone, have a great day
The reason I asked about the common power supply, the transistor is better if the supplies are not shared, because logic circuits sometimes suffer from "parasitic power" when a powered device is connected to an unpowered device. The voltage from an output can backfeed through the protection diode of an unpowered connected device pin, and power it up with a slightly reduced voltage and current. You can imagine the fun when this happens and you don't know what is going on...