Still Struggling with the formula!


Closed Thread
Results 1 to 18 of 18

Hybrid View

  1. #1
    Join Date
    Oct 2005
    Location
    Sweden
    Posts
    3,612


    Did you find this post helpful? Yes | No

    Default Re: Still Struggling with the formula!

    Hi,
    If it indeed is the 050U device then, if I read the datasheet correct it's an Unidirectional version and its output voltage at 0A is 0.6V - not Vcc/2.

    So if VRef for your AD-converter is 5.000V and you're using 12 bits then you should get an ADC reading of 4096/5*0.6=492 at 0A current. In an earlier post you said that you got 485 - that's pretty close. You'll then get 60mV per A.

    So at 1A current you should get a reading of offset+4096/5*0.06=541. To convert this to a readable value, if that's what you want, you first subtract the offset (541-492=49) and then multiply it by say 204 and then divide by 10. 49*204=9996, then divide by 10 = 999mA

    If you have 3.75A then you'll get an ADC reading of offset+4096/5*(0.06*3.75)=492+184=676. Start by subtracting the offset to get the "real" value (184) multiply by 204 and divide by 10 and you get 3753mA.

    If doing it this way watch out so you don't overflow you variables when multiplying. Another aproch would be to use the ** or */ operators as I showed you in another thread.

    /Henrik.

  2. #2
    Join Date
    Nov 2003
    Location
    Greece
    Posts
    4,132


    Did you find this post helpful? Yes | No

    Default Re: Still Struggling with the formula!

    I had the old Data sheet where there was no such device.

    Please accpet my appologies. Now downloaded the new pdf and see that indeed there is a variation of bidirectional device.

    050U is unidirectional and has 0.6 volts offset.

    So sorry.
    Ioannis

  3. #3
    Join Date
    Mar 2011
    Location
    Los Angeles, California
    Posts
    322


    Did you find this post helpful? Yes | No

    Default Re: Still Struggling with the formula!

    No problem Ioannis it happens to the best of us. Lol It is actually my fault if I had been thinking I would have included the spec sheet rather than just referencing it. It turns out from trial and error that the A/D readings includes the offset so in the calculations you have to subtract it.

    Best, Ed

  4. #4
    Join Date
    Nov 2003
    Location
    Greece
    Posts
    4,132


    Did you find this post helpful? Yes | No

    Default Re: Still Struggling with the formula!

    Yes, thats right. It is a constant value that has to be subtracted. The only little matter is that this constant is not so constant and may change with temp or other factors (aging etc.)


    So a complete zero after calculation cannot be guaranteed. Even worse,the calculation can result in a negative number, that in absolute valu can be very large positive.


    So a regular update of the offset value could be a good idea.

    Ioannis

  5. #5
    Join Date
    Mar 2011
    Location
    Los Angeles, California
    Posts
    322


    Did you find this post helpful? Yes | No

    Default Re: Still Struggling with the formula!

    Hi Ioannis!
    Thank you and you are very correct. What will probably be necessary is to add an external 3 second delay to measure the zero point each time time circuit is powered up. That is, power up the PIC, wait 3 seconds, then add the load. Where I have become very stuck is in what I call 4994 land. At 50 amps the A/D will be giving you value of 2987. Subtract a zero point of 490 and you get 2497. Times 2 and you get 4994. It seems no matter what I do this number keeps showing up!

  6. #6
    Join Date
    Nov 2003
    Location
    Greece
    Posts
    4,132


    Did you find this post helpful? Yes | No

    Default Re: Still Struggling with the formula!

    Taking into account that your power supply is 5Volts and the max output of the device is 3.6 volts in respect with the flowing current, the reading of the ADC I think is correct.

    I don't understand why you double it.

    Ioannis

  7. #7
    Join Date
    Mar 2011
    Location
    Los Angeles, California
    Posts
    322


    Did you find this post helpful? Yes | No

    Default Re: Still Struggling with the formula!

    When things go wrong is that yes (2987 divided by 10 gives 298 -49 = 249. 249 x 200= 49800. 49800 /4096 = 12. 12 x 4167 = 50004 close enough to 50.00 amps. Now do the same with an A/D OF 700 which is very close to 4.24 amps measured and 700 / 10 = 70. 70 - 49 = 21. 21 x 200 = 4200. 4200 /4096 = 1 (in a PIC) 1 x 4167 = 4167 or .4167 amps not the 4.24. What I am trying to say is that if I get the high end of the scale to work the low end does not! Even at a change to 800 the results will not change. Other approaches such as ((700-490) ** 8000) >>4 = 1 so it does exactly the same!

Members who have read this thread : 0

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts