Home Automation - How to Add Relays to Arduino




Introduction: Home Automation - How to Add Relays to Arduino

Update: 5th Jan 2022 – Added ESP-01 Relay Module

Update: 19th Dec 2021 – marked up a number of product links as “no longer available”. Classic Bluetooth shields have been replaced by BLE shields/boards. BLE is more difficult to use but pfoddesignerV3 and pfodApp makes it easy. See Bluetooth Low Energy (BLE) made simple with pfodApp.

Another simple solution for on/off Home Automation is to use pfodDesignerV3 to design your control for upto 4 switches and then use a Arduino Uno + Cheap/Simple Wifi Shield + DFROBOT Relay Shield for Arduino V2.1 powered by a USB power supply and controlled by pfodApp and, if switching mains power, have an electrician wire it in.

How to select Relays – Its all about Power.

When you are selecting a relay to connect to your Arduino you need to consider

a) the power (voltage and current) of what you want to switch on and off and
b) the power (voltage and current) required to drive the relay (i.e. to energise the relay coil)

We will look at a number of configurations for connecting relay modules to Arduino boards:-

1) Direct driven reed relays
2) Single 5V power relays powered from the Arduino board's 5V supply
3) Four (4) relay shields using a separate supply. The shield powers the Arduino board.
4) Separate multi-relay 5V modules high triggered and low triggered
5) Separate multi-relay 12V modules high triggered and low triggered
6) Modifications for Driving a 5V relay module from a 3.3V Arduino board
7) High/Low Triggered Relays for Use with 3.3V boards, e.g. ESP8266-01
8) ESP-01 Relay Module
9) FET Sheilds
10) Solid State Relays
Finally there small section on Help My Relay Stopped Working (RC Snubbers)

If you are looking for a simple way to switch these relays on and off from your Android mobile, via bluetooth, wifi or SMS, with optional 128 bit security, check out pfodDesigner (www.pfod.com.au) and this instructable Code generator for custom Android/Arduino menus to switch Arduino outputs on and off Absolutely NO programming required. No Android programming and no Arduino coding. The pfodDesigner generates all the Arduino code you need for your custom menus and the pfodApp takes care of displaying the menus on your mobile and handling your selections.

This instructable is also online at How to Add Relays to Arduino

Step 1: Relay Selection Based on What You Want to Switch on and Off.

This is relative straight forward so we will consider it first. While there are may different types of relays (see http://en.wikipedia.org/wiki/Relay), for home automation and control there are four main types that would be used.

i) Reed relay for switching low voltage and low current devices

ii) FET switches for switching 30V to 60V DC voltages and up to 20Amps

iii) 110V and 240V power relay for switching mains powered devices

iv) Solid State switches for switch mains powered devices.

Reed Relays

Reed relays are small low power relays suitable for switching <100V at current <0.5Amps. While designs vary, total switched power is usually less than 10 VA (volts x Amps < 10). Examples of IC form factor reed relays are TRR-1A relays and COTO TECHNOLOGY – 8L01-05-001

Power Relays

Most relay modules sold to connect to Arduino are power relays and are rated for either 110V or 240V. The ratings are usually printed on the relay case.

Notice that the maximum DC voltage that can handled is much less then the AC rating.

This is the type of relay you will need to use of switch mains powered devices. These relays will handle most devices used in homes except the highest powered ones like room heaters, stoves, motors. Make sure the VA (Volts x Amps) of the device you are switching on/off is less than the relay rating.

Any wiring to the mains power should only be done by a qualified electrician.

A final point, the power relays commonly use silver alloy contacts and are not suitable for switching very low currents like switching Arduino digital inputs. If you are only switching a few milliamps, for example by putting a relay across a low voltage garage door push-button, you should use a reed relay (or a relay with gold contacts) as the power relays need a “wetting current” to break through the surface film resistance and will not switch very small currents reliably.

“Normally, a switch's wetting current rating is far below its maximum current rating, and well below its normal operating current load in a properly designed system. However, there are applications where a mechanical switch contact may be required to routinely handle currents below normal wetting current limits (for instance, if a mechanical selector switch needs to open or close a digital logic or analog electronic circuit where the current value is extremely small). ... Normal silver or copper alloy contacts will not provide reliable operation if used in such low-current service!” (http://www3.eng.cam.ac.uk/DesignOffice/mdp/electric_web/Digital/DIGI_4.html )

FET switches do not have this problem and can be used to switch very low currents.

Step 2: Relay Module Selection Based Power Required to Drive the Relay

The Arduino digital outputs can only supply +5V (or +3.3V) and less than 40mA max. (typically <20mA for continuous use). So, except for some reed relays, you cannot drive the relay coil directly from the digital output since 5V power relays typically require ~100mA to operate the relay coil. This means for most (all) relay modules you need to provide a separate supply to the module in addition to the Arduino digital output which is used to control the relay switching.

We will look at a number of configurations for connecting relay modules to Arduino boards:-

a) Direct driven reed relays

b) Single 5V power relays powered from the Arduino board's 5V supply

c) Four (4) relay shields using a separate supply. The shield powers the Arduino board.

d) Separate multi-relay 5V modules high triggered and low triggered

e) Separate multi-relay 12V modules high triggered and low triggered

f) Modifications for Driving a 5V relay module from a 3.3V Arduino board

g) Solid State Relays

Direct Driven Reed Relays

5V Reed Relays can be driven directly from the Arduino digital output provided their coil current is less than 20mA. TRR-1A relays and COTO TECHNOLOGY – 8L01-05-001 only require 10mA each so you can easily drive 8 or more of these relays from an Arduino board supplied by a USB 500mA power supply plugged into the USB connector (The Arduino Uno has 500mA resetable fuse on the USB input).

Alternatively if the Arduino board is powered via 12V to its power plug, limit the number of 10mA reed relays to less than 6 as the on board 12V to 5V regulator limits the maximum current that can be drawn from the 5V supply to about 70mA or so.

Above is a circuit for a single 5V reed relay being driven directly from D7

Direct Drive Clamping Circuit

Two things to note:

a) The 1N4004 diode across the coil of the relay and

b) the 33 ohm resistor between D7 and the relay coil +

The diode is there to clamp the voltage/current spike the relay coil produces when it is switched off. Do a search on “flyback diode” for more details on this. (http://en.wikipedia.org/wiki/Flyback_diode for example)

The 33 ohm resistor protects the D7 output from excessive current and allows the diode to do the clamping. When a digital output is turned off it does not go open circuit, rather it connect the output pin to GND via a very low resistance. Without the additional 33 ohm resistance, the current spike from the coil would preferentially go back into the microprocessor via D7 to GND.

The coil resistance is about 500 ohms so when D7 is high (+5V) most of the voltage appears across the coil (I.e ~4.7V ) (search for Ohm's Law or checkout Sparkfun's tutorial) The “pull in” voltage on the datasheet for the TRR-1A 5V reed relay is 3.75V which means any voltage higher that than must close the contacts so 4.7V is more then enough to ensure the relay operates.

All commercial relay modules should already have the clamping diode fitted across the relay coil.

Step 3: 5V Power Relay Modules Powered From the Arduino Board's 5V Supply

There are a number of different single 5V relay modules available on-line. But most do not have any circuit diagrams available. Here are two examples (the first one from DX.COM's website).

Both operate the relay when the input (IN) is HIGH (+5V). The second board as an optical isolator and separate connectors for the IN ground (COM) and the main 5V supply ground (GND). The jumper is connecting these two grounds together so you can use it just like the left hand board.

Removing the jumper lets you have isolated supplies, one for the the Arduino and another completely separate one for the relays. Separate supplies provides some extra protection against mains volts getting back into the microprocessor. But this extra protection is mostly illusory. The pcb tracks on the back of the board are quiet close and nothing will protect you against a lightning strike on the power line outside your house.

So for either board, connect the relay GND to one of Arduino's GND pins and the relay 5V or Arduino's 5V pin and the relay IN to one of Arduino digital outputs, say D4. Then when the digital output, D4, is High the relay will operate.

The photo above shows this wiring. Note the Arduino is being powered by the 5V USB power. The relay is 5V so everything is at the same voltage.

The relay's contacts consist of a Normally Closed (NC) and Normally Open (NO) connection and a COM connection. When the relay is un-powered the NC terminal is connected to the COM terminal and the NO terminal is not connected. When the relay is operated, the COM terminal switches over and is now connected to the NO terminal and NC terminal is not connected. The screw terminals are either marked NO, NC and COM or small drawing is shown like the image above. It the image above, the top terminal is the NO one the centre terminal is the COM and the bottom terminal is the NC one.

Connecting these relay modules to the Arduino's 5V pin means both the trigger current (IN) and the current to drive the relay coil are being supplied by the Arduino board. From the datasheet for the SRD-05VDC-SL-C you can read that the relay coil takes ~72mA to operate. Added to this is the current required by the IN input to trigger the coil. For the optically isolated relay that is about 4mA and perhaps a bit more for the non-isolated one. (Measure it for your module).

In any case each of these relay modules will take <100mA from the Arduino's 5V supply. So if a USB supply is used to power the Arduino,you can attach up to 4 of these modules. Indeed that is just what the 4 channel relay shield from Seeed Studio (no longer available) does.

In Seeed Studio's 4 channel relay board, the relays are controlled by D4,D5,D6 and D7 so you can just plug this relay shield on top the Bluetooh Shield V2 (no longer available) to get a complete remote control of up to 4 relays controlled by Android and pfodApp. Use pfodDesigner to design the Android menu and generate all the code you need.

This shield is quoted as drawing 250mA, but 300mA would be more realistic based on the datasheet for the relays. In any case it is fine if you are powering the Arduino board via a USB supply. However it is not suitable if you are using a 9V or 12V supply due to the limitations of Arduino's on-board regulator.

Step 4: Four Channel Relay Shields Using a Separate Supply

An example of this type of relay shield is the DFROBOT Relay Shield for Arduino V2.1

This shield can be configured in a number of ways using the jumper strips. When operating all 4 relays it should be powered by 9V applied to the screw terminal on the left of the picture.

By default the relays are controlled by D2, D7, D8 and D10. The Itead Bluetooth Shield (no longer available) that I usually use already uses D2 as an output so only 3 relays can be driven in the default configureation, if you use that Bluetooth Shield.

However the DFROBOT relay shield can be reconfigured to use any digitial pins to drive the relasy. It also includes an Xbee socket so you can plug in an RN-42XV Bluetooth or RN-XV Wifi (no longer avalable) module and configure the jumpers to work with it. Note: in this case you should cut off the reset pin from the relay shield as it is driven by the RS-232 flow control on the Xbee socket.

Step 5: Separate Multi-relay 5V and 12V Modules, High Triggered and Low Triggered

Separate multi-relay 5V and 12V modules, high triggered and low triggered

If you want more the 4 relays then there are a number of multi-relay modules available. Typically with 8 relays but some with 16 relays. SainSmart has an 8 channel module.

The specification for the SainSmart say each channel needs 15mA to 20mA to drive it. I expect this is an error as all the modules I have measured need <5mA to drive them. However I suggest you measure the actual current needed to drive the inputs of any 8 channel board you use. The Arduino microprocessor has an absolute maximum total digital output current of 200mA, so 8 times 20mA = 160mA is higher then I would like to run continuously.

Since both the Arduino drive voltage and the relay coil voltage is the same, +5V, there is no problem with low triggered inputs since the voltage from the relay board being pulled down by the digital output will not be more the 5V. But as will discussed below this is not the case for 12V relay modules. It is also not the case if you are driving a 5V relay module from a 3.3V Arduino board like the Due or Fio or SparkFun's FioV3.

Separate multi-relay 12V modules, high triggered and low triggered

It is sometimes more convenient to use 12V relays driven by a 5V Ardunio board. You may have a 12V battery supply or need to use 12V for some other part of the circuit, or the lower current used by the 12V relay coils may be a consideration. In these cases you have to be careful about how the 12V relay coil is driven by the 5V Arduino output.

As mentioned above a lot of the relay modules available do not come with circuit diagrams. Problems can occur if the relay module is low triggered. That is the relay control input is pulled to GND by the Arduino digital output pin. In that case, then when the Arduino output pin is high there may be 12V applied to it from the relay module. This may damage the Arduino microprocessor.

This is also an issue if you are driving 5V relay module from a 3.3V Arduino board like the Due or Fio or SparkFun's FioV3. Again the +5V from the relay board applied to the 3.3V digital output pin may damage the microprocessor.

There are two ways to avoid this problem.

i) Use a module that is high triggered by +5V. In this case there will not be any excess voltage coming back from the module when the Arduino output is low.

ii) Use an optically isolated module that has a separate trigger supply terminal in addition to the 12V supply terminals for the relay coils. In this case the Arduino +5V supply goes to the trigger supply terminal and no excess voltage will be applied to the digital outputs.

