Still Struggling with the formula!


Closed Thread
Results 1 to 18 of 18

Hybrid View

  1. #1
    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!

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


    Did you find this post helpful? Yes | No

    Default Re: Still Struggling with the formula!

    At 50A: ADC=2987, offset=485. (2987-485) * 20 = 50040mA (50.04A)
    At 4.24A: ADC=700, offset=485. (700-485) * 20 = 4300mA (4.3A)
    At 1A: ADC=534, offset=485. (534-485) * 20 = 980mA (0.98A)

    Not perfect. However, there are some things that doesn't quite add up here... You should be getting 60mV per A so at 50A you should get 3V or a count of 2457+offset. Now, you say that the offset is 485 which should give you a total of 2942 at 50A, yet you say that you get 2987 but never mind.

    In theory, provided that your VRef is exactly 5.000V you will get 49.152 'counts' per A. If you get yoursefl a voltage reference of 4.096V then your ADC will report the measured voltage in units of 1mV instead which means that you'll get 60 counts per A - might make it easier for you.

    /Henrik.

  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!

    Hi Henrik!
    Thank you, thank you, thank you! Yes you are correct and it ended up being a low battery which gave the 485 value. After changing the 9 volts battery which was feeding a 5.0 volt regulator the 0.0 amp reading became 490. Before the battery failure, I placed an external ampmeter is series with the load which was two automobile brake lights. This external ampmeter was showing 4.22-4.24 amps. The other test load was two resistors which gave a load of .869 amps. To estimate what the A/D reading would be (without a known 50.0 A load) I have been testing the formula in Excel. Now that I plug in your formula Excel shows the A/D would be 2989. It is very clear after working on this for about a month I completely over complicated the math! The other part is that you tend to believe your PIC information as being more accurate than an external meter, amp or volt. What also did not help was calling Allegro and being told the 0.0 amp voltage to the A/D would be 0.5 volts and not 0.613 volts measured! Anyone need a approximate 1/4 bottle of 350 count bottle of Excedrin?

  4. #4
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,924


    Did you find this post helpful? Yes | No

    Default Re: Still Struggling with the formula!

    Anyone need a approximate 1/4 bottle of 350 count bottle of Excedrin?
    Why? Are you giving up programming?
    Dave
    Always wear safety glasses while programming.

  5. #5
    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 do not really know why, but such prescriptions are very rare here. Maybe it is the sun, the sea, the frappe or the good heart most we have. Not for me, thanks!

    Ioannis

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