Intelligent Sockets for Automation Through IoT

DOI : 10.17577/IJERTCONV6IS13173

Download Full-Text PDF Cite this Publication

Text Only Version

Intelligent Sockets for Automation Through IoT

Adyanth H

Ananya M B

Bharath V N

Shreekanth T

Dept. of ECE

Dept. of ECE

Dept. of ECE

Dept. of ECE





Mysuru, India

Mysuru, India

Mysuru, India

Mysuru, India

Abstract The intelligent sockets are a step forward in the normal implementation of a switchboard as existing systems are modified to preserve the layout. The additional features will be present in a non-intrusive way in the form of a web interface and a server placed along with the router at home. The facilities that can be provided to the user is easily improvable further in the form of software updates. The features like automatic timer, manual timer, live camera feed for security, current sensor to check for overload and log the usage which can be further used for studying power consumption trends via machine learning.

Keywords Nodemcu; smart socket; timer; security.


In this era of automation, our life is getting automated. This can be seen in the active development of smart devices and artificial intelligence being included in the day to day devices. The machines used in house-hold chores and facilities like washing machines, microwave ovens, electric induction stoves, air conditioners, etc. have some intelligence in it, including, but not limited to, timers and temperature sensors for automatic turn on, power saving when not in use, and other helpful features. We are implementing this idea of smart devices into the switchboard to control the devices connected to it. Power saving can be implemented centrally, the state and timing can be locally or remotely controlled via a user- friendly interface.

  • Xiao et al. proposed a system to intelligently link independent electric appliances to gather information and control those subsystems at a low cost and power consumption. It was not extensible to large scale systems, hence could not be scaled [4].


      The intelligent socket consists of two major blocks,

      1. The switchboard part with NodeMCU

      2. The server part with Raspberry Pi


  • Xu et al. proposed a system using MSP430 to achieve wireless home mobile intelligent socket. The system can be connected and controlled via SMS and a mobile app. Some of the disadvantages are lack of intrusion system, making it prone to dangers of trespassing. Unavailability of child access system leaving children vulnerable to electrical exposure [1].

  • Pawar et al. proposed an attempt to measure power consumption in residential areas with the use of Zigbee. The setup consisted of op-amp circuits to measure instantaneous voltage and ACS712 30A current sensor to calculate the instantaneous power. Higher cost of implementation due to the use of Zigbee and decrease in the range. Hence it is not ideally suited for this project [2].

  • Santoro et al. proposed an innovative socket to monitor power consumption for demand and response analysis and to plan the generation of power. They also did a calculation of the total harmonic distortion and transmit the data to the monitoring station. There is no active logging system, which restricts user usability of the system [3].

Figure 1. System block diagram of intelligent sockets.

The NodeMCU present in each of the switchboard is the actual interface to the 220V AC system. It communicates with the server to receive state information as well as timing, Accordingly, a simple algorithm decides what to turn on and off. The current sensor is read and kept track of for both overload protection as well as power consumption analysis.

