✨ DOWNLOAD OUR APP - Use RCAPP
for additional 5% discount! + Redeem RC COINS 👇
Skip to content
Free Delivery on Orders Above Rs 500/- Pan-India
Cash on Delivery Available for Orders above Rs.500/- and Upto Rs 3000/-
SAVE more when you BUY more. Upto 30% Off on BULK PURCHASE
GST Invoices for Your Business
Dedicated Technical Support Team
Safely Delivering Genuine Products PAN INDIA
  Support

How to connect ZMPT101B to Arduino

Summary

If you're interested in measuring AC voltage using an Arduino, then the ZMPT101B voltage sensor is a handy tool to have in your electronics kit. In this blog, you'll learn what the ZMPT101B voltage sensor is, how it works, the components required for connection, the connection diagram, how to interface the ZMPT101B with Arduino, and how to upload the code to read RMS voltage. Keep reading to learn how to get started with this essential sensor for any electronic project.

What is ZMPT101B Voltage Sensor?

ZMP101B is an AC Voltage Sensor used in DIY projects for measuring accurate AC voltage. It can be used with a whole host of microcontrollers with analog inputs such as the Arduino and ESP boards.

The output of the sensor is analog and the onboard potentiometer can be used to calibrate the output value specific to the microcontroller being used.

How does ZMPT101B work?

ZMPT101B uses a transformer to step down AC from the mains to a much lower voltage while preserving the waveforms and shapes to be used in calculations

The following diagram shows the internal structure of the ZMPT101B transformer

 

how to connect zmpt101b to Arduino

 

read more :  How 433MHz RF Module Works & Interfacing With Arduino

 

The input voltage from the AC mains (230V) will look like below

 

How does ZMPT101B voltage sensor work

 

The output voltage from the transformer (with 5V VCC) will look like below

 

zmpt101b to arduino

 

The output voltage should then be DC-biased by VCC/2 of the microcontroller being used. This can be accomplished with the onboard potentiometer.

For example, if Arduino is being used - which operated on VCC = 5V, the output voltage of the module needs to be offset by +2.5V, to ensure that the negative part of the AC cycle also falls on the positive side.

 

read more : Interfacing MAX30100 Pulse Oximeter with Arduino

DC-biased voltage output will look like below

 

connect zmpt101b to arduino

 

Similarly if ESP is being used - which operates on VCC = 3.3V, the output voltage needs to be DC-biased by +1.65V. More on how to calibrate will be later down in the guide (procedure section)

Note: Some reports have suggested that some modules may not work properly with 3.3V input directly from the ESP. In this case, try powering the module externally with a dedicated 3.3V supply (and make sure to make the GNDs common with the ESP)

In short:

The input AC voltage will be stepped down by the transformer to 0-5V (if VCC is 5V). The analog pin on the Arduino will measure voltage between 0-5V and map it to a number varying from 0-1023. These are the raw values obtained from the sensor. When no voltage is detected, ie 0V, the output Arduino reading should be 512 which would correspond to +2.5V

Components Required for Connection

For this guide, we will be using Arduino as the microcontroller to use the ZMPT101b amplifier.

The circuit is very simple, so the required components are very minimal and are as follows

  1. Arduino
  2. ZMPT101B
  3. Male to Male jumper wires

read more : Arduino Interfacing with Ultrasonic Sensor

Connection Diagram

The connections are quite straightforward and is as follows

S.no

Arduino

ZMPT101B

1

5V

VCC

2

GND

GND

3

A0

OUT

Note: Only connect one of the GND pins on the module.

Interfacing the ZMPT101B with Arduino

Calibration

Step 1: Connect the module to the Arduino as described above

