Author Topic: Current Sensor/Shunt for use with Arduino  (Read 11041 times)

0 Members and 1 Guest are viewing this topic.

Offline birdieTopic starter

  • Contributor
  • Posts: 17
  • Country: au
Current Sensor/Shunt for use with Arduino
« on: March 25, 2015, 03:05:38 am »
I'm looking at building a custom power monitoring system for my camper trailer. One of the things I want to do is measure some high currents (relative to what a Arduino can handle natively...) including solar panel current and voltage input to the camper trailer batteries, and overall system current usage. I also want to monitor the current usage for individual circuits including the lights and 12v camping fridge.

Can anyone suggest some suitable current sensor/shunts to use with an Arduino. It will all be DC, voltages up to 25V or so from solar, and 12V or so for batteries. Currents I'm thinking in the ballpark of 30A or so... but I honestly don't know my actually current draw which is why I want to build the monitoring circuit so I can keep on eye on my battery level and also monitor how much I'm putting back in via Solar and how much each ciruit is drawing...
 

Offline PeterFW

  • Frequent Contributor
  • **
  • Posts: 577
  • Country: de
    • Stuff that goes boom
Re: Current Sensor/Shunt for use with Arduino
« Reply #1 on: March 25, 2015, 04:03:55 am »
Texas Instruments INA226, only 5-6 external components, I2C interface, library allready available for the arduino IDE and it reads current/voltage and calculates the power.
 I had it running in under a minute and spitting out readings.
 

Offline zapta

  • Super Contributor
  • ***
  • Posts: 6190
  • Country: us
Re: Current Sensor/Shunt for use with Arduino
« Reply #2 on: March 25, 2015, 04:10:19 am »
You can also use a high side current to voltage converter and use the Arduino for the A/D. For example this one https://www.adafruit.com/products/1164 .  For higher currents you will need to connect an external shunt.
 

Offline birdieTopic starter

  • Contributor
  • Posts: 17
  • Country: au
Re: Current Sensor/Shunt for use with Arduino
« Reply #3 on: March 25, 2015, 04:41:31 am »
Someone else suggested these: http://www.jaycar.com.au/Test-%26-Measurement/Panel-Meters/Accessories-%28Current-Shunts%2C-add-on-PCB-etc-%29/Heavy-Duty-Current-Shunt---6---50A/p/QP5412

How do they work? Do you just measure the voltage across the two small terminals and then the voltage value is the current value?
 

Offline mtdoc

  • Super Contributor
  • ***
  • Posts: 3575
  • Country: us
Re: Current Sensor/Shunt for use with Arduino
« Reply #4 on: March 25, 2015, 04:43:00 am »
I bought one of these from eBay a while back but it looks like they are no longer available there. You could probably put together the same thing easily with the same or similar Allegro chip - they have several similar.
 

Offline mtdoc

  • Super Contributor
  • ***
  • Posts: 3575
  • Country: us
Re: Current Sensor/Shunt for use with Arduino
« Reply #5 on: March 25, 2015, 04:48:31 am »
Someone else suggested these: http://www.jaycar.com.au/Test-%26-Measurement/Panel-Meters/Accessories-%28Current-Shunts%2C-add-on-PCB-etc-%29/Heavy-Duty-Current-Shunt---6---50A/p/QP5412

How do they work? Do you just measure the voltage across the two small terminals and then the voltage value is the current value?

That's a current shunt. It has a very low, known resistance. You measure the voltage drop across it which is directly proportional to the current. But the voltage drop is very small (mV range) so you would need an accurate, high resolution ADC to use that value with an Arduino.

Several commercially available battery monitors, designed for renewable energy systems use shunts like those.  For example the Trimetric and Pentameric from Bogart engineering.
« Last Edit: March 25, 2015, 04:50:40 am by mtdoc »
 

Offline birdieTopic starter

  • Contributor
  • Posts: 17
  • Country: au
Re: Current Sensor/Shunt for use with Arduino
« Reply #6 on: March 25, 2015, 05:09:49 am »
I bought one of these from eBay a while back but it looks like they are no longer available there. You could probably put together the same thing easily with the same or similar Allegro chip - they have several similar.

How do these work, just output a 0-5v voltage proportional to the current which can then be read using an ADC on the Arduino?

Texas Instruments INA226, only 5-6 external components, I2C interface, library allready available for the arduino IDE and it reads current/voltage and calculates the power.
 I had it running in under a minute and spitting out readings.


I like the sound of that, I2C interface should be more accurate than relying on the internal ADC accuracy... I didn't see anything about the current or voltage ratings for this one though...?
 

Offline mtdoc

  • Super Contributor
  • ***
  • Posts: 3575
  • Country: us
Re: Current Sensor/Shunt for use with Arduino
« Reply #7 on: March 25, 2015, 06:30:35 am »
I bought one of these from eBay a while back but it looks like they are no longer available there. You could probably put together the same thing easily with the same or similar Allegro chip - they have several similar.

How do these work, just output a 0-5v voltage proportional to the current which can then be read using an ADC on the Arduino?
Yes.

Quote
Texas Instruments INA226, only 5-6 external components, I2C interface, library allready available for the arduino IDE and it reads current/voltage and calculates the power.
 I had it running in under a minute and spitting out readings.


I like the sound of that, I2C interface should be more accurate than relying on the internal ADC accuracy... I didn't see anything about the current or voltage ratings for this one though...?

