
ZMPT101B AC Voltage Sensor Library for Proteus Simulation

Hello friends, I hope you all are doing great. Today, I am going to share the new ZMPT101B AC Voltage Sensor Library for Proteus Simulation. The ZMPT101B module is the usual way to measure the mains voltage with an Arduino: a tiny transformer isolates it, an op-amp turns it into a small sine wave around half the supply, and the Arduino samples it to work out the RMS voltage and the frequency. With this library you can run a full Proteus simulation of it, and the voltage it measures is the real AC voltage of your simulated circuit - with no danger at all.
ZMPT101B AC Voltage Sensor Library for Proteus
Latest version: V1.0 (November 2026, this tutorial)
Helping Tools
- Serial Monitor Advance: a serial terminal window for the UART of your board
- Serial Monitor Expert: the serial monitor with extra debugging tools
- LCD Library for Proteus V3.0: 16x2, 20x4 and I2C LCDs to show your readings
The module is drawn at its real size and comes alive at run time: its PWR LED works and an AC LED lights when the mains is on its input. The demo is a mains monitor: an Arduino shows the voltage, the frequency and the live waveform on an OLED, with an OK and a FAULT LED.
NOTICE: Our team has put a lot of effort into these small parts: the bodies, the animation and the pop-ups are all our own design, and you get them free. Your feedback is the fuel that keeps us going, so please tell us what you think in the comments below or in the SCR and TRIAC board of our forum. And if our free libraries help you, you can buy us a coffee. So, let's get started with the ZMPT101B AC Voltage Sensor Library for Proteus Simulation:
What is the ZMPT101B?
The ZMPT101B itself is a small precision voltage transformer of the current type. You do not put the mains straight across it: a series resistor lets a small current - about 2 mA - flow through its primary, and the secondary gives the same current out, isolated by 4 kV of insulation. The module adds everything around it: the series resistor, a sampling resistor, an LM358 op-amp that amplifies the small signal and centres it on half the supply, and a multi-turn trimmer that sets the gain.
| ZMPT101B module | |
|---|---|
| Input | AC up to about 250 V, through a series resistor (about 2 mA in the transformer) |
| Isolation | the transformer: 4 kV between the mains and the module's side |
| Output | VCC / 2 plus a sine in step with the mains, its size set by the trimmer |
| Amplifier | LM358: the output cannot go closer than about 1.5 V to VCC |
| Supply | 5 V (3.3 V works with less swing) |
| Board | 49.5 x 19.4 mm: a screw terminal for L / N, the transformer, the LM358, the trimmer, a PWR LED, VCC / OUT / GND / GND |
Why a Calibration?
The output is a voltage proportional to the mains, but the factor depends on the series resistor, the transformer and above all on where you left the trimmer. So every ZMPT101B project starts the same way: measure the mains with a multimeter, measure the RMS of OUT with the Arduino, and divide. That number - volts in per volt out - goes into the sketch. In our model the trimmer at 50 % gives 0.8 V peak at OUT for 230 V RMS in, which is 406.6 V in per V out.
Clipping: the Classic Mistake
The LM358 is not a rail-to-rail op-amp: on a 5 V supply its output cannot rise above about 3.5 V. OUT is centred on 2.5 V, so the wave has 1 V of room upwards. Turn the trimmer up too far and the top of the sine is cut flat - the RMS comes out too low and the readings stop following the mains. Our model does exactly that, and the pop-up draws the limit as a red line on its oscilloscope.
Features of the ZMPT101B AC Voltage Sensor Library for Proteus Simulation
- A real-looking module: the blue board at its real size, 49.5 x 19.4 mm, with the screw terminal, the series resistor, the ZMPT101B transformer, the LM358, the blue multi-turn trimmer, the header and our small TEP mark.
- Animated: a PWR LED and an AC LED (our addition) that lights when the mains is on the input.
- A real input: L to N is 120 kOhm in your circuit, so the sensor measures the AC voltage your simulation really has - its size, its shape and its frequency.
- The real output: VCC / 2 plus the sine, the trimmer's gain, the LM358's limits with real clipping, and a little noise.
- A pop-up: an oscilloscope with the input and OUT over two cycles, the RMS and OUT's swing over the run, eight live tiles, trimmer chips, graphs, an event log and a check page.
- A complete package: about 2.3 MB with the library, our OLED, 5 mm LED and resistor libraries, our Arduino UNO V4.0 and the demo, without the source code of the model.
The ZMPT101B in Proteus
The device is ZMPT101BTEP in TEPZMPT101B.LIB, under Sensors > Voltage, with the prefix U and the model TEPZMPT101B.DLL. Search ZMPT101B or voltage in Pick Devices. It has two pins on the left, at the screw terminal - L and N - and three on the right: VCC, OUT and GND (the header's second GND is drawn only). Its one property is POT, the trimmer, 50 % by default.
Download ZMPT101B AC Voltage Sensor Library for Proteus Simulation
Click the button below to download ZMPT101B-AC-Voltage-Sensor-Library-for-Proteus-v1.0.zip (about 2.3 MB, without the source code of the models):
ZMPT101B AC Voltage Sensor Library for Proteus V1.0- README.txt: installation, the demo, the wiring, the safety notes, troubleshooting and the limits of the simulation.
- Proteus Library Files:
TEPZMPT101B.LIB,TEPOLED12864.LIB,TEPLED5MM.LIB,TEPRESISTOR.LIBandArduinoV4TEP.LIB. - Proteus Model Files:
TEPZMPT101B.DLL,TEPOLED.DLL,TEPLED5MM.DLL,TEPRESISTOR.DLLandTEPARDUINO.DLL. - Arduino Code: the demo sketch (no extra library).
- Proteus Simulation: the demo project, its HEX file and copies of the DLLs.
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 ZMPT101B AC Voltage Sensor Library for Proteus Simulation
- Close Proteus and extract the whole zip file, for example to your Desktop.
- Copy the files from Proteus Library Files into the LIBRARY folder of Proteus.
- Copy the files from Proteus Model Files into the MODELS folder.
- Delete
TEPZMPT101B.IDXfrom the LIBRARY folder if it is there. - Start Proteus, press P and search for ZMPT101B.
Proteus Simulation of a Mains Monitor
Our demo watches the mains. V1 is Proteus's own ALTERNATOR, set to 325 V peak - 230 V RMS - at 50 Hz, its negative side grounded like an earthed neutral. U1 is the ZMPT101B with the trimmer at 50 %: L on V1, N on the ground, OUT to A0 of our Arduino UNO Library for Proteus V4.0. Our OLED SSD1306 Library for Proteus shows the readings, and two LEDs from our 5mm LED Library for Proteus sit beside it: OK (green, D5) and FAULT (red, D6), each through 220 ohm. The Arduino's built-in monitor is the same window as our TEP Serial Monitor Advance for Proteus. Open ZMPT101B-Mains-ArduinoUnoV4.pdsprj.
The Sketch
The calibration is one constant - the volts in per volt out for this module and this trimmer setting:
const float VPV = 406.6; // the calibration: input volts per OUT volt (the trimmer at 50 %)
The sketch samples A0 as fast as it can for 200 ms - ten whole cycles at 50 Hz, so the RMS does not wobble - adding up the readings and their squares as it goes:
while (micros() - t0 < 200000UL) { // 200 ms: ten cycles at 50 Hz
Each time the signal rises through the centre it counts a crossing and keeps the time; two cycles of samples are kept for the picture. After the window, the mean is the centre (VCC / 2, as the ADC sees it) and the RMS of what is left is the AC part:
const float rmsCounts = sqrt(max(0.0, (float)sq / n - off * off));
Times the calibration, that is the mains voltage; the crossings and their times give the frequency:
hz = crossings >= 2 ? (crossings - 1) * 1e6 / (float)(tLast - tFirst) : 0;
The state is OK within 230 V +-10 %, LOW or HIGH outside it, and NO AC below 20 V. The OLED shows the voltage and the frequency in its yellow band, the two cycles as a line below, and the peak and the state at the bottom.
ZMPT101B Simulation Results
Open the project and press Run. The demo runs 3.5 simulated seconds and took 151 seconds on our PC with the pop-up open and the pictures being taken. Click the module for its pop-up. Every number below comes from one simulation run, the demo exactly as it ships.
The First Readings
As soon as the simulation starts, the module sees the alternator's 325 V peak on its L and N. The pop-up measures every cycle: 229.8 V RMS, 325.0 V peak, 50.00 Hz, and 1.91 mA through the series resistor into the transformer - just under its 2 mA rating. OUT swings from 1.701 V to 3.299 V, 1.598 V peak to peak around 2.50 V, safely under the red line of the LM358's limit. The Event log notes the power-up and the first cycle with AC.
The Mains Monitor Running
The sketch's first window gives "OK: 230.0 V RMS, 326 V peak, 49.97 Hz; OUT centred at 2.503 V" on the monitor, and a line about once a second after that. The OLED shows 230.1 V and 50.0 HZ in its yellow band, two neat cycles of the waveform below and "326 V PEAK OK" at the bottom; the green OK LED is on. The module's PWR and AC LEDs are both lit on the sheet.
Turning the Trimmer Up
Now the classic mistake. At 2.5 seconds our run script clicks Trimmer 100 % in the pop-up - like turning the real trimmer up after calibrating. The gain doubles: OUT should swing 1.6 V each way, but upwards the LM358 stops at 3.5 V, so the top of every wave is cut flat - the pop-up turns red and counts the clipped cycles. The sketch still uses the calibration for 50 %, so it multiplies a signal that is now twice as big: the monitor says "HIGH: 321.9 V RMS, 531 V peak" and the OLED 404.3 V, and the red FAULT LED comes on. The mains did not change at all - only the gain did. Turn the trimmer back, or calibrate again for the new setting (203.3 V in per V out at 100 %), and keep the peaks under the red line.
The Graphs, the Event Log and the Check Page
The Graphs page plots the input, OUT, the RMS of each cycle and the frequency. The Event log keeps the power-up, the first cycle with AC and any change of the voltage. The Check page sums up the run: VCC 5.00 V and about 4 mA; the input 230.2 V RMS, 325.0 V peak, 50.17 Hz over 174 cycles (229.3 - 230.3 V RMS through the run); 1.92 mA in the primary; OUT 0.901 - 3.500 V with 50 of the 174 cycles clipped - shown in red - and the trimmer at 100 % (203.3 V in per V out).
The monitor shows the sketch's side: the calibration, then a line each time the state changes.
Voltage, Current and Power
The ZMPT101B measures the voltage; its partner for the current is the ACS712 in our ACS712 Current Sensor Library for Proteus. Sample both at the same moments and you have an AC power meter: the average of voltage times current is the real power, the product of the two RMS values the apparent power, and their ratio the power factor. The zero crossings the ZMPT101B gives you are also what a phase-control dimmer needs - see our AC Dimmer Module Library for Proteus and our SCR and TRIAC Library for Proteus.
Try It Yourself
- Click Trimmer 100 % in the pop-up: OUT hits the red line, the top of the wave goes flat, and the sketch reads too low.
- Set V1's amplitude to 170 V (120 V RMS) and its frequency to 60 Hz: the FAULT LED comes on with LOW, and the frequency reads 60.
- Change the window from 200 ms to 150 ms and watch the RMS wobble - it is no longer whole cycles.
- Recalibrate for POT 75: what is the new VPV?
- Print the minimum and maximum readings and check that they stay inside the LM358's range.
Ideas to Extend the Demo
- Add an ACS712 and make an AC power meter with real power and power factor.
- Cut off a load with a relay when the mains is too low or too high - a voltage protector.
- Log the voltage through the day and plot the dips and surges.
Your Own Sketches
The demo sketch is in the zip file, and you can change it in the Arduino IDE. New to Arduino? Start with our Arduino Tutorial for Beginners. Export the compiled binary, and set the UNO's PROGRAM property to the new file. Our guide on How to get the HEX file from Arduino shows you where the file ends up.
Things to Know Before Using a Real ZMPT101B
- Mains can kill: the screw terminal and its wires carry the full mains voltage - build it in a closed box, never touch the board while it is plugged in, and get help if you are not trained for mains work.
- Calibrate: against a multimeter on the same mains, and again whenever you turn the trimmer.
- Mind the clipping: keep OUT's peaks well inside the LM358's range.
- Whole cycles: sample a multiple of 20 ms at 50 Hz or 16.7 ms at 60 Hz.
- 3.3 V boards: the module works, but the LM358 leaves only about 0.15 V of headroom - turn the gain down.
Troubleshooting
- The voltage is far off: the calibration does not match the trimmer - measure it again.
- A few volts with nothing on: noise - use a threshold, as the demo does with NO AC.
- Low readings and a flat-topped wave: OUT clips - turn the trimmer down and calibrate again.
- The RMS wobbles: sample whole cycles.
- The part is not simulated:
TEPZMPT101B.DLLis missing from MODELS and from the project folder.
Limitations of the Simulation
- The input current, the output centred on VCC / 2, the trimmer's gain and the LM358's limits follow the transformer's datasheet and the common module's circuit; the module is our own drawing of a ZMPT101B board.
- Our own choices: the gain scale (0.8 V peak for 230 V RMS at 50 %), the 120 kOhm input, a 50 us output filter, 2 mV of noise and the AC LED.
- Not modelled: the transformer's small phase shift and saturation, the trimmer's exact curve, temperature drift and the isolation's limits.
- Arduino is a name of Arduino; this library is not made or endorsed by Arduino, Labcenter or the maker of the ZMPT101B.
- Tested in Proteus 8.5 in November 2026 (the demo as shipped). Proteus 7 is not supported.
So, that was all about the ZMPT101B AC Voltage Sensor Library for Proteus Simulation. I hope it helps you build your mains monitor, your voltage protector or your AC power meter safely on the screen before the real board touches the mains - and shows that measuring AC is a simple thing at heart: a tiny transformer, half the supply, and the root of the mean of the squares. 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