Replacing a simple switch with an Arduino

Hey guys, I'm kinda new with this thing, hope to get some guidance.. I am looking to interface with a simple switch and to mirror its functionality with Arduino and being able to control it remotely. The switch is pretty simple, 2 wires that get connected when the switch is On |375x500 Any suggestions?

What are you switching with that switch? Advice depends on the answer :wink:

It's a Generator trigger. But as far as I understand it just closes the circuit that runs low DC voltage. Like 5V or something like that

Well you can use a relay which is basically a electrically operatable switch. You can get cheap arduino friendly relay boards from eBay.

It would typically have 6 pins. Leave the NC(Normally Closed) pin of the relay unconnected. Connect the two wires from your trigger switch to the pins named NO(Normally Open) and COM(Common) and power the relay from the 5V of your Arduino and when you want to set the switch to ON, you set the INPUT pin of the relay high from the Arduino using a digitalWrite() and it should work as desired.

Thanks Leo! Shouldn't it have 5 pins though? That's I think the relay I have home

Well a relay on its own has 5 pins. But most relay boards comes with 6 pins, a separate INPUT and 5v power.

pavelzagalsky:
It’s a Generator trigger. But as far as I understand it just closes the circuit that runs low DC voltage. Like 5V or something like that

No, you need to know exactly what is going on. If you don’t, one day you will blow the micro out of the board because you did not check thoroughly.

I agree with the suggestion the relay (board).

If you want to use the relay that you already have at home, be careful. Check the voltage that it needs to switch, check the current required, check the voltage and current that it can switch.
You can NOT directly connect a relay to the Arduino. You will need a transistor and resistor as well as flyback diode. is representative for a typical setup of the circuit; transistor and resistor choice might depend on relay.

Using a relay board is the safest option

sterretje:
No, you need to know exactly what is going on. If you don’t, one day you will blow the micro out of the board because you did not check thoroughly.

I agree with the suggestion the relay (board).

If you want to use the relay that you already have at home, be careful. Check the voltage that it needs to switch, check the current required, check the voltage and current that it can switch.
You can NOT directly connect a relay to the Arduino. You will need a transistor and resistor as well as flyback diode. is representative for a typical setup of the circuit; transistor and resistor choice might depend on relay.

Using a relay board is the safest option

Why is it not possible to connect a relay directly to Arduino? Diode is connect to prevent leakage to Arduino from the relay?

Relays require (in general) more current than a single output of the Arduino can source or sink.

The reason for the diode is protection against voltage spikes; see e.g. wiki flyback diode