That looks like a great solution as well. It looks like it works by reading the voltage drop across a current shunt so the shunt will determine the voltage and current ratings.
 

Offline PeterFW

  • Frequent Contributor
  • **
  • Posts: 577
  • Country: de
    • Stuff that goes boom
Re: Current Sensor/Shunt for use with Arduino
« Reply #8 on: March 25, 2015, 12:56:22 pm »
I like the sound of that, I2C interface should be more accurate than relying on the internal ADC accuracy... I didn't see anything about the current or voltage ratings for this one though...?

The following may include erros, please check the math yourself :)

It works up to 36V, the current capabillity is dependant on the shunt resistor.
The maximum shunt voltage is 800mV that means if you want to measure 30 Amps at 36 Volts your shunt must be smaller then 0,025 Ohm, wich is perfectly reasonable given the 16Bit resolution of the shunt monitor.
Even with a 0,01 Ohm shunt you have a measurement error below 0,5% with a resolution of about 50mA.
 

Offline Seekonk

  • Super Contributor
  • ***
  • Posts: 1938
  • Country: us
Re: Current Sensor/Shunt for use with Arduino
« Reply #9 on: March 25, 2015, 01:55:51 pm »
I use the 5A version of the ACS712 and then make a wire shunt to up the current.  Putting 30A through the 30A version is nuts.  It is a camper, no reason for all that accuracy.
 

Offline MLXXXp

  • Frequent Contributor
  • **
  • Posts: 327
  • Country: ca
Re: Current Sensor/Shunt for use with Arduino
« Reply #10 on: March 25, 2015, 06:06:19 pm »
Perhaps the INA3221 breakout board reward in this Kickstarter campaign may be of some interest:
https://www.kickstarter.com/projects/sunair/really-useful-breakout-boards-for-raspberry-pi-ard

You would probably have to change the values of the shunt resistors for your purposes.

INA3221 datasheet:
http://www.ti.com/lit/ds/symlink/ina3221.pdf
« Last Edit: March 25, 2015, 06:26:32 pm by MLXXXp »
 

Offline mtdoc

  • Super Contributor
  • ***
  • Posts: 3575
  • Country: us
Re: Current Sensor/Shunt for use with Arduino
« Reply #11 on: March 25, 2015, 07:03:13 pm »
The 30A versions of the ACS712 are available on a very cheap breakout board on eBay 

As Seekonk says - putting 30A through them for any prolonged period may not be a good idea and will likely release the magic smoke, but for that price buying a few to experiment with is a no brainer IMO. In fact I think I will pick up a few.
 

Online Psi

  • Super Contributor
  • ***
  • Posts: 9950
  • Country: nz
Re: Current Sensor/Shunt for use with Arduino
« Reply #12 on: March 25, 2015, 07:14:49 pm »
Be aware that hall effect current sensors don't have very good accuracy at mA level. They are good for sensing amps but not mA.
+/-200mA is what you can expect real world.
Greek letter 'Psi' (not Pounds per Square Inch)
 

Offline mtdoc

  • Super Contributor
  • ***
  • Posts: 3575
  • Country: us
Re: Current Sensor/Shunt for use with Arduino
« Reply #13 on: March 25, 2015, 07:27:15 pm »
Be aware that hall effect current sensors don't have very good accuracy at mA level. They are good for sensing amps but not mA.
+/-200mA is what you can expect real world.

Good point. But I think for the OPs use (and mine which is also monitoring of a RE system) the accuracy is good enough.   Temperature effects are also something to keep in mind - especially important if you are monitoring at an outside location.
 

Offline rx8pilot

  • Super Contributor
  • ***
  • Posts: 3634
  • Country: us
  • If you want more money, be more valuable.
Re: Current Sensor/Shunt for use with Arduino
« Reply #14 on: March 25, 2015, 07:41:52 pm »
Texas Instruments INA226, only 5-6 external components, I2C interface, library allready available for the arduino IDE and it reads current/voltage and calculates the power.
 I had it running in under a minute and spitting out readings.

I have used the INA226 on a production project and have been very happy with it. The i2c (TWI) interface is easy and the the device is accurate and cheap. I interfaced with an AVR and coded it on my own to integrate with and existing application so I have no notes on the Arduino. It outputs 16bit data which requires a pinch of effort.

There are some other INA devices that output a voltage range that you can capture with your on-board A/D. Less accurate though.
Factory400 - the worlds smallest factory. https://www.youtube.com/c/Factory400
 

Offline PeterFW

  • Frequent Contributor
  • **
  • Posts: 577
  • Country: de
    • Stuff that goes boom
Re: Current Sensor/Shunt for use with Arduino
« Reply #15 on: March 25, 2015, 08:39:45 pm »
I have used the INA226 on a production project and have been very happy with it. The i2c (TWI) interface is easy and the the device is accurate and cheap.

I would not say cheap but it is not pricey either, to me this device has a phenomenal bang per buck ratio.
It even will do averaging for you and is way more accurate then the on board ADC.

The allegro devices are not bad either but as allready mentioned, they guestimate the current rather then measuring it. Depending on your appication they might do what you want.
But you have to measure the bus voltage seperately and you should measure the supply voltage of the Allegro device or calibrate it once to improve the accuracy, since the output is 1/2 VCC referenced.
This library works fine for me, i have not had a problem yet:

https://github.com/jarzebski/Arduino-INA226
« Last Edit: March 25, 2015, 08:41:24 pm by PeterFW »
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf