Household power consumption monitoring device integrated with solar systemHousehold power consumption monitoring device integrated with solar system
OVERVIEW ABOUT THE PROJECT
THE URGENCY
Urgency of Integrating IoT and Wireless Sensor Technology in Power Monitoring Systems
Advanced electronics, information technology, and telecommunications techniques converge to create Internet of Things (IoT) technology, with wireless sensor technology at the forefront This technology finds applications in research, entertainment, production, business, and beyond, with its scope continuously expanding to meet diverse needs [4]
Despite the growing familiarity of wireless sensor technology and IoT, their full potential remains largely untapped, particularly in industrialized nations with established scientific and technological infrastructure While usage requirements, technological limitations, and economic factors currently hinder widespread adoption these technologies hold immense promise for future advancements in power management [5]
This research focuses on a "Household power consumption monitoring device integrated with a solar power system." The growing demand for remote electricity and power system metric monitoring via the internet aligns perfectly with the capabilities of IoT Numerous companies have documented significant energy savings following the implementation of power monitoring systems, especially in the wake of rising electricity costs [6]
Remote power monitoring equipment facilitates the real-time observation of electrical system characteristics like voltage, current, frequency, capacity, and power factor across an entire plant or individual components This enhanced awareness allows for informed decisions regarding factory operations and personnel deployment
This project aims to address these limitations by exploring internet-based communication with electrical devices through IoT technology Additionally, the project investigates the functionalities to:
Adjust the direction of solar panels for optimal energy harvesting
Automatically switch to a backup power source in the event of an outage
These integrated functions promise a more robust and efficient power management system for residential applications.
AIM
Build a system to monitor electricity usage and update mobile application parameters regularly to make monitoring easier
Create a system that can automatically switch from grid power to solar power when there is a power outage and control the reversing motor of the solar battery.
SCOPE OF APPLICATION
The proposed system addresses a common concern in everyday life: understanding and managing electricity consumption Despite its compact size (30cm x 30cm), it packs a powerful punch, allowing you to monitor a single device's energy usage in real-time This data will be automatically transmitted to a mobile application, providing you with a convenient and accessible way to track your energy habits Furthermore, the system goes beyond mere monitoring It incorporates intelligent features to optimize your energy utilization In the event of a power outage, the system seamlessly switches from grid power to your solar backup, ensuring uninterrupted operation Additionally, it takes control of the solar battery's reversing motor, maximizing energy efficiency during solar power generation This comprehensive approach empowers you to not only understand your electricity consumption but also actively manage it for a more sustainable and cost-effective living experience.
CONTENT
Building a User-Friendly Electricity Monitoring System:
Information Gathering: Similar to gathering information for prototype development, extensive research through books, articles, technical manuals, and online resources will be conducted to understand the intricacies of electricity measurement, ESP32 functionalities, and Blynk app development This knowledge base will be crucial for designing and writing code for the real-time electricity monitoring system
Real-Time Data Acquisition: Just like simulating solar panel adjustments, we will establish a hardware connection between an ESP32 microcontroller and a PZEM004T module This connection will be programmed to continuously read and capture various power characteristics like voltage, current, and power consumption Mobile App Integration: Taking inspiration from Blynk's user interface design for prototype monitoring, a dedicated mobile application will be developed using Blynk or a similar platform This app will serve as the user interface for the monitoring system, displaying the collected power data in a clear and concise format The app will be programmed to receive regular updates from the ESP32, ensuring users have access to the most recent readings
Automating Power Management and Efficiency:
Grid-to-Solar Power Switching: The system will go beyond just monitoring by incorporating intelligent features Inspired by the concept of simulating hardware connections, we will program the ESP32 to monitor the grid power status In the event of a power outage (detected by a pin grid voltage), the system will automatically trigger a relay switch, seamlessly transitioning power to the solar backup system This ensures uninterrupted operation of essential devices even during grid outages
Solar Battery Management: Similar to controlling a servo motor for panel adjustment simulations, the system will be equipped to manage the solar battery's reversing motor This will involve programming the ESP32 to control the motor's direction, optimizing energy efficiency during solar power generation
The first step involves a deep dive into the world of IoT This will involve scouring the internet, textbooks, and research articles to fully grasp the capabilities and limitations of this technology With a solid foundation, we'll then explore various IoT platforms to identify one that best supports the project's functionalities Finally, we'll delve into the realm of sensors and processors, carefully selecting the most suitable tools for the job Through research and informed choices, we'll ensure the system has the right "brain" and "senses" to effectively monitor and manage electricity usage
BASIC OF KNOWLEDGE
SSENTIALITY OF MONITORING AND ENERGY MANAGEMENT
In commercial, industrial, and government organizations that have faced significant economic and environmental challenges in recent years, energy management and monitoring are critical to energy conservation
Energy management and monitoring contribute to lessening reliance on fossil fuels, which are getting scarcer Energy management businesses and households can reduce this risk by controlling energy demand, saving electricity on the production line, and gradually increasing the efficiency of investment in product costs Both families and businesses that consume large amounts of energy will have to deal with a serious shortage of supply and the risk of rising energy prices, which will have an impact on the organization's profits
One advantage of using an energy monitoring and management system is that it can cut down on personnel costs and time spent on recording excel files for monthly reports Information provided by the meters
Cut down on mistakes made when gathering data by hand
Constant power and data control, day and night, at any workstation
Shorten troubleshooting times because all data is gathered, capturing the power source's waveform at the moment of issue
To help the Vietnamese electrical industry overcome the aforementioned challenges, this is one of the subjects that is being extensively examined and researched.
ESSENTIALITY OF MONITORING AND ENERGY MANAGEMENT
The following functional pieces make up the system for reading remote meter readings via RF radio waves: Electricity customers' homes are equipped with electronic meters that have an integrated radio frequency transceiver function These meters have a measurement function, wireless energy storage, and the ability to transmit energy to a mobile signal collector upon order
A handheld computer with an integrated RF radio signal transceiver module and a data collecting program created by the company itself make up the mobile signal collection unit (Handheld Unit) Using information from the power company database and a list of clients, the handheld computer will assist the recorder in issuing orders to read meters within the coverage region Every piece of recorded data will be immediately combined with the electrical company
There are benefits to this solution
When the site of the meter installation changes, or when the central location does not alter the equipment, irrespective of the distance, starting point, or finishing point Popular, little modem that is simple to install using a meter
Minimal cost per traffic (KB), ideal for non-real-time transmission applications Defect: You should think about selecting the service of a network provider with extensive coverage density and signal quality because the usage of wireless transmission lines, transmitted over mobile networks, may affect the signal in inclement weather positive indication
2.2.2 REMOTE ENERGY MONITORING AND MANAGEMENT SYSTEM VIA SIGNAL TRANSMITTER THROUGH POWER LINES
The TM power line remote meter measurement system is a real-time power consumption measurement system With this system, there is no need to send staff to record meter readings at households
The system includes 5 basic devices:
RTU: is a one-way terminal installed inside or outside the meters in a convenient location The RTU will count the rotation of the disk, convert it into an electrical signal, modulate the signal, and transmit the received data and other information to the centralized device
TRPU is a two-way terminal that combines the features of an RTU with two-way information functions, such as the ability to automatically turn on and off loads in response to commands from the center, repeat signals, and transmit alphabetical or numerical information received from the centralized device to the customer If an additional load controller is installed, TRPU can also repeat the signal as a repeater and automatically turn on and off loads in accordance with commands from the center
A CONCENTRATOR is a single station's worth of centralized equipment that is put on the low voltage grid The data collection and processing range of this device is
1250 meters Terminal device data is gathered in the central unit and sent in various ways to the central computer Two-way terminals can receive orders and other instructions from the centralized device
MICROTERMINAL: a portable data gathering tool that connects the central computer and the centralized device It transfers data to the central computer after receiving it from the central unit Additionally, it is used to program devices to gather information from them and enter it into computers read, TRPU, RTU, and central The system's operational software is located on the MAIN COMPUTER It obtains data from central units for application in the electrical sector
Techniques for communication: information is transmitted via the low-voltage grid (from transformer stations to homes) utilizing PLC technology The low voltage line and the backbone fiber optic communication cable system are connected by a high- speed modem HE (Head End) at transformer stations, which are in charge of converting high voltage currents into low voltage and delivering them to customers The job of the HE modern is to convert the fiber optic cable's communication signals into information signals that can be transmitted to the power grid at frequencies ranging from 1.6 to 80 MHz (several frequency ranges are utilized depending on the company) reduce voltage in the other direction Following modulation, the information signals are sent to the buildings on the low voltage grid in tandem with the electrical signals In this case, information signals are received by a PLC modem (CPE placed at home), which then demodulates and recreates the original information signals so you may use the Internet, phone, or fax In order to deliver modulated information signals to the HE modem, the PLC modem can also reverse this project[7]
There is an electrical network practically everywhere
With pathways running to electrical outlets servicing all devices, low voltage power networks can be leveraged to provide an accessible network infrastructure for millions of individual users and enterprises worldwide electrical appliances for the home and business
High-speed access is possible with PLC; communication speeds have surpassed hundreds of Mb/s
- Since the power line infrastructure is already in place and the network has already been constructed, there is an advantage in terms of initial investment costs This allows for the competition of less expensive access techniques Other intra-regional communications (which typically need a substantial initial outlay)
There are a lot of issues that need to be resolved because power transmission wires are not intended for data transfer The total of all the noise sources that enter the line and the receiver is the noise power on a power line
Noise from network-connected loads, such laptops, TVs, and vacuum cleaners, spreads across power lines; extra noise from other communication systems may also enter the receiver Power lines were not designed to transport data; rather, they were designed to facilitate the transmission of electrical energy There are a lot of things that can interfere with the signal when transmitting information on it But since we now live in a digital age and the internet and smart mobile devices have become so widespread, a new idea known as IoT (Internet of Things) has emerged, thus the issue Real-world applications of these accomplishments to effortlessly monitor and manage everything have been made.[8]
ON-GRID SOLAR POWER SYSTEM
One option selected by residential and commercial clients is the grid-connected solar power system, also referred to as grid-connected solar power This energy-saving option has the exceptional benefit of optimizing financial gains and contributing to the decrease of CO2 emissions into the atmosphere
Solar power systems operate at their best in Vietnam due to the country's high average solar radiation intensity; this is a way to save electricity by using less energy on the grid
Figure 1: On-grid Solar diagram [13]
The figure show Operation diagram: Sunlight shines on solar panels Solar panels convert sunlight into DC electricity DC power from the solar panels is transmitted to the inverter DC frequency converter to AC electricity.AC power from the inverter is transmitted to the main rule box.AC power from the main rule box is distributed to passive consumers If solar power is insufficient or unavailable, the utility's AC power will be supplied for load consumption Tool to measure electricity consumption from solar energy and utility services
2.3.2 OPERATING PRINCIPLE OF GRID-CONNECTED SOLAR POWER SYSTEM
The system will use an inverter, a grid-connected power converter, to change the direct current (DC) electricity from the solar panels into alternating current (AC) power In order to maximize the power obtained from solar energy, this converter is set up to automatically detect the Maximum Power Point Tracker MPPT from the panels
The technology is designed to synchronize the phase and connection between solar and grid power Direct solar power delivery to the load is prioritized In particular: The load will use all of the electricity from the solar power system when the grid capacity and the load capacity are equal
More grid electricity will be used to compensate the load when the consumed load capacity exceeds the available capacity of the grid
The excess electricity will be pushed to the electric meter and recorded by the two-way electric meter when the consumed load capacity is less than the grid capacity [9]
2.3.3 DESIGN AN AUTOMATIC POWER TRANSFER SWITCH IN THE GRID SYSTEM
The automated power transfer function is one of the many features of grid-connected power systems that still need improvement, despite their great development and many benefits
The majority of systems now require manual power switches, which is problematic for users who need to keep the electricity running in the house even when they are not home For this reason, I created an automatic switch for this project that, in response to a current sensor value measured in the grid system, may automatically transfer grid power to energy and show information about it grid or energy consumption mode.
IOT TECHNOLOGY
The world's newest technological platform, known as the Internet of Things, or IoT, gives every person and thing a unique identify and the capacity to receive and exchange data share data and information across a single network without requiring face-to-face communication between humans or computer users
Microelectromechanical, wireless, and Internet technologies have come together to form the Internet of Things
To put it simply, it is a collection of gadgets that can connect to the Internet, to one another, and to external sources in order to carry out specific tasks Or, to put it another way, the Internet of Things is made up of all connected gadgets There are several ways to connect: Wi-Fi, Bluetooth, ZigBee, infrared, broadband telecommunications networks (3G, 4G), and ZigBee Smartphones, coffee makers, washing machines, lightbulbs, headphones, and many other gadgets can all be considered devices
About 50 billion devices will be connected to the Internet by 2020, according to Cisco, a major supplier of network solutions and hardware, and this figure will only rise from there There will be relationships between people and devices, people and people, and devices and devices since the Internet of Things (IoT) will be a massive network that connects everything, including people Up to 50–100 trillion connected objects can be found in an IoT network, and each object's movement can be monitored by the network One could be surrounded by 1,000–5,000 tracking-capable items in an urban setting Depending on the application and variables such communication range, data transfer volume, security needs, and system energy, selecting the right connection protocol standard is crucial battery, [10]
2.4.1 DATA TRANSMISSION PROTOCOL USED IN SOME IoT APPLICATIONS
There are 5 popular data transfer protocols that can be used in models: MQTT, CAP, AMQP and DDS
MQTT is a machine-to-machine connection protocol, an open source protocol for transmitting messages between multiple Clients (Publisher and Subscriber) through an intermediary Broker, designed for simplicity and ease of deployment This protocol is so lightweight that it can be supported by some of the smallest measurement and monitoring devices, and it can transmit data over reachable networks, sometimes continuously The MQTT architecture is based on an intermediary Broker and uses a long-lived TCP connection from Clients to Brokers
In a system using the MQTT protocol, many station nodes (called mqtt clients - referred to as clients) connect to an MQTT server (called broker) Each client will subscribe to several channels (topics), for example "/client1/channel1",
"/client1/channel2" This registration process is called "subscribe" Each client will receive data when any other station sends data and the channel is registered When a client sends data to that channel, it is called "publish"
-The impact of IoT is very diverse, across all economic and life sectors: infrastructure management, healthcare, construction and automation, transportation Some typical and Medical care (eHealth)
Track the state of human health
Keep an eye on where kids and senior citizens are, find them, and alert someone in the event of an emergency
Fall detection: enables the crippled or elderly to live freely
Medicine cabinets: keep an eye on the conditions within the refrigerators used to hold medications, vaccinations, and organic materials
Track vital indicators in the athlete's care facility
Monitoring the state of patients both at home and in the hospital is known as patient monitoring
In order to caution people against exposing themselves to the sun at specific hours, ultraviolet radiation detects the level of UV sunshine
Smart Park: monitors the city's parking spaces
Construction inspection: monitors vibrations and physical conditions in buildings, bridges and historic structures
City noise map: monitor sounds in bars and downtown areas in real time
Traffic congestion: monitor vehicle and pedestrian levels to optimize driving and commuting
Smart lighting: smart and weather-responsive lighting in the street light system Waste management: detect the level of waste in containers to optimize waste collection routes
Intelligent transportation system: smart roads and highways with warning messages and adjustments according to weather conditions and unwanted events such as accidents and traffic jams.[10]
Energy and water usage: supports monitoring of water and energy consumption to give advice on how to save costs and resources
Remote control devices: turn on and off by remote control to avoid accidents and save energy
Intrusion detection systems: detect windows and doors and intrusions to prevent intrusion
Storage of goods and art: monitoring conditions inside museums and art storage facilities.[10]
Smart grid: monitor and manage energy consumption
Calculate the shape of storage tanks: monitor water, oil, and gas levels in tanks and storage tanks
Install photovoltaic systems: monitor and optimize the efficiency of solar energy devices
Water flow: measures water pressure in water systems
Calculate stock levels: measure stock levels and volume of goods.[10]
Supports automatic irrigation (smart irrigation system)
Monitor environmental quality such as soil and water, warn when problems occur to promptly handle and limit damage (precision agriculture)
-Security and Emergency (Security and Emergency)
Monitor operating status to proactively maintain and minimize damage
Control restricted access areas: control access to restricted areas and detect unauthorized people
Presence of liquids: detect liquids in data centers, data warehouses, and sensitive construction sites to prevent damage and corrosion
Radiation level: distribute radiation range measurement around the nuclear power zone to warn of leaks in time
Dangerous gas and gas explosions: detect gas concentrations and leaks in industrial environments, around chemical plants and in mines.[10]
Detect forest fires: monitor gas combustion and forest fire warning conditions to provide warning areas
Air pollution: controls CO2 emissions from factories, polluting gases from vehicles and toxic gases on farms
Prevent flash floods and landslides: monitor soil moisture, vibrations and soil density to detect hazards according to soil conditions
Early detection of earthquakes: distributed monitoring in areas with special shaking Water quality: research on the suitability of water in rivers and seas for fauna and water standards for use
Water leaks: detect liquid outside tanks and pressure fluctuations inside pipes Floods on rivers: monitor water level fluctuations on rivers, dams and water sources.[10]
NFC payment: payment process based on location or operating time for public transport, sports, theme parks…
Conveyor control: monitors storage conditions in lines and tracks products for monitoring purposes
Smart shopping applications: provide advice at the point of sale according to customer habits, preferences, ingredients that are objectionable to buyers or expiration dates
Smart product management: control the rotation of products in shelves and warehouses to automate replenishment processes .[10]
M2M applications: asset control and self-diagnostic machines
Indoor air quality: monitors toxic levels and oxygen levels in chemical equipment to ensure workers and goods are safe
Temperature monitoring: multi-degree control in industrial and medical cabinets with sensitive goods
Presence of Ozone gas: control Ozone gas levels while drying meat products in food factories
Indoor positioning: locate indoor assets using active (ZigBee) and passive (RFID/NFC) tags
Self-diagnosing vehicles: collect information from Can Bus to send real-time alerts to quickly advise drivers
It is evident that IoT applications are essential to success in the future and are highly helpful in all facets of life However, due to the high application cost and scarce resources for implementation, it is not very well-liked Consequently, getting more applications at a fair price is the next challenge that needs to be solved.[10]
DATA TRANSMISSION STANDARDS
In the early 1980s, Phillips developed a two-wire serial communication standard called I2C This is the bus line that communicates between ICs Although I2C was developed by Philips, it has been used by many IC manufacturers around the world I2C became an industry standard for control communications The I2C bus is used as a peripheral communication bus for many different types of ICs such as 8051 Microcontrollers, PIC, AVR, ARM memory chips such as: Static RAM, EEPROM, converters analog digital (ADC), analog digital (DAC), LCD, LED control IC
Figure 2 : I2C bus and peripheral devices[14]
The figure show the I2C bus and peripheral devices with SCL and SDA
A Two-Wire Serial Communication Protocol
I2C (Inter-Integrated Circuit) is a versatile serial communication protocol that allows multiple devices to communicate using only two wires:
Serial Data (SDA): Bi-directional data line for transmitting and receiving information
Serial Clock (SCL): One-way clock line that synchronizes data transmission, controlled by the master device
External devices connect their SDA and SCL pins to the corresponding lines on the bus
Each device on the I2C bus has a unique address and operates in either master or slave mode
The master device initiates communication, controls the clock signal, and determines whether to read from or write to a slave device
Slave devices passively participate in communication, responding to commands from the master
Data can flow in both directions on the SDA line, while the clock signal flows only from master to slave
I2C operates in three modes with varying data rates:
High-Speed Mode (up to 3.4Mbps)
The master device initiates communication by sending the slave device's address and a read/write bit
The addressed slave device acknowledges the transmission
Data transfer occurs based on the read/write operation initiated by the master
The communication cycle ends with a stop condition generated by the master.[11]
Sequence of transmitting bits on the transmission line:
Figure 3 : Transmitting bits on the transmission line[15]
-Step 1: A start condition is established by the host device All slave devices that are about to receive data across the transmission line are notified by this condition -Step 2: If the data read/write flag is set to 1, the next byte is sent from the slave device to the master; if the flag is set to 0, the next byte is sent from the master device to the slave device The master transmits the address of the slave device that it wishes to communicate with
-Step 3: The slave device on the I2C bus will respond with an ACK pulse if it has the right address in relation to the address that the master device sent
-Step 4: The data bus master and slave start talking to each other Data can be sent or received by both the master and the slave, depending on whether the communication is written or read The receiver receives eight data bits from the transmitter and returns an ACK bit
-Step 5: The host device establishes a stop condition to terminate the communication operation
The Crucial Role of START and STOP Conditions in I2C Communication
On the I2C bus, maintaining order and preventing data chaos relies heavily on two essential signals: START and STOP conditions
Initiating Communication: The START Signal
Imagine the START condition as a dinner bell When the master device generates this signal (marked by a high-to-low transition on the SDA line while the SCL line stays high), it's like ringing the bell to announce the start of a conversation All slave devices on the bus are alerted that communication is about to begin, allowing them to prepare for data exchange
Ending the Conversation: The STOP Signal
Just like needing a closing statement at the end of a discussion, the STOP condition serves that purpose in I2C communication This signal, indicated by a low-to-high transition on the SDA line with the SCL line remaining high, signifies the conclusion of a communication cycle All devices are informed that the current exchange has finished, and the bus becomes idle, ready to embark on a new conversation
Maintaining Bus Status: Idle and Busy
Before communication starts, both SDA and SCL lines remain high, signifying a "bus free" state – the bus is available for new interactions Once the START condition is generated, the bus becomes busy, indicating ongoing communication The STOP condition then signals the end of the busy state, returning the bus to an idle state, ready for the next conversation
While a STOP condition typically ends communication, there's an exception During an ongoing communication cycle, a repeated START signal (identical to a regular START) can be used within the cycle to initiate a new data transfer without completely terminating the current interaction
In essence, START and STOP conditions act as the traffic signals on the I2C bus, ensuring smooth and efficient communication by clearly defining the beginning and end of each conversation
UART (Universal Asynchronous Receive/Transmit) is an asynchronous data transmission and reception standard This is a popular and easy-to-use communication standard, often used in communication between microcontrollers and other devices UART converts between serial and parallel data
One-way, UART converts system bus parallel data to serial data for transmission
On the other hand, the UART converts received serial data into parallel data that the CPU can read into the system bus
The PC UART supports both simultaneous and non-synchronous communication types Simultaneous communication means the UART can send and receive data at the same time As for asynchronous (non-dual) communication, only one device can transfer data at a time, with a control signal or code deciding which side can transfer data
Asynchronous communication is performed when both directions share a path or if there are 2 paths but both devices only communicate over one path at the same time
In addition to the data line, the UART supports standard RS232 and control signals such as RTS, CTS, DTR, DCR, RT and CD.[12]
Figure 4 : UART connection between two microcontrollers[16]
To make it easier for programs to send and receive data in an asynchronous format, PCs and many other microprocessors have a component called UART (universal asynchronous receiver/transmitter)
Since UART's speed and convenience cannot be compared to today's modern interfaces, many microcontrollers are now integrated, and UART ports are no longer incorporated in newly manufactured PCs and laptops When two microprocessors use UART transmission to synchronize their communication that is, when each microprocessor generates its own clock pulse for independent use the issue is resolved if SPI and I2C interfaces have data wires and wires for transmitting clock pulses
A START bit is transmitted to start data transmission via the UART Data bits are then sent, and the transmission is terminated with a STOP bit
Figure 5: UART data transmission process When in standby state, the voltage level is at level 1 (high).[17]
The bit will shift from 1 to 0 to initiate a START transmission, alerting the recipient to the impending data transfer Data bits D0-D7 follow the START bit (the graphic indicates that these bits may be High or Low depending on the data) Bit Parity travels to the recipient to verify the data's accuracy after it has been transmitted in its entirety The STOP bit, which is set to 1, indicates to the device that the bits have completed transmission To verify that the data is accurate, the receiving device will examine the transmission frame fundamentals of UART transmission and reception parameters:
Baund rate (baund rate): Transmission time of 1 bit Must be set the same for sending and receiving
Frame (transmission frame): Transmission frame specifies the number of bits in each transmission
Start bit: is the first bit transmitted in a Frame Signals to the receiving device that a data packet is about to be transmitted Is a required bit
Data: is the data to be transmitted The least significant bit LSB is transmitted first followed by the MSB bit
Parity bit: check whether the transmitted data is correct
Stop bit: is 1 or more bits that tells the device that the bits have been sent The receiving device will check the transmission frame to ensure the accuracy of the data.
HARDWARE SELECTION
Measurement function for energy parameters) (energy, operating capacity, voltage, current, and g
Overload alert feature (power flash, buzzer beep, and over power alarm threshold) Setting function for the power alarm threshold (power alarm threshold can be set) energy key's reset function
Before turning off the power, store data by storing collected energy
Voltage, current, active power, and energy are displayed using the red digital display function
Function for serial communication (using TTL communication, it can connect to a number of terminal devices via pins)
Sensor PZEM-004T is a power measurement module used for power consumption monitoring applications The operating principle of the PZEM-004T sensor is based on measuring electrical parameters such as voltage, current, power consumption and energy consumption through main components including:
Current Transformer (CT): To measure current, the PZEM-004T uses a current transformer to convert a large current into a smaller, easy-to-measure current This current transformer consists of a magnetic core and a secondary coil When current flows through the main conductor (primary coil), it creates a magnetic field in the magnetic core, which in turn creates an induced current in the secondary coil This induced current is proportional to the current flowing through the main conductor and is fed into the electronic circuit of the PZEM-004T for measurement
Electronic circuit: The electronic circuit inside the PZEM-004T processes signals from current transformers and transformers to calculate power parameters This electronic circuit includes: ADC (Analog to Digital Converter): Converts analog signals from current transformers and transformers into digital signals Microcontroller: Processes digital signals from the ADC to calculate voltage, current, power, and energy consumption The microcontroller also manages communication with external devices such as computers or other microcontrollers
Communication: PZEM-004T can communicate with other devices via the UART (Universal Asynchronous Receiver-Transmitter) protocol This allows the PZEM- 004T to transmit measurement data to remote monitoring or control systems
The operating process of PZEM-004T can be summarized through the following steps:
The current from the load flows through the current transformer, creating an induced current proportional to the load current
The transformer measures the load voltage and provides a voltage signal to the electronic circuit
The electronic circuit uses ADC to convert analog signals from current transformers and transformers into digital data
The microcontroller processes digital data to calculate power parameters
Data is transmitted out via UART protocol for display or storage
The system is split into two sections: serial communication lines, which can fully communicate with various devices based on different demands, and current and voltage, which may be applied to the input device
There are four display positions on the screen: voltage, current, energy, and power Each display parameter has a brief description listed below
"-The voltage display screen industrial frequency grid voltage is measured and displayed
- The screen shows the current voltage When a current is 10 mA or above, the load current is measured and shown
- Power panel calculates and shows the amount of power being used Extra instructions state that the resolution is fairly high, the minimum energy measuring unit is 0.001kWh, and the accumulation process may be immediately monitored for testing at low power levels (less than 100W)
-Relay capacity shown on the screen For high power, 1W or more, measure and display the current load power
This module is equipped with a TTL serial data transmission interface, reading and setting related parameters through the communication port
Table 2 3 Table of communication protocols of module PZEM004T
Table 2.4 Technical specifications of PZEM004T
The microprocessor ESP32 is part of the class of affordable and low-power on-chip microcontrollers Dual-mode Bluetooth and Wi-Fi are integrated into almost all ESP32 models, giving it a great deal of versatility, power, and dependability for a variety of uses
It is a better-performing and feature-rich microcontroller, replacing the well-liked NodeMCU ESP8266 Produced by Espressif Systems, the ESP32 microcontroller finds extensive usage in Internet of Things, automation, and robotics applications Because of its low power consumption design, the ESP32 is perfect for battery- powered applications It may significantly prolong battery life by operating in sleep mode and waking up only when necessary thanks to a power management technology
The esp32 is utilized in this project to read sensor values
Power consumption 5μA in suspension mode
Wifi 802.11 B/g/n/E/I (802.11N @ 2.4 GHz up to 150 Mbit/s)
Bluetooth 4.2 BR/EDR BLE 2 control modes
Memory 448 Kbyte ROM, 520 Kbyte SRAM, 6
Kbyte SRAM on RTC and QSPI Flash/SRAM chip support
Digital GPIO 24 pins (some pins are just inputs)
Analog digital 12bit SAR type ADC, supports measurements on up to 18 channels, some pins support an amplifier with programmable gain
Hardware accelerated cryptography AES, SHA-2, RSA, Elliptical Curve cryptography (ECC), Random number generator (RNG)
This is essp32 that show all of pin it digital
Although the ESP32 has a lot of pins with various functions, some of them may not be suitable for the project The table below shows which pins are safe to use and which pins should be used with caution
GPIOs 34 to 39 are GPIs – input only pins
These pins don’t have internal pull-up or pull-down resistors They can’t be used as outputs, so use these pins only as inputs:
SPI flash integrated on the ESP-WROOM-32
GPIO 6 to GPIO 11 are exposed in some ESP32 development boards However, these pins are connected to the integrated SPI flash on the ESP-WROOM-32 chip and are not recommended for other uses So, don’t use these pins in your projects: GPIO 6 (SCK/CLK)
Although the ESP32 has 48 GPIO pins in total, only 25 of them are broken out to the pin headers on both sides of the development board These pins can be assigned a variety of peripheral duties, including:
MG996R is a metal gear servo motor with a maximum torque of 11 kg/cm Like other RC servos, the motor rotates from 0 to 180 degrees based on the duty cycle of the PWM wave supplied to its signal pin
In this project, servo motors are used to change the direction of solar panels
2.6.3.1 TECHNICAL SPECIFICAL OF MG996R RC SERVO MOTOR
Servo MG996R (upgraded MG995) has large torque
This is an upgrade from the MG995 servo in terms of speed, traction and accuracy Suitable for 50 -90 methanol type propeller aircraft and 26cc-50cc gasoline fixed wing aircraft
Compared to MG946R, MG996R is faster, but slightly smaller
Pull force 9.4kg/cm (4.8V), 11kg/cm (6V)
Rotation speed 0.17 seconds / 60 degrees (4.8 V) 0.14 seconds / 60 degrees (6 V)
Memory 448 Kbyte ROM, 520 Kbyte SRAM, 6
Kbyte SRAM on RTC and QSPI Flash/SRAM chip support Suitable models 50 – 90 methanol fixed wing aircraft and 26cc-50cc gasoline engine wing aircraft
One relay running at 5VDC and capable of withstanding voltages up to 250VAC 10A is included in Module 1 Relay The low-level trigger relay in Module 1 is robustly constructed and has excellent electrical insulation In order to fully isolate the control circuit (microcontroller) from the relay and guarantee steady microcontroller performance, the module already includes a relay trigger circuit that makes use of transistors and opto-isolator integrated circuits
It is very convenient to connect to a microcontroller using the built-in header International safety standards are met by this module, which also features module y distance slots for the loading and input areas
This item describes how to switch the power source from the mains to the backup and vice versa using a relay module [13]
This is single module relay includes NO,COM,NC
Control DC or AC power on and off, you can control AC 220V 10A load
There are normally open and normally closed contacts:
NO: normally open (when the contact is closed)
NC: Normally closed (when contact is opened)
Signal is 0: the Relay is closedSignal is 1: then Relay is open Output:
Relay contact 220V 10A (Note the contact, not the output voltage) NC: Normally closed
VCC, GND are the relay sources
-in is the control signal pin
SYSTEM ANALYSIS AND DESIGN
ANALYSIS AND DESIGN OF PROCESSING SYSTEM
This system offers comprehensive power monitoring and management A power measurement module meticulously tracks various electrical parameters like voltage, current, and energy usage A Wi-Fi connected microcontroller processes this data and transmits it to a server for analysis A user-friendly app then displays this information, providing insights into power consumption Additionally, the system features intelligent power management A relay module ensures uninterrupted operation by seamlessly switching to backup power during grid outages Furthermore, a servo motor, controlled through a user-friendly Blynk app, optimizes solar panel angle for maximum energy generation, reducing reliance on grid power This combined approach empowers users to monitor and manage their energy consumption effectively.
SYSTEM MODEL
This is a grid model; power is installed directly behind the meter, which receives electricity from the grid Here, the data will be measured and processed before being sent in turn to the server and shown on mobile devices via the Blynk app, enabling convenient monitoring from any location
When the relay switch receives control signals from the microprocessor, it will automatically turn on and off
When signals from the microcontroller are received, the servo motor block will turn on.
System block diagram
Microprocessor block: includes esp32, which is responsible for handling all tasks of the system reading sensor values, controlling the power block, controlling the engine block, and communicating with the app
Sensor block: PZEM004T is an AC power measurement sensor module that is responsible for returning the current value when the microprocessor block calls down Motor block: MG996R servo is responsible for changing the direction of the solar panel when there is a control signal from the microprocessor block
Power block: Relay module, whose task is to be an on/off switch to change the power source when there is a control signal from the microprocessor block
App block: Blynk app is responsible for displaying information pushed up from the microprocessor block and sending signals to the microprocessor block to control the engine block
- Power block: Provides 5V power to the entire system.
OPERATING PRINCIPLE OF EACH COMPNENT 1 OPERATING
3.4.1 OPERATING PRINCIPLE OF THE ELECTRICITY BLOCK
Figure show the microcontroller will connect to wifi and create a connection with the Blynk server when power is provided to it After that, the CPU will issue orders to read measured values from the PZEM 004T module, including voltage, capacity, current, frequency, and power It will then process the data and send updates to the servers so that the app and servers are synchronized
2 Esp32 connects to the Blynk app
4 AC power is supplied to the power outlet through the CT sensor of the
Pzem004T, the sensor will measure the values of the current
5 Esp32 sends signals to read voltage, power, current, etc values to Pzem004T
6 Pzem004T receives the request, responds to Es32
7 Esp32 pushes received data to Blynk App
3.4.2 OPERATING PRINCIPLE OF THE ENERGY BATTERY CONTROL BLOCK
Figure 17: General principles with app
A signal is delivered down the value range from 0-180 when the user extends the slider in the Blynk application The Esp32 detects the control signal and then generates a pulse signal to control the servo motor's command Modify the direction of the solar panels
Figure 18 :Data flow with app
The figure have the process begins by powering the ESP32 processor Once powered, the ESP32 springs into action: first, it establishes a connection to your Wi-Fi network With a reliable internet connection, it then connects to the Blynk app, creating a bridge between the hardware and the software interface Next, the ESP32 initializes the servo motor, positioning it at a starting angle of 0 degrees Now comes the user interaction! Through the Blynk app, you can manipulate a slider As you drag the slider, a corresponding value between 0 and 180 degrees is transmitted to the ESP32 The ESP32 receives this value and translates it into a specific pulse width modulation (PWM) signal This PWM signal, sent through a designated GPIO pin on the ESP32, acts as the control language for the servo motor By adjusting the PWM signal, the ESP32 instructs the servo motor to rotate to the exact angle you selected on the Blynk app, precisely translating your virtual slider movement into real-world servo motor action
This This displays the change of the angle of solar panels
3.4.3 OPERATING PRINCIPLE OF THE AUTOMATIC POWER TRANSFER SWITCH BLOCK
-When mains power is available, the sensor will sense the current voltage and display it as AC mode on the Blynk app It will also simultaneously activate relay 1 and deactivate relay 2 to ensure that the AC power source is connected to the wall outlet
-The sensor will indicate a voltage value of 0 in the event of a power outage At this point, the system will switch to using backup power by turning on relay 2 and off relay 1, allowing backup power to flow to the power outlet Solar mode will then be displayed on the app
-If the both input power get into It will only display AC mode with the sensor found AC power = 1
Upon powering on, the ESP32 microcontroller establishes a Wi-Fi connection and initializes the Pzem004T module for power monitoring The AC power source is connected to Relay 1 and the solar power source is connected to Relay 2 Both relays are initially kept off The ESP32 periodically requests voltage information from the Pzem004T If the voltage is above a set threshold, indicating a stable AC supply, Relay 1 is activated to connect the AC power source, while Relay 2 is deactivated to disconnect the solar power source However, if the voltage drops below the threshold, signifying a power outage, Relay 1 is immediately deactivated to isolate the faulty
AC source, and Relay 2 is activated to switch to the solar power source for backup This intelligent power management system ensures uninterrupted operation and prioritizes renewable energy whenever possible System design analysis
FLOW CHART OF DATA UPDATE FKOW ALGORITHM
Figure 22: Flow chart for updating AC electrical measurement value
After powering the system, the microprocessor connects to wifi and the Blynk server, setting up a timer to read sensor data.
Every 5 seconds, esp32 will read the sensor value once and send it to the Blynk server
Electricity bills are calculated based on the amount of electricity consumed Electricity fee = Electricity number * 2800 VND
3.5.2 FLOW CHART OF DATA SAVING FLOW SAVING FLOW ALGORITHM AFTER THE FINAL DATE AND TIME HAS ARRIVED
When it's time to close the number, the previous value will be stored in the eeprom and changed to yesterday's value, and the phone value will be reset to 0
The total amount of electricity used for the month is still computed and applied to the electricity bills
3.5.3 FLOW CHART OF POWER TRANSFER SWITCH ALGORITHM
Every five seconds, the esp32 reads the voltage data If the data is not readable or the voltage equals zero, the esp32 sends a control signal to turn on relay number two, which connects the solar power source to the outlet for continuous use, and turn off relay number one, which disconnects the power source connected to the grid
Figure 24: Flow chart of power transfer switch algorithm
FULL CIRCUIT PRINCIPLE DIAGRAM
Figure 25 : Full circuit principle diagram
Currently available software includes Altium Designer, Orcad, Eagle, Proteus, EasyEda, and others for designing the entire circuit diagram EasyEda is the program that I select from the selection The EasyEda interface gets quicker and more convenient
DEVICE MODEL DESIGN DIAGRAM
The device hardware is designed with the following parameters:
-Surface: The main circuit is placed on the fomex surface, next to it is a model of energy panels and 2 electric sockets from 2 mains and energy sources
INPUTMENT
INTRODUCTION
Monitoring power using the internet is the topic's primary objective The PCB circuit must be built, and it must be securely installed into the device model Next, create an account and configure the internet monitoring app's interface by logging into the Blynk cloud.4.1.1 Circuit board construction
CONSTRUCTION AND PACKAGING OF HARDWARE
It includes esp32 , 2 of relay, pzem004T , Servo MG996R and more product connection.
SYSTEM PROGRAMMING
The software used to program Arduino is called the Arduino IDE The Arduino IDE programming environment is compatible with the three most widely used operating systems available today: Linux, Mac OS X, and Windows This programming environment is entirely free and extendable by knowledgeable users because it is open source C++ libraries allow for the extension of the programming language Additionally, as this programming language is built on the C language foundation of AVR, users have the option to fully integrate AVR-written code into their programs
Step 1: Visit http://arduino.cc/en/Main/Software/ This is where Arduino IDE versions are stored and updated Click on Windows ZIP file for admin install as shown
Continue clicking JUST DOWNLOAD to start downloading
Step 2: After downloading, right-click on the downloaded file arduino- 1.6.4- windows.zip and select “Extract here” to extract
Bước 4: Run file in the arduino-1.8.19 directory to start the Arduino IDE
4.3.1.1.3 Programming ESP32 using Arduino IDE
To install the library and code loading function for the IDE, do the following: Go to File → Preferences, go to the Additional Board Manager URLs textbox and add the link http://arduino.esp8266.com/stable/package_esp32com_index.json into it Click
Next go to Tool→Board→Boards Manager
Wait a moment for the program to search We scroll down and click on ESP32, click on Install Wait for the software to automatically download and install
The process of loading code to the ESP32 NodeMCU circuit is similar to loading the regular Arduino circuit However, it should be noted that you must select the version appropriate to the board you are using using the menu Tools → Board -> ESP32 Dev Module
Figure 32 : Board Manager 4.4 Blynk app interface design
Blynk is an IoT (Internet of Things) platform that helps users easily create remote control applications for smart devices Blynk's special feature is its flexibility and ease of use
With Blynk, users can create applications that control IoT devices in just a few minutes without needing in-depth programming knowledge Blynk provides a series of tools and an intuitive user interface that makes it easy for users to drag and drop and interact with controls, graphs, sensors, and more
Specifically, users can create applications to control lights, fans, temperature sensors, humidity measurements and even smart dishwashers Blynk supports cross-platform, from mobile devices like smartphones to embedded devices like Arduino, Raspberry
This makes Blynk a useful tool not only for professional IoT developers but also for beginners interested in the world of IoT With convenience and flexibility, Blynk has been helping people easily implement their innovative ideas in the IoT field effectively
4.4.2 HOW TO REGISTER AND SET UP BLYNK 2.0
4.4.2.1 HOW TO REGISTER AND SET UP BLYNK 2.0 ON WEBSITE
If this is your firsttime using App Blynk, you need to register a new account Click on the link https://blynk.cloud/dashboard/login and follow the instructions below -Step 1: Click Create new account and fill in information such as email and password in the corresponding boxes After registering, the system will send you an email to confirm your information Go to your inbox and activate your account according to the instructions
- •Step 2: After registering for a Blynk 2.0 account, the interface will look like the image below > click New Template Next, name the Template and set the parameters as shown in the image
Figure 35 : Set up Blynk on website
-Step 3: Here, in the Info section, Template ID and Device Name will appear> click Copy and drop into Code on Arduino IDE
Figure 36: Link to arduino 4.4.2.2 HOW TO REGISTER AND SET UP BLYNK 2.0 ON App
Step 1: Log in to the previously registered account, here you will see the Template previously created on Web Cloud Blynk 2.0
Step 2: Click Value Display to represent the voltage value and similar values Step 3: Configure slider to control servo motors
EVALUATION RESULTS
After powering the system, the voltage values are fully displayed on the Blynk app, users can monitor voltage, current, electricity consumption today, yesterday and during the month and amount of electricity used during the day The automatic power transfer switch operates when the mains power is disconnected The solar panel control system has worked properly as required
The screen displays the energy, frequency, power, input voltage, total electricity, power consumption today and yesterday
Change the loads one by one to clearly see the change in power consumption through the parameters displayed on the screen, as well as the amount of power consumed over time Compare with the electronic meter installed before the system to check the accuracy of the sensor
Test the ability to measure electricity when plugging in a refrigerator device
It can be seen that when using a load at the smallest power level, the system will read and display the following parameters: Voltage (2ơ21V), Current (0.212A), Power (42W), Frequency (50Hz)
Regarding time, calculated from 12:00 p.m (0.01kWh) - 12:21 p.m (0.022kWh) means that in 21:13s a fan consumes 0.011kWh If compared with the electricity calculation formula, the error is not too large and completely acceptable
Test the automatic source change feature
Unplug the mains power supply through the sensor, after 5 seconds see relay 1 is off and relay 2 is on, connect the SOLAR power source to the power outlet after 0.5 seconds
Test the ability to change the direction of the panels
When in default mode, the solar panel is at a 0 degree angle, drag the slider to change the angle from the app, the solar panel will rotate in the desired direction
The project has finished the specified features and is operating steadily
Although there are still faults (very little, acceptable ones), the system model currently does a fair job of measuring and updating data to the web server and blynk server over time For the system to function more accurately, the model must be able to overcome noise
The Blynk app gives consumers easy-to-monitor access to comprehensive information and visual analytics Simple control interface, continuous data statistics throughout time.
CONCLUSION AND DEVELOPMENT DIRECTION
The present effort uses the internet to monitor a device's power consumption and shows all available data on an app The intended direction can be controlled via the solar battery control feature When there is a power loss, the automated power switch operates as needed, turning on the electricity can be tracked and managed from anywhere via a phone app, and it can get tracking information
The integration of IoT technology with solar systems to monitor energy
Households show a significant progress in energy management
This provides a solid foundation for more innovation and development in the field Hey, contributing to the use of energy efficiently, reliable and more sustainable Measurement and accurate data transmission system real -time data on voltage, current
Power and energy consumption, this is essential for energy management
Effective amount The use of Pzem-004T sensor and ESP32 microcontroller
Ensure reliable collection and transmission
Future research should discover the system's ability to expand to monitor many designs
Being and integrating with other renewable energy sources This may include expansion
The capabilities of the system to manage larger energy networks, such as networks Nets in commercial or industrial environment
The study of replacement protocols and communication technology, such as
Lorawan or NB-Eot, can improve the scope and reliability of the system, solid Especially in areas with poor network coverage
Update the setup to include additional sensors for measuring more devices
Create thresholds to alert users when they use excessive electricity or unsteady current
Integrate an inverter system to connect energy to the grid
Push data to the database to track every day of the month
[1] Jiacun Wang Real Time Embedded Systems, Quantitative Software
Engineering Series, 2nd edition, Wiley, 2020
[2] Mastering the STM32 Microcontroller by Carmine Noviello, Leanpub, 2022
[3] (Classics) Textbook of microprocessors in measurement and control, Hanoi University of Industry, Do Duy Phu, 2016
[4] Recommended text(s): Atmel 8051 Microcontrollers Hardware Manual
[5] The challenges of adopting new technologies in established markets
[6] Nguyễn Thái Học | Nguyễn Quang Huy| Lê Xuân Hải |
| Đặng Thị Thúy Huyền | Phạm Văn Hùng | Phạm Văn Nam | Mạng kết nối vạn vật (IoT) & Ứng dụng thực tế
[7] Fan, X (2015) Real-Time Embedded Systems Design Principles and
[8] Jane W.S Liu Real-Time Systems, Prentice Hall publisher, 2000
[9] Operating Systems Principles, Bic & Shaw, 2002
[10]Nguyễn Đình Phú, “Giáo trình vi xử lý II”, NXB ĐH Quốc Gia Tp.HCM, 2007
[11] Đồ án Nghiên cứu thiết kế hệ thống giám sát điện năng của nhà máy trên
PLC S7 – 400, http://luanvan.net.vn/luan-van/do-an-nghien-cuu-thie t-ke-he- thong-giam-sat-dien-nang-cua-nha-may-tren-plc-s7-400-26319/, 2013.Internet of things là gì, http://iot.dtt.vn/InternetofThings.html, 2018
[12]Review: IOT data logging services with MQTT, https://hackaday.com/2017/10/31/review-iot-data-logging-services-with-mqtt/, 2017 [13]:https://hiteconsvn.com/he-thong-dien-mat-troi-noi-luoi-giai-phap-tiet-kiem- dien.html
[14] http://arduino.vn/bai-viet/1053-giao-tiep-i2c-voi-nhieu-module
[15] https://www.thegioiic.com/tin-tuc/tim-hieu-ve-chuan-giao-tiep-i2c
[16]https://www.semiconductorforu.com/universal-asynchronous-receiver- transmitter-uart/universal-asynchronous-rece/
[17] https://anasa.vn/lap-trinh-pic-bai-9-giao-tiep-uart-voi-may-tinh
[18]https://innovatorsguru.com/wp-content/uploads/2019/06/PZEM-004T-V3.0-