ACS712T Current Sensor Module 20A (ACS712T) [B039]



https://www.youtube.com/watch?v=6NuyGoSPYO4


* Specs

Supply Voltage (VCC) 5Vdc Nominal

Measurement Range -20 to +20 Amps

Voltage at 0A VCC/2 (nominally 2.5Vdc)

Scale Factor 100 mV per Amp

Chip ACS712ELC-10A


* Contents

- Connect

VCC ---- 5V 

OUT ----- A0 

GND ----- GND 


Power+VCC -> Load/Sensor -> ACS712T (UP)

Power GND  ---------------> ACS712T (DOWN)


- Key Code

#include <Wire.h> 

#include <LiquidCrystal_I2C.h>


LiquidCrystal_I2C lcd(0x27,20,4);  // LCD2004


const int analogIn = A0;

int mVperAmp = 100; // use 100 for 20A Module and 66 for 30A Module

int RawValue= 0;

int ACSoffset = 2512; // default 2500 but i checked when this is disconnected to 2512

double Voltage = 0;

double Amps = 0;


void setup()

{

  lcd.init();  // initialize the lcd 

  lcd.backlight();

  lcd.print("start LCD2004");


  pinMode(analogIn,INPUT);

  delay(1000);


  lcd.clear();

}


void loop()

{

 

  lcd.setCursor(0,0);

  lcd.print("B039:ACS712T Current");


  RawValue = analogRead(analogIn);

  Voltage = (RawValue / 1023.0) * 5000; // Gets you mV

  Amps = ((Voltage - ACSoffset) / mVperAmp);


  lcd.setCursor(0,1);

  lcd.print("RawValue=" + (String)RawValue + "  ");


  lcd.setCursor(0,2);

  lcd.print("Voltage=" + (String)Voltage + "");


  lcd.setCursor(0,3);

  lcd.print("=>Current=" + (String)Amps + " A ");  


  delay(1500);

}

Posted by RDIoT
|