Simulating button press on monitor using transistor and arduino

Thread Starter

arcademade

Joined May 17, 2023
8
Hello everyone, I have next to no knowledge of electrical eng or circuitry and am having some trouble with my homebuilt arcade. The essence of my problem is that I want to wire both the computer and monitor to the same rocker switch. The monitor turns on via a button press that completes a circuit for a moment, I have removed the button and am dealing with the exposed female inputs. I am using an Arduino to simulate a button press through a momentary high(5V), low(<1V) switch in voltage (I know this is overkill but am not smart enough to come up with a different solution because for other reasons I cannot use the computer). The Arduino is wired to the base of a transistor that completes the circuit for the monitor when the base is activated. I have tried playing around with some resistors as I thought it was a pull down issue with no luck(1k and 47 ohm). When the Arduino goes to low voltage, the transistor still seems to activate and cycle the monitor between on and off. Furthermore when I touch the base with my finger, this also seems to activate the transistor. Any help is appreciated thanks.
 

Reloadron

Joined Jan 15, 2015
7,220
Your computer and monitor turn on with a button press. OK, knowing what a button press does figures into things. On a PC your button has one side to ground and the other floats at 5.0 VDC held high through a pullup resistor. Pushing the power on button places it at a logic low. I can't speak for your monitor. The best approach is measure across your power on button and see what you have. If you see 5.0 VDC and on button press it drops to 0.0 VDC it works as I suggested. Doing what you want to do is often accomplished using a simple NPN transistor as a switch. You are not drawing any current to speak of so... You mention a transistor but make no mention of how it is in your circuit or even transistor type and part number. I would use a 2N3904 or 2N2222 with the emitter to ground and collector to the other side of your push button. Simply put your transistor emitter and collector across your push button. You can leave the existing push button in place. Your transistor should have a base resistor and since you are switching very low current the value will not be high. I would use a transistor for each, your PC and your monitor.

You don't mention which Arduino? Anyway all you need to do is use a digital out line to drive your transistor base. I have to also agree with...
Show a diagram of how you have it wired.
Any transistor will require a base resistor.

Ron
 

Thread Starter

arcademade

Joined May 17, 2023
8
Your computer and monitor turn on with a button press. OK, knowing what a button press does figures into things. On a PC your button has one side to ground and the other floats at 5.0 VDC held high through a pullup resistor. Pushing the power on button places it at a logic low. I can't speak for your monitor. The best approach is measure across your power on button and see what you have. If you see 5.0 VDC and on button press it drops to 0.0 VDC it works as I suggested. Doing what you want to do is often accomplished using a simple NPN transistor as a switch. You are not drawing any current to speak of so... You mention a transistor but make no mention of how it is in your circuit or even transistor type and part number. I would use a 2N3904 or 2N2222 with the emitter to ground and collector to the other side of your push button. Simply put your transistor emitter and collector across your push button. You can leave the existing push button in place. Your transistor should have a base resistor and since you are switching very low current the value will not be high. I would use a transistor for each, your PC and your monitor.

You don't mention which Arduino? Anyway all you need to do is use a digital out line to drive your transistor base. I have to also agree with...



Ron
Hey Ron, thanks for this. When I press the button on the monitor it completes the circuit, there doesn't seem to be a current flow when the button is not pressed. I will give those transistor types a try, currently I am using a 2N3904. The Arduino is a knock off I got on kajiji, I'm not really sure what it is but the installation instructions were in Mandarin lol. What resistor level would you recommend? Thanks again.

B

Here is a diagram I drew. Sorry about the drawing lol, I'm also not very good at drawing. View attachment 294429
My resistor values are very off I have playing around with them for some time. Would I only need one resistor in place of the base resistor in a lower value?
 
Last edited:

sghioto

Joined Dec 31, 2017
4,918
Resistor values seem ok but connect the 30K from the base of the transistor to ground. The 2N3904 is OK to use.
See if that helps. Not sure if you need the 240 resistor.
 

Thread Starter

arcademade

Joined May 17, 2023
8
Resistor values seem ok but connect the 30K from the base of the transistor to ground. The 2N3904 is OK to use.
See if that helps. Not sure if you need the 240 resistor.
Thanks for the advice, I'll give this a shot when I get home later today

I copied the circuit that is on the datasheet of the 2N3904 and modified it to match your schematic:
Awesome thanks for this, I need to take some drawing lessons or something haha

Your schematic is correct.
Use one transistor to play a role of button, and also does a level shift to adapt 5V I/O Level.
Thanks, I will look into this. Any recommendations on a specific level shift? I'm not too familiar with them.
 

Thread Starter

arcademade

Joined May 17, 2023
8
This is what you want. There is no need for a collector pullup resistor. Your transistor(s) collector and emitter go across your existing push button(s). Maintain a common ground.

Ron
I was using two separate ground sources originally, I will try using a common ground thanks. I will update later today
 

Thread Starter

arcademade

Joined May 17, 2023
8
Hey guys thanks so much for all the advice! A bit of a weird setup but the solution was that the emitter that was wired to what I thought was ground but was actually an input checking if there is a flow of current. So it had to check if there was simultaneously current flowing out of the collecter and into the emitter. I bypassed this by wiring what I previously thought was the ground input to a constant 5v and the button output to a transistor which is wired to ground. Then I just sent the 5v fluctuation from the Arduino into the base to allow for the current to flow into the common ground. Thanks for all your advice everyone, this was a huge help!
 

MrAl

Joined Jun 17, 2014
10,612
Hi,

Another solution is to use an analog switch. Sometimes you have to use that when the switches are multiplexed.
 
Top