different voltaje a/d sensors


Closed Thread
Results 1 to 22 of 22
  1. #1
    Join Date
    May 2007
    Posts
    65

    Default different voltaje a/d sensors

    Hello grls & guys
    i have a pic18f4431 (obvious 5v) and i want to A/D at the same time:
    1.- a 0-3,3v device (accelerometer),
    2.- a 0-3,0v device (gyro) and
    3.- a 0-5,0v device (thermsistor)

    of course i have o problem on power supplying them, just voltage regulators & stuff, my problem is to measure the full range of each.

    it seems VREF works just for all a/d inputs at a time?
    is it possible?
    if possible, how should i circuit it?

    thx grls & guys
    "Beethoven had his critics too, see if you can name 3 of them"

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


    Did you find this post helpful? Yes | No

    Default

    It may not be the best solution but when I run into this type of thing I will scale the higher voltages down with a voltage divider so they all match.

    The 0 to 5 volt sensor is now a 0 to 3.
    Dave
    Always wear safety glasses while programming.

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


    Did you find this post helpful? Yes | No

    Default

    I don't understand the problem. If you are using 5V to power the PIC, you can also use it for AVdd. You will get the full range of all 3 sensors, you will merely lose resolution on the 3.3V & 3.0V sensors. If you want to maximize resolution, use op amps setup for DC gain to promote the 3.0V & 3.3V sensors.

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


    Did you find this post helpful? Yes | No

    Default

    I think he wants full resolution of the A/D converter at 3.3v as well as 5.0v.

    Darrell had a real nice 10 to 16 bit selectable over sample routine. It seems the sites.picbasic.net site is having some issues, so right now you can not download it from there. It was here: http://sites.picbasic.net/index.php?...d=70&pageid=27 and it was called DT_Analog.pbp

    By going to 11 bit over sampling, you would effectively get the resolution back for your 3.3v devices, and no extra hardware. It does slow your sampling time a tiny "bit" for the extra bit.

    Here is the speed
    Last edited by ScaleRobotics; - 21st October 2009 at 01:16.
    http://www.scalerobotics.com

  5. #5
    Join Date
    May 2007
    Posts
    65


    Did you find this post helpful? Yes | No

    Default

    As PIC is 5v I was thinking to transform electrically all sensors to ranges to 0-5v with a "magical IC" that outputs an analog voltaje (not digital) proportional to the input.

    For example if a 3,3v device (accelerometer, sensor) outputs 1,65v (50% of 3,3v), then this "magical IC" will recive 1,65v and output 2,5v (50% of 5v).- Aswell if in another channel or other IC configured to transform 0-3v to 0-5v (if sensor says 1,5v my PIC will receive 2,5v). Of course I think this IC should be circuited for matching the desired specific voltaje range

    Maybe those "magical" IC's are OpAmps, as dhouston (thx!) commented. Can OpAmps make that function?

    "Realtime" processing is critical, so multisampling solution suggested by scalerobotics (thx!)is definitely not an option to my application. Interesting for another app anyway.

    And to shrink voltaje as mackrackit suggested (thx!) it would limit "natural" analog resolution. I prefer to amplify a voltaje than shrinking it. And I hope an Operational Amplifier (OpAmp) does that.

    So: Can OpAmps make that function?

    Thank you very much for your attention !
    "Beethoven had his critics too, see if you can name 3 of them"

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


    Did you find this post helpful? Yes | No

    Default

    Sounds good. Certainly a lot of options.

    96.8 millionths of a second can seem like an eternity.
    Last edited by ScaleRobotics; - 21st October 2009 at 03:27.
    http://www.scalerobotics.com

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


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by RodSTAR View Post
    So: Can OpAmps make that function?
    See the Non-Inverting Amplifier in http://www.national.com/an/AN/AN-31.pdf.

  8. #8
    Join Date
    Jul 2003
    Posts
    2,358


    Did you find this post helpful? Yes | No

    Default

    You should be able to do it with three Resistors and two additional PIC pins...

    R1 connects between Vdd and VRef+.

    R2 connects between VRef+ and Digital PICpinX.

    R3 connects between VRef+ and Digital PICpinY.

    For additional stability, I would connect a 100nF Capacitor between VRef+ and 0v.

    Vref- connects to 0v.

    PICpinX and PICpinY are any available PIC pins that you have spare, that have full I/O capability and when in INPUT mode DO NOT have an internal Weak Pull-Up enabled.

    When requiring 5v on Vref+, set PICpinX and PICpinY to INPUT. A Vref+ of 5v is provided via R1. R2 and R3 are effectively not in circuit.

    When requiring 3.3v on Vref+, set PICpinX to OUTPUT LOW and PICpinY to INPUT. Vref+ is the product of Resistor divider chain R1 and R2. R3 is effectively not in circuit.

    When requiring 3.0v on Vref, set PICpinX to INPUT and PICpinY to OUTPUT LOW. Vref+ is the product of Resistor divider chain R1 and R3. R2 is effectively not in circuit.

    Resistors should be 1% or better. For absolute precision, make R2 and R3 hi-stab multi-turn pots and calibrate for 3.3v and 3.0v with their respecive PICpinX or PICpinY pulled OUTPUT LOW.

    In software, remember when switching between different VRef's, allow a short settling time before performing a new ADC measurement.

    Simple... cheap...

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


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Melanie View Post
    Simple... cheap...
    That is slick !!!
    Dave
    Always wear safety glasses while programming.

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


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Melanie View Post
    You should be able to do it with three Resistors and two additional PIC pins...
    I considered that but the OP seemed to be asking how to promote the 3.0V and 3.3V sensors so they are, in effect, 5V sensors. I don't think anything other than amplifying the signals accomplishes that.

    By changing ADCON1 on the fly (between AVdd & Vref+) you can simplify it further. Or, it can be simplified by using 3.3V for the thermistor circuit.

    However, it does assume that the OUTPUT LOW voltage is 0V which may not be the case. It may be as high as 0.6V @ 4.5Vdd.

  11. #11
    Join Date
    Jul 2003
    Posts
    2,358


    Did you find this post helpful? Yes | No

    Default

    Actually you don't need to assume 0v. It can be 1v for all the divider Resistors care... choose the values for R2/R3 that will give you 3.3v/3.0v when that pin is LOW, if you assume 0.6v then you will be pretty close with a paper exercise. If it's a one-off build (or a product where a high degree of accuracy is required), the using Hi-Stab multi-turn pots and manually calibrating as I suggested is the way to go...

    Either way, it's just another suggestion thrown into the melting pot of ideas... another could be using an LM317 and using the PIC to switch-in different Resistor values for different voltages (depending on the current draw, that option could also power your Sensor as well as Vref+)... one could carry on throwing ideas around all night long...

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


    Did you find this post helpful? Yes | No

    Wink

    Mel is Right ( as always !!! )

    For a project I am developping these days ... I use a DAC to feed the Vref + of the ADC ( external ...) and GND or a fraction of Vref+ as Vref - ...

    Note Vref+ is to change with atmospheric conditions ( NO, I didn't tell it's a barometer, ... nooooo ... )

    just to artificially enhance the ADC resolution ...

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

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


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Melanie View Post
    Actually you don't need to assume 0v.
    Yeah - I realized that just after posting.

  14. #14
    Join Date
    May 2007
    Posts
    65


    Did you find this post helpful? Yes | No

    Default

    I'm really amazed on how much options have appeared for the same operation thx all, and I have really learned from all of you, but...
    ...In my specific application, I must choose the closest possible to realtime AD option, and Melanies is a really great solution but it requires switching and waiting for a settling time for a succesfull digitalization.

    My application is an IMU, which means sampling 8 A/D as fastest as possible, then applying kalman, then PID, while doing PWM, interrupt bidirectional communications, logic & communication to other PIC's. Probably I'm abusing my poor PIC, and from all tasks, analog conversion should be the priority as the rest of the processess are based on my movement sensors, to stabilize movement.

    Is Amplifying all analog signals to 5v the best choice?
    Is OpAmp the best choice to amplify them?

    Really thx babies & guys.-

    PD: I changed from PIC18F4431 to PIC18F4553, for faster speed (12 MIPS [48 MHz/4]), more A/D inputs (13 pins) and better A/D resolution (12 bit)
    Last edited by RodSTAR; - 21st October 2009 at 14:45. Reason: MCU Update
    "Beethoven had his critics too, see if you can name 3 of them"

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


    Did you find this post helpful? Yes | No

    Default

    Dave
    Always wear safety glasses while programming.

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


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by RodSTAR View Post
    best choice?
    That's too subjective a criteria.

    You can maximize resolution by choosing Vref+ that is(are) slightly higher than the highest expected voltage(s) from your sensor(s). This would be an extension of Melanie's approach. For example, if the gyro never outputs more than 3V you could use 3V for Vref and power the thermistor circuit with 3V also. There's no additional switching.

    The op amp solution is straightforward, time-honored and easy to understand. It can also maximize resolution and operates in realtime (essentially) so there are no additional delays.

    Both increase noise sensitivity.

    You really need to be clear about what you want. If you want maximum sensitivity, 5V/4096=1.22mV per unit while 3V/4096=0.73mV per unit so the op amp gives you a little more sensitivity. The difference is proportionally greater with 10-bit ADC.
    Last edited by dhouston; - 21st October 2009 at 15:11.

  17. #17
    Join Date
    Jul 2003
    Posts
    2,358


    Did you find this post helpful? Yes | No

    Default

    Well, ultimately the question is "Can I afford to lose 1 Bit of resolution in exchange for speed"?

    If the answer is YES, then your worstcase scenario with a 10-Bit ADC is...

    5v Sensor = 1023 Bits FSD
    3.3v Sensor = 675 Bits FSD
    3.0v Sensor = 613 Bits FSD.

    ... and you don't have to do anything.

    If you can't live with that, then it looks like OP-AMPs could be your choice. That's a lot of extra components for one extra measly bit of accuracy...

    But you could of course run your PIC at 3.0v (the voltage of your lowest Sensor) and simply use divider Resistors for your 3.3 and 5.0v Sensor inputs.

  18. #18
    Join Date
    May 2007
    Posts
    65


    Did you find this post helpful? Yes | No

    Smile

    Considering melanie's and dhouston, last suggestions, I think the simplest, cheapest, noise cleanest, circuit simplest and MIPS faster option is to just connect sensors directly to my MCU/PIC/CPU.. specifically considering this case in which my PIC has a 12 bit resolution A/D (4 times the resolution than 10 bit). I'm happy with the idea, will test it and I'll let you know how how it works! and I think I'll can live with it

    __
    PD: Just away from this, appart I will play with OpAmps, just to know how these toys work.

    RodSTAR
    "Beethoven had his critics too, see if you can name 3 of them"

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


    Did you find this post helpful? Yes | No

    Wink

    Hi, Mel

    I think the main Problem in those Autopilots is the "Heading lock" feature ... One must ALSO measure very small Gyro variations for the Vehicle ( let's say UAV ... 10$ !!! ) to keep the perfect straight line.

    so, a maximum resolution must be kept for heading precision while the full signal range has to be measured for High "G" movements controlling ... and avoiding " non linear " ( ROFL ) - or unwanted - moves.

    Thermistor is just here for best temp compensation of Gyro and Accelmeter ...

    May be 8 Bits PICs, and generally Pīcs are not the best components for this kind of Games ...

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

  20. #20
    Join Date
    May 2007
    Posts
    65


    Did you find this post helpful? Yes | No

    Wink

    Quote Originally Posted by Acetronics View Post
    Hi, Mel

    I think the main Problem in those Autopilots is the "Heading lock" feature ... One must ALSO measure very small Gyro variations for the Vehicle ( let's say UAV ... 10$ !!! ) to keep the perfect straight line.

    so, a maximum resolution must be kept for heading precision while the full signal range has to be measured for High "G" movements controlling ... and avoiding " non linear " ( ROFL ) - or unwanted - moves.

    Thermistor is just here for best temp compensation of Gyro and Accelmeter ...

    May be 8 Bits PICs, and generally Pīcs are not the best components for this kind of Games ...

    Alain
    In fact my UAV board has a dsPIC33F(12bit A/D) and a PIC32 and a math coprocessor for sensors (and other more sensors), maths processing, GPS parsing, coordinates algorythms, and blah blah, in fact is a full AHRS. I just want to play from conceptual small to prototype big. Lucky I have no problems on C30 and C32, I'm on the digital side of the project, not on the electronics side, as you can see by the title of this thread. But i love electronics and I'm working to try to get inside it. The board comes ready to program. My this thread was oriented to the "conceptual small" version of it.
    Last edited by RodSTAR; - 21st October 2009 at 16:29. Reason: More details
    "Beethoven had his critics too, see if you can name 3 of them"

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


    Did you find this post helpful? Yes | No

    Smile

    Quote Originally Posted by RodSTAR View Post
    Considering melanie's and dhouston, last suggestions, I think the simplest, cheapest, noise cleanest, circuit simplest and MIPS faster option is to just connect sensors directly to my MCU/PIC/CPU..
    Actually, that was my first suggestion, as well.

  22. #22
    Join Date
    May 2007
    Posts
    65


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by dhouston View Post
    Actually, that was my first suggestion, as well.
    Yes but originally I didn't consider it because at that time I didn't have 12-bit A/D. your OpAmps suggestion was the one I most liked until I figured a 12 bit reolution.
    Last edited by RodSTAR; - 21st October 2009 at 16:34. Reason: Sorry my inglych
    "Beethoven had his critics too, see if you can name 3 of them"

Similar Threads

  1. 12f675 A/d Miseries
    By MARAD75 in forum mel PIC BASIC Pro
    Replies: 13
    Last Post: - 16th December 2008, 02:16
  2. 12F675 A/D and GPIO sleep interrupt
    By macinug in forum mel PIC BASIC Pro
    Replies: 10
    Last Post: - 8th September 2008, 14:39
  3. Need advice on A/D
    By james in forum mel PIC BASIC Pro
    Replies: 9
    Last Post: - 24th August 2007, 19:30
  4. A/D converter fails?
    By egberttheone in forum mel PIC BASIC Pro
    Replies: 14
    Last Post: - 13th February 2006, 18:57
  5. 18F2525 A/D, Comparator and Vref modules
    By fbraun in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 20th May 2005, 23:17

Members who have read this thread : 1

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