PZEM-004T Prepaid Energy Meter on Raspberry Pi 5 - Proteus Simulation: the Raspberry Pi 5, the PZEM-004T on the mains, the relay, the AC fan, the keypad and the LCD

PZEM-004T Prepaid Energy Meter on Raspberry Pi 5 - Proteus Simulation

40
700
60
25
60
PCBWay

Hello friends, I hope you all are doing great. Today, I am going to share the PZEM-004T Prepaid Energy Meter on Raspberry Pi 5 - Proteus Simulation, the seventy-eighth project of our IoT Projects series. If you have searched for a PZEM-004T with a Raspberry Pi, reading an energy meter over Modbus RTU in Python, how a prepaid electricity meter works, or a smart meter project in a Proteus simulation, here is a complete one. Millions of homes pay for electricity before they use it: they buy a token, type its number on the meter, and the meter keeps the power on until the credit runs out. No meter reader, no bill, no debt.

This Raspberry Pi 5 turns a PZEM-004T energy meter into exactly that. It reads the voltage, current, power and power factor of a small house on 230 V mains over Modbus, counts the credit down by the energy really used, beeps when it runs low and opens a relay at zero. Typing a token on a touch keypad brings the power back, and the Pi refuses a mistyped token and a token used twice. In this tutorial, we will go through the circuit, measuring AC power and power factor, the Modbus RTU protocol with its CRC, turning power into energy, and token check digits. Then we run the whole story in the simulation. At the end, you can download the project with the program and every library file.

NOTICE: Our team has put a lot of effort into this project: the circuit, the code and every part in the simulation are our own work, and you get them all free. Your feedback is the fuel that keeps us going, so please tell us what you think in the comments below. And if our free projects help you, you can buy us a coffee. So, let's get started with the prepaid energy meter with PZEM-004T on Raspberry Pi 5 in Proteus simulation:

PZEM-004T Prepaid Energy Meter on Raspberry Pi 5 - Proteus Simulation: the Raspberry Pi 5, the PZEM-004T on the mains, the relay, the AC fan, the keypad and the LCD
Figure: The prepaid energy meter in a Proteus simulation: the house supplied on its credit.
PZEM-004T Prepaid Energy Meter on Raspberry Pi 5: the working Proteus simulation, an animated view of the project's main steps
Figure: The project working in the Proteus simulation (an animation of the main steps).

What Does This Prepaid Energy Meter Do?

  • Measures the mains: a PZEM-004T in the live wire gives the voltage, current, power, energy, frequency and power factor over Modbus RTU, once a second.
  • Counts the credit down: power multiplied by time is taken off the credit while the house is supplied.
  • Warns and cuts: a beep every 2 s when the credit runs low, and the relay opens at zero.
  • Takes tokens: an 8-digit token typed on a TTP229 touch keypad adds credit and switches the house back on.
  • Refuses bad tokens: a check digit catches typing mistakes, and each token's serial works only once.
  • Shows it all: a 16x2 LCD beside the keypad and a dashboard on a laptop or a phone.

It is a great project for learning AC power measurement, an industrial serial protocol and a little security thinking in one go. In the simulation, the PZEM-004T's pop-up shows the voltage and current waveforms and every Modbus frame in hex, and the AC fan's pop-up shows its own power and power factor, so every number the Pi reads can be checked.

Components Used in the Proteus Simulation

All the parts come from our Proteus libraries, each with its own tutorial, plus Proteus's own alternator as the mains. The project zip at the end includes every LIB and DLL file and the TEP Pi runtime.

The parts of the prepaid energy meter and their library posts
PartProteus deviceLibrary postConnection
Raspberry Pi 5RASPBERRY PI 5Raspberry Pi 5 Library for ProteusPI1, prepaid_meter.py, Ethernet 192.168.1.51
PZEM-004T energy meterPZEM004TTEPPZEM-004T Energy Meter Library for ProteusU1 on the UART, IN / L on the live wire
TTP229 touch keypadTTP229ADVTEPTTP229 Touch Keypad Library for ProteusU2, SCL GPIO17, SDO GPIO27
I2C LCD 16x2I2CLCD16X2BLUEADVTEPI2C LCD 16x2 Library for ProteusLCD1, I2C1 at 0x27
Relay moduleRELAY1ADVTEPRelay Module Library for ProteusRLY1, IN GPIO22 (active LOW), the house's supply
120 mm 230 V AC fanFAN120ACTEP120mm 230V AC Fan Library for ProteusM1, part of the house, 19 W
Power resistor 10 WRESISTORPOWER10WTEPPower Resistor Library for ProteusR1 5K6, the heater, 9.4 W
Active buzzerBUZZERACTIVETEPActive Buzzer Library for ProteusBZ1 on the 5 V rail
BC547B transistorBC547BTEPSmall Transistors Library for ProteusQ1, base through R3 from GPIO23
Resistors 1kRESISTOR4BANDTEPResistor Library for ProteusR2 across the buzzer, R3 to the base
Mains 230 V 50 HzALTERNATORProteus's own partV1, 325 V peak
Laptop WiFi MonitorLAPTOP WIFI MONITORLaptop WiFi MonitorPC1
Mobile WiFi MonitorMOBILE WIFI MONITORMobile WiFi MonitorMOB1

