Shop OBEX P1 Docs P2 Docs Learn Events
Looking for some ADC help / advice please — Parallax Forums

Looking for some ADC help / advice please

eagletalontimeagletalontim Posts: 1,399
edited 2013-05-31 21:13 in Propeller 1
I am trying to decide if it using an ADC chip or building a simple ADC circuit with capacitors and resistors would be better. My goal is to keep cost down and get a fairly steady reading of the throttle position of my vehicle in a range of 0% to 100% to the closest whole number. I am currently using the resistor and capacitor design and using the ADC.spin code found in the obex I think.... The current circuit I am using works pretty good but is a little jumpy at low throttle (under 15% it may jump +/- 1%). I am pretty sure it has something to do with the environment and the circuit board I am using as well. The circuit is soldered within 1/2" of the Prop chip on the Prop Proto board and is all through hole components. On the circuit board I am designing, the components are all surface mount and are a little closer to the Prop unless I switch to using an already made ADC chip.

The biggest issue I am having is the output of the throttle is 5V which comes from the vehicle's ECU. It is not extremely stable, but with the right filter caps, it can be stable enough for what I need. So, with all this said, would it be easier / smarter to just use a single ADC chip or go with the basic ADC design I am already using with better filtering caps?

Comments

  • Dr_AculaDr_Acula Posts: 5,484
    edited 2013-05-30 19:18
    Maybe I did something wrong with my circuit, but I had a number of problems with the resistor/capacitor ADC circuit. I think it was because the components were about 10cm from the propeller chip, and I kind of lost confidence thinking that if it is that bad at 10cm, it would still not be fantastic at 1cm. I think the application note has surface mount components right up against the propeller pins which I am sure solves a lot of problems.

    I've had some great success with the pcf8591 chip. Four analog inputs and one analog output. http://www.nxp.com/documents/data_sheet/PCF8591.pdf It sits on the I2C bus so doesn't use any extra propeller pins, seems super stable and the code to drive it is in the Obex. My input went up to 5V like yours does, and as a bonus, what you can do is run the pcf8591 chip from 5V, and interface it via the 3V3 I2C bus that the propeller uses for the eeprom. 3V3 will register as a logic high. So for your application, you would not even need a voltage divider.

    The pcf8591 is 8 bit - would that be good enough resolution?
  • jmgjmg Posts: 15,173
    edited 2013-05-30 19:57
    So, with all this said, would it be easier / smarter to just use a single ADC chip or go with the basic ADC design I am already using with better filtering caps?

    Do both ? - Include a simple, easy tiny ADC like the SOT23-5 MCP3221, and use that to check your own ADC, and determine if those issues are in the ADC, or in the Sensor.

    Microchip also have 16b and 18b ADCs with precision references, in SOT23-5 packages, if you want a serious ADC specs.
  • eagletalontimeagletalontim Posts: 1,399
    edited 2013-05-30 20:08
    Eight bits is more than enough since I actually divide the output of the ADC down to 3 digits then run it though my calculation function. There is probably an easier way, but I am still learning Spin. Right now, I only need 1 ADC so a 1 channel will work for my application. I have also yet to hook up my o-scope to the thottle signal to see how stable it actually is.
  • ElkinElkin Posts: 58
    edited 2013-05-31 00:43
    I have an application where i have used a MCP3202 (12 bit and 2 channel) and added only a 1 uF cap to the input. I am logging values from an analog conductivity detector and this circuit is really simple and works great. the 3202 runs on 3.3V or 5V. I run mine off the 3.3 and log a 0-1V full scale signal, so I am only using a third of the capacity but it is still good enough. Also, Johnny Mac has some code for this ADC posted in the obex which makes it quick to use (http://obex.parallax.com/object/315), as indicated by the name.

    Cheers
  • jmgjmg Posts: 15,173
    edited 2013-05-31 02:03
    Another ADC option, I just found under a tab on Microchip's web, is this series
    http://www.smsc.com/index.php?tid=377

    These have 11-12b ADCs and can measure Current and Voltage, over a 0-40V common mode range.

    Similar to the TI INA226, but better price, and they have a Dual channel one.(PAC1720)
  • tritoniumtritonium Posts: 543
    edited 2013-05-31 03:55
    Hi
    I think you are going to have to learn to cope with the noise on the throttle signal (if that's what is the cause).
    Motor cars are very noisy environments.
    I would replace your throttle device with a quality potentiometer and stable voltage source and then test for the amount of jitter, just to prove if its the throttle or the circuit layout.
    For A/D you must have super stable voltage source.
    0-100 to 1% resolution is less than 7 bits of accuracy, should be quite achievable.
    You always get lsb jitter with adc when near the threshold.
    Can you average the result.? ie take last reading , add new reading, divide by 2, and use the result, which then becomes the last reading for the next calculation etc.
    Increase the sample rate and average more samples.
    Replace the throttle device with a grey scale encoder.
    Just some ideas
    Dave
  • frank freedmanfrank freedman Posts: 1,983
    edited 2013-05-31 19:42
    Even better with this chip, use it in single channel differential mode to help eliminate some of the common mode noise present your environment.

    As to the ref voltage not being stable, are you digitizing the output of the existing TPS or are you adding a separate pot for reading the position? Maybe a fixed reference if you have a separate pot. Then again, (here I am thinking out loud) if you are digitizing the output of the existing TPS, you may not have as big a problem with the instability. It's all relative... er, proportional perhaps. That is, for any given value out of the TPS assuming it is a pot, the out put will always have the same proportionality for a given position and regardless of the reference voltage, a certain count should happen at a given point every time. I.e. for 1/3 throttle, Vref=5V, the count should be Vsample/Vref*4096=1/3of max counts. if Vref falls to 4V, the output will be again proportional to Vref and again the same count value (+/- noise) should appear.

    The noise you could smooth out with a weighted running average of sequential samples much the same way quantum noise is averaged out of a fluoroscopic image.

    FF

    Elkin wrote: »
    I have an application where i have used a MCP3202 (12 bit and 2 channel) and added only a 1 uF cap to the input. I am logging values from an analog conductivity detector and this circuit is really simple and works great. the 3202 runs on 3.3V or 5V. I run mine off the 3.3 and log a 0-1V full scale signal, so I am only using a third of the capacity but it is still good enough. Also, Johnny Mac has some code for this ADC posted in the obex which makes it quick to use (http://obex.parallax.com/object/315), as indicated by the name.

    Cheers
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2013-05-31 21:13
    Dr_Acula wrote:
    ... I kind of lost confidence thinking that if it is that bad at 10cm, it would still not be fantastic at 1cm. I think the application note has surface mount components right up against the propeller pins which I am sure solves a lot of problems.
    Right: it makes a huge difference. 10 cm is way too far away. Even 1 cm is a stretch and could be improved upon.

    Tim,

    I see no reason that the sigma/delta ADC could not work for you. But do use SMD components mounted right next to the Prop pins. BTW, the QuickStart board has pads for thes parts, and it's not at all difficult to install them.

    -Phil
Sign In or Register to comment.