Step 2: Copy the following simple analog read code below

    void setup() {
    Serial.begin(9600); 
    void loop() { 
    Serial.println(analogRead(A0)); 
    delay(100);
    }

     

    Step 3: Connect the Arduino to your PC, select the correct COM port and upload the code

    Step 4: Connect the AC supply to the L and N (live and neutral) terminals of the ZMPT101B.Be very careful while working with AC supply voltage.

    Step 5: Once connected, in Arduino IDE, go to Tools and open Serial Plotter.

    Step 6: If the connections are correct, you should be seeing a sinusoidal wave on the Serial Plotter, shown below

     

      connect zmpt101b to arduino

       

      <should preferably use our own digram from Arduino Serial plotter>

      • Ensure the waveform appears in full in the Serial plotter. In case the waveform looks like it is being clipped, adjust the onboard potentiometer till the waveform appears in full. This is a very important step, and after calibration, ensure that the potentiometer will not be further adjusted

      read more : Interfacing MPU-9250 9-DOF Sensor with Arduino

      <should have an example image of clipped waveform>

      Uploading the code to read RMS voltage

      • Once the above calibration is done, we can upload the code that calculates the correct RMS voltage value
      • Download the Filters library 
      • Install the library by going to Sketch > Manage Library > Add .zip file and browse for the downloaded file
      • Copy the code from below

      #include <Filters.h> //Easy library to do the calculations

       

      float testFrequency = 50;                     // test signal frequency (Hz)

      float windowLength = 40.0/testFrequency;     // how long to average the signal, for statistist

       

      int sensor = 0; //Sensor analog input, here it's A0

       

      float intercept = -0.04; // to be adjusted based on calibration testing

      float slope = 0.0405; // to be adjusted based on calibration testing

      float current_volts; // Voltage

       

      unsigned long printPeriod = 1000; //Refresh rate

      unsigned long previousMillis = 0;



      void setup() {

        Serial.begin(9600);    // start the serial port

        delay(5000);

      }

       

      void loop() {

        

        RunningStatistics inputStats;

        inputStats.setWindowSecs(windowLength);

         

        while(true) {   

          sensor = analogRead(A0);  // read the analog in value:

          inputStats.input(sensor);  // log to Stats function

              

          if((unsigned long)(millis() - previousMillis) >= printPeriod) {

            previousMillis = millis();   // update time every second

            

            // Calculations part

            

            current_volts = intercept + slope * inputStats.sigma();

            current_volts = current_volts*(40.3231);               

            

            Serial.print("\tVoltage: ");

            Serial.println(current_volts); //Displays the value

          }

        }

      }

      Upload the code and open the serial monitor

      Note: Some minor calibrations may be required to further bring the values closer to the actual values. If possible connect a TrueRMS multimeter and monitor the AC voltage simultaneously and try adjusting the slope and intercept variables to get a better result.

      For the above code, we make use of the Filters library to take care of the math and noise filtering that may be required to filter out noisy data received from the sensor

       

      read more : IR Sensor Interfacing with Arduino

       

      Conclusion

      In this blog post, we have learned that the ZMPT101B voltage sensor is a powerful tool for measuring RMS voltage in your electrical projects. By understanding how it works and the components required for connection, you can easily interface it with an Arduino to accurately measure voltage levels. With the help of our connection diagram and code, you can start experimenting with this versatile sensor right away. So why wait? Start exploring the potential of the ZMPT101B voltage sensor today and take your projects to the next level!

       

      If you appreciate our work don't forget to share this post and leave your opinion in the comment box.

       

      Please do check out other blog posts about Arduino Interfacing ACS712 with Arduino , Arduino Interfacing with Ultrasonic Sensor , LED Interfacing with Arduino , Interfacing GSM Module with Arduino , Interfacing MAX30100 Pulse Oximeter with Arduino , IR Sensor Interfacing with Arduino  and  How to use Buzzer with Arduino.

       

      Make sure you check out our wide range of products and collections (we offer some exciting deals!)

        Excerpt

        Learn how to connect and interface a ZMPT101B voltage sensor module with Arduino. Step-by-step tutorial for voltage measurement projects.

        Frequently Asked Questions

        1. What is ZMPT101B voltage sensor?

        The ZMPT101B voltage sensor is a small device that can detect single-phase AC voltage. It is capable of measuring AC voltage levels and is often used in do-it-yourself projects where precise measurements are necessary. This sensor can be connected to open-source platforms such as Arduino, ESP8266, and Raspberry Pi. It uses the high-precision voltage transformer from the ZMPT101B series.

        2. How does ZMPT101B voltage sensor work?

        The ZMPT101B is an AC voltage sensor module that can measure AC voltages. Its output is analog and varies as the input voltage changes. The module uses a resistive voltage divider circuit-based DC voltage sensing device to generate an analog output. It typically operates at a rated current, and tutorials are available online for using it with microcontrollers.

        3. What is the ZMPT101B sensor?

        The ZMPT101B sensor is a compact voltage sensor used to measure AC voltage signals. It operates on a sensing principle that converts voltage into a proportional output. This sensor is popular for applications in energy monitoring, electrical projects, and various Arduino-based setups, allowing for easy voltage measurement and analysis.

        4. How to wire ZMPT101B with Arduino?

        To wire the ZMPT101B with Arduino, connect the sensor’s VCC to 5V, GND to ground, and the output pin to an analog pin on the Arduino. Ensure to also connect the input voltage source to the sensor. This setup allows you to read the voltage value through the analog pin easily.

        5. How does ZMPT101B measure voltage?

        The ZMPT101B measures voltage using a voltage divider circuit and a transformer. It converts incoming AC voltage into a lower, manageable level. The output is then sent to an analog pin of a microcontroller like Arduino, where it can be read and interpreted accurately.

        6. Can it measure both AC and DC voltage?

        The ZMPT101B is primarily designed for AC voltage measurement. It is not suitable for DC voltage measurements, as the internal circuitry is optimized specifically for alternating current. For DC measurements, consider using a different sensor designed for that purpose.

        7. What code is used for voltage reading?

        Calibrating the ZMPT101B involves adjusting the output to match known voltage levels. First, connect a known voltage (like 220V) and measure the output. Adjust the scaling factor in your code based on the measured values until they align with the expected input voltage.

        8. How to calibrate the ZMPT101B?

        The output range of the ZMPT101B module typically spans from 0 to 5V. However, the specific output correlates with the input AC voltage applied. The sensor can comfortably handle input AC voltages up to 250V, providing an appropriately scaled output voltage.

        9. What is the output range of the module?

        Yes, the ZMPT101B is an excellent choice for energy monitoring applications. By measuring AC voltage alongside current sensors, it allows you to calculate power consumption efficiently. This combination can help in creating energy management systems and monitoring devices.

        10. Can it be used for energy monitoring?

        The ZMPT101B sensor offers a reasonably accurate measurement for most applications, typically achieving an accuracy of around 1-2%. However, factors like calibration, wiring, and environmental conditions can affect the readings. Always calibrate for optimal performance.

        11. How accurate is the ZMPT101B sensor?

        When using the ZMPT101B, take necessary safety precautions. Avoid direct contact with high voltage connections. Use insulated wires and ensuring good electrical isolation. Always work with low voltages while setting up and testing to prevent accidents.

        12. What are safety precautions to follow?

        Prev Post
        Next Post

        Leave a comment

        Please note, comments need to be approved before they are published.

        Thanks for subscribing!

        This email has been registered!

        Shop the look

        Choose Options

        Edit Option
        Back In Stock Notification
        Compare
        Product SKU Description Collection Availability Product Type Other Details

        Choose Options

        this is just a warning
        Login
        Shopping Cart
        0 items
        FREE SHIPPING!
        ₹100 OFF
        ₹200 OFF
        WhatsApp Chat Chat