the specific TTP223B I have doesn't have jumper to change "active high" to "active low". This is the answer that is usually given to my problem
I am currently working on a touch-activated wall-mounted light switch.
I am using an ESP8266 ESP-01S (specific one) module programmed via ESPHome in Home assistant. GPIO2 is used to read the switch state.
I am using a ZHITING TTP223B Capacitive Touch Switch Module for the switching action.
note: this schematic doesn't include any resistors because I'm currently doing testing using a curent-limited desktop PSU and kept it simple for development purposes
ESPHome config file (for those not used to ESPHome, it basically generates templated programs to flash on the ESP based on yaml config)
api: ~ binary_sensor: - name: "Test ESP8266 binary sensor" pin: GPIO2 platform: gpio captive_portal: ~ esphome: board: esp01_1m name: wall_mounted platform: ESP8266 logger: ~ wifi: ap: password: REDACTED ssid: "REDACTED" password: "REDACTED" ssid: "REDACTED"
My current circuit looks like the above schematic. It works well as long as GPIO2 is not connected to the IO during the ESP8266's boot sequence. If I connect them after the ESP has booted, the circuit works well.
The problem seems to come from the fact that, to boot in "normal" mode, GPIO2 must be high on the ESP and the TTP223B pulls the IO low when in "open" state.
- I tried using a weak pull-up between the IO-GPIO2 and VCC. Didn't work
- I tried using GPIO0 (which has an internal pull-up) as the VCC input for the TTP2223B but all I ended up doing with that is pulling GPIO0 low ... which prevent "normal" boot again
I thought of using some kind of transistor or relay setup to keep the TTP223B's GND line open during boot but I find that solution overcomplicated ...
QUESTION: How can I use the TTP223B with an ESP8266-01S without having to disconnect the IO line during boot time.
- The *-01S version of the ESP8266 only has two accessible GPIOs, both must be pulled high for normal boot
- I would like to avoid switching to an other declination of the ESP. I only need one IO pin and am looking for the smallest possible form-factor.