What is ZMPT101B Voltage Sensor?
You can download the ZMPT101B voltage sensor datasheet here.
ZMPT101B Voltage Module Pinout
ZMPT101B module has 4 pins:
- VCC: Module power supply: 5 V
- GND: Ground
- OUT: Module output which is analog.
You can see Pinout of this module in the following image.
Interfacing ZMPT101B Voltage Sensor with Arduino
Step 1: Circuit
Connect the module to the Arduino according to the following image.
Step 2: Code 1
Upload the following code to your Arduino and then open the Serial plotter window from the Tools menu. If nothing is connected to the module inputs (module input is 0 volts), your diagram will show a number around 512 (i.e. 2.5 volts).
If you apply 220V AC to the input, you will see a voltage sinusoidal diagram on the Serial plotter.
/* ZMPT101B - AC Voltage sensor Show AC wava in serial plotter modified on 7 Sep 2020 by Mohammad Reza Akbari @ Electropeak
Make sure the sine wave is complete in the serial plotter, specifically the minimum and maximum parts of the chart. If your voltage pattern is not complete, you have to turn the potentiometer on the module to display the full waveform.
If the waveform is cut from the top or bottom, you will see an error in your measurement in the next step.
Step 3: Code 2
This module measures the peak-to-peak voltage. In this code, first it finds the maximum measured value (peak voltage) and then converts it to RMS value. You can see the result in the Serial Monitor.
/* ZMPT101B - AC Voltage sensor Calculate Voltage modified on 7 Sep 2020 by Mohammad Reza Akbari @ Electropeak
You can see the results for measuring city electricity voltage in the figure below.