Above is an indicative circuit of one channel of 8 channel relay module (This circuit from SainSmart)

As you can see with an optical isolator and a separate Vcc input (+5V from Arduino) and the Arduino digital inputs are isolated from the 12V relay voltage by the optical isolator.

Also shown is a typical optical isolated 12V 8 channel relay board. Notice the Gnd and VCC near the IN terminals. That VCC is for the 5V supply from Arduino. At the right hand end is the JD-VCC pin which is for the 12V for the relay coils.

The photo above shows an example connection for 12V optically isolated relay. Note that the Arduino is being powered by 12V via the plug in power. The Vin socket on the Arduino is the same voltage as the power plug, i.e. 12V, so the relay module JD-Vcc is connect to Arduino Vin to supply the 12V for the relay coils. The Arduino Vcc is 5V and is connected to the relay module Vcc to set the trigger voltage. The trigger GND is connected to Arduino GND and D4 is connected to IN1 to drive relay 1. In this module the JD-Vcc and the Vcc connections both have the same GND point so only one ground connection is needed and no jumper is needed.

Step 6: Modifications for Driving a 5V Relay Module From a 3.3V Arduino Board

One final point about drive 5V relay modules from 3.3V Arduino boards. In addition to using one of the above two solutions to prevent the 5V being feed back to your 3.3V digital outputs, you may need to modify relay board, if the 3.3V output does not reliably drive the relay. The problem is the circuit was designed for 5V to drive the optical isolator U1, and U1 may not be getting sufficient current from your 3.3V Arduino's output.

There are two common modifications for 3.3V operation of a 5V relay board:-

1) If the drive circuit has a led in series with it, i.e. IN1 in the circuit above, just short it out by soldering a wire from one side to the other. The led was using up about 2V so shorting it out means now you only need about 3V instead of 5V to drive the relay.

2) If there is not led in series with the drive pin, then add another resistor across R1 to reduce the series resistance and so increase the current available from you 3.3V drive. R1 is typically 10K (102) so adding another 10K resistor across the existing R1 should be sufficient. This will require some careful soldering.

Step 7: High/Low Triggered Relays for Use With 3.3V Boards (e.g. ESP8266)

I recently went looking for a single relay board to use with an ESP8266 module. The ESP8266 has 3.3V supply rails. The module I found did not have a separate IN+/-, instead it featured a High/Low Trigger selection jumper (see the above photo). Unfortunately there is no schematic provide for the very inexpensive module, so you need to test it to see if it is suitable for use with a 3.3V output from your microprocessor board.

Testing consists of selecting the High Trigger jumper, powering up the module with 5V and then measuring the voltage on the IN terminal, with nothing connected to that terminal. In my case the IN open circuit voltage, when in the High Trigger setting, was a few millivolts. So this in will not harm the 3.3V microprocessor board. Next apply 3.3V to the IN input and check that the relay operates. In my case the relay did operate with a 3.3V input and only draw 1mA. If your relay board does not operate you may have to find a series resistor in the input circuit and reduce its value as described above.

I actually did this testing using an UNO board. I used the UNO 5V and GND pins to power the relay module and then measure the open circuit IN voltage. Then I used the 3.3V pin on the UNO to test driving the relay with this voltage.

Step 8: ESP-01 Relay Module

Another alternative is the compact ESP-01 Relay Module. The photo above shows the module with and ESP-01 inserted. Check when you purchase whether or not the ESP-01 is included. This module will work with either ESP-01 or ESP-01S. For an example of programming and using this module see ESP-01 Timer Switch

This module as a number of limitations/problems:-

Although the relay is rated for 240V / 10A, the board layout has minimal track spacing and the screw terminals are too small to accept heavy duty wire. For comparison the stand alone single relay modules above have larger screw terminals and physical notches cut in the circuit board to separate the 240V from the low voltage coil pins. So the recommended use is for switching voltages less than 30V.