Proteus Simulation of the Prepaid Meter: the Circuit

Prepaid energy meter Proteus simulation circuit: Raspberry Pi 5, PZEM-004T, alternator, relay, AC fan, heater, keypad, LCD
Figure: The complete circuit of the prepaid energy meter on an A3 Proteus sheet.
The connections of the prepaid energy meter
Part pinConnectionSignal
PZEM-004T RX / TXGPIO14 TXD (pin 8) / GPIO15 RXD (pin 10)Modbus RTU, 9600 8N1
PZEM-004T IN, L / Nthe live wire / the neutralthe current through its shunt, the voltage
PZEM-004T OUTthe relay's COMthe metered supply to the house
Relay IN / NOGPIO22 (pin 15) / the houseLOW = supplied
TTP229 SCL / SDOGPIO17 (pin 11) / GPIO27 (pin 13)the keypad's 2-wire serial
LCD SDA / SCLGPIO2 (pin 3) / GPIO3 (pin 5)I2C1, 0x27
BC547 base (through 1k)GPIO23 (pin 16)HIGH = the buzzer on

The mains comes from V1, Proteus's own alternator: 325 V peak, which is 230 V RMS, at 50 Hz. The live wire goes into the meter's IN terminal and leaves at OUT, so the whole house current passes its shunt; L and N give it the voltage. A detail that catches many people: the PZEM-004T's metering side is powered by the very mains it measures, so without AC on L and N it does not answer at all. Its TTL side is isolated and powered by the Pi's 5 V. From OUT the supply goes through the relay to the house: the fan and the heater in parallel. The keypad and the relay take their supply from the 5 V rail; the LCD from the Pi's 5 V pin.

How the Prepaid Energy Meter Works

How a Prepaid Meter Works

A prepaid meter turns electricity into something you buy in advance, like phone credit. The customer pays a vendor, the vendor's system makes a token for that meter and that amount, and the customer types it on the meter. The meter checks the token, adds the credit, and from then on counts it down with every watt-hour the house uses. When the credit runs low it warns; at zero it opens its relay. Real meters follow the STS standard (IEC 62055-41): a 20-digit token, encrypted with a key that only that one meter knows, carrying the amount, a token identifier that can be used only once, and a check. This project keeps the same ideas in a simple, readable form.

AC Power and Power Factor

On AC mains, the voltage and the current both swing up and down 50 times a second. The meter samples both and works out three things. The RMS voltage and current are the effective values: 230 V RMS heats a resistor exactly as much as 230 V DC would. The real (active) power is the average of voltage times current at every instant, in watts: the power that does work and that the customer pays for. The apparent power is simply the RMS voltage times the RMS current, in volt-amperes. The power factor is real power divided by apparent power.

For a heater, the current follows the voltage exactly and the power factor is 1. A motor like the fan stores energy in its magnetic field every half-cycle and gives it back, so its current lags the voltage and its power factor is lower, 0.7 here. Worked example with the numbers of this project: the heater takes 230 x 230 / 5600 = 9.4 W, the fan 19 W, so the real power is about 28.5 W. The meter reads 229.6 V and 0.148 A, so the apparent power is 229.6 x 0.148 = 34.0 VA, and the power factor is 28.5 / 34.0 = 0.84. The house pays for 28.5 W, but its wires carry the current of 34 VA.

Modbus RTU and the CRC

The PZEM-004T speaks Modbus RTU, the plain binary protocol of countless industrial meters and drives, at 9600 baud. The Pi sends a request: the meter's address (0x01), a function code, the first register and the number of registers, and a 16-bit CRC. Function 0x04 reads input registers: ten registers from 0x0000 give the whole reading. The meter answers with its address, the function, a byte count (20), the 20 data bytes and its own CRC. The values are scaled integers: the voltage in 0.1 V, the current in 0.001 A, the power in 0.1 W, the energy in Wh, the frequency in 0.1 Hz and the power factor in 0.01. Current, power and energy need 32 bits, two registers, and the PZEM sends the LOW word first. The CRC is a 16-bit cyclic redundancy check with the polynomial 0xA001: a single wrong bit anywhere in the frame changes it, so a reply damaged on the wire is simply thrown away. Function 0x42 resets the meter's energy counter.

From Power to Credit

Energy is power multiplied by time. Every second the Pi takes the power the meter measured and the real time since the last reading, and subtracts power x time from the credit. Worked example: 28.5 W for 1 s is 28.5 joules, which is 28.5 / 3600 = 0.0079 Wh. A real meter counts kWh, and a house of 1 kW uses one per hour; this simulated house uses only about 30 W, so the project counts the credit in Wh to keep the story inside a minute. A credit of 0.15 Wh then lasts 0.15 / 28.5 x 3600 = 19 s. The meter's own energy register counts in whole Wh, too coarse for that, so the Pi does its own counting and shows the register beside it.

Tokens and Check Digits

A token in this project is 8 digits, UUUU SSS C: the credit in hundredths of a Wh (0030 = 0.30 Wh), a serial number (001) and a check digit. The check digit uses the Luhn algorithm, the same one that protects credit card numbers. Starting from the right of the first 7 digits, every second digit is doubled (9 is subtracted when the result is over 9), and everything is added up; the check digit is whatever brings the total to a multiple of 10. Worked example for 0030001: from the right, 1 doubled is 2, then 0, 0 doubled is 0, 0, 3 doubled is 6, 0, 0 doubled is 0; the sum is 8, so the check digit is 2 and the token is 00300012. A typing mistake in any one digit, and most swaps of two neighbouring digits, change the total, so the meter refuses it at once. A check digit protects against mistakes, not fraud, so the meter also remembers every serial it has accepted: the same token typed a second time is refused. Real STS tokens add encryption so that a token cannot be invented at all.

The Python Code Explained

The program is prepaid_meter.py, written for Raspberry Pi OS with lgpio for the GPIO and I2C and pyserial for the UART. Four threads share the work: the metering, the keypad, the buzzer and the web server. The Modbus request for the ten input registers:

        r = self.transact([PZEM_ADDR, 0x04, 0x00, 0x00, 0x00, 0x0A], 25)

The CRC, one bit at a time with the polynomial 0xA001, and the check of every reply:

            c = (c >> 1) ^ 0xA001 if c & 1 else c >> 1
        if len(r) != want or crc16(r[:-2]) != (r[-2] | r[-1] << 8):

