Shop OBEX P1 Docs P2 Docs Learn Events
Theory Topic - Target ranges for RCTIME value — Parallax Forums

Theory Topic - Target ranges for RCTIME value

John KauffmanJohn Kauffman Posts: 653
edited 2004-12-09 16:54 in BASIC Stamp
Theory Topic - target ranges for RCTIME value
·
When designing a project with a sensor I like to use an RC circuit and the RCTIME command. There are usually many options of resistor-sensors and caps to create the circuit. I've been thinking about the theory and math of what makes the best combination for measurement by STAMP (BS2). Anyone care to comment?· I'm particularly interested in any numeric analysis.
·
- Minimum value produced by RCTIME:
There must be some minimum value below which the internal timing of the STAMP affects its ability to measure a very small length of time for RCTIME. WAM page 148 notes a unit of RCTIME for BS2 is about·2 uSec. The BS2 runs at 20 MHz, so that is 0.05 uSec per line of assembler code. But I'm not sure how many lines of assembler code execute for each RCTIME measurement. What are the theoretical and practical minima for RCTIME?
·
- Maximum value produced by RCTIME:
Can not exceed the size of a word variable = 65,535. Any other limits?
·
- Range of high accuracy
Is the accuracy linier over the min-max range?·I haven’t thought of any theoretical reason for deviation. Should we design for a certain RCTIME value range to stay in a straight part of the curve? Anyone else thought about this?
·
- Wobble
I can make a RC circuit of a fixed res + cap (no sensing) and then take ten RCTIME measurements over one second. Values vary from 1000 to 1050. Why the spread? Are there changes in resistance or capacitance of the jumper wires? How much wobble can we expect from caps and resistors? Are there some types of caps and resistors that are more stable?
·
- Testing
I'm thinking of testing linearity by creating RC circuits and seeing what RCTIME values are steadiest for a given RC circuit. The problem is that I need to use a res and cap that are stabile enough that I can believe fluctuations are from the STAMP, not the RC circuit. Any suggestions?
·
Thanks.

Comments

  • Tracy AllenTracy Allen Posts: 6,658
    edited 2004-12-09 16:54
    Hi John,

    This topic was also of interest to me, especially in the process of developing the Earth Measurements (Applied Sensors) text, which relies on RCtime for its analog to digital conversion.

    I have an essay on it:
    www.emesystems.com/BS2rct.htm

    As you surmised, I agree that noise is the limiting factor on the high end. The resolution is somewhere around 8 to 10 bits at best, and that requires care in the wiring, to avoid ground loops that pick up digital noise artifacts or AC. 10 bits means a reading of 1000, stays within 999 to 1001. The example you gave, a reading between 1000 to 1050, amounts to an accuracy of only between 4 and 5 bits, so I guess there must have been a noise pickup loop in there.

    There is also a temperature drift effect on the threshold. As to components, the best results come from using stable capacitors and resistors. For example, a 0.1 uF film capacitor with a metal film resistor will give better results than an electrolytic or Z5U ceramic capacitor with a carbon 5% resistor.

    The input circuitry of the microprocessor chip was not really designed to operate as a comparator in linear mode. To do so is a wonderful hack. When the voltage applied to the input approaches the threshold, the current drawn by the chip increases by 1 to 2 milliamps. That is current flowing through the internal totem pole circuit. That generates heat internally that sloshes around in the chip and adds 1/f noise to the RCtime value. The added current also can be picked up by ground loops if there is bad wiring. When the voltage approaches the threshold gradually, it stays in the higher current state longer.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Tracy Allen
    www.emesystems.com
Sign In or Register to comment.