The relay will flick on/off when the module is powered up. Depending on your application this may or may not be a problem. See ESP-01 Timer Switch for how to add a capacitor to the relay module to prevent this relay flicker on power up.

The relay has a 5V coil, but V4 of the Relay Module drive the coil from the 3V3 supply. (V1 used the 5V input instead). The schematic for the Relay Module V4 is here. Operation of a 5V relay from 3V3 is marginal. The two examples tested both operated, but if you find the relay does not switch on reliably the ESP-01 Timer Switch has a simple modification to convert the board to use the 5V input to drive the relay.

Step 9: FET Shields and Solid State Relays

FET Shields

An alternative to relays for switching low to moderate DC voltages is FETs. There are a number of boards available:-

All these can be driven by a 5V Arduino output and can control voltages up to 30V to 60V at 0.6A to 20A.

The actual voltage and current that can be controlled depends on the the FET used on the particular shield. You need to check the FET specifications. Look for the MIN Drain-to-Source Breakdown Voltage to see how much voltage the board can switch. The current carrying capacity depends of the how well the FET can get rid of the heat. Check the boards published specifications.

The LEDSEE 8 channel FET shield (with jumper JP1 removed) and the Yourduno 4 channel optical isolated board should also be able to be driven by 3.3V Arduino outputs, but I have not tested this.

Solid State Relays

Solid State relays are inexpensive and can handle high current loads. The one shown above will switch a load of up to 40Amps from a 24 to 380V AC supply. The control input is DC 3 to 32 Volts. However there are a number of things to look out for when using Solid State Relays with Arduino.

a) Make sure the relay is controlled by DC volts 3 volts and up. Some solid state relays have AC control inputs of higher voltages instead on DC control inputs.

b) Choose a relay that is rated for the current you need to switch. The one in the photo is a 40Amp relay

c) Make sure the relay can handle more then 1.414 times the AC line voltage. That is >340VAC for a 240V supply and >180VAC for a 120V supply.

d) Always attach the relay to a suitable heat sink using a thin smear of thermal compound that completely covers the base of the relay. Solid State relays can get very hot and burn out if the heat sink is too small. For a 10amp load, the relay needs to get rid of about 16Watts of heat.

e) Solid State relays are best suited for resistive loads like heating elements. If you are trying to turn a motor on and off a normal relay and a snubber is probably a better choice. This article has some information on Solid State Relays Common Precautions (local copy here) While this posting discusses snubbers (local copy here)

The main advantage of Solid State relays is that if it still working after 3 months (infantile failure) it will probably work for many years.

The solid state relay can be controlled with 3V, so is suitable for the 3.3V arduino boards. However it takes about 12mA to switch the solid state relay, so do check that your board can supply that amount of current from a digital output. Some 3.3V boards, like LinkIt ONE, will only supply 3mA from a digital output. Arduino Uno boards can supply about 20mA.

Step 10: Help My Relay Stopped Working (RC Snubbers)

You have tested your relay on the bench with a multi-meter, but after you install it, it stops working. That is it won't turn OFF. This happens most commonly if you are switching inductive loads, like motors, ceiling fans, etc, but can also happen when switching incandescent lights and is caused either by the contacts welding close due to high initial current OR arcing on opening and continuing to pass current.

Assuming you can normally hear the relay operate (a small click), then if you can not hear it click when it should be opening then the contacts may be welded together, you will need to replace the relay in this case. If you can hear it click when it opens but the motor keep running then the contact are probably arcing.

The solution to these problems is to add a snubber network. This pdf has some examples and suggested sizings. This discussion (local copy here) also has information on choosing snubbers. RC snubbers are also available pre-built in a variety of sizes, e.g at element14.

ESP8266 + 4 Relays + USB = Failure

In this case you are using an ESP8266 base board and 4 or more optically isolated relays. You have separate VCC and JD-VCC connections. The JD-VCC is the 5V supply for the relays and the VCC is the opto interface supply, the ESP8266 3.3V supply. You have plugged your board into your computer's USB port to program it but you find that while using only 2, and possibly 3, relay work, when you add the fourth relay the ESP8266 stops working correctly. The problem is likely to be the limited 5V power supplied via the USB port.

The ESP8266 draws about 220mA when using WiFi (and more on startup) while each 5V relay draws about 90mA so ESP8266 + 4 Relays >= 580mA. This 580mA is greater than the 500mA must USB ports are limited to. To solve this problem use a larger USB supply, 1A or 2A.

Remember it is all about POWER.


There are a number of types of relays you can add to your Arduino to switch real things on and off. You need to choose a relay appropriate to your needs.

The simplest solution for on/off Home Automation is to use the free pfodDesigner to design your control for upto 4 switches and then use a Arduino Uno + Cheap/Simple Wifi Shield + DFROBOT Relay Shield for Arduino V2.1 powered by a USB power supply and controlled by pfodApp and, if switching mains power, have an electrician wire it in.

Tech Contest

Participated in the
Tech Contest

Microcontroller Contest

Participated in the
Microcontroller Contest

2 People Made This Project!


  • For the Home Contest

    For the Home Contest
  • Big and Small Contest

    Big and Small Contest
  • Make It Bridge

    Make It Bridge



Tip 1 year ago

Update: 5th Jan 2022 – Added ESP-01 Relay Module


Tip 1 year ago

Update 19th Dec 2021 -- It has been 7 years since this was first published and a number of the products referenced here are no longer available.
marked up a number of product links as “no longer available”. Classic Bluetooth shields have been replaced by BLE shields/boards. BLE is more difficult to use but pfoddesignerV3 and pfodApp makes it easy.
See Bluetooth Low Energy (BLE) made simple with pfodApp.


2 years ago

thank you so much ,


5 years ago

What most people are failing to realize is with the optical isolated multi relay boards all the opto's high side are tied together through the 5 volt coming from the Arduino board. this means you have to connect the low side pins on the relay board to the output pins on the Arduino and set that pin to low to make the relay turn on, when the pin is high the relay will be off. if you do not declare this in your sketch setup the relay will be on from the start up because the pins are automatically set to low and your project will not function properly.

Setup ()

digitalWrite(RELAY1, HIGH); // This will Turn Relay 1 Off so when the loop starts your relay will be off......if not they will all be on.


Reply 4 years ago

That is a pretty good point indeed.! Thanks.


6 years ago

I'm planning to do a home automation project
how can i interface 5V 4 Channel relay and a sim 900 module (without power supply) to arduino uno which has only one 5V pin and one 3.3 V ?
_I'm new to arduino


Reply 6 years ago

For an alternative and better means of powering the arduino/SIM900/relay boards see this project


It is a robotic arm powered from a 3A 5v supply via prototype shield directly to the Arduino 5V header pin. Note the capacitor 220uF on the prototype shield between +5V and GND close to the Arduino 5V pin Both the SIM900 and the relays draw current in spikes and the capacitor helps smooth these out.

Using this approach you would power the SIM900 from the Arduino +5V (plug the SIM900 into the prototype shield header) and also wire the relay +5V to the prototype shield 5V rail.


Reply 6 years ago

This tutorial shows you how to connect a SIM900 and a Mega and one solid state relay

An Arduino Mega is used as it has more RAM available then the UNO.

For your case of 4 relays, the free Android app pfodDesignerV2 lets you design an android menu and then generates all the code necessary to turn outputs on and off via SMS (using pfodApp). There is an option for a 128bit security password to prevent un-authorized people controlling the relays.

You may find the UNO does not have enough RAM to run the generated code. If you already have the UNO try it and see. Otherwise order a Mega.

What is left to do is to supply your 4Channel relay board with 5V from the supply and connect the digital outputs to the relay inputs to turn them on and off.

Both the UNO and the Mega have a polyfuse on the USB supply input. So if you find the Arduino keeps rebooting, it probably means you are drawing too much current via the Arduino USB input. In which case use a 7V to 9V (note not 12V) supply to power the Mega via the power jack and power the SIM900 and relay board from the Mega 5V pin.

In any case DO NOT use your computer's USB to power the Mega with the SIM900 connected as the computer's USB ports are limited to 500mA.

Contact pfod.com.au via support if you have any problems.


6 years ago

Hi! I hope you can help me, I'm really a noob with this. I have a four channel relay board and my idea is to connect three different things that use different voltages and different amp.

It's a desk lapm that is now connected directly to 220v

A fan that is also connected to 220v

and a RGB led strip that uses a 12v 2.0 amp power supply. My Idea is to control the relay board with the arduino and centralize it in one sector of the room. How would I connect every device to the relay board? is it ok that all devices use different voltage or amps? I hope I made myself clear.

Thanks in advance!


Reply 6 years ago

Hi AssliH,

Yes that is possible. but be careful 220V can kill you. It is recommended you get a electrician to wire the 220V parts.

Basically you take the two leads running to the device, say the RGB strip, and cut one of the leads and connect one of the cut ends it to the Common (C) and the other to the Normally Open (NO) relay terminals. When the relay operates it connects these two terminals together and joins the wire you just cut and your RGB strip turns on (if you have already turn on the 12V 2.0amp supply)

This tutorial, Home Automation for Beginners, shows you step by step and also shows you how to build a custom Android App to control the relays. No coding required.pfodApp handles all the Android side and the free pfodDesignerV2 lets you design your own menu and then generates all the Arduino code for you.


6 years ago

Hello, I wanted to know if I could use an arduino relay for switching power to a whole house. (for switching between a solar power and main grid power lines)


Reply 6 years ago

I think you would need to use the Arduino relay to switch the voltage to the coil of the HIGH POWER relay that actual switches between solar and mains power. The relays shown here only carry enough current for one power point. Not enough for a whole house.

Mark JanezS
Mark JanezS

6 years ago

How do you control the relay?


Reply 6 years ago

In the second picture above, Output D4 is connected to the relay. Make Output D4 high/low to control the relay.

If you are using pfodApp to control your Arduino from your Android mobile then you can use the free pfodDesignerV2 app to design the Android on/off slider user interface, interactively, and then generate the Arduino Code to connect to pfodApp to allow you to control the relay from your Android mobile, (no Android coding required)

You can connect to your Arduino with pfodApp via Bluetooth, Bluetooth Low Energy (BLE), Wifi, Ethernet or SMS


6 years ago

Added a section, Help My Relay Stopped Working (RC Snubbers)


7 years ago

Hello, i have i more question.

If i would use 5V 16 Channel relay board and switch it from Arduino:

1. use external power for 16xRelay board - Can i switch with Arduino all 16 Relays at once? does it still apply the 200mA limit?

2. if 200mA is applied ,do i need to switch it via some kind of power tunner?

This is the board


Reply 7 years ago

For that many relays I would use an external 5V supply to power the coils.

It is a bit hard to see what the circuit on the board is, but I assume there is at least a transistor driver to switch the relays.

I suggest you use a multimeter to measure the current needed to switch one relay and work out from there how hard you will be stressing the Adruino chip. I would keep the the total to 100mA or less, myself.


Reply 6 years ago

These relays draw only 40milli-amps @ 5V. But it is always a good idea to make it a habit of placing an ammeter between source and load. Also, most of these relays are switched on via an optocoupler, so no need for flyback diode protection. see my video: Control 8 relays, plus 2 servos, completely independently AND simultaneously with a $3.00 ARDUINO 'Nano' and a simple sketch based on Object Oriented Programming and State Machines methods,https://youtu.be/xOqstsdmj54


Reply 7 years ago

Need to wait till it arrives, then i can test, but the Relays are SRD-05VDC-SL-C, as i test it on the 8x relay board it was 33mA/relay

1. so if i want to use all 16 Relays at once, does the EXTERNAL 5V power supply to the Realy board makes any difference/help for Arduino board?

2. if not how to drive all of them at once?



Reply 7 years ago

Did you measure the current from Arduino digital output to drive the relay IN? Should only be a 1 or 2mA.

16 relays at 33mA each coil is about 530mA, This greater than the 500mA USB ports normally provide but you could use a USB Wall adapter instead, say a 1A or 2A one, and power the Arduino from it and then use the 5V Arduino output to power the relays. Note: do not use the 7V to 12V Arduino input to power the board and relays as the onboard Arduino 5V regulator is not designed to handle this much current.

If you want to program the Arduino while the relays are being driven then use a powered USB hub to supply the power and to protect your computer's USB port from power overload.

The Arduino has a 1A resetting fuse in the 5V line but you should be OK at 530mA + some trigger drive current per relay.

Finally if you are using an UNO you will need to use some of the A0 to A5 pins to drive the relays. You can control the A0 to A5 as outputs by referencing them as Pins 14 to 19 in your code