MPXA4115A picbasic code


Closed Thread
Results 1 to 40 of 104

Hybrid View

  1. #1
    Join Date
    Jun 2008
    Location
    Varese , Italy
    Posts
    326

    Default MPXA4115A picbasic code

    Good day to all,
    I am searching for a reference picbasic code to get pressure from a Motorola MPXA4115A absolute pressure sensor.
    Did someone write such a code ?
    thanks
    Ambrogio

    Edit from Moderator:
    A Wiki has been created from some of the posts in this thread. It is located here: http://www.picbasic.co.uk/forum/cont...-picbasic-code
    Last edited by ScaleRobotics; - 8th June 2010 at 14:45.

  2. #2
    Join Date
    Feb 2006
    Location
    Gilroy, CA
    Posts
    1,530


    Did you find this post helpful? Yes | No

    Default

    Darrel has the basic formula here: http://www.picbasic.co.uk/forum/showthread.php?t=182
    http://www.scalerobotics.com

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


    Did you find this post helpful? Yes | No

    Default

    It's been a few years since that thread. Don't even remember doing it.

    However, I think pt3rg asked the wrong question back then.
    I'm sure he also wanted to convert the A/D reading from the sensor to a pressure value.
    May be why he never came back.

    With the formula for Vout ...
    Vout = Vs*(0.009*P - 0.095)

    For 10-bit A/D and 1 decimal, the reverse would be
    P = ADC * 0.1086 + 10.6

    -- OR --
    Code:
    ADCIN 0, ADval
    P = ADval * 1086
    P = DIV32 1000
    P = P + 106
    
    LCDOUT "P=",DEC P/10,".",DEC P//10,"kPa"
    hth,
    DT

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


    Did you find this post helpful? Yes | No

    Default MPX4115A Calculator

    In case you didn't want 10-bit A/D with 1 decimal place in kPa ...

    This should cover the other possibilities.
    http://www.pbpgroup.com/Calculators/...A/MPX4115A.htm
    <br>
    DT

  5. #5
    Join Date
    Jun 2008
    Location
    Varese , Italy
    Posts
    326


    Did you find this post helpful? Yes | No

    Default

    Thanks Darrel for your very professional reply on the matter.
    I saw your last post just now.
    I think your assistance is great for all people in the forum.
    Regards,
    Ambrogio
    IW2FVO
    North Italy

  6. #6
    Join Date
    Jun 2008
    Location
    Varese , Italy
    Posts
    326


    Did you find this post helpful? Yes | No

    Default

    Hi Mr. Taylor,

    I am goping to prepare an home made weather station : this will be an hobby project for my small radio ham station.
    I have seen the pressure transducer calculator you have post to me: it is very interesting.
    I would like to use the PIC 10 Bit ADC instead of using an additional 12 bit ADC.
    I have considered that my home is at about 1050 ft above the mean sea level and the baro pressure will never change so widely. I have in mind to put the PIC ADC " -REF " to 3.75 Vdc and the ADC " +REF" to 5Vdc.
    The 3.75 Vdc is about 938 mB of presssure that has never been observed here in the years.
    In this case I will use 10 bit to read the voltage output from 3.75Vdc to 5Vdc.
    What do you think about that ? Do you recomand this solution ?
    If it will be Ok, what will be the final PICbasic code ?
    Thanks a lot for the interest.
    Regards,
    Ambrogio
    IW2FVO
    North Italy

  7. #7
    Join Date
    Dec 2005
    Posts
    1,073


    Did you find this post helpful? Yes | No

    Default

    I'll let Darrel help with the coding but, if you haven't used this sensor, you should be aware that decoupling its voltage supply line is critical (Figure 3 in the datasheet). Otherwise, it will be too noisy to make use of its output.

  8. #8
    Join Date
    Jun 2008
    Location
    Varese , Italy
    Posts
    326


    Did you find this post helpful? Yes | No

    Default

    Thanks,
    any suggestion for a practical good decoupling of the power supply based on your experience ?
    Thanks
    Ambrogio

  9. #9
    Join Date
    Dec 2005
    Posts
    1,073


    Did you find this post helpful? Yes | No

    Default

    I used the 1.0µF and 0.01µF as well as the 470pF capacitor values shown in Figure 3 (Page 5) of the datasheet and the output was clean. Before adding them the output was wildly erratic. In my case, I used SMD ceramic caps.

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


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by iw2fvo View Post
    I have in mind to put the PIC ADC " -REF " to 3.75 Vdc and the ADC " +REF" to 5Vdc.
    The maximum VREF- is (VREF+ -2.0V). So with VREF+ at 5V, VREF- can be 3.0V MAX.

    I'll add the option to the calculator later tonight and see what happens.
    <br>
    DT

  11. #11
    Join Date
    Jun 2008
    Location
    Varese , Italy
    Posts
    326


    Did you find this post helpful? Yes | No

    Default

    Thanks Darrel,
    I forgot the vref- constrain. So the VREF- will be 3Vdc.
    Ambrogio

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


    Did you find this post helpful? Yes | No

    Default

    You're welcome Ambrogio,

    I've added the Vref+/- to the calculator.
    It should come up with a good formula for you now.

    I haven't figured out how to deal with the +/-1.8% error yet.
    So these numbers represent an "Ideal" sensor.

    MPX4115A Calculator
    http://www.pbpgroup.com/Calculators/...A/MPX4115A.htm

    Now I gotta go back and redo the MPX4250D for Walter.

    hth,
    DT

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


    Did you find this post helpful? Yes | No

    Wink

    Hi, Darrel

    Handy tool, indeed !

    Could you add ( or allow ) the 4.096, 2.56, 2.048 and 1.024v "Classical" Vref values ( 3 decimals !!! ) ???

    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
    Aug 2006
    Location
    SWITZERLAND (french speaking)
    Posts
    891


    Did you find this post helpful? Yes | No

    Default pressure to altitude conversion formula

    Hi Darrel,

    I'm a little confused about how to convert the ADC "pressure" result in an altitude (from 0.2V...4.8V to n meters or feets).

    I've read lots of posts, but it is still unclear to me
    Roger

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


    Did you find this post helpful? Yes | No

    Default Re: MPXA4115A picbasic code

    Hi Roger,

    Me too.
    All I did was convert to kPa, PSI or BAR as shown in this calculator.
    http://www.pbpgroup.com/Calculators/...A/MPX4115A.htm

    Walter did a project for an altimeter using a lookup table ...
    http://www.picbasic.co.uk/forum/cont...-picbasic-code


    .
    Last edited by Darrel Taylor; - 3rd March 2011 at 15:07.
    DT

Similar Threads

  1. sample code for AT45DB642D in Picbasic Pro
    By itsssyam in forum General
    Replies: 0
    Last Post: - 10th March 2010, 06:01
  2. 16f887 44 pin demo board code problem?
    By jessey in forum mel PIC BASIC Pro
    Replies: 9
    Last Post: - 7th December 2008, 14:17
  3. How to configure SPI in PICBASIC PRO?
    By moogle in forum mel PIC BASIC Pro
    Replies: 13
    Last Post: - 15th April 2007, 18:31
  4. PicBasic code problems with a 16F84A
    By Lauren Barta in forum mel PIC BASIC
    Replies: 3
    Last Post: - 30th May 2006, 22:50
  5. PicBasic Fundamentals
    By Billyc in forum General
    Replies: 9
    Last Post: - 4th May 2004, 10:04

Members who have read this thread : 3

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