Shop OBEX P1 Docs P2 Docs Learn Events
Question on AN008 Sigma/Delta ADC — Parallax Forums

Question on AN008 Sigma/Delta ADC

On page 9 of the ApNote it talks about using a common output pin with multiple input pins by switching the source for CTRA. It goes on to say "The one major caveat is that, after switching inputs, it is necessary to delay long enough before taking the first reading for the summing junction caps on the new input to recharge to the input pin's logic threshold." Any idea what "long enough" is?
I have two ADC running with a common output pin, but I am getting sufficient cross talk so that both devices are showing that same reading.
Jim

Comments

  • I don't know what your application is but have you thought about using a separate ADC like and MCP3204 0r 3208
  • Or maxim mx7705
  • jmgjmg Posts: 15,173
    edited 2016-12-30 08:26
    RS_Jim wrote: »
    I have two ADC running with a common output pin, but I am getting sufficient cross talk so that both devices are showing that same reading.

    You mean 100% cross talk ? Sounds like something is amiss.

    RS_Jim wrote: »
    It goes on to say "The one major caveat is that, after switching inputs, it is necessary to delay long enough before taking the first reading for the summing junction caps on the new input to recharge to the input pin's logic threshold." Any idea what "long enough" is?
    The active node will be at 50% of Vcc, and the inactive node will be at some stable voltage, other than 50%, determined by the IP voltage differences.
    If both Vin are (almost) the same, the settling time will be short.
    If one is at Max+, and the other at Min-, then you need to slew 50% of Vcc
    - Allowing a delay of R//*C will give you a little margin, for worst case differences.

    RS_Jim wrote: »
    I have two ADC running with a common output pin..
    If you have a spare Timer, you could run two simultaneous ADCs

  • Jmg,
    The Analog device is a Parallax joystick fed with 3.3V from the Quickstart Board.With the joystick centered, both inputs are about 1.7 V. If I move the joystick to the limit in one direction, I get a reading of 0 and at the other it is 512. (512 is the max count value for the routine) When centered, both outputs are similar 1 at 256 the other at 307. when I move the joystick, to extreme both outputs end up at either 512 or 0. So I was wondering if my problem was a hardware issue or software. The AP note says you can use one output pin from the counter connected back to the inputs with 100K resisors for each input.

    I was trying to make Sigma/Delta work as I had the resistors and the caps were readily available. To use a second timer would require using another output pin which I was trying to avoid. I may be forced to move to a hardware solution such as thhe MCP3208.

    Being to do it all with S/D would allow me to get all the A/D I wanted without additional hardware.

    Jim
  • kwinnkwinn Posts: 8,697
    RS_Jim wrote: »
    Jmg,
    The Analog device is a Parallax joystick fed with 3.3V from the Quickstart Board.With the joystick centered, both inputs are about 1.7 V. If I move the joystick to the limit in one direction, I get a reading of 0 and at the other it is 512. (512 is the max count value for the routine) When centered, both outputs are similar 1 at 256 the other at 307. when I move the joystick, to extreme both outputs end up at either 512 or 0. So I was wondering if my problem was a hardware issue or software. The AP note says you can use one output pin from the counter connected back to the inputs with 100K resisors for each input.

    I was trying to make Sigma/Delta work as I had the resistors and the caps were readily available. To use a second timer would require using another output pin which I was trying to avoid. I may be forced to move to a hardware solution such as thhe MCP3208.

    Being to do it all with S/D would allow me to get all the A/D I wanted without additional hardware.

    Jim

    I suspect the problems you are having are hardware, and related to the layout of the components of the s/d. Having the components close to the pins is critical, as is the physical location of the common output pin in relation to the input pins.
    Note that the single input s/d circuit in the ap note suggests using corner pins, and the dual circuit has 3 consecutive pins with the output in the center of the trio. For best results a grounded guard band on the pcb around each input would help.

    Getting good results from Sigma/Delta adc's requires careful component layout, which is very difficult to achieve with typical pad per hole prototyping boards.

  • ErNaErNa Posts: 1,752
    the cap is about 1nF, the resistor 100K, so the time constant 10^-9*10^6 = 10^-3. When switching from one channel the the other it will take a few ms, until the value settles. If you measure the same value on both channels, it may be, you are toggling the channel to fast. I run 4 ADC-inputs from one output successfully
  • ErNa,
    That is what I was suspecting in the timing. How much delay do you use for each switch of inputs?
    Jim
  • ErNaErNa Posts: 1,752
    edited 2016-12-30 16:59
    10 ms should be enough. If you have a scope the settling of the newly selected channel could be visualized. If a graphic display is connected, the values could be visualized as a vector
  • Ok, I will introduce 10MS of timing delay and see what happens.
    Thanks
    Jim
  • Tracy AllenTracy Allen Posts: 6,664
    edited 2016-12-30 18:06
    As to the time delay, the time constant of the circuit is 120 microseconds. (100k in parallel with 150k, ignoring the impedance of the joystick pot, and 2nF as the capacitors are effectively in parallel.) You'd want to delay some 10 time constants to let it settle, so 1 or 2 milliseconds should suffice. At 8 time constants the difference settles to about 0.01% of its starting value.

    I attach the diagram from AN008 for reference. I'll +1 the above comments that every single component there needs to be close to the associated pins, and that includes the capacitor connections to Vss and Vdd. Within a few tenths of an inch for best results. It sounds like the crosstalk is quite strong, or the scale factor is off. You mentioned that the values are 256 and 307 when both are at the center position. What happens when you move them slightly off the center position? It might help to show your code.

  • Tracy,
    My code is the code in the ap note with a loop added to pick up the additional input and provide an additional output for storing the results. I can easily add a 2MS delay by introducing a wait count between calls to the ADC subroutine after switching the input to the CTRA.
    Thanks for all the feedback
    Jim
  • Cluso99Cluso99 Posts: 18,069
    A few years ago I used the sigma-delta ADC to interface a resistive touch screen (just the touch screen section from a Nintendo replacement from eBay which was cheap at the time) to the prop.

    IIRC I posted the code on the forum so I will try and dig it out. For my purpose it wasn't that critical for the components to be quite as close to the pins (a few tenths of an inch). I was impressed with how well it worked.
  • jmgjmg Posts: 15,173
    edited 2016-12-30 20:02
    RS_Jim wrote: »
    .. If I move the joystick to the limit in one direction, I get a reading of 0 and at the other it is 512. (512 is the max count value for the routine) When centered, both outputs are similar 1 at 256 the other at 307. when I move the joystick, to extreme both outputs end up at either 512 or 0. ..
    The fact you can get some difference suggests no dead-short like issue - how different can you get the values at varying joystick positions.
    Check the wipers with a voltmeter, and see if the ADC is roughly reporting what the wiper voltages are.
    To simply avoid any SW-Mux cross talk effects , for checking, you can run just one channel at a time.
    ie compile ChA, download and plot some points, then compile ChB only, and plot some points.
    If the effect remains, you have a hardware issue.


  • Well, I guess I abandon this approach. The leads are all too long and I can't get any kind of accuracy to the readings. When I step back to just one variable voltage I get three readings 0, 50%, 100%. I had built this up on a breadboard initially and thought it was working, but the critical layout got me. I checked the docs from parallax regarding sigma/delta on the quickstart rev A and the sigma delta portion of the board is un_populated, so I can not test using that method. I guess I am forced to go the route of an external ADC. I did not want to go out and buy parts at this time.
    Thanks for all the input, back to the drawing board! Maybe I can work a deal with Duane to get 1 of his new 3208 boards.
    Jim
  • ErNaErNa Posts: 1,752
    Whatever is going wrong, it's very unlikely the length of the leads. The balancing capacitor (about 1 nF) and the feedback resistor (about 100 kOhm) are definitely not critical when 8 Bit resolution is sufficient. Theoretically you can have 4000 counts resolution at 20KHz data rate. In this case, hardware is critical. But a joystick, moves with a few Hz, will show good results event under bad conditions. Could you please post a sketch of your hardware connection and the code, you are using? Certainly a separate ADC will not be simpler to manage.
  • jmgjmg Posts: 15,173
    RS_Jim wrote: »
    Well, I guess I abandon this approach. The leads are all too long and I can't get any kind of accuracy to the readings. When I step back to just one variable voltage I get three readings 0, 50%, 100%.
    What does your multimeter say ?
    ie measure the actual resistor values, and check both the Wiper voltage, and the ADC node at the Prop Pin.
    In charge balance mode, the Prop pin voltage will be a plateau of ~ 50% Vcc, but outside the range (0% and 100% readings), it can no longer maintain balance, and it will move away from ~50%.
    If you have wildly incorrect resistor values, for example, you can get similar to your results.
    Post a table of 5~8 values of Wiper Voltage and ADC Pin voltage for 20~12.5% steps

    You can also test with no Joystick, just 2 or 3 resistors :
    eg With a feedback resistor of 100k, a total series in R of 200k should give ~ 25% and 75% at Vcc/Gnd drive.

  • RS_Jim wrote:
    My code is the code in the ap note with a loop added to pick up the additional input and provide an additional output for storing the results.
    How about posting that code so we can look at it?

    -Phil
  • Cluso99Cluso99 Posts: 18,069
    I agree with the others Jim. It does work so there is something wrong, so don't give up. Let us help in finding the problem.
  • RS_JimRS_Jim Posts: 1,764
    edited 2017-01-06 00:23
    Ok,
    I am going to attempt to attach a zip of the code and a photo of the wiring.
    Voltages measured at the joystick are 1.66V and 1.68 respectively Mid Stick.
    1 direction on stick 0.03 to 3.08 and 0.07 to 3.3 in the other direction
    Jim
Sign In or Register to comment.