Project Files of PZEM-004T Prepaid Energy Meter on Raspberry Pi 5 - Proteus Simulation
009e89b5209b47a19832e1973abbe18b.zip

PZEM-004T Prepaid Energy Meter on Raspberry Pi 5 - Proteus Simulation V1.0
PZEM-004T Prepaid Energy Meter on Raspberry Pi 5 - Proteus Simulation V1.0 comes as a ZIP archive of 156 files (15.8 MB, 31.7 MB unpacked) holding Proteus library files, simulation model DLLs, a Proteus simulation, source code and a nested archive.
- LIBProteus library
- DLLProteus model
- DSNProteus simulation
- SRCSource code
- ZIPNested archive
Description
Prepaid-Energy-Meter-PZEM-004T-Raspberry-Pi-5-Proteus-Simulation-v1.0.zip: the complete Proteus simulation project (a Raspberry Pi 5, a PZEM-004T energy meter, 230 V mains, a relay, an AC fan and a heater, a TTP229 keypad, an I2C LCD, a buzzer, the Laptop and Mobile WiFi Monitors), the Python program prepaid_meter.py, every LIB and DLL, the TEP Pi runtime and a README.
File Structure
19.2 KB18.6 KB9.9 KB181.4 KB39.5 KB13.1 KB157.2 KB21.5 KB490.4 KB306.9 KB60.5 KB93.4 KB3.3 MB34.3 KB620.8 KB36 KB169.8 KB628.1 KB99.3 KB65.3 KB4.8 MB4.1 MB80 B97.8 KB26.8 KB1.2 MB1.1 MB88.9 KB27.3 KB55.8 KB79.8 KB105.8 KB193.8 KB113.8 KB48.8 KB145.8 KB36.8 KB29.3 KB42.3 KB28.8 KB67.3 KB89.3 KB153.8 KB22.8 KB38.8 KB2.1 KB9.9 KB4.1 KB1.3 KB4.7 KB431 B2.5 KB17.5 KB283 B6.5 KB37.9 KB11.1 KB5.5 KB885 B13.6 KB9 KB878 B1.5 KB4 KB1004 B10 B110 B2.6 KB1.1 KB8.9 KB58.5 KB12.4 KB6.6 KB18.5 KB20.7 KB27.8 KB21.1 KB7.1 KB7.7 KB2.7 KB51.2 KB100.9 KB1.2 KB24.3 KB7.4 KB53.6 KB26.1 KB20.5 KB60.5 KB19.6 KB1.6 KB8.4 KB20.9 KB2.6 KB539 B1.4 KB9.7 KB2.8 KB21 B92 B7.9 KB264 B3.4 KB3.8 KB17.5 KB55.2 KB3.3 KB10.8 KB1.5 KB4.2 KB7.3 KB2.5 KB32.6 KB14.5 KB283 B17.4 KB257 B691 B14.5 KB12.8 KB3.6 KB1.7 KB37 KB418 B6.2 KB7 KB37.3 KB10.6 KB23.7 KB28.7 KB8.8 KB16.9 KB291 KB292 KB276 KB409 KB3.0 MB304.5 KB318.5 KB330 KB311 KB311.5 KB48.6 KB14.4 KB291 KB292 KB276 KB409 KB3.0 MB304.5 KB318.5 KB330 KB311 KB311.5 KB14.4 KB13.1 KBGallery12 images from the tutorialOpen the tutorial
The circuit, the board and the results as they appear in PZEM-004T Prepaid Energy Meter on Raspberry Pi 5 - Proteus Simulation. Open an image for its full size.












