Black Lives Matter - Action and Equality. ... Adafruit is open and shipping.
0

sensing current via Arduino?
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

sensing current via Arduino?

by bridges_pdp on Wed Oct 29, 2008 6:20 pm

I'm daydreaming a project to use an Arduino and a pair of XBees to sense current (up to 20A) and transmit the presence or absence of current to a remote location. We generate our own power and being able to sense when a water pump or a freezer is on or off remotely would be fantastic. Any ideas for an Arduino-based circuit?

Thanks,

Scott

bridges_pdp
 
Posts: 31
Joined: Fri Oct 24, 2008 7:00 am

Re: sensing current via Arduino?

by adafruit on Wed Oct 29, 2008 8:37 pm

its definately possible. you'll need a current transformer and some analog circuitry. might want to google for DIY power meters or sensing

adafruit
 
Posts: 12151
Joined: Thu Apr 06, 2006 4:21 pm
Location: nyc

Re: sensing current via Arduino?

by Amberwolf on Thu Oct 30, 2008 3:54 am

There are some open-source microprocessor-based motor controllers out there, primarily for RC plane or Ebike use, that have current sensors in them to ensure the motor at stall doesn't draw so much power it blows up the driver chips, the batteries, or the motor itself.

Those systems simply use a sensor of some type to convert the current into a voltage. If you are sensing the current in DC-power systems, then it is fairly simple--use a coil of wire with a hall-effect sensor near it, with the power to the device you are trying to sense feeding thru that coil of wire. As the power thru the wire increases, the magnetic field the coil generates becomes stronger. The hall sensor will detect that and output a voltage proportional to that which the arduino could then read, and you will even be able to tell how *much* power is being used, once you calibrate the output reading of the hall sensor to the actual measured load of the device you're measuring.

If all you want is to know if it is drawing power at all, there are versions of the hall sensor that simply give a logic on/off response instead (built-in comparator), so that when a magnetic field is present in sufficient strength, the turn the output on. The type used in many brushless motors inside PC cooling fans are of this type, so if you have some old worn out PC fans (hard to imagine any tinkerer who wouldn't have a box of them! :) ) you can disassemble them for the sensors, and lookup the pinouts online (this can be a little harder than it sounds, though).

Most hall sensors I've worked with are powered from 5v. Some can run on 3v ok. The analog output types I've used start with no magnetic field around them at half their power supply value as output value (2.5v for a 5v powered unit). Then if the magnetic field is N-S thru the sensor, they begin to approach one rail (say, go toward 5v) as the field gets stronger. The opposite output if the field is S-N (so outputting 0v when the field strength meets or exceeds the max that sensor is designed for).

There are other ways to do it, too, but this is a common enough method for completely-isolated sensing of current pulses in high-powered motor control, and if you are using DC power to the wells/etc, it will work for that, too.

If you are using AC power to the devices you want to monitor, you can use a similar arrangement but you will have to use a non-retriggerable one-shot (555 circuit, for instance) on the output of the hall sensor so that the arduino isn't being triggered every AC-cycle (60hz, for instance, though it might actually be 120hz for the hall output, as the field will cross zero twice every cycle and trigger the hall's output). The one-shot needs to be setup so that until the hall isn't outputting for some small amount of time, a few cycles' worth, it won't reset to be allowed to trigger again, or else the arduino will keep being told the device is turning off and on when it really isn't. :)
Watch me build an electric bike from assorted junk!
Alternative Energy Sources for the Home from Recycled Junk
A subsidiary of Cybernetic Necromancers, Discorporated:
"We Bring Dead Things To Life"
Amberwolf
 
Posts: 310
Joined: Wed Oct 08, 2008 2:42 am
Location: Phoenix, AZ, USA

Re: sensing current via Arduino?

by TheBestJohn on Sat Jun 12, 2010 11:31 pm

Hate to revive a dead topic but I am in need of this as well. I am planning on building a ebike. I was wondering if anyone knew anything about this http://www.sparkfun.com/commerce/product_info.php?products_id=9028 or had any experience with it.
The voltage would be around 40V and and I'm assuming I wont need the 90A of current that this is capable of using. It also says that it's output is 3.3V ADC which I assume is safe for the arduino am I right?

