Voltage Range and General Information for touchRead() Teensy 3.2

Status
Not open for further replies.

Gerhardus1

New member
Hello,

I intend to use the touchRead() functionality with Teensy 3.2 to read capacitance values. One "plate" of the capacitor will be grounded, and the other will be connected to the chosen pin on the Teensy.

From my understanding of how touchRead() works, the Teensy will use onboard hardware to charge/discharge the chosen pin through some pre-determined voltage range. After some number of cycles or some elapsed time, the Teensy will then repeat the same cycle with an onboard 1pF reference capacitor and then output the ratio of reference capacitor cycles to pin cycles. Is this an accurate understanding of the touchRead() functionality?

My questions are as follows:

What voltage range relative to ground does the Teensy cycle the pin through? If it is different, what voltage range does the Teensy cycle the reference capacitor through?
The Teensy will potentially experience extreme temperature changes. Is there any data available for the impact of variable temperature on the Teensy?
Does the read time or output scale linearly with any given capacitance change or resistance change on the pin (the assumption is that resistance will be in series with the capacitor, and not distributed throughout the capacitor)?
Reading through the forum, I have found a few posts indicating that errors of less than 20pF are readily achievable, and an error of 1pF or less could be theoretically obtained if a large M-ohm-range resistor was put between the active element of the capacitor and the Teensy pin. Unfortunately, I am now unable to find those posts. That said, how accurate can touchRead() get? Note that the setup can be calibrated for its specific components and operating conditions.

The connection from the Teensy to the capacitor will be via a significant length of coaxial cable which will also be subject to temperature changes and consequent capacitance changes. To correct for the unknown and variable capacitance of the cable in real time, would it be reasonable to run an identical cable alongside it which is not connected to a capacitor, and measure its capacitance with another pin? The value of the capacitance of the parallel cable can be subtracted from the reading from the cable-capacitor assembly in real-time to eliminate the effect of the variable capacitance of the cable. The delay between the reading of each cable should not have a significant impact. Is this a valid line of reasoning?

Thanks in advance for the information.
 
Reading the whole TSI chapter of the K20 reference manual will tell you that there are 2 independent oscillator circuits involved: A rather fixed oscillator acting on the internal reference capacitance and a variable oscillator which acts on the pin capacitance. For both oscillators, the voltage swing and the charging currents can and have to be configured within a wide range independently, so that the pin oscillator signal which acts as a gate signal for the following 16bit counter works on a ways lower frequency than the reference oscillator whose pulses will be counted during one pin oscillator period.
Since besides of the comparator thresholds which determine the voltage swing and the constant current source control bits which you set, the hardware of both oscillators is identical, thermal drift should not be a huge issue since both oscillators will drift by the same factor which is then automatically eliminated by the counting principle.
 
The best available info for most of your questions is in the chip's datasheet:

https://www.nxp.com/docs/en/data-sheet/K20P64M72SF1.pdf

The electrical specs for the touch sensing (TSI) start on page 60.

Unfortunately there simply aren't direct answers to many of your questions. Some stuff can be measured, to give an idea of how it works, at least at room temperature. For example, here's what my oscilloscope says for "What voltage range relative to ground does the Teensy cycle the pin through?" (I tried to put the Y1 & Y2 cursors on the peaks of the waveform during the measurement period)

file.png

This is the code a Teensy 3.2 was running for this test:

Code:
void setup() {
}

void loop() {
  Serial.println(touchRead(1));
}
 
Thank you for the information. I will do some reading followed by testing in my operating conditions to quantify the Teensy's performance in my application. Relevant documentation will be posted here.
 
Status
Not open for further replies.
Back
Top