Sony Arouje

a programmer's log

Control AC/DC devices using Arduino

leave a comment »

In forums I could see people asking how to switch on/off devices using Arduino. It’s a very simple approach using a relay module. In this post I will briefly explain how to do that.

 

Connecting Relay module to Arduino

RelayConnection_bb

 

Most of the relay module runs with 5 or 12v DC. Even if it’s 5v, never connect VCC of relay to Arduino. Always make sure Relay should powered from an external source. Most of the relay need more current (A) than Arduino can supply and might damage your Arduino. In the above diagram I used a battery (it should be a 12v battery, I couldn’t find 12v battery in fritzing) to as power source.

Here the Arduino and the Relay are powered from the battery. If you are powering Arduino separately via USB then remove the wire connecting to VIN of Arduino. Leave the GND connecting to Arduino as it is, all the connected devices needs common ground.

Relay need a trigger to switch on/off the connected device. If we supply high (5v) to INP pin of relay module the connected device will switch on, if we supply low then the device will get switched off. Here I connected D2 to INP pin of the relay. In code if we do digitalWrite to D2 with HIGH, the relay will get activated and LOW will deactivate the relay.

We can control AC or DC device using the relay. As you can see from the above diagram, the Relay is in series to the power supply going to the load. The wiring is very similar to a switch between a load and the power.

Advertisement

Written by Sony Arouje

April 19, 2016 at 4:12 pm

Posted in Arduino

Tagged with , , , , ,

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: