The intelligent Home is an important realization of the environments of brilliant electricity. The designed module is to be considered using in smart home applications where electrical safety is required. This can be achieved, by measuring electrical current, voltage and the power of connected device. The electrical parameters are monitored and controlled by client application software running under widely used internet browsers. The module is also monitors the status of the plug and the surrounding temperature of the socket. The main advantage of this design is making useful and important module for the universalmodules. Test the results of this module system have shown that it can be easily used for the smart home automation applications. ESP32 microcontroller system is utilized to log data from several sensors and measurement modules and transmitted via Wi-Fi. The proposed module is a universal module which could be connected to any standard socket. Although, other programming environments such as LabVIEW is recommended to develop software for real time monitoring and control.
smart module, IoT, LabVIEW, building management system, internet browser, electrical plug
Modernization and innovation in electrical power socket design is a continuous challenge in smart home application and Building Management System (BMS) . The recent developments in technology which permit to use power sockets have enabled to connect different domestic devices and equipment into electrical network. As a part electrical network, electrical sockets play an important role in home applications and safety . But the usage of these sockets can be dangerous for several factors such as: short circuit fault, open circuit fault and overloading occurrence, when a device or equipment is connected into the electrical network via a socket. In addition to that, carelessness or to lack of awareness of some basic rules should be mentioned as dangerous factors which lead to many serious accidents. In spite of rarely occurrence of accidents in home due to the mentioned above factors, there is a demand of developing and improving existed domestic sockets.
According to the number of holes, electrical sockets which are used in home application can be classified into “two holes” and “three holes’ sockets [4, 5]. The internal design of these sockets depends on manufacturers and requirements defined by the metrological agency in a country, where the socket will be installed .
Although, there is another classification of the sockets which depends on the outlet plug used in the country, for example in USA, there are about 15 types of electrical outlet plugs existed in the market. These plugs assigned a letter by US Department of Commerce International Trade Administration (ITA), starting with A and moving through the alphabet . As a fact, sockets manufactured to accept only compatible plugs inserted in the correct orientation.
The general description of a plug is followed. It consists of an outlet cover , and two or three holes provide two main functions: housing and fixing of the connected plug. The “two holes” socket has two connections: neutral connection, which is being earthed at distribution board and line or hot connection which carries voltage relative to the neutral line. An additional connection is added to the three holes socket, which is a protective earth. In addition to that, some sockets are available with a knob which connects or disconnects the pins of the plug to/from electrical network. Other sockets may include a switch and circuit breaker unit.
The modern design of excited sockets shows that new sockets in the market are available with screen monitor, motion sensor, energy saver and other IoT (Internet of Things) components which make these sockets safer and more reliable for use .
The work considers a design of a universal socket module, which could be connected to any types of existed sockets without changing the design of the installed socket.
In work , the author proposes a GSM smart socket, which is a simple device that monitors the physical activity for older adults living alone, the observers will receive SMS (Short Message Service) notifications, where the observers are relatives and medical staff for nursing services. This system monitors physical activities using sensors technologies such as accelerometer, gyroscope track, position and kinematic sensors. The product’s idea has been born from a rethinking of the well-known device GSM (Global System for Mobile Communication) Alarm - GSM socket. The basic GSM power sockets are designed just for remote switching and reboot. Also the sockets can send SMS about power failure alerts. It could contain several sensors to send measured information too; sensors could be temperature sensor, gas sensor, fire sensor, built-in microphone. The GSM smart sockets send notification to End-users via SMS for switching-on electrical devices, by two possible modes, one by - direct sending notification to End-users, Other by sending notification to intermediate server, which routes it to End-users. Using second choice (intermediate server) lets us to process the data, for example: estimating the behavior of individual sockets, for example: the adult turns on particular device in specific period of time every day, where the absence of this activity will be notified and sent to End-users as an expected fault/alarm. Intermediate server could send the notifications by different transport mechanisms, as like Push notification, and Twitter.
The author in work  illustrates a solution for the stand-by power of turned-off appliances, which consumes electric power by eliminating it. The proposed design uses a microcontroller unit (MCU), and two sensors, one for current CBCT (Core Balanced Current Transformer), and other for presence of user in the room - PIR (Pyroelectric Infrared) sensor, and a communication module (ZigBee). The work stated that the proposed socket is easy to install, cheap and saves power efficiently. The work presented a compare between the readings of CBCT conditioning circuit to Clamper readings, it was fairly matched.
The output reading from MCU is fed to ZigBee communication module, ZigBee from socket side and ZigBee from Data Center side are configured as Router and Coordinator respectively. Socket side ZigBee sent Load Current data to data center ZigBee. The work contains a test for the algorithm after constructed PIR sensor and CBCT conditioning circuit as inputs, Relay and RS232 as outputs.
In work , the author presents an intelligent power outlet system that can be controlled wirelessly and that has been specifically designed to monitor electrical events in low-current loads. Each power outlet of the system embeds a microcontroller, a 2.4GHz ZigBee interface, RFID (Radio Frequency Identification) reader, a relay, and a current sensor. The main features of the system include the remote control of the power outlet, real-time monitoring of the current consumption, the customization and programming of the power supply time schedule, the automatic interruption of vampire currents, and the prevention of certain types of electrical fires and electrocutions. The author of the work  addresses some of the most common problems that arise when interacting with power sockets and shows a novel approach to two of them: the prevention of electrical fires and the avoidance of electrical shocks. The proposed socket has two safety features: It's able to detect overconsumption that might cause overheat in low current systems and, therefore, to electrical fires. Also it prevents electrocutions, since it only supplies power when it identifies a valid appliance. It also gives other features; it can be remotely using wireless sensor network technology. It is able to monitor in real-time and make available to external devices (e.g., PCs connected to the Internet, smart phones, and tablets) current consumption data. It can disconnect the power supply when a vampire current is detected (a vampire current is a current that arises when an appliance consumes power when it is in stand-by mode or when it claims to be switched off).
It was stated that all commercial smart power sockets have mutual functionalities: can switch on/off outlets, and monitor energy consumption. It was stated also that although the traditionally electrical protections (e.g., circuit breaker and fuses) achieve their goal when configured properly, they usually don't adapt dynamically to the environment or to the connected appliances. The system proposed by the author in work , prevents electrical shocks based on the following principle: if there is no appliance connected to the outlet, electricity will not be supplied. In this way, most of the tampering will have no consequences and no electrical shocks should occur. The solution of electrical shocks comes from sensing appliance plug by RFID reader and tags; where the tag is attached to appliance's plug, the electricity is on when the tag is a few centimeters away from reader in socket.
For cost minimization , it was recommended to replace the ZigBee module with ESP8266 which also supports interfaces with mesh capabilities. It also explained the need of using WSN (Wireless Sensor Network) based communication architecture, whose use of certain nodes as repeaters allows for compensating signal attenuations. The work included Reaction time calculation of the reaction time of switching off the relay due to short circuit/over consumption current. In a study of preventing Electrical fires and shocks. Concluded the reaction time of the proposed socket (1.23 ms) is faster than MCB (Miniature Circuit Breaker) trip time (20 ms) then it's safer.
Besides the mentioned above works, Fibaro manufacturer produces a smart wall plug  that uses Z-Wave communication technology which has the ability to create mesh network by duplicating received signal from a socket side into data center side. Wall plug switches the power using a relay with output power up to 2.5 kW, the plug visualizes the load current by a color changing crystal LED ring. It could be operated using the service button located on its casing, or via any Z-Wave compatible controller. Fibaro is a wireless system, based on Z-Wave technology, the radio signal is weakened by various obstacles located on its path, and in extreme cases it fails to transfer required data. The advantage of the produced System is that its devices are working as duplicators into the data center device. Fibaro is a bi-directional wireless system. This means that the signal is not only sent to the receivers, but also the receivers send the confirmation of its reception. Fibaro operates in the free band for data transmission. Although Z-Wave is quite new technology, it has already become recognizable and officially binding standard, similarly to Wi-Fi. Fibaro generates a dynamic network structure. After Fibaro System is switched on, the location of its individual components is automatically updated in real-time through status confirmation signals received from devices operating in a "mesh" network. The Fibaro Wall Plug is protected from overcurrent or short circuit [14-15].
Other works [16-18] which are related with energy management and electrical outlet design also present smart socket modules and smart monitors which could be used in smart home application.
Building on the above, the purpose of this work is to illustrate the design of smart socket for home application which will be capable to protect consumer form electricity failures and monitoring the parameters of electrical devices connected to the socket. The literature review shows that the core of smart socket is based on the usage of microcontroller development or IoT components such as ESP32. These components are utilized for data acquisition, processing and communication. The block diagram of the smart socket is shown in Figure 1.
The plug unit consists of two main components: a smart key identifier (Radio-frequency Identification system -RFID ID12-la) which is used to enable the socket to work and IR sensor (IR Transmitter –Receiver) to detect the presence of the plug pins in the socket.
The second unit is a testing unit, which provides testing for the following electricity parameters: short circuit test, open circuit test, current and voltage measurement, power measurement, load identification, overload protection.
The short circuit and open circuit tests are based on measuring the resistance of the connected lead wires and current flow across the lead wires. In order to measure the current and voltage and load identification, a Multifunction Power Monitoring Communications Module Monitor Module (PZEM-004T) is used.
Figure 1. Diagram of smart socket
It provides current and voltage measurements with rated power of 100A/22kW and sends data by serial communication. The operation principle of PZEM-004T is based on utilizing Current Transforming principle, the output of the transformer is then converted into corresponding voltage. The module also includes TTL serial data communication interface, which provides easy connection into PC or microcontroller units. The third unit is the processing and control unit, which is the core of the proposed module. It is developed using ESP32 unit. The unit includes the most popular components for IoT development . The schematic connection of a Multifunction Power Monitoring Communications Module Monitor Module (PZEM-004T) and ESP32  is shown in Figure 2.
Figure 2. Connection of PZEM-004T andESP32 unit
The schematic connection design of the proposed module is illustrated in Figure 3.
Figure 3. Schematic design of smart socket module
The electrical connection of smart socket module for two holes standard socket is shown in Figure 4.
Figure 4. The electrical connection of smart socket module for two holes of standard socket
Table 1. List of components
Control, measurement, communication, data logging
Measurement of electrical parameters
To cover the designed module
To connect socket components
To power on/off the socket
Radio-frequency Identification system
As shown in Figure 4, the lead wire of a standard socket is to be connected to the proposed module; the IR sensor which is fixed on the front of the socket defines the presences of the plug. A smart key identifier is used to activate the module for further operation. At first, the module provides a short circuit and open circuit tests of the leads, the corresponding message will be sent over Wi-Fi channel to a server or smart phone. In addition to that, a Buzzer will generate different sound tones according to the test. If no short circuit or open status circuit is detected, the microcontroller connects the lead wire to the electricity network by activation a relay. The parameters of electricity are measure by PZEM-004T and these parameters are transmitted over Wi-Fi channel to server or smart phone. The usage of PZEM-004T provides to calculate the current, voltage and consumed power. The overload is defined by measuring the current flows across the wires and measuring the temperature surrounding the hot line. If the system detects a notable change in temperature surrounding the hot wire (10oC from the room temperature), the microcontroller will deactivate the relay and an alarm signal will be send to the user. Table 1. shows the main components used to build the smart socket module.
The software design for the smart module is a client service tool which could be monitored and controlled by the user in most popular internet browsers such as Chrome, Microsoft edge or Microsoft internet Explorer. According to ESP32 manufacturer , ESP32 could be programmed under various programming environment such as Arduino IDE and Toolchain . In addition to that API (Application Programming Interface) which includes several functions to program ESP32 is also available for programmers. In this work, Arduino IDE is utilized because of its simplicity and it includes all necessary libraries for ESP32.
Although, other programming environments such as LabVIEW [22-26] is recommended to develop software for real time monitoring and control. The development process of the software is shown in the flowchart Figure 5.
Figure 5. Flowchart for software programming
The electrical parameters measured by PZEM-004T are displayed on the client webpage; in addition to that the surrounding temperature and plug detection are also displayed in the same page.
The graphical user interface is developed under LabVIEW environment [27-28]. LabVIEW allow building both server and client application and browsing the information on internet via internet Explorer.
To test all the functions of the proposed system, a module was built. It was designed to be a simple home automation application and to cover all shapes of existed sockets in the market.
Figure 6 shows a snapshot of the user graphical user interface developed by LabView environment using the web publisher utility. The developed software can be used from multiple device hardware such as Laptops, PCs, and smart phones with any web browser.
Figure 6. Monitor of electrical parameters
The procedure of the implemented smart module is followed:
1.The user connect the load into the plug.
2.The plug is enabled with a valid RFID card.
3.The smart module provides all tests before connecting the load into the electrical network.
4.If the tests have being succeed, the module connects the load and monitors the electrical parameters and displays them on the browser.
5.If the tests did not success, the module define the problem and one of the indicators is ON.
Figure 7. shows the photo of developed smart socket module.
Figure 7. The main components smart socket module
The main components in figure 7 are
1. ESP32 NodeMCU as a microcontroller, this version contains a built-in Wi-Fi module, it's intended to connect things easily serving out the internet of things (IoT) concept.
2. PZEM-004T Power measurement device, the device provides current and voltage measurements with rated power of 100A/22kW, sends data by serial communication.
3. (ID-12LA) RFID reader, its pins are apart 2 mm spacing, with a built in antenna, it reads tags with frequency of 125 kHz, sends data by serial communication.
4. Relay switch.
A smart socket module for smart home application has been designed and developed. The proposed module is a universal module which could be connected to any standard socket. ESP32 microcontroller system is utilized to log data from several sensors and measurement modules and then data is transmitted via Wi-Fi to be displayed on client application developed under LabVIEW environment. In addition to that, the microcontroller system is used to control and monitor the status of smart module.
 Ma Y. (2013). The design and application of intelligent electrical outlet for campus’s electricity saving and emission reduction. Bulletin of Science and Technology 29(9): 102-105.
 Okereke Eze A, Gozie I, Opara FK. (2013). Design exploration of a microcontroller based rf remote control 13amps wall socket. IOSR Journal of Computer Engineering (IOSR-JCE) 11(1): 56-60.
 Jabar Alzubaidi A. (2014). Design of switches & sockets testers based on microcontroller. IOSR Journal of Engineering (IOSRJEN) 4(8): 40-43. https://doi.org/10.9790/3021-04844043
 Yang YX, Zhang CY, Huang YW, Guo YS, Xu JY. (2016). The Design and Research of a Creative Automatic Bouncing Socket, Mathematical Modelling of Engineering Problems, A publication of IIETA 3(2): 67-70. https://doi.org/10.18280/mmep.030204
 Chen RH, Lin M, Wu ZP, Chen L. (2014). Research on the size of the standard of the single phase plug socket and the converter in China. Standard Science 3: 50-60.
 Taylor D. (2014). Plugging in: Power sockets, standards and the valencies of national habitus. Journal of Material Culture 20(1): 59-75.
 Kajikawa T, Takegami E, Higuchi K, Nakano K, Tomioka S. (2010). Robust digital control of DC-DC power supply with remote sensing. IJAT 4(6): 502-509 https://doi.org/10.20965/ijat.2010.p0502(2010).
 Smart Guide Wiring: step-by-step projects, Fran J. Donegan, Creative Homeowner Press 2004, p.74.
 Tzimenakis J, Holland, D. (2000). Electrical product safety: A step-by-step guide to LVD self-assessment. Electrical Product Safety 58(2): 223.
 Schneps-Schneppe M, Namiot D, Maximenko A, Malov, D. (2012). Wired Smart Home: Energy metering, security, and emergency issues. In Ultra-Modern Telecommunications and Control Systems and Workshops (ICUMT), 2012 4th International Congress on, pp. 405-410. https://doi.org/10.1109/ICUMT.2012.6459700
 Singaravelan A, Kowsalya M. (2016). Design and implementation of standby power saving smart socket with wireless sensor network. Procedia Computer Science 92: 305-310. https://doi.org/10.1016/j.procs.2016.07.360
 Fernández-Caramés TM. (2015). An intelligent power outlet system for the smart home of the internet of things. International Journal of Distributed Sensor Networks 2015(1): 1-11. https://doi.org/10.1155/2015/214805
 Lobaccaro G, Carlucci S, Löfström E.A review of systems and technologies for smart homes and smart grids. Energies 2016, 9.
 Froiz-Míguez I, Fernández-Caramés T, Fraga-Lamas P, Castedo L, Froiz-Míguez I, Fernández-Caramés TM, Fraga-Lamas P, Castedo L. (2018). Design, implementation and practical evaluation of an IoT home automation system for fog computing applications based on MQTT and ZigBee-WiFi sensor nodes. Sensors 18(8): 2660. https://doi.org/10.3390/s18082660
 Chien TL, Su KL, Guo JH. (2009). Intelligent home-automation security system. IJAT 3(2): 121-129. https://doi.org/10.20965/ijat.2009.p0123(2009).
 Feng J, Jian D, Fei W, Yan Z. (2015). Design of socket based on intelligent control and energy management. (IJACSA) International Journal of Advanced Computer Science and Applications 6(10).
 Zipperer A, Aloise-Young PA, Suryanarayanan S, Roche R, Earle L, Christensen D, Bauleo P, Zimmerle D. (2013). Electric energy management in the smart home: perspectives on enabling technologies and consumer behavior. Proceeding of the IEEE 101(11): 2397-2408. https://doi.org/10.1109/JPROC.2013.2270172
 Mitani A, Hosoya T. (2011). Mechatronics education in school of design – development of educational tool to study design expression using mechatronics. JRM 23 5): 629-637. https://doi.org/10.20965/jrm.2011.p0629.
 Hyodo K, Noborisaka H, Yada T. (2011). Development of mechatronics teaching materials for embedded system engineer education. JRM 23(5): 611-617. https://doi.org/10.20965/jrm.2011.p0611(2011).
 Xu F, Wang LP, Wang RG. (2017). Adaptive control with ESP32 for anti-windup design of actuator with input saturation. International Conference on Education, Management, Computer and Society (EMCS 2017), Advances in Computer Science Research (ACSR) 61.
 Alawneh R, El Sheikh A, Kanaan R. (2011). Development of embedded personal health CareRecord system. IBusiness 3(6): 178-183. https://doi.org/10.4236/ib.2011.32024
 Younes TM. (2016). Development of LVDT signal conditioner using waveguide acoustic resonance tube. Sensors & Transducers 206(11): 88-94.
 Chen CY, Liu CY, Kuo CC, Yang CF. (2017). Web-based remote control of a building’s electrical power, green power generation and environmental system using a distributive microcontroller. Micromachines 8(241): 1-12. https://doi.org/10.3390/mi8080241
 Vechet S, Hrbacek J, Krejsa J. (2016). Environmental data analysis for learning behavioral patterns in smart homes. In Proceedings of the 2016 17th International Conference on Mechatronics-Mechatronika (ME), Prague, Czech Republic, pp. 7–9.
 Younes TM. (2012). Computer-based acoustic detector for determining the type and concentration of a solution. Journal of Applied Research and Technology 10: 859-866. https://doi.org/10.1016/j.imavis.2012.10.003
 Monzer. M. Krishan. (2015). Sensor development for corrosion monitoring of reinforcement steel. International Journal of Scientific & Engineering Research 6(2): 632.