The registers into real units, the 32-bit values low word first:

        return {'v': w[0] / 10, 'i': (w[1] | w[2] << 16) / 1000, 'p': (w[3] | w[4] << 16) / 10, 'wh': w[5] | w[6] << 16,

At start the meter's energy counter is reset with function 0x42:

        r = self.transact([PZEM_ADDR, 0x42], 4)                    # (the reply echoes the request)

Every second, power x time comes off the credit:

            used = p * dt / 3600.0                               # Wh in this second
            credit = max(0.0, credit - used / UNIT_WH)

The relay is active LOW, so a 0 supplies the house:

    lgpio.gpio_write(chip, RELAY, 0 if on else 1)        # (active LOW: 0 = the relay on = the house supplied)

The keypad is read with 16 clocks; a touched pad pulls SDO low:

            if lgpio.gpio_read(chip, KEY_SDO) == 0 and not key:

A token: the Luhn check doubles every second digit from the right, then its credit and serial, and a serial is accepted only once:

        if k % 2 == 1:
    units, serial_no = int(tok[:4]) / 100, tok[4:7]
    if serial_no in used_serials:

The LCD shows the credit and the power, or LOW with BUY A TOKEN, or CREDIT EMPTY with ENTER TOKEN; while a token is typed, its digits; after OK, the answer for 3 s. The dashboard's pages are / (the credit, the readings, the energy and the last events) and /data (JSON).

How to Run the Proteus Simulation

  1. Download the project zip below and install the library files (the steps are under the download button).
  2. Open Pi-5-Prepaid-Meter.pdsprj from the Proteus Simulation folder. Keep prepaid_meter.py and the DLL files next to it.
  3. Press Play. The house runs on its 0.15 Wh credit: LOW CREDIT after about 11 s, CREDIT EMPTY after about 19 s.
  4. Click U2 for the keypad's pop-up and touch 0 0 3 0 0 0 1 2 (pad 10 is 0), then pad 12, OK: +0.30 Wh, the house on again.
  5. Try 00300015, a typing mistake, and 00300012 again, a used token. Watch the LCD and the dashboard on the Laptop WiFi Monitor (press Go).

Simulation Results: the Prepaid Meter in Proteus

We ran the whole story in one simulation: the house running down its credit, the warning, the cut-off, a token, a typing mistake and a copied token, reading the Pi's terminal, the LCD, the dashboard and the pop-ups of the meter, the fan, the relay and the keypad along the way. The program started cleanly:

   0.1 s  PZEM-004T at 0x01: the energy register reset (0x42)
   0.1 s  the credit is 0.15 Wh: the supply is ON

1. The House on Its Credit

Prepaid energy meter Proteus simulation: the house supplied, the LCD shows the credit and 29 W
Figure: The prepaid meter simulation with the house supplied: the credit on the LCD.
PZEM-004T pop-up in the Proteus simulation: 229.8 V, 0.148 A, 28.5 W, PF 0.84, the Modbus traffic in hex
Figure: The PZEM-004T with the house supplied: 28.5 W at a power factor of 0.84.

The meter's pop-up shows exactly what the power factor section predicted: 229.8 V and 0.148 A, which is 34.0 VA of apparent power, 28.5 W of real power, a power factor of 0.84, 50.0 Hz. The current wave (green) runs a little behind the voltage (orange): that is the fan's lagging current. On the right, every Modbus frame in hex: the Pi's 8-byte requests and the meter's 25-byte replies, 0 CRC errors.

AC fan pop-up in the Proteus simulation: 2642 RPM, 19.1 W at power factor 0.72 on 230 V
Figure: The 120 mm fan: 19.1 W at a power factor of 0.72, the motor's share.

The fan's own pop-up confirms its share: 19.1 W at a power factor of 0.72, running at 2642 RPM. The other 9.4 W is the heater, at a power factor of 1, and together they give the 0.84 the meter measured.

LCD 16x2 pop-up in the Proteus simulation: CR 0.10Wh 28W, 230V PF 0.84
Figure: The LCD with the house supplied: the credit, the power, the voltage and the power factor.
Laptop WiFi Monitor in the Proteus simulation: the prepaid meter dashboard, ON, the readings
Figure: The dashboard with the house supplied: the credit falling, the readings, the events.

The LCD and the dashboard show the credit falling second by second, 0.0079 Wh at a time. The meter's own energy register still reads 0 Wh, since it counts in whole Wh, while the Pi's count had already reached 0.045 Wh.

2. LOW CREDIT, then CREDIT EMPTY

  11.1 s  LOW CREDIT: 0.058 Wh left (28.5 W: about 7 s)
  19.1 s  CREDIT EMPTY: the supply is OFF - buy a token
Prepaid energy meter Proteus simulation with LOW CREDIT: LOW 0.05Wh, BUY A TOKEN on the LCD
Figure: The prepaid meter simulation with LOW CREDIT: the buzzer beeps every 2 s.
LCD 16x2 pop-up in the Proteus simulation: LOW 0.05Wh 29W, BUY A TOKEN
Figure: The LCD with LOW CREDIT: about 7 seconds left at this power.

Below 0.06 Wh the meter switched to LOW and started beeping every 2 s. The terminal even worked out how long the credit would last at the present power: about 7 s.

Prepaid energy meter Proteus simulation with CREDIT EMPTY: the relay open, the house off
Figure: The prepaid meter simulation with CREDIT EMPTY: the relay open.
LCD 16x2 pop-up in the Proteus simulation: CREDIT EMPTY, ENTER TOKEN
Figure: The LCD with the credit gone: CREDIT EMPTY, ENTER TOKEN.

The credit ran out at 19.1 s; the calculation above said 0.15 Wh at 28.5 W would last 18.9 s. The relay opened at once, with one long beep.

PZEM-004T pop-up in the Proteus simulation: 230.5 V, 0.000 A, 0.0 W with the house switched off
Figure: The PZEM-004T with the house off: the voltage still there, no current.
Relay module pop-up in the Proteus simulation: the relay is off, IN high, the contact open
Figure: The relay module with the credit empty: IN high, the contact open.

The meter still sees the mains, 230.5 V, but no current flows through its shunt any more: 0.000 A, 0.0 W, a flat green line. The relay's pop-up shows why: its input high, its coil without current, its contact open.

Laptop WiFi Monitor in the Proteus simulation: EMPTY, the credit 0.000 Wh, the supply OFF
Figure: The dashboard with the credit empty: the supply off.

3. A Token on the Keypad

LCD 16x2 pop-up in the Proteus simulation: TOKEN: 00300012 typed on the keypad
Figure: The LCD while the token is typed: TOKEN: 00300012.
TTP229 keypad pop-up in the Proteus simulation: the pads read 10 10 3 10 10 10 1 2, a read every 50 ms
Figure: The TTP229 keypad: the pads the Pi read, pad 10 being the 0.

We touched 0 0 3 0 0 0 1 2 on the keypad's pop-up, pad 10 being the 0. The LCD showed every digit as it came, and the keypad's pop-up lists the pads the Pi read, one read every 50 ms, without a single miss.

  27.0 s  token 00300012 accepted: +0.30 Wh (serial 001) - the credit is 0.30 Wh
  27.1 s  the supply is ON again
LCD 16x2 pop-up in the Proteus simulation: TOKEN OK +0.30Wh, CREDIT 0.30 Wh
Figure: The LCD after OK: TOKEN OK, +0.30 Wh.
Prepaid energy meter Proteus simulation after the token: TOKEN OK on the LCD, the house supplied again
Figure: The prepaid meter simulation after the token: the house on again.

OK on pad 12: the Luhn check passed, serial 001 was new, and the credit of 0.30 Wh was added. The relay closed at once with two short beeps.

Laptop WiFi Monitor in the Proteus simulation: the token accepted, 37.1 W at PF 0.91 while the fan restarts
Figure: The dashboard just after the token: the fan's start-up surge, 37.1 W at PF 0.91.

The dashboard caught something real a moment later: 37.1 W at a power factor of 0.91. That is the fan starting again. A motor draws more while it speeds up, and at a better power factor, until it reaches its running speed and settles back to 19 W. A prepaid meter charges for that too.

4. A Typing Mistake and a Copied Token

  32.8 s  token 00300015 refused: the check digit is wrong (a typing mistake?)
  36.6 s  token 00300012 refused: serial 001 was already used
LCD 16x2 pop-up in the Proteus simulation: INVALID TOKEN, CHECK DIGIT for 00300015
Figure: The LCD after 00300015: the check digit does not match.

Next we typed 00300015, the same token with its last digit wrong. The Luhn total no longer ended in 0, so the meter refused it with INVALID TOKEN and a long beep, without touching the credit.

LCD 16x2 pop-up in the Proteus simulation: TOKEN USED, SERIAL 001 for the token typed again
Figure: The LCD after the same token again: serial 001 already used.

Then we typed the good token 00300012 a second time. Its check digit is perfect, but serial 001 had already been accepted, so the meter refused it: TOKEN USED. A token can be photographed or passed around; it can still only be used once.

Laptop WiFi Monitor in the Proteus simulation: the tokens refused, the credit 0.191 Wh, ON
Figure: The dashboard at the end: one token accepted, two refused.
Mobile WiFi Monitor in the Proteus simulation: the prepaid meter dashboard on a phone
Figure: The same dashboard on the Mobile WiFi Monitor.

The phone shows the same dashboard. And the terminal holds the whole story:

Raspberry Pi 5 terminal in the Proteus simulation: every prepaid meter event of the run
Figure: The Raspberry Pi 5 terminal: every event of the run.
The prepaid meter's run in the Proteus simulation
EventThe program's timeWhat the meter did
the house on its credit0.1 s0.15 Wh, 28.5 W, PF 0.84
LOW CREDIT11.1 sa beep every 2 s
CREDIT EMPTY19.1 sthe relay opened: 0.000 A
token 0030001227.0 s+0.30 Wh, the house on again
token 0030001532.8 srefused: the check digit
token 00300012 again36.6 srefused: serial 001 used

The run covered 43 seconds of simulation in about 10 minutes on our PC: 44 Modbus requests, 44 replies and 0 CRC errors, 27 keys read and none missed. The pop-ups of the meter, the fan and the relay judged every number independently.

Download the Project Files

Click the button below to download Prepaid-Energy-Meter-PZEM-004T-Raspberry-Pi-5-Proteus-Simulation-v1.0.zip (about 15.8 MB, without the source code of the models):

PZEM-004T Prepaid Energy Meter on Raspberry Pi 5 - Proteus Simulation V1.0
  • Proteus Simulation: Pi-5-Prepaid-Meter.pdsprj, prepaid_meter.py and copies of the models.
  • Python Code: prepaid_meter.py, the program.
  • Proteus Library Files: the LIB files of every part.
  • Proteus Model Files: the DLL models and the TEPPi folder (the Python runtime of the simulated Pi).
  • README.txt: the installation steps, the properties, the test results and the links to every library post.

No Proteus yet? Read How to Download and Install Proteus 7 and 8. New to libraries? Follow How to Install a New Library in Proteus.

How to Install the Project Files

  1. Close Proteus and extract the whole zip file, for example to your Desktop.
  2. Copy the files from Proteus Library Files into the LIBRARY folder of Proteus.
  3. Copy everything from Proteus Model Files, the DLL files and the TEPPi folder, into the MODELS folder.
  4. Start Proteus and open the project from the Proteus Simulation folder.

Changing the Code

prepaid_meter.py is plain Python: edit it next to the project and press Play again. The start credit (START_UNITS), the low-credit level (LOW_UNITS) and the size of a credit unit (UNIT_WH, 1000 for kWh on a real meter) are at the top. On a real Raspberry Pi the same file runs with python3-lgpio and python3-serial installed and the serial port enabled in raspi-config.

Ideas to Extend the Project

  • Add an emergency credit: a small loan of energy at night, paid back from the next token.
  • Keep the credit and the used serials in a file so that a power cut does not lose them.
  • Add tariffs: a higher price per Wh above a threshold, or at peak hours.
  • Make real tokens: sign the amount and serial with a secret key (an HMAC) so that nobody can invent one.
  • Send the low-credit warning to the customer's phone.
  • Use the PZEM-004T's power alarm register to cut off a single appliance that draws too much.

From Simulation to a Real Meter

  • Mains can kill: the meter, the relay and the wiring must be built and fitted by a qualified electrician to the local rules; this project is a simulation for learning.
  • Size the relay: the contacts must carry the whole house current; real meters use a latching relay of 60 to 100 A.
  • Use the CT version for big loads: the PZEM-004T 100 A version measures with a current transformer instead of a shunt.
  • Count in kWh: set UNIT_WH to 1000; a 1 kW house then uses one unit an hour.
  • Never trust a token you can read: a check digit stops mistakes, only encryption stops forgery.

Troubleshooting

  • No reply from the PZEM-004T: its metering side needs AC on L and N, and its RX and TX must cross to the Pi's TXD and RXD.
  • The credit never falls: the house must be wired after the meter, through IN and OUT, so its current passes the shunt.
  • The keypad does nothing: VCC on the 5 V rail, 16-key mode (TP2), SCL and SDO on GPIO17 and GPIO27.
  • Every token is refused: 8 digits, the last one the Luhn check digit; a serial works only once per run.
  • The terminal cannot start Python: the TEPPi folder must be in the MODELS folder.

Limitations of the Simulation

  • The credit is counted in Wh, not kWh, because the simulated house uses only about 30 W and the story must fit in about a minute of simulation.
  • The tokens are a simple 8-digit form with a check digit and one-time serials; real STS tokens are encrypted.
  • The meter, the fan and the heater are our libraries' models; the mains is Proteus's ideal alternator, without the dips and noise of a real grid.
  • The network to the laptop and the phone is simulated inside Proteus.
  • Raspberry Pi is a trademark of Raspberry Pi Ltd and PZEM-004T a product of Peacefair; this project is not made or endorsed by them or by Labcenter.

So, that was all about the PZEM-004T Prepaid Energy Meter on Raspberry Pi 5 - Proteus Simulation. I hope it helps you understand how an energy meter measures real power and power factor, how to read it over Modbus RTU with a proper CRC check, how power becomes energy and credit, and how a simple check digit and one-time serials make tokens safer to type, all tested in a simulation before you go anywhere near the mains. More projects with the Raspberry Pi 5 and the ESP32 are coming. If you have any questions, ask in the comments and I will help you out. Till the next tutorial, take care and have fun!


Comments

0

Join the conversation