README
===============================================================================================================
PZEM-004T Prepaid Energy Meter on Raspberry Pi 5 - Proteus Simulation - Project V1.0
The Engineering Projects - www.TheEngineeringProjects.com
===============================================================================================================
IMPORTANT LINKS
The project tutorial (circuit, code, simulation results):
https://www.theengineeringprojects.com/2026/11/prepaid-energy-meter-pzem-004t-raspberry-pi-5-proteus-simulation.html
The libraries this project is built from (each post has its own full download and tutorial):
Raspberry Pi 5 board:
https://www.theengineeringprojects.com/2026/10/raspberry-pi-5-library-for-proteus.html
PZEM-004T energy meter:
https://www.theengineeringprojects.com/2026/11/pzem-004t-energy-meter-library-for-proteus.html
TTP229 touch keypad:
https://www.theengineeringprojects.com/2026/10/ttp229-touch-keypad-library-for-proteus-v1-0.html
I2C LCD 16x2:
https://www.theengineeringprojects.com/2026/10/i2c-lcd-16x2-library-for-proteus-v1-0.html
Relay module:
https://www.theengineeringprojects.com/2026/10/relay-module-library-for-proteus-v1-0.html
120 mm 230 V AC fan:
https://www.theengineeringprojects.com/2026/11/120mm-230v-ac-fan-library-for-proteus.html
Power resistor:
https://www.theengineeringprojects.com/2026/11/power-resistor-library-for-proteus.html
Active buzzer:
https://www.theengineeringprojects.com/2026/11/active-buzzer-library-for-proteus.html
Small transistors (BC547):
https://www.theengineeringprojects.com/2026/11/small-transistors-library-for-proteus.html
Resistor:
https://www.theengineeringprojects.com/2026/11/resistor-library-for-proteus.html
Laptop WiFi Monitor:
https://www.theengineeringprojects.com/2026/10/laptop-wifi-monitor-library-for-proteus.html
Mobile WiFi Monitor:
https://www.theengineeringprojects.com/2026/10/mobile-wifi-monitor-library-for-proteus.html
Support our free work: https://www.theengineeringprojects.com/donate
FILE STRUCTURE
Pi-5-Prepaid-Meter-TEP-v1.0/
|-- Proteus Library Files/
| |-- TEPACFAN120.LIB 19.2 KB a part of the project -> LIBRARY folder
| |-- TEPBJT.LIB 18.6 KB a part of the project -> LIBRARY folder
| |-- TEPBUZZER.LIB 9.9 KB a part of the project -> LIBRARY folder
| |-- TEPI2CLCD16X2.LIB 181.4 KB a part of the project -> LIBRARY folder
| |-- TEPLAPTOP.LIB 39.5 KB a part of the project -> LIBRARY folder
| |-- TEPMOBILE.LIB 13.1 KB a part of the project -> LIBRARY folder
| |-- TEPPOWERRES.LIB 157.2 KB a part of the project -> LIBRARY folder
| |-- TEPPZEM004T.LIB 21.5 KB a part of the project -> LIBRARY folder
| |-- TEPRELAY.LIB 490.4 KB a part of the project -> LIBRARY folder
| |-- TEPRESISTOR.LIB 306.9 KB a part of the project -> LIBRARY folder
| |-- TEPRPI5.LIB 60.5 KB a part of the project -> LIBRARY folder
| |-- TEPTTP229.LIB 93.4 KB a part of the project -> LIBRARY folder
|-- Proteus Model Files/
| |-- TEPACFAN120.DLL 291.0 KB a model -> MODELS folder
| |-- TEPBJT.DLL 292.0 KB a model -> MODELS folder
| |-- TEPBUZZER.DLL 276.0 KB a model -> MODELS folder
| |-- TEPLCD.DLL 409.0 KB a model -> MODELS folder
| |-- TEPNET.DLL 3.01 MB a model -> MODELS folder
| |-- TEPPOWERRES.DLL 304.5 KB a model -> MODELS folder
| |-- TEPPZEM004T.DLL 318.5 KB a model -> MODELS folder
| |-- TEPRELAY.DLL 330.0 KB a model -> MODELS folder
| |-- TEPRESISTOR.DLL 311.0 KB a model -> MODELS folder
| |-- TEPTTP229.DLL 311.5 KB a model -> MODELS folder
| |-- TEPPi/python/ 17.54 MB Python 3.11 embeddable -> MODELS\TEPPi (33 files)
| |-- TEPPi/runtime/ 1.11 MB TEP Pi runtime, gpiozero -> MODELS\TEPPi (87 files)
|-- Proteus Simulation/
| |-- Pi-5-Prepaid-Meter.pdsprj 48.6 KB the project simulation
| |-- prepaid_meter.py 14.4 KB the program PI1 runs
| |-- TEPACFAN120.DLL 291.0 KB copy of the model
| |-- TEPBJT.DLL 292.0 KB copy of the model
| |-- TEPBUZZER.DLL 276.0 KB copy of the model
| |-- TEPLCD.DLL 409.0 KB copy of the model
| |-- TEPNET.DLL 3.01 MB copy of the model
| |-- TEPPOWERRES.DLL 304.5 KB copy of the model
| |-- TEPPZEM004T.DLL 318.5 KB copy of the model
| |-- TEPRELAY.DLL 330.0 KB copy of the model
| |-- TEPRESISTOR.DLL 311.0 KB copy of the model
| |-- TEPTTP229.DLL 311.5 KB copy of the model
|-- Python Code/
| |-- prepaid_meter.py 14.4 KB the program (the same file)
|-- README.txt ~11.7 KB this file
Total: 31.70 MB (unzipped). The C++ source code of the models is not included.
WHAT IS IT?
A prepaid (pay-as-you-go) electricity meter: buy a token, type it on the keypad, and the house has power until
the credit runs out. A Raspberry Pi 5 reads a PZEM-004T energy meter over Modbus, counts the credit down by the
energy really used, warns when it runs low, switches the house off at zero and checks every token.
* PI1 RASPBERRY PI 5 runs prepaid_meter.py on Ethernet at 192.168.1.51 (port 8000).
* U1 the PZEM-004T (PZEM004TTEP, Modbus address 1) on the Pi's UART (/dev/serial0, 9600 8N1): its RX from the
Pi's TXD (GPIO14, pin 8), its TX to the Pi's RXD (GPIO15, pin 10), 5V from the Pi's 5 V pin (pin 2), GND. On
the mains side IN and L on the live wire, N on the neutral; OUT feeds the house through the relay.
* V1 Proteus's own ALTERNATOR, 325 V peak (230 V RMS) 50 Hz: + the live wire L, - the earthed neutral.
* RLY1 a 1-channel relay module (RELAY1ADVTEP): IN = GPIO22 (pin 15, active LOW), VCC on the 5 V rail; COM from
the meter's OUT, NO to the house.
* The house: M1 a 120 mm 230 V AC fan (FAN120ACTEP, 19 W, power factor 0.7) and R1 a 10 W power resistor 5K6
(RESISTORPOWER10WTEP, 9.4 W - the heater): about 28.5 W, power factor 0.84 together.
* U2 a TTP229 touch keypad (TTP229ADVTEP, 16 keys, TP2): SCL = GPIO17 (pin 11), SDO = GPIO27 (pin 13), VCC on the
5 V rail; pads 1 - 9 = 1 - 9, pad 10 = 0, pad 11 = DEL, pad 12 = OK.
* LCD1 an I2C LCD 16x2 (I2CLCD16X2BLUEADVTEP, 0x27) on I2C1, VCC from the Pi's 5 V pin.
* BZ1 an active buzzer (BUZZERACTIVETEP) switched by Q1 BC547B (base through R3 1k from GPIO23, pin 16), R2 1k
across the buzzer.
* Laptop WiFi Monitor (PC1) and Mobile WiFi Monitor (MOB1) open http://192.168.1.51:8000/.
What the program does:
the meter Modbus RTU function 0x04, ten input registers from 0x0000 once a second: voltage (0.1 V),
current (0.001 A, 32 bits), power (0.1 W, 32 bits), energy (1 Wh, 32 bits), frequency (0.1 Hz),
power factor (0.01), alarm; 32-bit values LOW word first; the CRC16 (0xA001) checked on every
reply; at start function 0x42 resets the meter's energy
the credit counted in Wh (a real meter counts kWh: this house uses about 30 W, so Wh keep the story short);
power x time is taken off while the house is supplied; under 0.06 Wh a beep every 2 s
(LOW CREDIT); at 0 the relay opens (CREDIT EMPTY); the start credit 0.15 Wh
a token 8 digits UUUU SSS C: the credit in hundredths of a Wh, a serial, a Luhn check digit over the
first 7; a good token adds its credit and switches the house on; a wrong check digit (a typing
mistake) or a used serial (a copied token) is refused. Real meters use 20-digit encrypted STS
tokens; this one shows the idea. The test tokens: 00300012 (+0.30 Wh, serial 001); 00300015 (a
wrong check digit)
Its pages:
/ the dashboard /data JSON
Python libraries: lgpio and serial (both in the TEPPi runtime; on Raspberry Pi OS: python3-lgpio and
python3-serial); threading, http.server.
TEST STATUS
Tested in Proteus 8 Professional on Windows 11, the run that made the tutorial's screenshots (the program's times):
- Start: "PZEM-004T at 0x01: the energy register reset (0x42)"; 0.15 Wh credit: the supply ON.
- The house: 229.5 V, 0.148 A, 28.5 W, PF 0.84, 50.0 Hz (34.0 VA; the fan 19.1 W at PF 0.72 on its pop-up).
- 11.1 s: "LOW CREDIT: 0.058 Wh left (28.5 W: about 7 s)" - a beep every 2 s, LOW 0.05Wh / BUY A TOKEN.
- 19.1 s: "CREDIT EMPTY: the supply is OFF" (0.15 Wh at 28.5 W = 18.9 s) - the relay open, the meter 0.000 A, 0.0 W.
- The token 0 0 3 0 0 0 1 2 + OK on the keypad: "token 00300012 accepted: +0.30 Wh (serial 001)" at 27.0 s, the
supply ON again (the fan's start-up surge: 37.1 W at PF 0.91, then back to 28.5 W).
- 00300015 + OK at 32.8 s: refused, the check digit is wrong; 00300012 again at 36.6 s: refused, serial 001 used.
- 44 Modbus requests, 44 replies, 0 CRC errors; 27 keys read, 0 missed; 43.0 s of simulation in 603 s.
INSTALLATION
1. Close Proteus. Extract the WHOLE zip file, for example to your Desktop.
2. Copy the files from "Proteus Library Files" into the LIBRARY folder of Proteus, for example
C:\Program Files (x86)\Labcenter Electronics\Proteus 8 Professional\LIBRARY
3. Copy everything in "Proteus Model Files" - the DLL files and the TEPPi folder - into the MODELS folder (next
to LIBRARY).
4. Start Proteus. Press P in the schematic and search for RASPBERRY PI 5 or PZEM004TTEP to check that the parts
are there.
RUN THE SIMULATION
1. Open "Proteus Simulation\Pi-5-Prepaid-Meter.pdsprj". Keep prepaid_meter.py and the DLL files beside it.
2. Press Play. The house runs on the 0.15 Wh credit: LOW CREDIT after about 11 s, CREDIT EMPTY after about 19 s.
3. Click U2 for the keypad's pop-up and type 0 0 3 0 0 0 1 2, then OK (pad 12): +0.30 Wh, the house on again.
4. Try 00300015 (a typing mistake) and 00300012 again (already used). Watch the LCD and the dashboard (PC1, Go).
PROPERTIES USED IN THIS PROJECT
PI1 RASPBERRY PI 5 PROGRAM=prepaid_meter.py, ETHERNET=IN (192.168.1.51)
U1 PZEM004TTEP ADDRESS=1, ALARM_W=2300, ENERGY=0
V1 ALTERNATOR AMP=325V, FREQ=50Hz
U2 TTP229ADVTEP OPTIONS=TP2 (16 keys); R1 RESISTORPOWER10WTEP 5K6; M1 FAN120ACTEP; RLY1 RELAY1ADVTEP
LCD1 I2CLCD16X2BLUEADVTEP; PC1, MOB1 HOMEPAGE=http://192.168.1.51:8000/
TROUBLESHOOTING
* "no reply from the PZEM-004T": the meter is powered by the mains it measures - V1 must feed its L and N; its RX
and TX cross to the Pi's TXD and RXD.
* The keypad does nothing: VCC on the 5 V rail, SCL / SDO on GPIO17 / GPIO27, 16-key mode (TP2).
* The house never switches off: the relay's IN is active LOW (GPIO22 high = off).
* The credit never falls: the house must be wired after the meter (IN, OUT) so its current passes the shunt.
SAFETY
* Mains voltage can kill. In a real installation 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.
LICENCES
* The project, the program, the parts (LIB files) and the models (DLL files) are made by The Engineering Projects
and are free for learning and for your own projects. The models use only standard Windows libraries.
The C++ source code of the models is not included; the source code is not included for any model.
* TEPPi\python is the Python 3.11 Windows embeddable package (Python Software Foundation License); TEPPi\runtime
holds our TEP Pi runtime with gpiozero and colorzero (BSD licences) - their licence files are inside the folders.
* Proteus is a product of Labcenter Electronics and is not included (the ALTERNATOR is Proteus's own part).
Raspberry Pi is a trademark of Raspberry Pi Ltd; PZEM-004T is a product of Peacefair.
This project is not made or endorsed by them.
VERSION
V1.0 - the first release of the project.
===============================================================================================================Development1 release
-
V1.0PZEM-004T Prepaid Energy Meter on Raspberry Pi 5 - Proteus Simulation V1.0this page
V1.0 is the only release in the Download Center so far. When a newer version is published, it appears above with its own download page.
Installation7 steps
From the download to a working project, in order. The steps follow what the package contains.
You will need
- Proteus Design SuiteProteus 8 or newer (Labcenter), on Windows
- Pythonto build the source files into firmware
- Any archive toolWindows, macOS and Linux extract ZIP files on their own
Steps
- 1
Extract the archive
Right-click 009e89b5209b47a19832e1973abbe18b.zip and choose Extract All (or open it with 7-Zip or WinRAR) into a folder you can find again. Keep its folder structure (Pi-5-Prepaid-Meter-TEP-v1.0) as it is.
- 2
Copy the library files into Proteus
Move TEPACFAN120.LIB, TEPBJT.LIB and TEPBUZZER.LIB and 9 more and the files into the LIBRARY folder of your Proteus installation: C:\Program Files (x86)\Labcenter Electronics\Proteus 8 Professional\LIBRARY for Proteus 8, or the matching Proteus 7 folder. Older versions keep it under ProgramData\Labcenter Electronics. If Proteus is open, close it first.
- 3
Add the simulation model
Copy TEPACFAN120.DLL, TEPBJT.DLL and TEPBUZZER.DLL and 14 more into the MODELS folder next to LIBRARY, so the component can run, not only be drawn.
- 4
Restart Proteus and place the component
Start Proteus, open a schematic, press P (Pick Devices) and search for the component by the name used in the tutorial. It appears with its pins ready to wire.
- 5
Build the source code
Open prepaid_meter.py, attr.py and color.py and 28 more in the compiler named in the tutorial (MikroC, Keil, MPLAB, Code Composer or the Arduino IDE) and build it to get the firmware.
- 6
Open the example simulation
Open Pi-5-Prepaid-Meter.pdsprj in Proteus to see the wiring exactly as in the tutorial. Check the controller's Program File path, then press Play.
- 7
Follow the tutorial
PZEM-004T Prepaid Energy Meter on Raspberry Pi 5 - Proteus Simulation explains every connection and setting in order; keep it open beside the files while you build.
FAQs8 questionsContact TEP
How do I download PZEM-004T Prepaid Energy Meter on Raspberry Pi 5 - Proteus Simulation V1.0?
Wait for the 30-second guest countdown on this page, then press the download button; the file comes straight from our storage. Members who are logged in skip the wait. If the browser opens the file instead of saving it, use its Save as option. The download link is made for you when the countdown ends and works for 15 minutes; a saved or shared link stops working, so share this page instead.
What is inside the archive?
PZEM-004T Prepaid Energy Meter on Raspberry Pi 5 - Proteus Simulation V1.0 comes as a ZIP archive of 156 files (15.8 MB, 31.7 MB unpacked) holding Proteus library files, simulation model DLLs, a Proteus simulation, source code and a nested archive. Open the File Structure tab for the full list of 156 files.
What should I do if the download does not start?
Check the browser's download list first; an ad blocker or a company firewall can also hold it back, so try another browser or network. If the file arrives incomplete, download it again. For an installation problem, read the Install tab or tell us in the comments with your software version and the exact error message.
Is this file free?
Yes. Every file in the TEP Download Center is free for learning, personal and student projects. If you share it, link back to this page or the tutorial so others find the latest version.
How do I check that the file arrived complete?
Compare its SHA-256 with the one on this page, c800c4273364e8107aac09065f0e0a846ea0e4b0432528b89758f6b5c0d4bd41. In PowerShell run Get-FileHash "009e89b5209b47a19832e1973abbe18b.zip"; on macOS or Linux run shasum -a 256 "009e89b5209b47a19832e1973abbe18b.zip". The same value means the file is exactly the one in our storage; a different one means the download broke off, so download it again.
Do I need WinRAR to open the ZIP file?
No. Windows, macOS and Linux open ZIP archives on their own (Extract All, or double-click). WinRAR and 7-Zip work too. Extract the whole archive before using the files.
Where do I put the LIB and IDX files?
Both files go into the LIBRARY folder of your Proteus installation (Proteus 8: C:\Program Files (x86)\Labcenter Electronics\Proteus 8 Professional\LIBRARY; Proteus 7 has the same folder under its own name). Restart Proteus afterwards and search for the component with P.
Which Proteus version does the library need?
The tutorial names the Proteus version the library was made and tested with. Most TEP libraries work in Proteus 7 and Proteus 8; if the component does not appear after a restart, check that both the LIB and the IDX file were copied and that Proteus was fully closed while copying.
Members skip the wait. Log in or join TEP.
- 0Total downloads
- 4%Popularity
- Raspberry PiCategory
- 0Comments
- ssyedzainnasirUploaded by
- 28 Nov 2026Uploaded at
c800c4273364e8107aac09065f0e0a846ea0e4b0432528b89758f6b5c0d4bd41






















Comments
0