Monday, April 30, 2012

Monitoring Power Consumption with the ACS715

We needed a power meter for monitoring power consumption of our ham radio's when in emergency communications mode (no grid). Although you can get these commercially, from the fully featured off grid power system capable Bogart Trimetric, to the single item Watt's UP, we wanted a diy homebrew unit that is educational, and customizable. Based on a ACS715 Hall Effect Current Sensor, connected to an Arduino, we are now monitoring the current consumption of our radio gear. The following screen shot shows both TX and RX power modes.
I'm posting the code below for the current monitor, and now I'm off to add voltage monitoring, and to calculate watts, watt hours, and amp hours.

 /* This sketch describes how to connect a ACS715 Current Sense Carrier ( to the Arduino, and read current flowing through the sensor.

Vcc on carrier board to Arduino +5v
GND on carrier board to Arduino GND
OUT on carrier board to Arduino A0

 Insert the power lugs into the loads positive lead circuit, arrow on carrier board points to load, other lug connects to power supply positive */

int analogInPin = A0; // Analog input pin that the carrier board OUT is connected to
int sensorValue = 0; // value read from the carrier board
int outputValue = 0; // output in milliamps

void setup() { // initialize serial communications at 9600 bps:
Serial.begin(9600); }

void loop() {
// read the analog in value:
sensorValue = analogRead(analogInPin);

// convert to milli amps
outputValue = (((long)sensorValue * 5000 / 1024) - 500 ) * 1000 / 133;

 /* sensor outputs about 100 at rest. Analog read produces a value of 0-1023, equating to 0v to 5v. "((long)sensorValue * 5000 / 1024)" is the voltage on the sensor's output in millivolts. There's a 500mv offset to subtract. The unit produces 133mv per amp of current.*/

 // print the results to the serial monitor:
 Serial.print("sensor = " );
Serial.print("\t Current (ma) = ");

 // wait 10 milliseconds before the next loop
 // for the analog-to-digital converter to settle // after the last reading:
 delay(10); }

1 comment:

Related Posts Plugin for WordPress, Blogger...