Pages: [1]   Go Down
Author Topic: Interfacing Allegro ACS754 with Arduino  (Read 677 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Karma: 0
Posts: 3
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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;
   A = (analogRead(ampPin)-512);

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  smiley
« Last Edit: January 19, 2010, 07:38:43 pm by buu-gadgets » Logged

Manchester (England England)
Offline Offline
Brattain Member
Karma: 596
Posts: 33290
Solder is electric glue
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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)

Pages: [1]   Go Up
Jump to: