I am having a hard time finding some information on touchRead(). It appears simple enough to use, just insert the pin number in there and it spits out a value.
1. It returns the value in units about 1/20th of a pF. Is that correct?
2. What is the maximum capacitance it will measure before it overflows and returns a -1?
3. What is the maximum amount of time before it returns?
4. Is it blocking?
5. Will a 470 ohm resistor in line with the touchRead() pin prevent using it effectively?
6. Can I switch between using touchRead() on a pin, and using the pin for an IO pin?
What I am doing: A cable tester for a cable with 4 wires.
How I'm thinking of doing this: Connect the 8 pins total to 8 of the touchRead() pins on a Teensy 3.0. First, set all pins as input with the internal pullup active. Then pull each pin low one at a time and check that only the matching pin also pulls low. The 470 ohm resistor is to prevent overcurrent if a pin is shorted to ground.
If any of the wires are shorted to each other, an indication is given.
To determine which end of the cable has an open, touchRead() will then be used on each of the ends of the cable on the wires indicating an open circuit. The other wires will also be read to give an indication, as there is a variation in cable length over about a 5:1 range, and the multiwire cable comes in at least two varieties. I am fairly certain that the maximum capacitance on any wire is 1nF to 2nF, and that the shortest cable will still have at least 100pF.
It is to continue testing the cable as long as it is turned on.
So am I on the right track? I am a newbie to programming but not to electronics.
1. It returns the value in units about 1/20th of a pF. Is that correct?
2. What is the maximum capacitance it will measure before it overflows and returns a -1?
3. What is the maximum amount of time before it returns?
4. Is it blocking?
5. Will a 470 ohm resistor in line with the touchRead() pin prevent using it effectively?
6. Can I switch between using touchRead() on a pin, and using the pin for an IO pin?
What I am doing: A cable tester for a cable with 4 wires.
How I'm thinking of doing this: Connect the 8 pins total to 8 of the touchRead() pins on a Teensy 3.0. First, set all pins as input with the internal pullup active. Then pull each pin low one at a time and check that only the matching pin also pulls low. The 470 ohm resistor is to prevent overcurrent if a pin is shorted to ground.
If any of the wires are shorted to each other, an indication is given.
To determine which end of the cable has an open, touchRead() will then be used on each of the ends of the cable on the wires indicating an open circuit. The other wires will also be read to give an indication, as there is a variation in cable length over about a 5:1 range, and the multiwire cable comes in at least two varieties. I am fairly certain that the maximum capacitance on any wire is 1nF to 2nF, and that the shortest cable will still have at least 100pF.
It is to continue testing the cable as long as it is turned on.
So am I on the right track? I am a newbie to programming but not to electronics.