Math Problem


Closed Thread
Results 1 to 21 of 21

Thread: Math Problem

  1. #1
    Join Date
    Jul 2007
    Posts
    74

    Default Math Problem

    I need to figure out how to convert the non-linear AD Value to something more linear as far as the conversion goes.

    I figured out by reading a little on NTC thermistors, with the little data I have, I came up with resistance values that I believe are accurate within 1ohm

    Anyways, here is a link to the spreadsheet
    www.drivearu.com/Electronics/ntc%20thermistor.xls

    I am stumped!

  2. #2
    Join Date
    Jul 2007
    Posts
    74


    Did you find this post helpful? Yes | No

    Default

    Ah, forgot that it needs to be the temperature range 100-250 degrees F

    When o I get the ability to edit my posts?

  3. #3
    Join Date
    Jan 2009
    Location
    Miami, Florida USA
    Posts
    699


    Did you find this post helpful? Yes | No

    Default

    Erice1984,

    You can do a linear approximation but you are going to loose accuracy. Try doing a polynomial or exponential approximation. In EXCEL go to help and see how to add a trendline (it varies with the different versions of EXCEL). Obtaining the trendline is very simple. The trendline is going to give you a formula in the form of Y(X), X being the temperature and Y being the Resistance. Try with different options and settings until you get a good approximation. Then, you can use the resulting formula in your PBP program. That is with any value X (temperature) you can calculate a value Y (resistance).

    You should get the whole temperature range 100-250 degrees F in your graph before doing an approximation, so you get better results.

    This is one way to do it, which is very accurate. It all depends on the accuracy that you want for the resistance reading.

    Hope that this helps.

    Robert

  4. #4
    Join Date
    Jul 2007
    Posts
    74


    Did you find this post helpful? Yes | No

    Default

    Thank you very much!

    Wow, that was really easy!

    I lost accuracy but its in the place I don't care about!

  5. #5
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default

    I already used the following with good results.

    Curve Expert
    http://userpages.xfoneusa.net/~dhyams/cmain.htm
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

  6. #6
    Join Date
    Jul 2007
    Posts
    74


    Did you find this post helpful? Yes | No

    Default

    It all works, just wondering how I will try to make exponents happen..

  7. #7
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default

    What's your current formula?

    A third degree polynomial didn't fit?
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

  8. #8
    Join Date
    Jul 2007
    Posts
    74


    Did you find this post helpful? Yes | No

    Default

    f(x) = 5167.68(0.98^x)

  9. #9
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default

    could be more simple than you think
    http://en.wikipedia.org/wiki/Exponentiation
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

  10. #10
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default

    Nope, bad link...
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

  11. #11
    Join Date
    Jul 2007
    Posts
    74


    Did you find this post helpful? Yes | No

    Default

    well, I changed it up and am using three diff power curves to keep everything within 1 degree +/-

    only thing that is trouble is negative exponents.. tryin to figure out how to simplify it out so pbp can do it, but im am sucking on figuring this out. lol

  12. #12
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default

    You could still build a lookup table and use some interpolation between some points, that should do the trick and way easy to implement.
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

  13. #13
    Join Date
    May 2004
    Location
    NW France
    Posts
    3,648


    Did you find this post helpful? Yes | No

    Lightbulb NTC linarization

    Hi, Folks

    I knew something REALLY simple was available ... but Where ???

    http://www1.produktinfo.conrad.com/d...K_5Prozent.pdf

    In the Application notes section ( You must scroll down ... the left side menu doesn't work !!! )

    Alain
    ************************************************** ***********************
    Why insist on using 32 Bits when you're not even able to deal with the first 8 ones ??? ehhhhhh ...
    ************************************************** ***********************
    IF there is the word "Problem" in your question ...
    certainly the answer is " RTFM " or " RTFDataSheet " !!!
    *****************************************

  14. #14
    Join Date
    Jul 2007
    Posts
    74


    Did you find this post helpful? Yes | No

    Default

    Wow, you mention that and I look at the gauge that the sender was supposed to work with and they did that!

  15. #15
    Join Date
    Jul 2007
    Posts
    74


    Did you find this post helpful? Yes | No

    Default

    So I looked at the resistor that was used, its 510

    It brings the change in resistance per degree down to
    3 ohm from 100-150
    2 ohm from 151-200
    1 ohm from 201-250

    Isnt that crazy.

  16. #16
    Join Date
    Jul 2007
    Posts
    74


    Did you find this post helpful? Yes | No

    Default

    I am going to use an op amp to get me full range of my 0-5v scale instead of this 0-1v stuff... would that limit the signal from "bouncing" around?

  17. #17
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default

    You could filter your signal in hardware, or in software (averaging results). I tend to use hardware in many case as it's just a matter to add a capacitor or any kind of Low-Pass filter. On the other hand, a combination of both is also good depending how fancy you want it.
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

  18. #18
    Join Date
    Jul 2007
    Posts
    74


    Did you find this post helpful? Yes | No

    Default

    interesting, I have heard about the capacitor trick. How would it be done "averaging" in software?

  19. #19
    Join Date
    Jan 2009
    Location
    Miami, Florida USA
    Posts
    699


    Did you find this post helpful? Yes | No

    Default

    Erice1984,
    Looking at the EXCEL graph that you have posted it seems like a second degree polinomial will fit nicely. A formula of the form Y(X)=a*(X^2) + b will work. The EXCEL trendline will give a value for a and b in the above formula. Then, round this numbers up and you should have a good approximation for your graph. I am writing this reply from my cell phone so I don't have EXCEL with me at this moment to show you what it might look like.
    Give it a try. If you have any problems, let us know.

    Robert

  20. #20
    Join Date
    Jul 2003
    Location
    Colorado Springs
    Posts
    4,959


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by erice1984 View Post
    How would it be done "averaging" in software?
    Here's one possible way.
    http://www.picbasic.co.uk/forum/show...3267#post13267

    Although I never did hear back from ANYONE.
    I have used it myself since that post.
    No problems found.

    It's based on my original Averaging routines ...

    Averaging 16 bit values without using 32 bit math?
    http://www.pbpgroup.com/modules/wfse...hp?articleid=7

    HTH,
    DT

  21. #21
    Join Date
    Jul 2007
    Posts
    74


    Did you find this post helpful? Yes | No

    Default

    I updated the spreadsheet, feel free to take a look

    http://www.drivearu.com/Electronics/...thermistor.xls

    I am pretty confidant in this one, no exponents which is nice, and I looked at other automotive temperature gauges and they are showing +/- 7 degrees on theirs.

Similar Threads

  1. Line Graph, math problem...
    By TerdRatchett in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 6th May 2009, 04:20
  2. Math problem with string result
    By Lotondo in forum mel PIC BASIC Pro
    Replies: 10
    Last Post: - 15th November 2006, 10:06
  3. PicBasic Pro Math Problem??
    By Glen65 in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 5th March 2006, 04:36
  4. Math Formula / Variable Problem! Help!
    By bwarp in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 18th February 2006, 07:59
  5. Math problem...with picbasic pro
    By pcaccia in forum mel PIC BASIC Pro
    Replies: 0
    Last Post: - 15th October 2005, 19:28

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