Switching(Relay) Interface for IOT Devices

By | September 17, 2017

Hey Everyone.

Before making any IOT Device using any microcontroller or development board, one must be aware of interfacing 220V-AC appliances(or, load) with there device. Since, the aim of the IOT devices is to operate the heavy load machines or home appliances which run on 220V-AC with a microcontroller which operate these machines as per our code stored in it.

Now, the microcontroller or other electronic control systems majorly operate at 5V-DC so they cannot operate these 220V-AC machines. Thus, the requirement for a intermediate switching device comes into significance which can easily operate these heavy voltage machines without damaging our controlling device.


“Relay is an electrical device, typically incorporating an electromagnet, which is activated by a current or signal in one circuit to open or close another circuit.”



Components required:

  1. SC5-S-DC6V Relay [ Input: 6VDC (Max.) / Output: 240VAC-7A (Max.) ]
  2. BC547 NPN Transistor
  3. Any Microcontroller Development Board (I am using Atmega8 based development board)
  4. Table Lamp (Or any AC load)

Now first of all, just write a code in any microcontroller(like, Atmega8) or development board(like, Arduino or Raspberry Pi) to send ‘1’ or ‘0’ to a pin (which you would further connect with relay). The condition for sending ‘1’ or ‘0’ can be any, either you can toggle the output between ‘1’ and  ‘0’ in a fixed interval of time(using delay function) or you can use input from another pin to toggle between ‘1’ and ‘0’.

Once you are done with programming your microcontroller make the connection as shown in the circuit diagram.

Circuit diagram:


After making the complete connections, your circuit should work as LOAD “ON” for PIN OUTPUT = ‘1’  and LOAD “OFF” for PIN OUTPUT = ‘0’

So, once you have learnt interfacing relays with microcontrollers you can now control any 220V-AC device with your microcontroller and implement it in your IOT based device. Just some smart coding is required!!!