Pages: [1]   Go Down
Author Topic: Arduino Current Sensing  (Read 1706 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 3
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi all,

I am currently working on sensing the current used by a robotic device. Consider that I am also using external filters and trying different methods to try to get rid of the noise. The idea is to get a "clean" current signal here, but that is made difficult by the amount of noise I am dealing with.

So I decided to build this mini circuit (see attachement) in order to find out whether or not my Arduino (motor shield) itself is contributing to that noise. As you can see in the schematic, I am using a gain 10 Opamp to amplify the signal that I am sending through the 0.1Ω sense resistor. This amplified signal is then monitored using the analog pin A0. The signal that is being send through the sense resistor is alternating on/off, meaning that I turn pin 3 HIGH for about 0.25 sec then turn it LOW for another 0.25 sec and so on and so forth..

After testing it, I realized that I was getting very small numbers (ranging btw 0 and 4). My guess is that the input signal sent trough pin 3 is pretty low. Any idea on what the magnitude of the signal I am sending through RSense is? I would also welcome any other alternatives of the same purpose.


* Screen shot 2012-06-28 at 12.18.38 PM.png (30.51 KB, 515x369 - viewed 59 times.)
« Last Edit: June 28, 2012, 12:27:56 pm by Mamdu0_0 » Logged

Switzerland
Offline Offline
Faraday Member
**
Karma: 111
Posts: 5242
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I guess you already burnt your pin 13. Putting a HIGH on that pin while it's connected by almost a short circuit to ground is too much current for the pin.

5V / 0.1 Ω = 50A theoretically.

The fuse will stop that at 500mA but the pins are designed for a max of 40mA.
Logged

Montreal
Offline Offline
Faraday Member
**
Karma: 30
Posts: 2602
Per aspera ad astra.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Any pin can't source more than 40 mA
Logged

0
Offline Offline
Shannon Member
****
Karma: 215
Posts: 12489
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

No pin can source or sink 40mA or more without risking permanent damage to the chip.  It'll certainly manage more that 40mA for a while, but this overloads and overheats the output transistor on the chip.

The sense resistor needs to be in the current path from the power source.  You want a gain of more like 50 to 100 for the opamp to be useful since you don't want the sense resistor to drop more than a small fraction of a volt - this means the sense resistor will dissipate less heat.
Logged

[ I won't respond to messages, use the forum please ]

Offline Offline
Newbie
*
Karma: 0
Posts: 3
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I'm using an Arduino mega 2560. I decided to now confirm if my Arduino is sensing current that we can verify somehow. I have tried sensing the current using the circuit shown in the schematic below.

The results I obtained are also shown below. I can see the shift in current consumption when a add/remove different loads but my question is is this considred good enough to approve this Arduino for my project? Any other suggestions for a way to find out whether my Arduino mega 2560 is sensing current correctly?



* Screen shot 2012-07-05 at 2.24.25 PM.png (21.56 KB, 381x409 - viewed 47 times.)

* Screen shot 2012-07-05 at 2.30.15 PM.png (33.4 KB, 696x526 - viewed 36 times.)
Logged

0
Offline Offline
Shannon Member
****
Karma: 215
Posts: 12489
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Now you are using an inductive load to blow up pin A0!  The diode goes across the motor, not in line with it.  See examples for controlling a motor or relay from Arduino for the proper circuit.
Logged

[ I won't respond to messages, use the forum please ]

Offline Offline
Full Member
***
Karma: 2
Posts: 226
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

sorry off topic, but which circuit programm has that schematic of an arduino?
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 3
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

MarkT - I thought the diode accross the transistor would protect it from back voltage coming from the motor shutting off or going reverse?

lax123 - You can build your own schematics at this link http://www.dz863.com/index.php.
Logged

0
Offline Offline
Shannon Member
****
Karma: 215
Posts: 12489
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

The diode goes across the inductor - it provides a safe path for current to flow on switch off (inductors resist changes to current flow, and will generate very large voltages if there is no path for the current to keep flowing).  Where you have the diode it does nothing as the lower terminal of the inductor will _rise+ to 100's or 1000's of volts on a timescale of microseconds when the transistor switches off, instantly destroying transistor and Arduino.

With the diode across the inductor the lower terminal rises to about 0.7V (or more if a slow diode) above the supply and then the diode safely carries the current.  Alas this is still enough to damage the Arduino - add a 10k resistor in series with the analog pin.
Logged

[ I won't respond to messages, use the forum please ]

Cumming, GA
Offline Offline
Edison Member
*
Karma: 20
Posts: 1658
Ultimate DIY: Arduino
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

There are much smarter and safer ways to sense current...  maybe you should do a search for chips designed to do this so you don't waste your AVR chips.
Logged

Pages: [1]   Go Up
Jump to: