logo elektroda
logo elektroda
X
logo elektroda

ESP32 Touch Test: unexpected results for pins 0, 32, 33 on TTGO T-Koala

kamilmm 519 4
ADVERTISEMENT
Treść została przetłumaczona polish » english Zobacz oryginalną wersję tematu
  • #1 19294745
    kamilmm
    Level 11  
    According to this page the pins with touch are pins #0,2,4,12,13,14,15,27,32 and 33.
    I have this simple test code
    
    void setup() {
      Serial.begin(115200);
      delay(1000);
      Serial.println("ESP32 Touch Test");
    }
    void loop() {
      Serial.println(touchRead(4));  // 0,2,12,13,14,15,27,32 i 33
      delay(1000);
    }
    
    .
    After uploading it and touching the GPIO4 leg with a screwdriver (such a touch simulation) the results in the serial monitor change from 80-90 to 4-5, which is the expected result. However, I have strange results for pins 0, 32 and 33.
    When touchRead(32) and touching the GPIO32 pin, nothing happens, the value changes when touching GPIO33 (and vice versa). Conclusion: the pins marked GPIO 32 and 33 are clearly swapped places.
    The problem is always a low state on GPIO0 equal to 1. Why? Does anyone have a correct pinout diagram?

    Greetings
    Kamil
  • ADVERTISEMENT
  • #2 19297469
    khoam
    Level 42  
    kamilmm wrote:
    The problem is always a low state on GPIO0 equal to 1. Why?
    .
    GPIO 0 is a "special" purpose pin and it is internally pulled up by a resistor to the power supply (pull-up). Link .
  • ADVERTISEMENT
  • #3 19298771
    kamilmm
    Level 11  
    Thanks for the link, I also came across this page this morning. I'll keep googling to see if it can be easily used as a touchpad.
  • ADVERTISEMENT
  • #4 19299297
    khoam
    Level 42  
    kamilmm wrote:
    When touchRead(32) and touching the GPIO32 pin, nothing happens, the value changes when touching GPIO33 (and vice versa). Conclusion: pins marked GPIO 32 and 33 are clearly swapped places.
    .
    In fact, for some variants of arduino boards with ESP32 there is an error in Arduino Core:

    Note : there is an issue with touch pin assignment in Arduino IDE. GPIO 33 is swapped with GPIO 32 in the assignment. This means that if you want to refer to GPIO 32 you should use T8 in the code. If you want to refer to GPIO33 you should use T9. If you don’t have this issue, please ignore this note. .

    kamilmm wrote:
    I will google further whether it can be easily used as a touchpad.

    I don't think it makes much sense to use GPIO 0 as a touchpad on off-the-shelf boards like the TTGO. Usually a capacitor is connected to this pin for ground:

    ESP32 Touch Test: unexpected results for pins 0, 32, 33 on TTGO T-Koala .
  • #5 19303652
    kamilmm
    Level 11  
    Thanks for your help. This " can it be easily used as a touchpad " is just as a learning experience (and a long way ahead of me).
ADVERTISEMENT