Other Arduino Codes and Videos by Robojax

Robojax Arduino DC Energy Meter V1

Robojax 500A Arduino DC Energy Meter V1

We will learn how to measure DC Energy using shunt resistor and Arduino. Using This libray you will be able to measure any DC voltage and DC Current using Shunt resistors available in the market from 1A to 1000A. There is no limit for this.

This video requires two videos and ocde

1-Introduction to LCD1602 with I2C module
2-How to measure Current with Any Shunt Resistor
3-Display DC Current from Shunt Resistor on LCD1602 or LCD2004
4-How to measure Any DC voltage using Arduino

Resources for this sketch and video


 /*
 * Project: 500A DC Arduino Energy Meter with LCD and Serial Monitor- Robojax library
 *  I've used 75mV Shunt and you can use any shunt up to 500A or highter.
 *  Voltage divider used for measuring any DC voltage.
 * 
 * Watch Video instrution for this code: https://youtu.be/UK8Kvk8wFmw
 * 
 * Full explanation of this code and wiring diagram is available at
 * my Arduino Course at Udemy.com here: http://robojax.com/L/?id=62

 * Written by Ahmad Shamshiri on May 28, 2020 at 16:17 in Ajax, Ontario, Canada
 * in Ajax, Ontario, Canada. www.robojax.com
 * 
Related Videos:
Measure any DC voltage with Arduino: https://youtu.be/t8xwrVj2aFs
500A Shunt Resistor with Arduino : https://youtu.be/9jwCc7uPGoc
Display and measure up to 500A DC on LCD with Arduino: https://youtu.be/xHe9RRQWMBM
Display and measure up to 500A DC on LED TM1637 with Arduino: https://youtu.be/M6IFUdVoDT4
Learn Arduino in 30 Minutes (video): http://robojax.com/L/?id=135

 * Get this code and other Arduino codes from Robojax.com
Learn Arduino step by step in structured course with all material, wiring diagram and library
all in once place. Purchase My course on Udemy.com http://robojax.com/L/?id=62

If you found this tutorial helpful, please support me so I can continue creating 
content like this. You can support me on Patreon http://robojax.com/L/?id=63

or make donation using PayPal http://robojax.com/L/?id=64

 *  * This code is "AS IS" without warranty or liability. Free to be used as long as you keep this note intact.* 
 * This code has been download from Robojax.com
    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <https://www.gnu.org/licenses/>.


*/

const int SHUNT_IN_PIN =A0;//can change
const float SHUNT_CURRENT =100.00;//A
const float SHUNT_VOLTAGE =75.0;// mV
const int CORRECTION_VALUE = 3;
const int ITERATION = 50; //can change (see video)
const float VOLTAGE_REFERENCE = 1100.00;//1.1V
const int BIT_RESOLUTION =10;//and 12 for Due and MKR
const boolean DEBUG_ONCE = true;
const float MINIMUM_CURRENT = 10.0;
const int DURATION_TYPE = 2;//1= 5:18:32:16 Day:Hour:Minutes:Seconds
                              //2= 5D 18H 32M 16S
const int LCD_CHAR =20;
const int LCD_LINE = 4;
const int I2C_ADDRESS = 0x27;//I2C address watch video for details
const int PUSH_BUTTON_PIN = 2;// for reset push button
///Start of Settings for Reading voltage

float ValueR1 = 993;
float ValueR2 = 46140;
const int VOLTAGE_IN_PIN = A1;//the pin connecting the voltage. 
const int DISPLAY_DELAY =1;//every 1 seconds
///end of Settings for Reading voltage


// start of settings for LCD1602 with I2C
#include <Robojax_Energy_Meter.h>
Robojax_Energy_Meter shunt(
                   I2C_ADDRESS, LCD_CHAR, LCD_LINE,
                   SHUNT_IN_PIN,SHUNT_CURRENT, SHUNT_VOLTAGE,
                   CORRECTION_VALUE, ITERATION, VOLTAGE_REFERENCE,
                   BIT_RESOLUTION, MINIMUM_CURRENT, DEBUG_ONCE,
                   ValueR1, ValueR2, VOLTAGE_IN_PIN,PUSH_BUTTON_PIN                   
                   );                   
// end of settings for LCD1602 with I2C



// the setup routine runs once when you press reset:
void setup() {
  // Robojax.com Arduino Energy Meter 
  Serial.begin(9600);
  Serial.println("Robojax 500A Current for Arduino");
  shunt.begin();  
  shunt.backlight();
  shunt.print("Robojax Energy Meter");  
 
  
  //for line below see https://www.arduino.cc/reference/en/language/functions/analog-io/analogreference
  analogReference(INTERNAL);//1.1V internal reference
  //analogReadResolution(BIT_RESOLUTION);//only Arduino with Due and MKR
  delay(500);
}

// the loop routine runs over and over again forever:
void loop() {
 //robojax.com 500A Shunt Current Measurement for Arduino
 shunt.showCurrent();
 shunt.showVoltage();
 shunt.showEnergy();
    delay(DISPLAY_DELAY);
  //shunt.printDebug();
  //shunt.printSerial();


  // Robojax.com Arduino Energy Meter 
  //delay(500);
}



 

   

If you found this tutorial helpful, please support me so I can continue creating content like this. support me via PayPal