ACS758 Arduino Current Sensor Tutorial

Measuring Higher Current with your Arduino

ACS758 Tutorial Feature ImageThe Allegro AC758 allows for high current measurements.  Coupled with the isolation benefits of a hall sensor,  the power supply requirements and output values make it a nice fit for an Arduino.

My bench tests show the module to be very functional.  What’s not included in these tests is a determination of whether the module is fit for long term continuous service at peak current.   If your intent is to create a permanent solution,  I would do that analysis.

Otherwise I would consider it a nice proof of concept device.

Finding an ACS758

Given the current sensor range, I would consider these reasonably priced.

eBay      Amazon

ACS758 Pin Outs

There are only three connections to your Arduino.   The other two connections are to be placed in series with your load.   The ‘forward’ and ‘reverse’ labeling is relative to conventional current flow theory.

ACS758 Current Sensor Pin Outs

 

ACS758 Current Sensor Scale Factors and Offsets

The ACS758 is offered in four ranges.  Each offered range is available as either a uni-directional sensor or a bi-directional sensor.

The bi-directional sensors will measure current in both directions and are useful when measuring current flowing into or out of a battery.

The uni-directional sensors measure current in one direction only and thus allow for a larger scale factor.  This larger scale factor, when properly designed for, can offer better measurement resolution.

Successfully using this sensor requires applying the correct scale factor and offset.  The table below is derived from the ACS758 Datasheet.

RangeDirectionScale FactorOffset
50 AmpUni-directional60 mV per Amp0.6 Volts
50 AmpBi-directional40 mV per Amp2.5 Volts
100 AmpUni-directional40 mV per Amp0.6 Volts
100 AmpBi-directional20 mV per Amp2.5 Volts
150 AmpUni-directional26.7 mV per Amp0.6 Volts
150 AmpBi-directional13.3 mV per Amp2.5 Volts
200 AmpUni-directional20 mV per Amp0.6 Volts
200 AmpBi-directional10 mV per Amp2.5 Volts

 

ACS758 Arduino Tutorial

Connect the ACS758 to your Arduino and Load

Key in the picture below is the reminder to make solid connections.   Things heat and burn pretty quickly if you don’t.

ACS758 Arduino Tutorial ConnectionsUpload the Arduino ACS758 Tutorial Sketch

The example code here should be modified to match your particular sensor.  Either refer to the comments in the code or in the table above.

 

/*
Henry's Bench
ACS758 Current Measurement Tutorial
*/
const int analogIn = A0;

// Set your scale factor
int mVperAmp = 40; // See Scale Factors Below

/* Scale Factors
50A bi-directional = 40
50A uni-directional = 60
100A bi-directional = 20
100A uni-directional = 40
150A bi-directional = 13.3
150A uni-directioal = 26.7
200A bi-directional = 10
200A uni-directional = 20
*/

// Set you Offset
int ACSoffset = 2500; // See offsets below

/* Offsets
If bi-directional = 2500
If uni- directional = 600
*/

int RawValue= 0;
double Voltage = 0;
double Amps = 0;

void setup(){ 
 Serial.begin(9600);
}

void loop(){
 
 RawValue = analogRead(analogIn);
 Voltage = (RawValue / 1023.0) * 5000; // Gets you mV
 Amps = ((Voltage - ACSoffset) / mVperAmp);
 
 Serial.print("Raw Value = " ); // shows pre-scaled value 
 Serial.print(RawValue); 
 Serial.print("\t mV = "); // shows the voltage measured 
 Serial.print(Voltage,3); // the '3' after voltage allows you to display 3 digits after decimal point
 Serial.print("\t Amps = "); // shows the voltage measured 
 Serial.println(Amps,3); // the '3' after voltage allows you to display 3 digits after decimal point
 delay(2500); 
 
}

Measuring AC Current with the ACS758

The ACS758 can be used to measure AC Current.  To measure AC current of a clean sine wave,   you can refer to the tutorial for the ACS712.