Current Sensor circuit

Hello everyone.

I am trying to make a sensor circuit for work that would sense battery charger current and voltage, and send the resulting information to an SD card to be logged.

Because the data is going to an SD card, I had hoped to build the circuit onto Sparkfun's MicroSD Shield, so I pulled up their eagle files, and made modifications to suit.

I wanted to run this past you folks first, to see what you think.

I am going to use this current sensor IC
ACS758LCB-050B-PFF-T

The resistors and switches are in place to create a voltage divider. I wish to select between 30 or 40V, cut it down to 5v, and send that to the arduino's analog pin for voltage checking.

Thanks.

I don't see the recommended 0.1 microfarad bypass capacitor across the sensor power leads.

The sensitivity is 40 mV per Amp and the Arduino input sensitivity is about 5 mV per count (at Aref=5V) so you should be able to measure currents in increments of about 1/8 A. Seems reasonable.

I have updated the image to reflect the capacitor addition, as well as tieing the ground of the charger system to the arduino, so the voltages won't be floating.

Let me know what you guys think.

thanks.

I can't see a second resistor in voltage divider. I'd not use a switch for 30-40, just a "software " coefficient, which you can select with keypad ( if there would be any lcd/keypad ) or switch connected to arduino digital input will select a scaling coefficient. Software approach would include some calibration constant (resistor inaccuracy, temperature).
For more precision measurements better to drop voltage down with a zener before voltage divider ( 25V or so ), but I don't think it necessary, as 1/10 divider would allow to get 50 mV.

I think you might have meant S2-2 going to Arduino A1 and the end of R4 going to ground. That will create a voltage divider that will give you 5V into the Arduino when you have 30V coming in, assuming your switch S2 has pins 3 & 2 connected. That might be cutting it a little close if your input voltage goes over 30 volts. Your divider for when the switch is in the other position gives you 4.7V out when your input is 40V so that one is probably safe. You could sacrifice a little resolution and use the larger divider for both ranges and just let S2 indicate it's position to the Arduino through a digital input as Magician suggested.

I don't get why you need the two position switch unless it is to get the maximum possible resolution of the battery voltage. What is the purpose?

It may not be a good idea to have the ground of your battery system common to the ground of the current sensor. The sensor is designed to make that unnecessary. The dilemma comes from when you want to measure battery voltage you have to have a common ground to the Arduino.

There may not be a problem with having common grounds in your particular application. One solution would be to use another current sensor as an isolated "voltmeter" by selecting an appropriate voltage divider to place across its isolated differential inputs. At $7 per sensor, that may not be economical to do.

Edit: That was a dumb idea. You can build a cheap opto-isolated voltage measuring circuit using a Clare LOC-110 or similar and a couple of op amps. Here's the app note:

http://www.clare.com/home/pdfs.nsf/www/AN-107.pdf/$file/AN-107.pdf

@zryder

Check this post http://arduino.cc/forum/index.php/topic,72715.0.html I did a schematic for his application. So check my schematic ( the good one ). To measure a voltage with an analog pin, you use a voltage divider, But to measure a current, you need two voltage divider across a low resistor ( see my schematic ) in the software , you simply take the difference ( A0 - A1 <-- in my example ) Just take into account that the minimum difference is 5 mV or 1 value <- from a analogRead(), And simply in the software calculate the current base on what the 1 value represent for you.

EmilyJane:
I think you might have meant S2-2 going to Arduino A1 and the end of R4 going to ground. That will create a voltage divider that will give you 5V into the Arduino when you have 30V coming in, assuming your switch S2 has pins 3 & 2 connected. That might be cutting it a little close if your input voltage goes over 30 volts. Your divider for when the switch is in the other position gives you 4.7V out when your input is 40V so that one is probably safe. You could sacrifice a little resolution and use the larger divider for both ranges and just let S2 indicate it's position to the Arduino through a digital input as Magician suggested.

I don't get why you need the two position switch unless it is to get the maximum possible resolution of the battery voltage. What is the purpose?

The circuit is designed to test battery chargers at my work. My company make's floor scrubbers, and these systems almost always have 2 12v deep cycle batteries in series, for a 24v system. The battery chargers on these machines is what needs to be tested. The largest chargers will put out 30A at 24V, and 25A at 36V. There is only one machine that uses 36V, but I wanted to have the ability to test this as well. However, since the vast majority of the chargers tested will be designed to charge 24V batteries, I wanted the most precision I could get, within safe limits. I am completely open to other ideas as to how to get there.

As for the battery charger's ground connected to the circuit's ground, I agree it's not the best idea, but I don't know a better way to tie the 2 grounds together to get accurate voltage readings.

I updated the image in the first post to reflect a great idea.

How is it best to protect the system from accidental overcurent? Put a 1A fuse between the battery ground and the arduino's ground. If it somehow draw's more than 1A, the grounds are separated.

Sound like a good idea? Or is my logic somehow off in left field.

The circuit is designed to test battery chargers at my work. My company make's floor scrubbers, and these systems almost always have 2 12v deep cycle batteries in series, for a 24v system. The battery chargers on these machines is what needs to be tested. The largest chargers will put out 30A at 24V, and 25A at 36V. There is only one machine that uses 36V, but I wanted to have the ability to test this as well. However, since the vast majority of the chargers tested will be designed to charge 24V batteries, I wanted the most precision I could get, within safe limits. I am completely open to other ideas as to how to get there.

If you use the divider for the higher voltage system for both voltage systems, you will have a resolution of approximately 0.04V. Is this not good enough? That is 0.13% of full scale of the lower voltage. The theoretical maximum resolution would be 0.1% and circuit tolerances will make it impossible to achieve that anyway. The advantage is you eliminate the switch and a resistor and some program code to handle both cases.

Sound like a good idea? Or is my logic somehow off in left field.

That won't protect the Arduino if some accident or resistor divider failure occurs. If you want complete isolation and safety for the Arduino, you will have to isolate the voltage measurement as I suggested. It's a trade-off between the added cost and complexity of your circuit and the cost of an Arduino. It may not be worth worrying about, especially if you observe care in construction.