# Trying to do load sensing - how?

I'd like to do some load sensing on my little toy robot I'm building. I built my own H-bridges with TIP122/127's, which works great. I'd just like to be able to detect when the motors stall (generally due to running into something). What I've got are a pair of .050ohm 30watt TO220 package resistors, one wired in series with each motor. The motors are 2.8ohms, the power source is 9.2v, so at full load that's about 3amps. 3amps going across a .050ohm resistor should create about .15v (maybe I should step up to a 1ohm, get 3v output?). Aside from possibly having the wrong resistor value (I went with what I had laying around), how do I get that information into the Arduino's analog pins? I guess I need some way of being able to get the difference in voltage of both sides of the resistor into a CPU pin. What kind of device/circuit can do this? Maybe an op amp? I'm really mostly doing this for the educational benefit.. :) Thanks for the help/tips guys.

Actually that's a very good question, how can one read how much current a motor is drawing while under program control. There are a couple of ways I can think of. The most non-invasive way it to use a hall-effect current sensor. This has a wire carrying motor current routed through the chip but otherwise no direct electrical connection to it, and output a DC measurement voltage proportional to the current. Advantages are no power loss consumed across a series resistance. Disadvantage might be cost of module, as I haven't seriously looked into their prices, current ranges, and interface voltage requirements. For battery operation on larger applications like robots, etc, efficiency is all important for maximum battery life between recharging.

The more traditional solution is to use a 'shunt' resistor like you have described and just measure the voltage drop across the resistor. It's easiest to interface with a arduino if it's a ground based measurement, so the resistor should be wired from the motor voltage sources negative voltage terminal to the entry for ground of the H-driver chips or low side driver transistors for discrete H-drive designs. As the arduino and H-drive power source should already be sharing a common ground wire, all that is required is to run a wire from the 'hot' side of the shunt resistor to a Arduino analog input pin.

One likes to have as small a resistance as possible as any voltage drop represents power loss to the motor as in watts lost = amps X amps X ohms. However as you stated your .05 ohm resistor will only present .15vdc at expected normal load current and that is a small number for decent resolution measurement on a normal arduino 0-5vdc analog input pin, only reading at 3% of measurement range. However you can enable the internal 1.1vdc A/D reference and your measurement range will shift down to 0-1,1vdc so your .15v current measurement will fill about 14% of the range and that might be usable.

Finally I think some of the H-drive IC modules include current measurement outputs, but I don't recall which ones. As most of these modules have some form of over-current shutdown/protection, they already have an internal means to measure current flow and as I said some give that measurement available on a analog output pin as I recall. I think I recall that anyway. :D

Any of that make sense?

Lefty

Yes, that's perfect. I should have thought of using the ground input for the sensing. And having both motors stalling will double my reading as well, .3v instead of .15v, at best.. Thanks for the tips. :)

If you are sensing 2 motors then you need 2 resistors and 2 analogue input pins. You cannot add the separate voltages together to produce 0.3 volts since each must be referenced to a common ground point. As the previous writer said, for maximum efficiency and measurement resolution you should go for hall type sensors. These can be provided with a 0-5 volt output over the desired current range and are totally isolated from the current being measured.

jack

I'm a fan of hall-effect type current sensors, because they're non-invasive and not very expensive. However, since you already have the shunt resistors in hand, you can put a differential amplifier across each shunt resistor. This is a standard op-amp circuit. You could also use an instrumentation amplifier circuit, which is somewhat better (and also a standard circuit). http://en.wikipedia.org/wiki/Operational_amplifier_applications has both circuits.

I build a brake-light failure detector for a car a long time ago. A reed relay with the wire wrapped round it. I put enough turns on so that it would cut in with both bulbs on, and not with only one bulb. Any good for your application?

If you want to simply detect motor stall conditions, rather than trully monitoring motor current, then measure the primary variable (shaft speed), not a secondary one (motor current). Look at shaft speed and when it stops turning, the motor has stalled - QED.

You could use either an optical sensor looking at an interrupted light through a vane wheel or a simple magnet mounted on each of the wheels to operate a reed switch. Measuring the time interval between switch operations will determine when the wheel stops turning.

No voltage losses, no hall sensors and no opamps

jack

ohh sorry for writing here but I'd like to use L298 driver to control a step motor... lol but I have no idea what to do with current sensing pins...

so what do I do if: 1. I don't need chopping 2. I want to use it

“…you can put a differential amplifier across each shunt resistor.”

Do you need to do this, or can you just use shunt resistors and read in the analog value to the Arduino pin? I’m trying to do this as well but uncertain if high-side current sensing is going to fry my Arduino if I’m current sensing around 5V and 1A through a 1.2 ohm resistor I have. Any thoughts?

As long as the voltage you're feeding into the Arduino isn't over 5v, you're fine. You're simply reading the amount of voltage drop through the resistor.

I'm current sensing around 5V and 1A through a 1.2 ohm resistor I have

No you can't be doing that!

If you have 5 volts across a 1.2R resistor you have 4.16A ( = 5/1.2 ) If you have 1 amp through a 1.2R resistor then the voltage across it will be 1.2 volts ( = 1*1.2)