MPXA4115A picbasic code


Closed Thread
Results 1 to 40 of 104

Hybrid View

  1. #1
    Join Date
    Jan 2004
    Location
    Thessaloniki , GREECE
    Posts
    61


    Did you find this post helpful? Yes | No

    Default

    So... Acetronics

    *your XL was perfect for make me understand many things!


    After a lot of experiment and according to your very usefull XL I finally decide to two different senarios

    Acording to your XL (and 10 , 12 and 14 bit results attached to xl file below)
    the 'resolution' is at 10bit -> around 8m, 12bit -> around 2m and 14bit -> around <1m

    So I am thinking of
    1st. just use simple pic 10 bit adc and Darrel's oversampling method (thank you scalerobotics for the link)

    2nd use an LM385 for example dual amp and take just 'a window' od the mesurements of MPX4115 between 0-2300 meters

    3rd compine LM385 and MAX187 (12bit) to get better resoloution

    My onle concern is that as I want to keep pcb at minimum of costs / and parts count if Darrel oversampling method works , it would be Great!

    I let you know.

    I am in the progress of schematic and pcb design BUT I have to decide the method first!!
    Attached Files Attached Files

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


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by bitmaniac View Post
    Acording to your XL (and 10 , 12 and 14 bit results attached to xl file below)
    the 'resolution' is at 10bit -> around 8m, 12bit -> around 2m and 14bit -> around <1m
    Not that it matters much, but in your graph, you are breaking it down to measurements every 0.10 mBar (not A/D conversion resolution). For every 0.10 mBar, your altitude changes by about 0.82 meters. However, this is not the resolution of your analog to digital converter at 14 bits. You will notice that from 0 to 22.13 meters altitude, your a/d conversion reading changes by 40. So ... 22.13 meters/40 = 0.55325 meters per 14 bit increment of your a/d converter. A lot closer to half a meter of resolution with a 14 bit conversion.
    Last edited by ScaleRobotics; - 3rd June 2009 at 17:14.
    http://www.scalerobotics.com

  3. #3
    Join Date
    Jan 2004
    Location
    Thessaloniki , GREECE
    Posts
    61


    Did you find this post helpful? Yes | No

    Talking

    @scalerobotics

    Of course you have not notice that in the last attached XL I upload there are three XL sheet in the file 10,12,14bit

    Test it

    My only concern is what method to choose (to start building) pic A/D with oversampling tehnicue , 12bit MAX and pic or DIF AMP + MAX + pic?

    I cannot decide yet.

  4. #4
    Join Date
    May 2004
    Location
    NW France
    Posts
    3,653


    Did you find this post helpful? Yes | No

    Default

    Hi, Alexandros

    I'd recommend you to read the Freescale AN 1646 ...

    Interesting matter !

    take care to the LM 358 output voltage range ... I think it's not the good choice ...
    LMC662 or AD 623 would be better ...

    Have a good Evening

    Alain
    Last edited by Acetronics2; - 3rd June 2009 at 19:42.
    ************************************************** ***********************
    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 " !!!
    *****************************************

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


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by bitmaniac View Post
    @scalerobotics

    Of course you have not notice that in the last attached XL I upload there are three XL sheet in the file 10,12,14bit
    Actually, I did notice, and it looks to be 100% correct. I am only pointing out that the increments with the 14 bit is 0.553 meters (near sea level), and not the ~1 meter that you mentioned in your previous post.

    Thanks,

    Walter
    http://www.scalerobotics.com

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


    Did you find this post helpful? Yes | No

    Default

    I just tested Darrel's oversampling, using the MPX4115a and a PIC12F675 that I quickly soldered up, and it works very well. I just used the two capacitors on the power side of the MPX4115a, like the data sheet shows, but with no filter capacitor on the output. Even at 16 bit resolution, the A/D output values only varied by +/- 1 digit. It varied more when I breathed though! 16 bit is really sensitive!

    My vote is for oversampling, parts count is at 6, running the board from the power of the PicKit2.

    Pic12f675
    3 capacitors
    mpx4115a
    20 mhz resonator
    http://www.scalerobotics.com

  7. #7
    Join Date
    May 2004
    Location
    NW France
    Posts
    3,653


    Did you find this post helpful? Yes | No

    Wink

    Hi, Scalerobotics

    Could you tell us what it shows for some close to another calibrated pressures ( water column i.e.) I'm really curious about this "oversampling method" application ...

    And moreover after having carefully read the relevant AN 1152 from Microchip ...

    Alain

    " Surely overpaid Engineer ... ( lol ) , but Graduate Engineer ... "
    ************************************************** ***********************
    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 " !!!
    *****************************************

  8. #8
    Join Date
    Jan 2004
    Location
    Thessaloniki , GREECE
    Posts
    61


    Did you find this post helpful? Yes | No

    Default

    @Acetronics
    VERY good infos in AN thanks for sharing!

    @ Scalerobotics

    You have done excellent job That was exactly I was thinking to do trying oversampling on 12f pics! so you did the job for me THANKS!

    So the conclusion is that we can use 12f675 ir 12f683 as I want to just measure an alt difference of 200m

    I did some calculation and I have attaches 2 XL one is the previous 10,12,14bit calculation and bolded out the 200m measurements just to see what is going on and the second one is use pic 10bit ADC but with Dual AMP LMC662 (Acetronics suggestion) to give a narrow-window measurements and the resolution improved to about 4m .

    Also attached a fast schematic of my thoughts (not checked , improvements are welcome!)

    Final conclusion I take the amp route or MPX connected directly to pic (with oversampling). I think as I will only want to measure 200m difference. the pcb must/and can be kept simple (low weight) and low part count.

    (dual amp trick: first subtracts 2.5V from MPX vout and the result is multiplied by 3 , so we have a range just from
    0-2300meters but better resolution for 10bit pic adc -see AZAltitude10bit_DUALAMP.xls)

    Scalerobotics about oversampling on 12f do you think you can 'go with' just the internal 8Mhz rc oscilator or it will not do the trick?!
    Attached Files Attached Files
    Last edited by bitmaniac; - 4th June 2009 at 11:03.

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


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Acetronics View Post
    Hi, Scalerobotics

    Could you tell us what it shows for some close to another calibrated pressures ( water column i.e.) I'm really curious about this "oversampling method" application ...

    And moreover after having carefully read the relevant AN 1152 from Microchip ...
    At my location and 14 bits, I get an output of 13255. This calculates to a pressure of 1004.86 mBar, and an altitude of 229.85 feet. I don't have a barometer here, so I can't really give you a side by side comparison on the figures. On the internet, it said a nearby weather barometer read 1014.42. But I think this is more a function of the accuracy of the MPX4115a, and to a bigger extent (since I don't have a calibrated barometer side by side) my altitude. The altitude from my calculations seem very close. I think I am between 250 and 285 feet altitude.

    Oversampling is really just a form of averaging. So it can't skew your results. At worst, you could have no noise in your A/D conversion, which would give you a 10 bit result with lots of useless bits to the right. Once I find a 470pf capacitor around here, I plan to test results again. I think this will filter the result a bit too much, and take away some of the needed noise. Here, white noise is our friend.

    On a side note, at 16 bits, when you watch the results at first power up, you can really see the effects of the MPX4115a and maybe the PIC12F675 warming up. For about two minutes the values really move!
    Last edited by ScaleRobotics; - 4th June 2009 at 17:36.
    http://www.scalerobotics.com

  10. #10
    Join Date
    Nov 2007
    Location
    South-West of Australia. A small town called Denmark. 'Where the forest meets the sea.'
    Posts
    136


    Did you find this post helpful? Yes | No

    Default A/D and the number of bits/levels

    I don't see the problem with dividing by 1024?
    The process is quantising a variable. Say our variable voltage lies in the range 0 to 10 Volts and we have one bit to use for the digital result of the quantising (2 to the power of 1 = 2, so we have two levels to play with):

    A. The result 0 means that the voltage was in the range 0 to 5 Volts (not that it was zero).
    B. The result 1 means the voltage was in the range 5 to 10 volts (not that it was 10 volts)

    So each level is 10/2 volts wide. Not 10/1 volt wide.

    The bit of cake after carving it up into portions has a slice 0 - it is not any smaller than any other slice.

    This is not jibberish created by highly paid engineers it is simple maths.

    I wonder how many devices you have launched on the world that are happily 'over' measuring analog quantities by assuming that each slice is bigger than it actualy is?

    Kind regards to you all

    Bill Legge

  11. #11
    Join Date
    May 2004
    Location
    NW France
    Posts
    3,653


    Did you find this post helpful? Yes | No

    Wink the problem ... without the solution.

    Hi,

    The problem is very simple : the servo signal frame length is too long ( or too short ??? ) and the ESC do not recognise it as a valid frame ...

    The solution is not so simple : the total time of the frame must be 30 or 35 ms as a MAXIMUM and , say 17-18 ms as a minimum.

    That's why servo works and not the ESC ...

    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 " !!!
    *****************************************

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 : 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