Menu

Problem reading ACS712 current sensor

Help
2013-02-12
2013-05-30
  • Tom Poulton

    Tom Poulton - 2013-02-12

    Hi Guys,

    I'm a little stuck (yet again), I'm building a bench PSU with voltage and current displayed to an LCD, the voltage measurement is working fine however I'm very stuck on getting the ACS712-05B maths.

    The sensor reads -/+ 5A giving 0V output at -5A, 2.5V at 0A and 5V at 5A. and is connected to AN1

    So I was thinking that rather than messing around with negative figures in maths could I use a Vref of 2.5V on the analog input, or would that also apply to AN0 and mess up the voltage reading. Or is there a simple way to get the current to 2 decimal places that doesnt involve going into negative numbers?

    I am sorry if this is a fairly basic question but maths was never my strong point

     
  • kent_twt4

    kent_twt4 - 2013-02-12

    Using a 2.5V Vref isn't going to help, any a-d readings over 2.5V will read 255?  Dim the a-d reading variable as an Integer.  Then use a conditional to check for values <127 and set the MSb to 1 (i.e. adVar.15 = 1) for the negative readings.

     
  • kent_twt4

    kent_twt4 - 2013-02-12

    Make the conditional check for <511 when using ReadAD10.

     
  • Tom Poulton

    Tom Poulton - 2013-02-12

    Oops, that never even crossed my mind, I see what you mean, if it's less that 511 then ignore value as its negative.

    Cheers

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.