Shop OBEX P1 Docs P2 Docs Learn Events
Peak Performance on TLC2543 — Parallax Forums

Peak Performance on TLC2543

Kirk FraserKirk Fraser Posts: 364
edited 2006-10-10 05:20 in BASIC Stamp
The TLC2543 is a 12 Bit 11 input Analog to Digital Converter with a 4 line serial output buss·which can be connected to a Stamp.· Previous threads helped get it going and reduced errors by regulated and reference power supplies, adding 0.1 uF capacitors, and input averaging by 8 which delivered one degree in 360 fairly reliably.· Now after a question to the manufacturer in August, we have a response showing new ideas which I hope can get·my ADC circuit to deliver tenths of a degree, which other posters already get.· The email from TI support:
Can you please run a test for me. Make the following two changes to your circuit:
 
1) Add an OPA350 buffer (in the unity-gain follower configuration) between your pot and the MUX input. Use the same power supply for the OPA350 as used for the ADC. Be sure to add P/S bypass. If the cap on the wiper continues giving trouble add a simple RC filter between the OPA350 and the MUX input instead to filter the noise. Free samples of the OPA350 are available at:
 
   [url=http://focus.ti.com/docs/prod/folders/print/opa350.html][u][color=#0000cc]http://focus.ti.com/docs/prodhttp://forums.parallaxinc.com/folders/print/opa350.html[/color][/u][/url]
 
2) Any time you address the MUX or change the channel, first do two conversions and throw away the data of the TLC2543. Keep the 3rd conversion and up; your accuracy will improve if you do multiple conversions and do an average in your Stamp uP.
 
I hope this helps. If you have further questions please email or call me at 972-644-5580. 


I now have the·samples ready to test.· I thought throwing away some data would help but I didn't imagine the formula 2).· Prior to testing I'm doubtful the buffer will help more than·forum advised 1M resistor & filter capacitor but I'll try it.· I don't know what the unity-gain follower configuration is but the data sheet shows a diagram feeding an ADC so I'll wire that and post results.

·

Comments

  • Kirk FraserKirk Fraser Posts: 364
    edited 2006-10-06 20:31
    Any advice on what variable capacitor(s) to use to try to filter the noise? In Digikey's online catalog most are within the range of 1-100pf and three together span most of 240pf - 2525pf. I don't see anything like the radio tuning capacitors available when I was younger.

    In the mean time I'm thinking: just plug in a few loose capacitors and see if there's any benefit. However I'm not sure if I can use electolytics in this and what +- orientation to use. Anyone please advise.
  • NewzedNewzed Posts: 2,503
    edited 2006-10-06 20:51
    The TLC2543 does not need or use a variable capacitor.· Use a .1uf bypass located as close to the chip pin as possible.

    Sid

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Sid Weaver
    Need a TV Module?

    Newzed@aol.com
    ·
  • Kirk FraserKirk Fraser Posts: 364
    edited 2006-10-06 22:38
    Sid,

    The variable capacitor is for the OPA350 which TI recommended putting between the potentimeter and TLC2543 input.

    BTW, what is that TV Module in your signature? I am looking for a better than ATI tv on pc converter as I've burned out two different models of ATI in under 10 years.

    Kirk

    PS: Still looking for variable capacitor advice as above.
  • NewzedNewzed Posts: 2,503
    edited 2006-10-06 23:06
    Kirk, the TV Module is a duplicate of the TV circuitry·on the Demo board.· It has a 4-pin header which you can plug into Pin 0, 4, 8, 12, 16 or 20.

    I also have a VGA Module, again a duplicate of the VGA circuitry on the Demo board.· It has an 8-pin header which plugs into Pin 0, 8 or 16.· Plug it in, attach the cable from your VGA monitor and it displays the output of the propeller.

    Sid

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Sid Weaver
    Need a TV Module?

    Newzed@aol.com
    ·
  • Kirk FraserKirk Fraser Posts: 364
    edited 2006-10-08 02:01
    Back to topic -- in the process I burned out a 12v wall transformer and am now using a 12v industrial 1.7A unit. Other than that hopefully one-time problem, the advice given by TI in the first post of this thread is giving better results, combined with the advice from the previous thread.

    Values to tenths appear to be within 3 which means I'm getting example values of 3566 3567 3568 which is 356.7 degrees. So in my application that's accuracy to 0.3 degree or about 0.3 to half an inch, which is great. Getting it down to a tenth of an inch would be better yet.

    I'm not finding a variable capacitor centering around 0.1uF online yet -- all I found from DigiKey was in the pF range, not uF but I would like to be able to tweak one to try for the last tenth. Any other suggestions?

    Thanks,
    Kirk

    PS: Here's the software implementing TI suggestion 2.

    ' {$STAMP BS2px}
    ' {$PBASIC 2.5}
    ' {$PORT COM1}
    'Test A/D Inputs

    ' A/D pins
    ADclk PIN 11
    ADdati PIN 10
    ADdato PIN 9
    ADcs PIN 8

    'VARIABLES
    a VAR Nib
    ADch VAR Nib
    ADout VAR Word
    avg VAR Word

    DO
    GOSUB Read_Inputs
    'PAUSE 0 ' Future: Check time for 200 Hz loop
    LOOP

    Read_Inputs:
    FOR ADch = 9 TO 10 'Read analog inputs as digital 0 to 4095
    avg = 0
    FOR a = 1 TO 10 'Get 10 per channel to toss 2 average 8
    LOW ADcs ' select chip
    SHIFTOUT ADdati,ADclk,MSBFIRST,[noparse][[/noparse]ADch<<8\12] ' output AD channel #
    SHIFTIN ADdato,ADclk,MSBPRE,[noparse][[/noparse]ADout\12] ' input pot value
    HIGH ADcs ' deselect chip
    IF a > 2 THEN avg = avg + ADout : ENDIF
    NEXT
    ADout = (avg ** 57630) / 8 'convert average to degrees
    DEBUG "Ain #",DEC ADch, " ADout ",DEC ADout, REP 32\5,CR
    NEXT
    RETURN
  • Tracy AllenTracy Allen Posts: 6,662
    edited 2006-10-08 05:06
    Kirk, the feedback compensation capacitor suggested by TI will be on the order of 10 picofarads, not 0.1 microfarad. You can easily find a variable capacitor that will go from 7 to 22pf. On page 11 of the data sheet there is a formula to estimate the feedback capacitance. There is a complication though, when the circuit is built on one of those white plugboards. (Is that still where it is??) Those boards have a relatively large capacitance from one node to the next, and if the plugboard is built on a metal ground plane, there is an additional capacitance there. Those are "parasitic" capacitances, and they add maybe 50 to 100 pf both as input capacitance and perhaps also as parasitc feedback capacitance. The effect will also depend on which package you have for the op-amp, as the single OPA350 will have quite different parasitics than the dual or quad OPA2350/OPA4350. That is because the single op amp has its output on the opposite side of the package from the inputs, whereas in the single and quad, the output is right next to the inverting input. I know that is not the simple answer, but parasitics are never simple.

    On the good side, it may not make any difference. The signals you are acquiring are basically DC. A lot of the stability issues arise when you are trying to acquire signals at a very high rate. The Stamp is not capable of pushing the TLC2543 anywhere near its top rate. The example given in the OPA350 data sheet is a 500 khz ADC, but the Stamp may at best be sampling at 100 hertz. A switched capactior ADC like the TLC2543 produces small pulses of current as the input capacitor is alternately attached and detached from the ADC input. That capacitance and those pulses of current are reflected back onto the external circuit that is attached to the input of the ADC. This is called "charge injection". and averaged over time into an external impedance it causes a DC error. The OPA350 has a very fast responding output circuit (38 megahertz bandwidth), and that enables it to respond changes without "ringing" and it has a low output impedance to minimize DC errors . The challenge is difficult when the pulses are coming out at 500khz but much much less so at 100 hertz. At low frequencies, when the charge injection pulses arrive very seldom, there is little DC error even with a passive RC circuit at the input. I hope that did not confuse the issue too much.

    The circuit shown in the data sheet (figure 5) has a gain of x2. Is that what you are using?

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Tracy Allen
    www.emesystems.com
  • Kirk FraserKirk Fraser Posts: 364
    edited 2006-10-08 08:33
    I want to report that removing the TI op-amp circuit completely and having 0.1uF caps between all three legs of the pot seems to work down to 2 or 3 tenths, with the TI software suggestion. Perhaps the op-amp would help on a long wire between the pot and circuit.

    Hi Tracy,

    I now have learned to keep one circuit on the white prototype board until I've got a duplicate built in my application and drawing. That way I don't forget some important detail. Thanks for the tip on the variable capacitor range. I have the single OPA350 because it comes in DIP instead of the harder to use SMD. As noted above, I may not need it. I hope a variable capacitor will enable compensating for the parasitic impacts or other interferrences a little better. Would the picoFarad range still apply without the op-amp?

    The ringing you described may explain an occasional long-term or restart shift of one tenth or so in the result. I'm not yet considering it a problem. Is it possible ringing is responsible for most or all of the remaining +-0.1 degree error? It doesn't seem like it but with that much difference in chip frequencies....

    BTW, how can I achieve 200Hz? I was told that's what the whole system needs for a biped robot, so individual channels should be processed faster. I'm thinking the Stamp 2px might be going a little faster as it seems to start slow then pick up speed in the debugger. But if I can't possibly get 200Hz with it, what should I do?

    I hoped to use multiple TLC2543's using the same 3 wire buss but seperate chip select pins on a Stamp with a network of Stamps enabling control of 70 channels to be passed through a USB port, possibly with only one Stamp. Now it's looking like I'll be lucky to run one or two channels per TLC2543 + Stamp, maybe only one on a network. Any suggestions?

    Thanks,
    Kirk

    PS: Yes the op amp data sheet diagram 5 is what I was using. Thanks, that 2x explains why I was only getting about half the range from my pot. What diagram or change is needed to get 1x or "unity gain" - if it would help on a 6' line between pot and chip?

    PPS: It seems almost too easy now, with regulated and·reference power,·3 0.1 uF caps between the potentiometer leads, the pot driven by either 5v supply, and nothing between the pot and TLC2543 input pin apparantly giving a varibility between two adjacent tenths.· Yet there is still a bug.· How do I get the range back to 0-360.0 instead of 2.1-357.9?· These were measured from direct wires to the regulated buss to seperate ADC pins.

    Post Edited (Kirk Fraser) : 10/8/2006 7:12:05 PM GMT
  • Kirk FraserKirk Fraser Posts: 364
    edited 2006-10-09 08:45
    Does anyone get better results than +-0.1 degree? By that I mean a span of 3 values on a potentiometer. If so, how?

    Does anyone get the full 0-360.0 range? How?

    Thanks,
    Kirk
  • Kirk FraserKirk Fraser Posts: 364
    edited 2006-10-09 20:30
    Fortunately waiting for replies isn't the only available option when one doesn't have a clue.· One can write the manufacturer.· This time TI response was much faster than·1.5 months:
    1)  The software improvment got my results from a full degree to 0.3 degree.  Is it possible to get all the way to 0.1 degree?  
     
    You can improve A/D converter accuracy by taking the average of more samples. The more the better.
     
    2) The op-amp circuit seems to deliver the same result as none at all except I wasn't able to find the "unity" gain circuit so I used the 2x circuit -- figure 5 in the data sheet. 
     
    Figure 3 shows a unity-gain follower. The 5Kohm resistor is optional (for overvoltage protection).
     
    3)  Is the op-amp useful for longer lines like 6' between pot and TLC2543 input?  
     
    Very definitely yes.
     
    4) A remaining problem is the range reported is now reduced by about 2 degrees on each end.  How do I return the range to 360.0 at 5v and 0 at GND?  I'm using the TI REF02 chip and a variable regulator set to 5v so perhaps I need to tweak them somehow? 
    
     
    Tweaking may help but I suggest you leave it alone. Staying away from the extremeties can help accuracy. Just rescale in your software. 4 parts out of 360 is only 1%.
    

    These answers show little hope for getting better results than +-0.1 degree.· Tweaking didn't restore the 2·degrees·on each end·which is annoying since one of my·applications requires 360 degree rotation.· Maybe it's·a degraded chip?· The tips on the op-amp should be useful if performance degrades with a long line to the potentiometer.
    The collection of information thus far isn't all that I'd like but it's definitely enough to proceed to my applications with.
  • Tracy AllenTracy Allen Posts: 6,662
    edited 2006-10-10 03:10
    Kirk,

    You asked if anyone gets better results than +/- 0.1 degree and a full 0 to 360 degree range.

    You can't expect to get much better than 0.1 degree resolution, one part in 3600, because that is commensurate with the resolution of the TLC2543 converter, which is 12 bits, one part in 4096.

    Just to check it out and give you some figures, I hooked up a wind vane to a TLC2543 on one of my data loggers. The wind vane is a potentiometer that rotates freely through 360 degrees, and this one has an end to end resistance of 20 kohms. The vane is mounted on a 40 foot cable, and for this test I strung it across the room, over the top of the oscilloscope and over the top of a refrigerator. The cable is unshielded 4 conductor telephone wire. There are no capacitors at the potentiometer itself, but I experimented with different capacitors at the input to the converter, that is, input channel to ground. I set the vane at 180 degrees, so the output is at the halfway point, Vref/2. There are no op amps in the signal path. Aside from the zap protection network, it is straight through from the potentiometer to the TLC.

    with no capacitor, +/- 6 degrees.
    with 0.1 uF, +/- 0.2 degree
    with 10 uF, +/- 0.1 degree (somtimes rock steady in both millivolt and degree readings)

    Also ran it through averaging algorithms synched to the power line frequency, with no capacitor (compare to +/- 6 degrees)
    4 samples, +/- 2 degrees
    8 samples, +/- 1 degree
    16 samples, +/- 0.5 degree

    So it seems to me you should be able to get your 0.1 degree resolution. Note that the capacitor has more of an immediate effect than the averaging algorithm. It's always best to start with a clean signal!


    With regard to other questions:
    -- No need to use the picofarads variable capacitor if you are not using the op-amp. The purpose of the capacitor is to stablize the feedback loop of the op-amp. I doubt if "ringing" is affecting your result. It can happen though, with circuits that have trouble driving capacitive loads. For example, the LM34 temperature sensor output can "ring" significantly when loaded with certain values of capacitance. But the OPA350 is specifically designed to drive capacitive loads.

    -- You asked for the circuit for a unity gain buffer, but I see that you found the one in the OPA350 data sheet.

    -- Regarding the loss of 2 degrees at each end, Op-amps can never push their outputs exactly to the supply rails. The OPA350 can get within 20 or 30 millivolts of the rails, but no closer, and that cuts 2 degrees of the end of the range. One way to get around that is to use a higher supply voltage for the op-amp.

    -- With regard to throwing away two samples when changing channels. I haven't found that necessary. However, always throw delay and throw away the first sample when the TLC2543 is first powered up or when it wakes up from its sleep mode.

    -- How to acheive 200 hertz? It's not clear, what repetitive task needs to be done at that rate? On a BS2pe, it takes about 3 milliseconds to acquire a reading from one channel of the TLC2543. Compare that to the 5 milliseconds, the period at 200 hz. The BS2p or px could go faster, but not by orders of magnitude Maybe you should be looking at the Propeller?

    I hope your persistence will pay off!

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Tracy Allen
    www.emesystems.com
  • Kirk FraserKirk Fraser Posts: 364
    edited 2006-10-10 05:20
    Tracy,

    Thank you very much! I'll try your 10uF suggestion as soon as I can get some. On the 2 degree loss at both ends, it appears the chip on the whiteboard has degraded as an equivalent circuit on my application returned 3600 with the same program today.

    On the 200 Hz, the repetitive task that needs to be done is causing a biped robot to stand up. That is fighting gravity with about 7 actuators per leg while each actuator is potentially moving during a walk or run as well as standing and fighting wind or a shove or whatever. So it must sense the position of each actuator and compensate to maintain the desired position. The complete cycle of 14 actuators must be handled 200 times every second according to a professor who has already done an electric biped. I view that as an achievable target but I'll reevaluate that figure after seeing the performance of my own equipment.

    Taking 3ms out of 5ms for just one reading obviously won't work without at minimum a Stamp per actuator and from trying a network of 2 on Stamp 1's, I expect the network could take a comparable amount of time to process even on px's. I'm not sure what a Propeller does. Is it like 8 Stamps in one? Or is it some other parallel processor?

    I also hope my persistance will pay off. As you know I've been working with this electronic circuit for years -- so long that if I were hiring myself to work on it, I'd have fired myself by now. The lack of knowledge and skill I have on this is a sad thing. But I think the robot project is important enough that it's the only hope I have for a business. It has a built in guarantee if I finish. Even if nobody buys my robot, I can program it to make things in my garage which are currently being imported and sold successfully. Of course I may need more resolution than tenths, more like one ten thousandths of an inch to match current CNC machines. That will take something different like a radio position sensor which some power gloves use.

    Thanks again,
    Kirk
Sign In or Register to comment.