ESP32

IoT based Smart Energy Meter using ESP32 & Google Sheet or Google Spreadsheet

IoT based Smart Energy Meter:

IoT based Smart Energy Meter using ESP32 & Google Sheet or Google Spreadsheet- In today’s article, you will learn how to make an IoT based Smart Energy Meter using ESP32 WiFi + Bluetooth module, the ZMPT101b AC Voltage Sensor, The DFrobot CT Clamp Current Sensor, And the Google Sheet or Google spreadsheet as the IoT platform for the real-time monitoring and data logging.

This is the prototype model of IoT based Smart energy meter.

IoT based Smart Energy Meter




And this is my Google spreadsheet for monitoring the Date, Time, Voltage, Current, Power, and Units.

IoT based Smart Energy Meter

But, before, I start the practical demonstration, there are certain things which I would like to talk about.

  1. You might be thinking, why Google sheet or Google spreadsheet as the IoT Platform? Why not Blynk IoT Platform? Well, Blynk is an amazing IoT platform and I have used it in so many projects and its good for the real-time data monitoring. But the Google spreadsheet is perfect for the real-time monitoring and Data logging. It’s absolutely free, you can monitor as many sensors as you want. You can use multiple Google sheets, and you don’t have to pay a single penny. I know, it doesn’t have those fancy widgets, but I really don’t care about the widgets. I want real-time monitoring and data logging; and I know Google spreadsheet is perfect for this job.
  2. As a beginner, you might also be thinking about why ESP32? Why not ESP8266. Well the answer is ESP8266 has only 1 analog pin whereas on the other hand ESP32 has got multiple Analog pins and it also has the advantage of having a Bluetooth module. I am not saying that you can’t use the Nodemcu ESP8266 for monitoring multiple analog sensors. You can use the ADS1015 to increase the analog pins on the ESP8266 for connecting multiple analog sensors.
  3. Your Sensors (“Voltage sensor and Current Sensor”) should be calibrated otherwise your project won’t be of any use. In my previous Arduino Home Energy Monitor based project, I explained in detail how to calibrate the ZMPT101b AC voltage Sensor, and

how to calibrate the CT Clamp Current Sensor. So, you can apply the same calibration techniques over here.

I think, I have shared enough useful information with you guys. So, now, let’s go ahead and start the practical demonstration.

Read my article on “LoRa Energy Meter“.



IoT based Smart Energy Meter, Practical Demonstration:

My laptop is connected to the WiFi. Since this is an IoT based project, it really doesn’t matter if you connect the laptop and ESP32 to the same WiFi network or different WiFi networks. Anyway, in the Google spreadsheet I will be monitoring the Date, Time, Voltage, Current, Power, and Units.

I am going to supply AC voltage to the ZMPT101b AC voltage sensor.

IoT based Smart Energy Meter

Be very careful, never touch these contacts when the AC supply is connected. Next, I attached the CT Clamp Current Sensor.

IoT based Smart Energy Meter

Everything looks good but first I am going to measure the actual voltage and current.

IoT based Smart Energy Meter

The actual voltage is 168 volts and the actual load current fluctuates between 0.35 and 0.36 ampere.



Now let’s power up the ESP32 WiFi + Bluetooth Module. As you can see I am able to receive the desired values.

IoT based Smart Energy Meter

You can see the measured voltage and current values are pretty close to the actual voltage and current values. If on your side the current value is different then you can change the correctionfactor value in the programming. Anyway, once the data is received in the Google Spreadsheet then it’s not going anywhere unless you delete it yourself.

Anyway, you can also monitor the same values on your cell phone.

IoT based Smart Energy Meter

All you need is to login into your account. You can check the voltage, current, power, and units at any given time.

Amazon Links:

ESP32 WiFi + Bluetooth Module(Recommended)

CT Clamp Current Sensor

ZMPT101b AC Voltage Sensor

Other Tools and Components:

Top Arduino Sensors:

Super Starter kit for Beginners

Digital Oscilloscopes

Variable Supply

Digital Multimeter

Soldering iron kits

PCB small portable drill machines

*Please Note: These are affiliate links. I may make a commission if you buy the components through these links. I would appreciate your support in this way!



Gravity: Analog AC Current Sensor (20A)

When you want to measure the AC current, are you still having trouble cutting the wires, wiring, or soldering. Gravity: Analog AC Current Sensor comes to the rescue, eliminating the need to cut wires or reconnect circuits. Simply clamp the AC transformer probe on the AC line, and then plug the 3.5mm headphone jack into the signal conversion module to read the current AC current value. The analog output is designed to be compatible with 3V3/5V micro-controller. It can be conveniently used for AC current measurement to monitor AC motors, lighting equipment, air compressors, etc.

IoT based Smart Energy Meter

Pin Description:

IoT based Smart Energy Meter

 

LABEL NAME Function Description
1 GND
2 + Power Input (3.3V-5.5V)
3 A Signal Output (0.2-2.8VDC)
4 Φ3.5mm 3P plug AC Transformer Input Signal

FEATURES

  • Non-contact measurement, high safety
  • Multiple ranges for various measurement scenarios
  • Compatible with 3V3/5V micro-controller

APPLICATIONS

  • AC motor automatic monitoring
  • Lighting and electrical equipment measurement

SPECIFICATION

AC Current Signal Conversion Module

  • Input Voltage (VCC): 3.3V-5.5V
  • Interface: Gravity Analog (PH2.0-3P,analog voltage output 0.2-2.8V DC)
  • AC Voltage Input Range: 0-1V (AC RMS)
  • Relative Error: ±4%
  • Dimension: 32×27 mm /1.26×1.06 in
  • Weight: 5g

Open Type AC Transformer Probe

  • AC Current Range: 0-20A
  • Signal Output (standard Φ3.5mm 3P plug): 0-1V AC voltage, linear corresponding range 0-20A
  • Accuracy: ±1%
  • Non-linearity: ≤±0.2%
  • Frequency Range: 50Hz~1kHz
  • Cable Length: 1m
  • Working Temperature: -25 ℃~+70 ℃
  • Opening Size: 13×13 mm / 0.51×0.51 in
  • Weight: 50g




ZMPT101B 230 volts AC Mains Voltage Sensor:

This module is based on a high precision ZMPT101B voltage Transformer. This module makes it easy to monitor AC mains voltage up to 250 volts. This module comes with Multi-turn trim pot which can be used for adjusting the Analog output.Using ZMPT101B  AC Voltage Sensor you can easily measure main voltage using Arduino or even Raspberry Pi (external ADC required).

IoT based Smart Energy Meter

Features of ZMPT101B AC voltage sensor Module

  1. Voltage upto 250 volts can be measured
  2. Light weight with on-board micro-precision voltage transformer
  3. High precision on-board op-amp circuit
  4. Operating temperature: 40ºC ~ + 70ºC
  5. Supply voltage 5 volts to 30 volts

Advantages of ZMPT101B AC voltage sensor 

  1. Analog output corresponding quantity can be adjusted.
  2. Pcb board size: 49.5 (mm) x19.4 (mm)
  3. Good consistency, for voltage and power measurement
  4. Very efficient and accuracy

Now, let’s go ahead and take a look at the connections.



IoT based Smart Energy Meter, Circuit Diagram:

IoT based Smart Energy Meter

Connect the VCC and GND pins of the ZMPT AC voltage sensor to the ESP32 3.3V and GND. Connect the Out pin of the ZMPT voltage sensor to the ESP32 IO34.

Connect the VCC and GND wires of the AC Current Sensor to the ESP32 3.3V and GND. Connect the output signal wire A to the ESP32 IO33.

So, that’s all about the connections.

Required Library(Arduino IDE):

You will also need to download the ZMPT101B library. Go to the Sketch menu > then to Include Library > and click on the Manage Libraries. Search for the ZMPT101B library and install it.

IoT based Smart Energy Meter

Now, let’s go ahead and start with the Google Spreadsheet setup.



Altium Designer + Altium 365 + Octopart:

Arduino LoRa Free SMS

Altium 365 lets you hold the fastest design reviews ever. Share your designs from anywhere and with anyone with a single click. it’s easy, leave a comment tagging your teammate and they’ll instantly receive an email with a link to the design. Anyone you invite can open the design using a web browser. Using the browser interface, you’re able to comment, markup, cross probe, inspect, and more. Comments are attached directly to the project, making them viewable within Altium designer as well as through the browser interface. Design, share, and manufacture, all in the same space with nothing extra to install or configure. Connect to the platform directly from Altium Designer without changing how you already design electronics. Altium 365 requires no additional licenses and comes included with your subscription plan.

Get real-time component insights as you design with Octopart built into Altium 365. Octopart is the fastest search engine for electronic parts and gives you the most up-to-date part data like specs, datasheets, cad models, and how much the part costs at different amounts etc. Right in the design environment so you can focus on your designs. Start with Altium Designer and Activate Altium 365. Search for electronic parts on Octopart.

ESP32 & Google Spreadsheet Setup:

While you are logged in into your registered Gmail id, click on Google apps and then click on sheets.

IoT based Smart Energy Meter

Click on Start a new spreadsheet.

IoT based Smart Energy Meter

Enter your project name.

IoT based Smart Energy Meter



Set the column names.

IoT based Smart Energy Meter

Go to the Extensions menu and click on the Apps Script.

IoT based Smart Energy Meter

Then rename the untitled project in App script

IoT based Smart Energy Meter

Then copy the following Google script code and paste it

IoT based Smart Energy Meter




Go to your Google Spreadsheet and copy this part of the URL.

IoT based Smart Energy Meter

And paste it in the script.

IoT based Smart Energy Meter

Click on the Deploy button and select New deployment.

IoT based Smart Energy Meter

Click on Enable deployment types and select Web app.

IoT based Smart Energy Meter

Write the description and Under who has access, select Anyone and then click on the Deploy button.

IoT based Smart Energy Meter



Clik on Authorize access.

IoT based Smart Energy Meter

Select your Gmail account.

IoT based Smart Energy Meter

Click on Advanced and select the project Go to Energy Meter (Unsafe).

IoT based Smart Energy Meter

Click the Allow button.

IoT based Smart Energy Meter

Copy the Deployment ID.

IoT based Smart Energy Meter

Copy the following IoT based Smart Energy Meter programming and paste the Deployment ID

next to the GOOGLE_SCRIPT_ID. And that’s it.

IoT based Smart Energy Meter



IoT based Smart Energy Meter, ESP32 Programming:

Finally, you can select your ESP32 board and the communication port, and click on the upload button. And don’t forget to change your SSID and password.

Note: If you can’t see your ESP32 board in the Arduino IDE boards list; it means your ESP32 board is not installed. For this you can read my getting started article on the ESP32.

Don’t forget to like, share, and Subscribe to my YouTube channel “Electronic Clinic”.



Watch Video Tutorial:

 

Related Articles

Leave a Reply

Your email address will not be published. Required fields are marked *

Back to top button