I have this little code:
#include <LiquidCrystal.h>
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
const int voltPin = 1;
const int ampPin = 3;
int A = 0;
void setup() {
lcd.begin(16, 2);
}
void loop() {
float volt = (analogRead(voltPin) + 1) * .00488;
lcd.setCursor(1,0);
lcd.print(volt);
lcd.setCursor(8,0);
lcd.print("Volt");
A = (analogRead(ampPin)-512);
lcd.setCursor(1,1);
lcd.print(A);
lcd.setCursor(8,1);
lcd.print("mA");
delay(200);
}
My goal is to read voltage and mA on a 16x2 LCD.
The part of the voltave is done, but I can't solve the part of interfacing with ACS754.
The main charateristics of the current sensor is:
Vcc =5.0v
Zero current = 2/Vcc = 2.5v (at output pin = analogRead 3)
Sensitivity = 13.3 mV/A = 0.0133v
Can some one help me and explain the math for this divider, and make this thing work