Reading Amperage with the Propeller (and a few other things)
Brian Carpenter
Posts: 728
I set out initially wanting to figure out how i could tell if my A/C unit was on or off.· it evolved into something much better.· I bought an Amp25 from www.Amploc.com It is a hall sensor.· it has an offset of 1/2 the input voltage.· The documentation states that it requires 5 to 10 volts supply.· I am using it at 3.3v and am having great success.· I have connected the analog output of the Amploc to an input on an MCP3202 ADC.· From there it was just code.· Now, i am not a good coder by any means and it took mw awhile to figure out how i was to accomplish the task.· Since the Amploc puts out a voltage in relation to its Amperage, the readings come out as a Sine wave.· The data sheet gives amps per mV but then you have to to RMS math to get the true amperage.· I stet up to make a test on the system.· I stole the Toaster from the kitchen and plugged it into my setup.· i turned it on and read the ADC values into hyperterminal and then imported them into Excel.· I was then able to see my Highest Value and my Lowest Value.· I also took a real RMS meter and read the Amps to be 6.26amps.· I took my Lowest value and subtracted it from my highest and divided by 2 to get my ADC value that resembled the 6.26 amps.· I then looped the wire through the Amploc twice.· Did the same as above and recorded the values.· and then did it one more time with three loops.· I was able to see that that if i took the value that i recieved from the ADC and multiplied it by 0.02495, i would get an accurate amp reading.· NO RMS Math.
So, to get my amps, i sample the ADC many times to find the limits of the sine wave.· Take the High, subtract the low, divide by 2 and then divide by 4.· this gives me a value 10x bigger than the acctual value.· Divide by 10 and Modulus by 10 to get my "Float" number.
I have attached some pics and some code.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
It's Only A Stupid Question If You Have Not Googled It First!!
Post Edited (Brian Carpenter) : 11/5/2008 6:38:04 AM GMT
So, to get my amps, i sample the ADC many times to find the limits of the sine wave.· Take the High, subtract the low, divide by 2 and then divide by 4.· this gives me a value 10x bigger than the acctual value.· Divide by 10 and Modulus by 10 to get my "Float" number.
I have attached some pics and some code.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
It's Only A Stupid Question If You Have Not Googled It First!!
Post Edited (Brian Carpenter) : 11/5/2008 6:38:04 AM GMT
Comments
Cool. Nice use of the Prop Mini Dev Board.
It should be noted to anyone using the AMP25 device that the pinout is NOT the same as the Parallax Servo cables. You need to swap the Red and Black wires on the AMP25 end of the cable (see Brian's pictures).
Bean.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
"The welfare of the people in particular has always been the alibi of tyrants." ~ Camus
www.iElectronicDesigns.com
·
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
It's Only A Stupid Question If You Have Not Googled It First!!
www.analog.com/en/amplifiers-and-comparators/current-sense-amplifiers/AD628/products/product.html
This AD628 device is amazing, just use a sense resistor inline between the power and device being monitored, then set the gain for the output and reference output levels. It will measure the friction of a fly's legs getting traction while trying to land on a spinning motor.
www.allegromicro.com/en/Products/Part_Numbers/0712/
For example to get the amps into the Prop, use ADC or run the output of the 628 into a comparator - input, output a DAC from the Prop to the + of the comparator to set a fixed reference level, then have the Hall sense into the -, when the - exceeds the +, the Prop sees the comparator output low. To continuously scan using the comparator instead, fast ramp a DAC to the comp + in a repeat loop, when the comparator trips, the level on the DAC at trip point was the value of the current(relative).
Post Edited (Originator) : 11/5/2008 6:03:06 PM GMT
I intend to approach the problem in a manner to similar to this thread using a hall effect sensor to indirectly measure current. Is this is most efficient route?
Cheers
Eric
http://www.allegromicro.com/en/Products/Part_Numbers/0756/
Ive been messing with them a bit with my Rc stuff
you can even run them at 3.3v
+- 100 amps with a tiny 130·µΩ· resistance
jesse
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
It's Only A Stupid Question If You Have Not Googled It First!!
For DC I'd go with the resistor type.
Bean.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
There is a fine line between arrogance and confidence. Make sure you don't cross it...
·
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Need to make your prop design easier or secure? Get a PropMod has crystal, eeprom, and programing header in a 40 pin dip 0.7" pitch module with uSD reader, and RTC options.