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

    Hi! back again with this unfinished project.
    Well after a lot of experiment I will alter my schematic again.
    Using Darrel code for 14bit convertion I have problems with servo in / out routine. Using pulsin/pulsout to re-generate servo signals although normal servo response ok (a little bit jerky motion) when it comes to use Speed controller to ontrol brushless motor it does not seem to respond at all. If I disable Darrel convertion routine SC workink ok.
    So I am thinking of using a MAX187 12bit ADC (and maybe an op-amp in the future).
    I have already put together a 12f683 + MPX4115 and a MAX187 on a raster and SC seems to work now. I will keep you inform of my future proggress.....
    Last edited by bitmaniac; - 7th September 2009 at 16:11.

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


    Did you find this post helpful? Yes | No

    Wink At last !!!

    Hi, Alexandros

    Now we can make good work ... there was no other serious solution than having REAL bits as inputs ... 12 is a minimum.

    Just have to find MAX 187 ... ( 4.096v internal ref is a good thing ! ) ... may be we could try to find another ADC with both LoVref and HiVref pins available ... some more bit to win here !!!

    An LTC1286 could be the one ... with 4.096v ext ref !!!

    The MS5534 was the other solution : a bit expensive, but better resolution !!! ( it's the one used in commercial altitude related devices ... eh ! ). It just needs a 12F683 for 32 khz generation ( HPWM ) ...

    Alain
    Last edited by Acetronics2; - 7th September 2009 at 17:04.
    ************************************************** ***********************
    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 " !!!
    *****************************************

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


    Did you find this post helpful? Yes | No

    Default

    Hi! Alain

    Well max 187 is a very good ADC I think and you can also use External Vref (as I can see from datasheet)

    I tried tie external Vdd to ref pin (according to datasheet you have to leave pin 3 floatting) and change pin 4 cap from 4.7uf to 100nf.
    I tried internal 4.096V ref. but as I did not use op-amp I think I was at the limit of 4.096v so I decide to go roughly with Vdd external but I noticed a jerky ADC reading -/+ 10 values up and down. Maybe this was to a not clear 5v external source (I used an ATX pc supply). I will try again with Speed contrller Bec and let you know.
    I must finish this project....

    (...Alain maybe we can use a 14bit 8pin SPI IC if exists! ....(I want too much eh!?)

    Also about MS5534 you suggest I follow some links you gave me in previous posts but as I have already ordered 5 MPX sensors and as I want a simpler project (just read 200m ALT change) and not even real ALT in meters measurements I think we can just go with an F683 and a 12bit ADC(or 14bit ADC 8 pin if available).
    Last edited by bitmaniac; - 7th September 2009 at 18:58.

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


    Did you find this post helpful? Yes | No

    Default

    The MPX4115A is a "Ratiometric" type of device. Which means that the output voltage is proportional to the power supply voltage.
    This is a great feature when using a PIC, because the PIC's A/D converter is also "Ratiometric".
    This way you will always get the same results from the sensor, even if your power supply isn't exactly 5.00V or if it drifts a little, like will happen with a battery operated device.

    If you try to measure a ratiometric device using a fixed voltage reference ... as the VDD voltage changes, your pressure reading will change too. So you've lost that nice stable signal that a ratiometric sensor gives you.

    I don't think you should use a VREF+ at all.<hr>

    Quote Originally Posted by bitmaniac
    Using Darrel code for 14bit convertion I have problems with servo in / out routine. Using pulsin/pulsout to re-generate servo signals although normal servo response ok (a little bit jerky motion) when it comes to use Speed controller to ontrol brushless motor it does not seem to respond at all. If I disable Darrel convertion routine SC workink ok.
    Trying to do all that in software ... no doubt there are problems.

    For 14-bit resolution it takes a minimum of 7.4ms to grab the 256 samples needed.
    If you left PBP's default AD defines intact, it could take up to 25ms.
    Obviously not fast enough to do software timed servos too.

    I agree, an external A/D with higher resolution will probably be best. (without fixed Vref+)

    Added:

    But if you're just going to a 12-bit external A/D.
    You might try the same routines again at the 12-bit resolution. Or even 13-bit.

    At 12-bit resolution it only needs 16 samples, which takes <strike>387us</strike> 465us minimum.
    Plenty of time left for eveything else.
    <br>
    Last edited by Darrel Taylor; - 8th September 2009 at 00:05. Reason: 12/13-bit
    DT

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


    Did you find this post helpful? Yes | No

    Default

    Well,
    I put together some stuff on a prototype pcb and servo routines worked ok! ( a little bit of improvement needed!)
    I notice that without an op-amp and using just a max187 12bit ADC with EXTERNAL Vref tied to Vdd I get readings from ADC that plays between 2-3 value (NOT good). If we think that we use 12bit we have a resolution of about -+2meters and if the value plays between 2-3 values the error increase between -+6 meters (not good at all).
    May be the only and better solution is go to 12bit ADC AND an op-amp too!
    Also as a final thought is that maybe I have interference somewhere with the sensor although I used decoupling and filter capacitors according to MPX datasheet.
    The main thing is that servo routines / speed controller arming e.t.c work fine!

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


    Did you find this post helpful? Yes | No

    Wink

    Hi, Alexandros

    1) do not forget a LoPass R/C at the sensor output ( Freescale AN's ... )

    2) take care to the ground plane (@ 12 bits it becomes useful !!! )

    2) you can take 8 or 16 samples and calculate the mean value ( this is pompously called ... "Oversampling" , if you take into account the UNMEANINGFUL LSBits of the result . LOL ! )

    or better use a " rolling mean value " ( mean value = 7/8 oldvalue + 1/8 Newvalue i.e. , for 8 samples ) advantage is you access meanvalue after each sampling ...

    I am testing an auto zeroing and resolution enhancement design on my side ... but shhhht !!!

    Alain
    Last edited by Acetronics2; - 8th September 2009 at 20:59.
    ************************************************** ***********************
    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 " !!!
    *****************************************

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


    Did you find this post helpful? Yes | No

    Default

    Alain about your suggestions:
    1> I think you are right I have not implement an rc filter. AN note is VERY usefull here I think. (although I have read it before I did not use rc filter just decoupling caps). I have some 750ohm and 330nf around here so I can give it a try.
    2> for the moment no ground plane just a proto-raster board (this of course causes problem by itself)
    3>samples is already there but I get only 4samples maybe get 8 or 16 and see what happens.

    ALL the suggestions you make is not difficult to imlemented so I will give them all a try and let you know

    (...and shhhhht ,yah waiting for your enhancements!!)

  8. #8
    Join Date
    Aug 2006
    Location
    SWITZERLAND (french speaking)
    Posts
    949


    Did you find this post helpful? Yes | No

    Default "define adc_bits 16" ???

    Hi All,

    Just a question about DEFINEs.

    In Darrel's code, I can see
    Code:
    DEFINE ADC_BITS 16 '10 BIT A/D CONVERSION RESULT
    What does it mean?

    I'm using a 12F683 that can only do a 10 bits resolution son what do I not understand? Why 16?
    Roger

Similar Threads

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