I can get the Touch pins working OK. I am using a small finger point size touch pad. I use touchRead(pin) and check value against threshold. Untouched value is about 50 and touched value is about 5 and set threshold at 20 and works to detect whe finger is off. But I either have to damp my finger or push tight on the touch pad to make stable enough contact for the touched (low) reading. I was wondering if there was any settings in the library files I should setup to try and get a low reading for less contact pressure. When I look at some of the video tutorial on touch I see users getting readings up in the 10000. How do they get that...?
By using larger touch pads maybe ?
Larger pads not the answer. I have limited space to put them. I tried larger but reading still same.
I get reading of about 50 untouched and about 5 touched. doesnt matter if I touch a wire or a pad. Ido use touchRead(pin) with Teensy 3.2 and 4.0 etc and it works well with a very light touch and I can set the touch harder by increasing the threshold. I seem to have no range of values with the ESP32....Yet if I watch videos of ESP32 touch they get readings in 10000 range even touching a wire.
I also have used fasttouchRead() by Adrian Freed and it works for teensy 3.2 and teensy 4 but I cannot get it to compile with the ESP32 Pico D4 board
I think I have sorted the problem...... It was the Logic of my thinking.....??
Here is test code..... I wanted to test for untouch pins so Initially I was setting the threshold "Low" as I thought that would detect untouched earlier.... It worked to a point but made me think the touch was not very sensitive and slow to respond. What I found was it detected the untouch earlier but needed a hard press to indicate touched again. What I have done now is increase the threshold so taking finger off is fast enough for Untouched as finger is going away and to get back touched only a light touch is needed.... and it is very fast.... Good...
// ESP32-PICO-D4 board
const int pinPico[] = {33, 32, 2, 15, 13, 12, 14, 27}; // touch pins in order used
volatile int touchValue = 0;
// Arduino Setup
void setup(void) {
Serial.begin(115200);
for (int i = 0; i <= 7; i++)
{
pinMode(pinPico[i],GPIO_MODE_INPUT); // make them input, dont knoe if I need this.?
}
}
//Arduino Loop
void loop() {
delay (200);
for (int i = 0; i <= 7; i++)
{
touchValue = touchRead(pinPico[i]);
if (touchValue >= 35) // >35 is not touched.....
{
Serial.print( millis() ); // see how quick it is......
Serial.print(" ...NOT... ");
Serial.print(i);
Serial.print(" ...NOT... ");
Serial.println(touchValue);
}
else
{
Serial.print( millis() );
Serial.print(" ...YES... ");
Serial.print(i);
Serial.print(" ...YES... ");
Serial.println(touchValue);
}
}
} // end of loop.....
This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.