Grid decarbonization, with a focus on electrification of different economic sectors, is increasing demand for electricity. The push to add more renewables into the generation mix to make the grid cleaner creates challenges for operation, since renewable and load are poorly correlated. Therefore, the ability to control and coordinate loads behind-the-meter and across meters becomes increasingly important and necessary in this new electric grid. Upon examining multiple devices which have tried to fulfil the need for this new electric grid, we have found that none of them manage to address the issue fully. Therefore, this research proposes an upgraded version of a smart socket, one that boasts multiple features that provide answers to all demands. We have developed a behind-the-meter Smart Socket: a hardware device that is able to control load operation via remote ON/OFF and load curtailment capabilities. Moreover, the Smart Socket can coordinate the operation of loads, given user preferences, to reduce electricity cost based on end-user electricity rate-structure. Smart Sockets can also cooperate with each other to reduce a coincidental peak and thus protect the grid infrastructure, e.g. transformers and circuit breakers, and reduce the demand charge component of the electricity rate structure for customers who are exposed to it. Additionally, this device provides soft-start capabilities to reduce inrush currents from electric motor-based loads and has an over voltage protection. Moreover, we developed a mobile application to enable users to set preferences and electricity rate structure to ensure the Smart Sockets operates accordingly. Finally, the design and implementation of the Smart Socket was made using off-the-shelf components to ensure that anyone can build such a device. Different tests in real-world conditions were performed to demonstrate the features and capabilities of this device. The design and code were made publicly available through GitHub.
Keywords: Smart Socket, Electricity meter, AC power control, Soft start, Power Consumption
Climate change is considered as one of the biggest threats to humanity since it affects everything that gives us security from food production to access to fresh water to habitable temperatures to ocean food chains1. With the recognition that greenhouse gases (GHG) are the main cause, many countries around the world are trying to drastically reduce their GHG emissions to combat this change through coordinated efforts, most notably the Paris Agreement2. The electricity system accounts for 25 percent of total greenhouse gases emissions in the world3. In addition, many countries are pushing to electrify non-electric residential appliances to reduce the reliance on gas and other forms of fossil-based energy4. This shift is not only going to increase the overall electricity cost to homeowners, but also increase the load in the distribution system that has the potential to overload the infrastructure assets such as transformers and cause instability in the power delivery5. In order to prevent the above mentioned challenges to occur and ensure a smooth transition to all-electric homes and buildings, systems that are able to monitor electric grid key parameters, operate, coordinate and control devices to support grid operations, and provide a seamless user interface while at the same time being low-cost are going to become a crucial component of the process.
Multiple works have focused on monitoring and control of electrical loads as well as their value to customers and companies. In the article “An analysis of smart meter technologies for efficient energy management in households and organizations,” Knayer and Kryvinska have analyzed the prevalence and the acceptance of smart energy meters in households and enterprises6. In addition, they have assessed ways to improve acceptance of smart energy measuring technologies in organizations and help manufacturers better understand customer needs, using a combination of public data from big companies as well as interviews, surveys and expert visits.
Next, Authors A. Arif, M. Al-Hussain et al, built a smart energy meter prototype to monitor the power consumption of a home leveraging off of-the-shelf hardware parts and transmitting information through either a cellular network or using a ZigBee protocol7. Similarly, they developed a smart energy meter prototype as well as an user interface through a mobile application and a web browser8. Their goal was to improve the experience of interaction with devices and reading the data.
N. Prayongpu and V. Sittakul developed a smart plug that is much smaller than previous models leveraging the ZigBee protocol. They also used off-the-shelf components to make their system more accessible. However, this device can only monitor power consumption9.
Authors Devenndra M., Mohan P. et al, designed a fully functioning prototype of a smart energy meter inside Proteus simulation program. They implemented sophisticated filtering algorithms to ensure high precision of their device10.
Authors S. Drive, S. Aditya et al, developed an AC voltage regulator based on Triac that can change the power consumption of the connected load when the user pushes the button or turns the potentiometer11. This system is primarily targeted at resistive loads.
Authors Mirza Jabbar Aziz Baig, M. Tariq et al developed a system based on MQTT and blockchain technologies which allow users to trade their electricity12. Ethereum blockchain technology allows users to trade their energy automatically and easily.
Limitations of Existing Inventions
However, all research papers describe devices that address only one or two issues, for example they can only monitor power consumption of connected devices, or can only control connected devices but do not provide monitoring capabilities and lack a convenient user interface. These features, by themselves, are important but have limited value when not combined together in a single system.
Benefits of the Upgraded Smart Socket
In contrast to all existing devices, the Smart Socket prototype currently developed allows the user to control the power consumption of devices as it provides soft-start capabilities that prevent inrush currents, coordinate the operation of multiple loads connected to different Smart Sockets, and provide power monitoring capabilities in an intuitive mobile user-interface. In order to validate the Smart Socket functionalities, seven use-cases were chosen to showcase these capabilities: 1) monitor and visualization of power consumption data, 2) monitor and visualization of voltage fluctuations, 3) soft-start, 4) on-off control of loads, 5) grouping and coordination of devices and 6) power control and power limitation.
Standard electrical loads such as house appliances are generally passive devices; they have limited capability that can only be accessed through proprietary applications that are not capable of sensing current electrical grid conditions e.g., voltage and frequency, measure power consumption, and are not capable of remote controlling of their operation and change power consumption. Further, some house appliances do not have overvoltage protection and most are not capable of automatically scheduling its operation; thus, they are not sensitive to electricity price. In addition, most devices with an AC motor inside don’t have smart electronics to reduce start current by soft starting the motor.
The Smart Socket proposed and developed in this work addresses all these issues simultaneously by providing these capabilities in a unique platform. Each of these capabilities can be turned off in case a load already has one or multiple of these features or its power can’t be controlled by voltage variation. For example, resistive loads such as space heaters, as well as resistive hot water heaters and lights are examples of loads whose power consumption is a function of the voltage and are responsive to the proposed power control. Loads that can’t be controlled by voltage variation, such as TV, AC units, and Heaters with built- in electronics can still be discreetly controlled and their power consumption still can be monitored.
The paper begins with a Methods Section, describing the main components of the system: Hardware and Software, which is divided in two subsections, measurements and control, and communication, and User interface. The Results section presents the experiments and test results. In the Discussions section, we examine the performance, benefits and limitations of each of the features implemented. Finally, the Conclusions section provides a summary of the system and its performance, possibilities for future research, and potential new applications for the Smart Socket.
The Smart Socket sits in between the load and the grid. It has a cord/plug connection to connect to the grid and a socket so different loads can connect their cord/plug to it. Each Smart Socket connects to a single load. Multiple Smart Sockets can communicate with each other using a master/slave configuration where one Smart Socket is the master and it orchestrates the operation of the other slave Smart Sockets. Figure 1 shows a high level overview of the system.
In this section, the main components of the system will be described: Hardware, Software (measurements and control), Software(communication), and User interface.
This paragraph focuses on the core elements of the system. The smart socket is based on a microcontroller ESP3213 that orchestrates the communication with sensors, load control modules- such as triac and relay, different smart sockets, and external information such as user preferences. To extend the ability of the main microcontroller, a secondary microcontroller Arduino nano is used14, helping the main microcontroller with the graphic interface on the LCD display. In addition to the microcontroller, the smart socket measures voltages and currents using off-the-shelf AC voltage and AC current sensors15 16. A triac module is used to modulate the power17. To cool down the triac module and prevent its overheating, a standard 12v 40mm fan is used. In order to provide proper voltage to the fan, a dc-dc converter is used. It boosts voltage from 5v to 12v. ESP32 controls power using standard mosfet module, which allows to turn the fan only if the triac module is open or used to modulate sine. A relay module is used to protect the device against overvoltage. An additional relay module is needed because the triac module is connected after power supply of the device, so the triac can’t protect the device against overvoltage. The relay, on the other hand, is connected before power supply so it shuts both load and device off. In order for the smart socket to work while the relay is closed, the device has a li-ion accumulator with a charging module. A standard plug is used to connect the smart socket to the grid, smart-socket itself has an inbuilt power socket to connect the load that the user wants to monitor and control. Finally, LED’s and two buttons are used to change modes and display information. The graphs below showcase all elements that were used to build each module and the scheme of elements that are related to the high voltage side. The full principal scheme of devices is available at the appendix section.
The following paragraph discusses the methods of dealing with EMI inside a device. In constructed devices, there are both analog and high frequency signal lines that are near each other. Furthermore, analog measurements can be easily screwed up by poor power voltage or external EMI. To protect analog signals from electro-magnetic interference, different methods were used. To ensure that a stable input voltage is provided to the system, input capacitors were used to buffer potential fluctuation from the power supply. Secondly, an independent linear power stabilizer for 3.3-volt sensor power was added. Finally, all analog wires are wrapped with ground wires to protect it against electromagnetic noises.
Additionally, some nuances regarding screen and temperature sensor are available. There are functions that must be run every 20 ms. In order to avoid conflict, functions that take more than 20 ms to run cannot be present. However, communication with the screen and requesting data from the temperature sensor requires a lot of time (more than 20 ms). So, an external Arduino nano board was added to the device. Arduino serves as a link between ESP32 and screen. In addition, it provides additional pins for LED’s. Connection between Arduino and ESP32 is via UART bus. (Serial2 on ESP32 side and Soft Serial on Arduino side).
Software (measurements and control)
This section explains all algorithms and methods that are used for measuring values and control power.
The first step in measuring values is to collect analog data. For this purpose, calibration of ADC is needed. Internal ESP32 12 bits ADC is used to measure analog signals from sensors. ADC was calibrated by measuring two clear voltages and then calculating coefficients of linear function. From both current and voltage sensors ESP32 receives sine waves with a central value of half of the VCC (1.6 volts).
Then, the RMS value can be calculated. Firstly, half of the VCC is subtracted from the values and the result is rectified with help of the abs function. Afterwards, the true RMS algorithm was run over these values. (Each of the sample points was squared; then, the medium was calculated; finally, the square root of this value was calculated).
Finally, filtration algorithms are runned over RMS values. Firstly, 50 values during the 20ms period are measured which means 50 samples per one sine wave. Then the rms algorithm is runned over these 50 values. Then every 100 milliseconds median filter is runned over 5 RMS values. Finally, every half of a second medium value of five values from the median filter is calculated. So, every half of second values are refreshed on display and in the mobile app.
Next step is power control via voltage change. Voltage is controlled with the help of a triac module. Triac module can cut off part of the sine wave. When the sine wave crosses zero, the triac is turned off, then the triac is turned on after calculated time. By cutting part of the sine wave off RMS voltage is decreased which allows to change power of load. This method of power control works only with simple devices without electronics so you can turn this function off.
In this paragraph, the soft start algorithm is explained. For automatic soft start, rare non filtered current data are used. If the soft start function is enabled, only a quarter of the sine wave goes to load. Every time current is higher than 0.2 amps, the power is slowly increased to maximum during a predetermined period.
2 PID regulators are used for different purposes. First regulator controls the power consumption of the smart socket or group of them. It reduces the power of a module or modules to prevent exceeding of the power limit. Second regulator is used to control power of load when the module is in temperature maintaining mode.
Overvoltage protection was implemented for better protection. Every time voltage is measured, this voltage is compared to the maximum instantaneous voltage of the sine wave. If this voltage is much higher than normal, relay cutts load off the grid to protect it. Voltage is measured every 400 microseconds so reaction time is pretty fast. Overvoltage in power supply lines can be the result of lightning strike, or a fast change in the amount of load on the grid18. This can be dangerous for sensible equipment, such as computers, TVs etc.
Ability to measure the voltage of the accumulator was also added just to protect the device from over discharge in case it doesn’t connect to the grid for a long time.
This section explains all algorithms and methods that are used for connecting modules together.
Firstly, searching and communication algorithms are discussed. To exchange data between modules and mobile app UDP protocol is used. Devices can find each other by sending broadcast requests to IP addresses which end by 255. (When you send messages to the IP address which ends on 255 it is automatically broadcasted to all members of the network). The App can find devices using the same methods. UDP is used because you don’t need a server for this protocol, you need only a WI-FI network with a router also it is easy to work with.
Then, devices can be connected to groups. Users can easily unite devices to groups which allow synchronization of devices and power limitation. To create a group, the user needs to perform three simple steps. User chooses the master device and turns search mode on this device. On the slave device, the user presses the same button and waits until led indicates that the device is now in slave mode. Finally, the user turns search mode on the master device off. Creating device groups allows the implementation of features such as synchronization of devices and load limitation.
Later, devices can be synchronised. Slave devices can be put into sink mode. In this mode slave device automatically turns on when master turned on, and turns off after master device turned off. This feature is very useful in workshops when you need to turn on the vacuum cleaner when the saw is turned on.
Finally, this paragraph discusses power limitation algorithms. The user can set the power limit to group. This means that if the summary power consumption of a group is higher than maximum, the system automatically turns off slave devices first and master device if needed. The user can then turn this device on via button or mobile app. You can set different power limits for different time periods. This feature allows you to save electricity in peak hours for example by preventing you from turning the cooker and heater simultaneously. Also, it can reduce your electricity bill a lot if you have additional charge for amperes you consume.
This section explains all sides of my device that interact with the user.
LEDs. LED indicators provide a quick way for users to check the status of an electronic device without having a deep technical knowledge on how this device operates. Therefore 7 LED’s were added even though the device already has an LCD display. Buttons. There are two buttons which allow basic interactions with devices without using mobile app. Screen. On my device there is an LCD screen with parameters such as voltage, current, power, and others.
Finally a mobile app was made. The app was created using MIT app inventor 2 to enhance the abilities of the device. In this mobile app you can change names of modules, control load, change parameters which were described before, see values of current, voltage, power and history of consumption. Also, you can create groups easier with the help of the mobile app. The mobile application provides a user interface and you can understand your system more with the help of the mobile app.
In this section you can see graphs that help to understand use cases described in the introduction.
In this experiment, the soft start feature of the smart socket was initially turned off, so at the current graph we can see a current spike that is 4 times higher than nominal current consumption. During the second measurement, the soft start feature was turned on, so we can see only a small increase in current consumption during start-up period.
The soft start case has multiple places of implementation. Every motor without any electronics has inrush currents that are 3 or more times bigger than nominal current. These high current peeks destroy wires and the motor itself, also these peeks influence the grid which leads to voltage drops or even transformer damage. As you can see with soft start Inrush current is much lower and there weren’t any big peaks on the current line. Soft start significantly extends life of motors and stability of the grid, as well as makes handling power tools easier by reducing recoil which is created when you start power tools momentarily.
Synchronization of different loads
In this experiment two modules were connected to each other using WI-FI. Firstly, the load connected to the master module was manually switched on (A). Slave module automatically switched the load connected to it after 1 second delay (B). After the load connected to the master module was switched off (C) slave module waits until power consumption thought master module will reach zero (D) and starts the timer. After a specific period, the slave module turns his load off (E).
The synchronisation case was made for workshops when you have a lot of situations when you need to power a vacuum cleaner simultaneously with a saw to suck the dust off the working place immediately. So, the device allows you to power the vacuum cleaner simultaneously with the saw even if the vacuum cleaner hasn’t a built-in socket. Also, synchronization can help you in case you have independent heaters or coolers in different rooms. Besides providing comfort (not to walk across all rooms) synchronization stabilizes the grid by smoothing increase in power.
In this experiment two modules were connected to each other using WI-FI. Power limit for the group of these two modules was set to 2000 watts. After power of load connected to the master unit was increased (A), and summary power consumption exceeded 2000 watts, the slave module automatically decreased power of load connected to it (B). Then, when power of load connected to the master module was decreased back (C), the slave module increased power of load connected to it (D).
This load limitation case helps you to reduce electricity bill if your price for Kilowatt hour depends on power that you consume (you get extra charge by having more than n kilowatts consumption). In this mode devices are going to constantly change power of slave load not to exceed limit. Without the smart socket power consumption between points B and C would be around 2500 watts, but with smart sockets power is kept under the 2000 watts limit that is set by the user.
In this experiment two modules were connected to each other using WI-FI. Also, the slave module was switched to discrete mode, which means that it can only switch load connected to it on and off, and can’t modulate power. Power limit from 21:39 to 21:40 was set to 1000 watts, while the power limit for the rest of time was 2000 watts. This simulates a scenario when the cost of electricity during certain hours is greater than the standard cost during the day. At 21:39 power limit decreased (A), so the slave module turned off load, connected to it (B). Then, by pressing the button on slave module load was manually switched on (C), but after sensing that summary power exceeded limit, slave module switched load off. At 21:40 when the power limit changed to 2000 watts (D), and the slave module turned its load on (E).
The scheduled load limitation case helps you to consume less power in peak hours, which helps you to pay less and also it is good for the whole grid system because you reduce load on a grid when load is highest. Without the smart socket power consumption between points B and E would be around 1500 watts, but with smart sockets power is kept under the 1000 watts limit that is set by the user.
In this experiment a smart socket module was configured to control the heater in order to maintain target temperature.
With help of a temperature control scenario, you can easily convert an old heater or cooler when you can’t set temperature in real degrees to a device which can keep the exact temperature that you set.
In this section the limitations of the experiments are discussed.
Firstly, some errors on load limitation (Figure 9) and temperature keeping graphs (Figure 11) should be discussed. On load limitation graph the power of slave modules decreased only after 5 seconds of exceeding load limit. This phenomenon occurs because the proportional-integral-derivative (PID) controller coefficients were not optimized. Also, system have about a second delay that occurs because of filtration algorithms. But even with the current coefficients it only takes 5 seconds for the system to reach steady state. This small transient wouldn’t affect the electricity bill much.
Figure 11 shows the system tracking the temperature setpoint. In this figure it may seem that the smart socket was not able to actually hold the set temperature. This occurs because of two reasons: the first reason is the PID controller coefficients, as explained before. The second reason is that these experiments needed to run for longer periods of time to properly capture the system dynamics, i.e. heating and cooling, for the controller to track it perfectly. However, even though the system had high fluctuation in the initial part, these fluctuations got smaller with time and the system closely reached the set temperature towards the end.
Also, there is no graph for the Overvoltage protection scenario. To make this graph laboratory transformer is needed that can change voltage at input of the device. Overvoltage protection works in theory. Also, tests were conducted where overvoltage protection value was set to 210 volts, and when this change was done, the relay immediately turned the device off.
A smart socket system was built with the following features that can be used by most residential loads: soft-start, power monitoring, load synchronisation, and load limitation. In addition the system was designed with a user-friendly focus by having multiple LED’s indicators and a LCD screen in the smart socket case, and a mobile application that the user can install, monitor and control the device in their personal mobile phones.
In contrast to previous researches, the system combines multiple features such as monitoring of main parameters of the grid, controlling power of appliance connected to it, and connecting to each other using WI-FI to set priorities in power control. This allows user to use my system in multiple scenarios such as soft starting of load, coordination of multiple loads, limitation of power consumption and even adding temperature or humidity sensors to devices that don’t have them. My devices can be used in many places at home, a small factory or a home workshop.
For future work researchers should: 1) focus on reducing the form factor of the smart socket by designing and printing a circuit board with all the components in it, 2) we will develop a cloud-based server to allow monitor and control the operation of the device from anywhere, as long as the system is connected to the internet, and 3) we will focus on the security aspects of data communication to prevent malicious actors to access the data and control the hardware.
I want to thank my physics and programming teachers for the knowledge I needed to write this paper. Also, I want to thank the site alexgyver.ru for lessons about programming microcontrollers.
Github repo: https://github.com/Fyodorbezz/Smart-Socket
EMI – electromagnetic interference
RMS – root mean square
PID – proportional integral differential regulator
ADC – analog to digital converter
UART – serial interface that connects two microcontrollers by two wires and common ground
UDP – protocol of transferring data between different components of network
- Climate Change “Biggest threat modern humans have ever faced”, World-Renowned Naturalist Tells Security Council, Calls for Greater Global Cooperation SC/14445 23 FEBRUARY (2021). [↩]
- National Academy of Sciences. “Climate change: Evidence and causes: Update 2020.” The National Academies Press. Washington, DC, p. 5. doi: 10.17226/25733 (2020). [↩]
- “Sources of Greenhouse Gas Emissions” United States environmental protection Agency [↩]
- City of Palo Alto (ID # 11751) Utilities Advisory Commission Staff Report. Meeting Date: 1/6/2021 (2021). [↩]
- S. Golden, “California just took a huge step towards building electrification” Greenbiz. August 13 (2021). [↩]
- T. Knayer, N. Kryvinska. An analysis of smart meter technologies for efficient energy management in households and organizations. Energy Reports. Volume 8, 4022-4040. (2022). [↩]
- A. Arif, M. Al-Hussain, N. Al-Mutairi, E. Al-Ammar, Y. Khan, N. Malik. “Experimental study and design of smart energy meter for the smart grid”. International Renewable and Sustainable Energy Conference (IRSEC), pp. 515-520, doi: 10.1109/IRSEC.2013.65297143 (2013). [↩]
- C. De Capua, G. Lipari, M. Lugarà, R. Morello, “A smart energy meter for power grids”. IEEE International Instrumentation and Measurement Technology Conference (I2MTC) Proceedings. (2014). [↩]
- N. Prayongpun, V. Sittakul. “Smart Plug for Household Appliances”. Springer, Singapore. vol 467 (2017). [↩]
- Devendra M. Jaiswal, Mohan P. Thakre. “Modeling & designing of smart energy meter for smart grid applications”. Global Transitions Proceedings. Volume 3, Issue 1, 311-316. (2022). [↩]
- R. Rajat, S. Divye, S. Aditya, S. Sanat. “Arduino Based AC Voltage Control using Zero Voltage Crossing Detection”. (2020). [↩]
- Mirza Jabbar Aziz Baig, M. Tariq Iqbal, Mohsin Jamil, Jahangir Khan. “Design and implementation of an open-Source IoT and blockchain-based peer-to-peer energy trading platform using ESP32-S2, Node-Red and, MQTT protocol”. Energy Reports. Volume 7, 5733-5746. (2021). [↩]
- https://lastminuteengineers.com/esp32-pinout-reference/ ESP32 Pinout Reference [↩]
- https://www.circuitstoday.com/arduino-nano-tutorial-pinout-schematics Arduino Nano Tutorial – Pinout & Schematics [↩]
- https://electropeak.com/learn/interfacing-zmpt101b-voltage-sensor-with-arduino/ Interfacing ZMPT101B Voltage Sensor with Arduino [↩]
- https://www.hackster.io/ingo-lohs/ac-current-sensor-182aff AC Current Sensor [↩]
- https://www.instructables.com/AC-Dimming-and-AC-Motor-Speed-Control-How-to-With-/ AC Dimming and AC Motor Speed Control How to With Arduino/NodeMCU [↩]
- https://citel.us/en/the-origin-of-overvoltages The origin of overvoltages [↩]