Shop OBEX P1 Docs P2 Docs Learn Events
Reading Amperage with the Propeller (and a few other things) — Parallax Forums

Reading Amperage with the Propeller (and a few other things)

Brian CarpenterBrian Carpenter Posts: 728
edited 2009-03-24 18:05 in Propeller 1
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.hop.gifturn.gif

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

  • BeanBean Posts: 8,129
    edited 2008-11-05 12:21
    Brian,
    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

    ·
  • Brian CarpenterBrian Carpenter Posts: 728
    edited 2008-11-05 15:04
    Good call on the wiring Bean

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔


    It's Only A Stupid Question If You Have Not Googled It First!!
  • T ChapT Chap Posts: 4,223
    edited 2008-11-05 17:49
    Brian, here are a few other devices to monitor current that work really well, although they require a PCB.


    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
  • EricGarlicEricGarlic Posts: 41
    edited 2009-03-21 11:27
    I am interested in reading the current on the mains supply into the house in order to track over time the rate of spend on electricity. Figured it would be interesting to see what the kids thought and whether it would encourage them and us to switch-off their computers/tvs rather than leave them on standby. Anybody done this?

    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
  • s2jesses2jesse Posts: 62
    edited 2009-03-22 02:51
    id recomend trying this

    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
  • PhilldapillPhilldapill Posts: 1,283
    edited 2009-03-22 04:33
    Hey! I use that exact same device, Jesse. I can also say that they work great! You can snoop around on the Allegro website, and you'll find that they have many different hall effect sensors. Some are Bidirectional, some are Unidirectional, some range from 5A in an 8pin SOIC package, all the way up to a 200A unit. The best thing, is they generate virtually no heat. The conductor is a heavy copper conductor - no resistor.
  • Brian CarpenterBrian Carpenter Posts: 728
    edited 2009-03-22 05:01
    if you want something that will just slide right over the mains go to amploc.com they have 200amp units. Bean has some. Maybe he can chime in?

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔


    It's Only A Stupid Question If You Have Not Googled It First!!
  • BeanBean Posts: 8,129
    edited 2009-03-24 17:46
    The hall effect type are good at measuring AC voltage. But if you try to measure DC with them you get a kind of memory effect, also if you move them the changing magnetic field of the earth will change the reading. With AC all this stuff is negated because you measure the min and max of the AC waveform. Any constant magnetic fields get cancelled out.

    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...

    ·
  • mctriviamctrivia Posts: 3,772
    edited 2009-03-24 18:05
    I did not think hull effect even worked on dc. I have used them lots for ac work great.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    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.
Sign In or Register to comment.