The server keeps track of all present states of the sockets, user inputs, timing of both automatic and manual timers. This further provides a platform to host a live stream from a camera so that user is kept informed during his/her absence. Everything may be locally implemented for security.


    Node MCU: This development board based on ESP8266-12E Wi-Fi module is the base for the aforementioned sockets. This, after receiving and processing the data from the server, controls the sockets using a 4-channel relay module. The current, and thus, power being consumed, is being measured by ACS712 -30A Hall effect current sensor.

    4-channel relay module: This is an opto-isolated relay module being driven by active low 5V logic. The other end of this relay module is connected to AC mains to be able to control it.




    Initial Contact


    Initial Insulation Resistance

    100M, 500VDC

    Unit weight


    Coil voltages @5V Coil resistance

    3.80V pickup, 0.5V dropout, 70±10%


    Sealed IP67

    Operating voltage AC

    15A@125V, 10A@250V

    Temperature range

    60oC max

    ACS712 30A: This is a fully integrated, Hall Effect-Based Linear Current Sensor IC with 2.1 kVRMS Isolation and a Low-Resistance Current Conductor. This means that, it is perfectly safe to interface with low power microcontrollers and precisely measure the current flowing through at any instant.



    Range of current




    Zero Current output


    Output current source


    Output current sink


    Operating voltage

    4.5V-5.5V, 8V max

    Temperature range

    -40o to +85o C


    NoIR Raspberry Pi Camera: The Raspberry Pi camera module is an integrated board easily attachable to give a static photo or a video input to the Raspberry Pi. This connects to the Raspberry Pis Camera Serial Interface (CSI) bus connector via a flexible ribbon cable. The cameras image sensor has a native resolution of five megapixels and has a fixed focus lens. It is a NoIR camera, which means that it has no IR blocking filter and can be used in the dark with IR lights since it is being used for surveillance.



    Native resolution




    Lens type

    Fixed focus

    Photo resolution

    2592 × 1944

    Video resolution

    1080p30, 720p60 and 480p60/90

    Operating voltage

    4.5V-5.5V, 8V max



    This section contains information on the design and implementation of the complete proposed model.

    Intelligent sockets is not a replacement to the existing switchoard, rather a modification to the existing hardware. Not only does it connect the switches to the internet, it also provides remote accessibility, helping in efficient usage of power in the household.

    It provides security as it stores the live feed from the camera on the server. It also may prevent fire hazards and overload due to short circuit in the sockets. The control of switches from the server can be through voice. For instance, to switch on a fan, all it takes is for the user to say "turn fan on. We have also implemented timer on the switches so that a device can be switched off after a specified time interval.

    1. Client/Socket side

      The socket side interface consists of a NodeMCU following a control flow according to the algorithm given.

      • Maintain a previous and current state vector for both hardware and software switches.

      • Initialize the ports and the Wi-Fi connection.

      • Do forever,

        • The current reading is checked to be under the threshold, along with sending it to the database every minute.

        • The timing information is retrieved every 5 minutes and set as required.

        • Get the status of all the switches from the database.

        • Do for each hardware switch,

          • Read the state of the switch.

          • If there is a change from the previous state, update the previous state and set the socket state.

          • Send the new state to the server and change the software vectors.

          • If there is any change in the software state, indicating a virtual switch press, update the previous software state and set the socket state accordingly.

      The Figure 2. shows the flowchart of the given algorithm. It can be easily seen that control is two sided with both remote as well as local control.

      In the socket side, the normal switch interface remains same to provide an element of familiarity to the user. This data, combined with that of the servers is used for the decision.

      To provide these functionalities, open-source libraries such as ArduinoJSON for processing JSON data, ACS712 library for the current sensor were used. Further, a custom library was written to establish connection to the PHP script to communicate with the database. To upload these codes, Arduino esp core [5] was used in Arduino IDE.

      Figure 2. Client-side control flow

    2. Server side

      A raspberry pi was used to host a LAMP webserver which serves four purposes.

      All logging information is saved in the server, i.e. the Raspberry Pi itself. The web interface which dynamically changes its page width to be compatible with the mobile platform is also hosted here. The whole system will take care of both physical switch presses as well as remote control instructions along with timer service.

      User Interface: This provides the user with a control interface which can be used to switch the sockets on or off remotely. This also provides the timer interface for the user to program the sockets in a timed mode for ease of use.

      The timer has two modes, one being daily repetition mode and the other being one-time mode.

      The manual mode is for a task which exists right now, such as charging a phone for 2 hours. This can be set and forgotten, the socket will turn off automatically, saving power as well as preventing an overcharge. The auto mode is for a task that is of repetitive nature, like turning the porch light on

      and off from 6pm to 7am. This can be input once, and the device does this task every day, without being reminded of it.

      Live Feed: This is the camera interface which shows the output of the camera in real time. This allows the user to remotely monitor the house. Since a NoIR camera is used, it can be paired with IR floodlights for a clear view during nighttime.

      Communication Interface: These are for the NodeMCU to communicate with the servers database to get the configuration and log the current details.

      SQL server: This is the backbone of the whole system that keeps track of the current state and timing information given by the user. This also contains the information on the current/power consumed by the whole system.

      RPi Cam Web Interface is a web interface for the Raspberry Pi Camera module. It can be used for a wide variety of applications including surveillance, DVR recording and time lapse photography. It is highly configurable and can be extended with the use of macro scripts. It can be opened on any browser, even on a smartphone.


    The Figure 3 shows the hardware of intelligent sockets. We currently have added four sockets to be controlled. The board has NodeMCU, relay module and current sensor built into it. The working can be easily seen as the mosquito repellant connected to socket 1 is turned ON even as its corresponding switch is OFF. This is because, the first socket was turned on using the web interface shown in Figure 4. This is scalable to smartphone displays as well.

    Figure 3: The initial setup is made as shown in the gure

    Figure 4: Home Page

    Some of the points that can be noticed are:

      1. A HTTPS connection: Ensures data cannot be hacked while being used to control the devices.

      2. Microphone access: It is given to the page for easy, client-side voice control.

      3. Virtual switches: These reflect the state of the hardware sockets, and also used for control by clicking on it or by voice.

      4. Voice commands: The predefined voice commands can be used to turn the switches ON and OFF. Additionally, it can also be used for navigating to other features such as timers and camera feed.

    As it can be seen in the image, SSL certificate was added so that it provides authentication and encryption for the data transmitted as shown in Figure 5.

    Figure 5: SSL and digest authentication.

    Also, voice recognition function provided by webspeech API was used to provide voice command support so that almost everything can be done using voice. Figure 6 and Figure 7 shows the timer interface provided.

    Figure 6: Auto timer

    Figure 7: Manual Timer

    Further, the live feed from the camera can be seen in the Figure 8. This has options ranging from photo and video record to automatic actions being performed when motion is detected. This can be used when the user is away from the home.

    The security aspect of this product resides in the server connected with a camera to broadcast the live feed to the user when required. This interface as shown in Figure 8, can be used to remotely monitor the house for security reasons. The interface also allows image and video recordings, motion detection and more.

    Figure 8: Live feed interface


    We have designed and implemented "Intelligent Sockets" – a system with enough intelligence to be voice controlled, remotely accessible, secure, remote monitorable so that a peace of mind is guaranteed for the user.

    • Remote control of devices over internet.

    • Timers for each device.

    • Overload protection.

    • Intrusion system.

      This was achieved by using a LAMP server to control the devices remotely with a web interface which features manual control along with predefined voice commands. Auto mode and manual mode timers deal with different ways for turning the devices ON and OFF for specified interval of time. For overload protection, we have used hall sensor which switches off the whole circuitry if it detects an overload. Intrusion systems comprises of Pi camera for live feed with additional features like offline recording and motion detection.

      Some of the advantages are:

      • The remote access and control helps use the energy more efficiently for better sustainable development for the future generations.

      • As they rightly say, "Greenest Watt is the one the need not be produced&quot, it helps avoid wastage.

      • Automatic and Manual timer mode provides better and user friendly interface for using the energy from the grid more efficiently.

      • As it will be integrated with the existing hardware, the front end usage platform will be just like the conventional platform i.e, the switchboard, so it is much easier to adapt to this new technology.

      • The live feed from the camera helps user to constantly have an eye on their homes, to detect any intrusions.

      • It is very cost effective, as it does not require any much of new hardware.

        Some drawbacks that can be further improved upon are:

      • Latency is one of the prime concerns of this project, i.e., control might not be instantaneous, as the states that is read from the switchboard or the user interface on the web interface has to go to server and come back.

      • No redundancy for remote control, if network fails. Only local interface will be available.

      • Strict security should be in place. Otherwise anyone can control the switching system of the house.

      • Sleep mode can be implemented to automatically switch OFF the Wi-Fi connectivity of each unit when not in use.

      • The target devices can be switched OFF in the case of it being ON and drawing power below a threshold.

      • Power consumption can be monitored and logged, with the help of this logged data the current bill can be estimated and notified to the user.

      • Touch screen user interface can be provided at each switchboard along with timers.

    With these improvements, the product may easily be suitable for customers through mass production.


  1. A. Xu and S. He, "The wireless smart socket control system design," 2017 2nd International Conference on Advanced Robotics and Mechatronics (ICARM), Hefei, 2017, pp. 698-703.

  2. P. Pawar and K. P. Vittal, "Design of smart socket for power optimization in home energy management system," 2017 2nd IEEE International Conference on Recent Trends in Electronics, Information \& Communication Technology (RTEICT), Bangalore, 2017, pp. 1739-1744.

  3. P. Santoro, V. Calderaro, V. Galdi and A. Piccolo, "Active smart socket design to perform local control of power demand in residential units," 8th IET International Conference on Power Electronics, Machines and Drives (PEMD 2016), Glasgow, 2016, pp. 1-5.

  4. M. Xiao, Y. H. Liu and Q. Hu, "Design and Implementation of Socket-Based-Network Connections Smart Home System," 2016 Sixth International Conference on Instrumentation \& Measurement, Computer, Communication and Control (IMCCC), Harbin, 2016, pp. 756-760.

  5. GitHub (2018), esp8266/Arduino, [online] Available at: [Accessed 20 Mar. 2018].

Leave a Reply