Go Down

Topic: Interfacing Allegro ACS754 with Arduino (Read 816 times) previous topic - next topic

buu-gadgets

Jan 20, 2010, 01:37 am Last Edit: Jan 20, 2010, 01:38 am by buu-gadgets Reason: 1
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  :)

Grumpy_Mike

The A/D gives you a reading of 1023 for 5V input
So for a given reading R you have a voltage of:-
V = R * (5/1023)
With the current sensor you have half way biased signal so a voltage reading of:-
V = (R-511) * (5/1023)
at 13.3 mV per Amp
you have
Amps = V / 0.0133

This gives you a resolution of 367mA per reading increment. Given that you always get plus or minus one on a digital to analogue converter your accuracy will approximately be to the nearest half an amp. (734mA)

Go Up
 


Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

Arduino
via Egeo 16
Torino, 10131
Italy