Help with MOSFET as button switch, please!

I have an F540NS mosfet which I've scavenged. I've tested the MOSFET, it works. I also have an camera for which I've removed the button contact tape and soldered one wire to ground, and one wire to positive. When you touch the wires to each other for two seconds, the camera powers on. Again, and it powers off. Camera is powered via a separate USB line. Voltage across those two button lines is 3V.

I have transistors and relays coming in the mail, but for now my goal is to use the MOSFET to connect the two button leads (+ and -) when a voltage is applied to the MOSFET gate. I'm pulling digital pin 5 high (5V) for two seconds, then setting it low again to simulate a button push.

I have a wire coming from digital pin 5 to the gate. I have the button's positive lead (soldered to center dot of button) running to source. The button's negative lead (outer contacts) to drain. I've tried running ground to the gate, or the drain, or both, and none has worked. Doing this all on an Uno. I can get it to work by having button negative connected to source, button positive to drain, and digital 5 to the gate - but this setup immediately fails when I add a second identical setup for the camera's other button running off of digital pin 3. At no point are pin 3 and pin 5 pulled high at the same time.

I am ashamed to say how many hours I've spent trying to get this to work. Arduino stuff is not new to me, but I cannot wrap my head around this.

Could someone please provide a succinct answer of what should be connected to gate, drain, source? And perhaps which of these should also be running to ground on the Uno? Why was it failing when I ran a second setup to run off of digital pin 3?

Thanks, Austin

Your second setup is correct. The source should be connected to ground. The issue you may be having is connecting the camera ground to the arduino ground. (It needs to be).

If you are looking for isolation, you can always use optoisolators

Would the camera not being connected to the Arduino's ground create the issues I'm running into when I try to set up the second mosfet? Just tried it again now, second setup works, but as soon as I duplicate it with a second mosfet going to pin 3 the whole thing stops working.

Given that it's powered by USB, how should I address getting the Arduino and camera on a common ground?

Just connect the camera ground to the arduino gnd. Can you post a pic of the wiring? The mosfet you are using isn’t a logic level mosfet either. It is barely conducting at the arduino 5V level.

The camera gnd has to be connected to give the mosfet/arduino a reference to gnd. Without it, all kinds of strange things happen.

Depending on how the switch in the camera is connected, it might not be a good idea to just connect the grounds.
The clean solution would be to use an optocoupler instead of the the MOSFET. The principle is the same, but now the input and output are galvanically isolated, so you won’t have any problems should the Arduino and the camera be at different potentials.



Can you please post a copy of your circuit, in CAD or a picture of a hand drawn circuit in jpg, png

Tom... :)