TheBestJohn
 
Posts: 17
Joined: Thu Jan 14, 2010 10:01 am

Re: sensing current via Arduino?

by chuckm on Sun Jun 13, 2010 8:53 pm

Jorad it won't work for you if you really do go to 90A since the dissipation in the shunt would be 90^2 * .001 or 8 watts. The shunt will melt.

It would be useful to know the specs of the motor for your ebike. Basically if you have its rating in watts you can divide by the input voltage to get a sense of how much current it will consume. Also motors tend to consume a lot of current when they are just starting up so you may find that you get spikes that are more than 100A before it settles down.

--Chuck

chuckm
 
Posts: 159
Joined: Thu Dec 24, 2009 3:31 am

Re: sensing current via Arduino?

by TheBestJohn on Mon Jun 14, 2010 3:36 am

Well I'm not quite sure what it's peak current will be however I am planning on using this motor: http://www.hobbyking.com/hobbyking/stor ... :_70-55%29

It's maximum power rating is 7000W which by my calculations at 39V could consume up to 179A however it's idle current is 3.5A The reason I want to be able to get the current draw is because I want to log the information on accelerating from a dead-stop to see what is the most efficient method of rigging the motor up. Does anyone know of any other ways to measure DC current?

TheBestJohn
 
Posts: 17
Joined: Thu Jan 14, 2010 10:01 am

Re: sensing current via Arduino?

by pstemari on Tue Jun 15, 2010 1:08 pm

Specs on the datasheet say that device is good for up to 89.4 amps, so presumably it can dissipate 8w OK.

Why 89.4 amps and not 90 amps, that's a bit odd. Reading a bit further, the 1 milliohm resistors are rated for 2W each and are in parallel, so sqrt(2W / 0.001 ohms) = 44.7 amps each, or 89.4 amps total.
--Paul

A wholly owned subsidiary of:
Persephone: DL R+W+B C 7 X L W C++ I++ T+ A E H++ S+ V-- F+ Q P B PA+ PL
Aldebaran: DM Rt H 5 Y L- W+ C+ I++ T++ A+++ E H++ S+ V+ F++ Q+ P B++ PA- PL--
User avatar
pstemari
 
Posts: 310
Joined: Sun Mar 21, 2010 6:10 pm
Location: Seattle, WA

Re: sensing current via Arduino?

by zener on Tue Jun 15, 2010 6:24 pm

And the temp de-rating on the resistors is...

zener
 
Posts: 4567
Joined: Sat Feb 21, 2009 2:38 am

Re: sensing current via Arduino?

by chuckm on Mon Jun 21, 2010 1:35 am

Jorad wrote:It's maximum power rating is 7000W which by my calculations at 39V could consume up to 179A however it's idle current is 3.5A The reason I want to be able to get the current draw is because I want to log the information on accelerating from a dead-stop to see what is the most efficient method of rigging the motor up. Does anyone know of any other ways to measure DC current?


Yup, not quite a 10HP motor. The easiest way to measure current on it would be use a clamp on ammeter probe. If your multi-meter can keep min-max readings then you hook it up, run your bike, then read the current.

Since its a brushless motor I presume you are designing the controller for it? Lots of folks on the various e-bike forums seem to be looking at it. I presume you will have some sort of transmission for it as well. since its only going to be able to sustain that sort of power with enough RPM to keep air pumping through it.

So bottom line, if you're not already familiar with the design of high power electronics I'd start there. There is a pretty good book you can get if you sweet talk your International Rectifier representative called "Motor Drive Control IC Designers Manual" it was invaluable to me when I was building my DC motor controller (it was a 10KW capable controller but since it was for DC motors its simpler than a brushless design). Also the manufacturer of the motor (the name 'Turnigy' is not the manufacturer, its probably one of the Chinese motor houses) will have a recommended controller for it usually.

Its an interesting road you're on, good luck!
--Chuck

chuckm
 
Posts: 159
Joined: Thu Dec 24, 2009 3:31 am

Please be positive and constructive with your questions and comments.