Posts

UPDATED ESP32 CODE CODE CODE CODE

 #include <Arduino.h> #include <WiFi.h> #include <FirebaseESP32.h> // Provide the token generation process info. #include <addons/TokenHelper.h> // Provide the RTDB payload printing info and other helper functions. #include <addons/RTDBHelper.h> /* 1. Define the WiFi credentials */ #define WIFI_SSID "Galaxy M126967" #define WIFI_PASSWORD "raji1234" /* 2. Define the API Key */ #define API_KEY "26Sg2a5KBO7macmeRxeJKnUMw0GJlYbkQHIYGAog" /* 3. Define the RTDB URL */ #define DATABASE_URL "https://iot-enabled-energy-meter-default-rtdb.asia-southeast1.firebasedatabase.app/" //<databaseName>.firebaseio.com or <databaseName>.<region>.firebasedatabase.app /* database secret used in Firebase.setQueryIndex function */ #define DATABASE_SECRET "DATABASE_SECRET" /* 4. Define the user Email and password that already registered or added in your project */ #define USER_EMAIL "brsanjeevadharsh@gmail.com...
  https://github.com/circuiTician/Embedded-System-IoT/tree/main/Firebase%20RTDB%20ESP32 https://randomnerdtutorials.com/installing-the-esp32-board-in-arduino-ide-windows-instructions/

IOT METER UPDATED CODE CODE CODE CODE

  #include <Wire.h> #include <LiquidCrystal_I2C.h> #include "EmonLib.h"             // Include Emon Library #include "ACS712.h"               // Include ACS712 Library // Define LCD parameters #define I2C_ADDR 0x 27             // I2C address for the LCD #define LCD_ROWS 2 #define LCD_COLS 16 // Create instances of the libraries LiquidCrystal_I2C lcd ( I2C_ADDR, LCD_COLS, LCD_ROWS ) ; EnergyMonitor emon1; ACS712 sensor ( ACS712_05B, A0 ) ; #define VOLT_CAL 592 #define RESISTOR_VALUE 1000       // Resistance value in Ohms #define VOLTAGE_RMS_REF 230.0     // Reference RMS voltage in Volts #define POWER_THRESHOLD 100       // Power threshold for determining "power off" state const int samplingInterval = 1000 ;  // Sampling interval in milliseconds const int displayInterval = 20000 ;  // Display updat...

IOT ENERGY METER UPDATED CODE

 #include <Wire.h> #include <LiquidCrystal_I2C.h> #include "EmonLib.h"             // Include Emon Library #include "ACS712.h"              // Include ACS712 Library // Set the LCD address (usually 0x27 or 0x3F) #define I2C_ADDR 0x27 // Define LCD size (rows and columns) #define LCD_ROWS 2 #define LCD_COLS 16 // Create an instance of the LCD class LiquidCrystal_I2C lcd(I2C_ADDR, LCD_COLS, LCD_ROWS); #define VOLT_CAL 592 #define RESISTOR_VALUE 1000      // Resistance value in Ohms #define VOLTAGE_RMS_REF 230.0    // Reference RMS voltage in Volts (typically 230V for mains) EnergyMonitor emon1;             // Create an instance of EnergyMonitor ACS712 sensor(ACS712_05B, A0);   // Create an instance of ACS712 const int samplingInterval = 1000;  // Sampling interval in milliseconds const int numSamples = 3600;      ...

WIFI MODULE CODE

  #include "UbidotsEsp32Mqtt.h" const char *WIFI_SSID = " M1269Galaxy67" ;      // Put your Wi-Fi SSID here const char *WIFI_PASS = "raji1234" ;      // Put your Wi-Fi password here const char *UBIDOTS_TOKEN = "BBUS-jDOPvemaBYQifSNqldosg3xGe3XtPB" ;  // Put your Ubidots TOKEN here const char *DEVICE_LABEL = "iot-energy-meter" ;   // Device label for all variables const char *VRMS_VARIABLE_LABEL = "VRMS" ; // Variable label for VRMS const char *IRMS_VARIABLE_LABEL = "IRMS" ; // Variable label for IRMS const char *POWER_VARIABLE_LABEL = "POWER" ; // Variable label for POWER const char *POWER_FACTOR_VARIABLE_LABEL = "POWER_FACTOR" ; // Variable label for POWER_FACTOR const char *ENERGY_VARIABLE_LABEL = "ENERGY" ; // Variable label for ENERGY const int PUBLISH_FREQUENCY = 2000 ; // Update rate in milliseconds Ubidots ubidots ( UBIDOTS_TOKEN ) ; void setup () ...

EXISTING IOT ENERGY METER FOR DISPLAYING POWER

  #include "EmonLib.h"             // Include Emon Library #include "ACS712.h"               // Include ACS712 Library #define VOLT_CAL 592 #define RESISTOR_VALUE 1000      // Resistance value in Ohms #define VOLTAGE_RMS_REF 230.0    // Reference RMS voltage in Volts (typically 230V for mains) EnergyMonitor emon1;             // Create an instance of EnergyMonitor ACS712 sensor ( ACS712_05B, A0 ) ;   // Create an instance of ACS712 const int samplingInterval = 1000 ;  // Sampling interval in milliseconds const int numSamples = 3600 ;        // Number of samples to store (3600 samples = 1 hour) float voltageSamples [numSamples];   // Array to store voltage samples int sampleIndex = 0 ;                 // Index to keep track of the current sample float prevVoltage = 0...

ARDUINO IDE CONNECTIONS FOR IOT ENERGY METER

  Connection Guide: Voltage Sensor: Connect VCC to 5V on Arduino Uno. Connect GND to GND on Arduino Uno. Connect OUT to A0 on Arduino Uno. Current Sensor: Connect VCC to 5V on Arduino Uno. Connect GND to GND on Arduino Uno. Connect OUT to A1 on Arduino Uno. ZMPT101B: Connect VCC to 5V on Arduino Uno. Connect GND to GND on Arduino Uno. Connect OUT to A2 on Arduino Uno. 16x2 LCD with I2C Module: Connect VCC to 5V on Arduino Uno. Connect GND to GND on Arduino Uno. Connect SDA to A4 (SDA) on Arduino Uno. Connect SCL to A5 (SCL) on Arduino Uno. ESP32: Connect TX on ESP32 to RX on Arduino Uno. Connect RX on ESP32 to TX on Arduino Uno. Connect GND on ESP32 to GND on Arduino Uno. Connect 3.3V on ESP32 to 3.3V on Arduino Uno.