0
\$\begingroup\$

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

schematic

simulate this circuit – Schematic created using CircuitLab

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.

notes:

  • 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.
\$\endgroup\$
4
  • 1
    \$\begingroup\$ You should not link to store websites when referencing your hardware. Please reference a valid datasheet so people don't have to search for them. \$\endgroup\$ Commented Feb 28, 2021 at 1:42
  • 1
    \$\begingroup\$ You’ve got rx and tx as gpio. Or solder a wire to the esp8266 chip for another gpio. \$\endgroup\$
    – Kartman
    Commented Feb 28, 2021 at 4:44
  • \$\begingroup\$ Can you post a picture of the both sides of the TTP223 board? The chip has the pins... if they are not connected to anything, you can still solder a wire to the pins. \$\endgroup\$ Commented Feb 28, 2021 at 9:47
  • \$\begingroup\$ @Kartman Can you please create an answer so that I can accept it. For some reason it didn't occur to me that RX & TX were actually GPIOs ... -_- \$\endgroup\$ Commented Feb 28, 2021 at 9:52

2 Answers 2

1
\$\begingroup\$

You've got rx and tx as gpio. With Tasmota you can disable the serial port function and gain two gpios.

\$\endgroup\$
1
\$\begingroup\$

The TTP223 should have pins that can be tied high or low to change the operating mode. Connect wires to the pins to make the device operate in active low mode so the output is high when you power up. You will have to change your code to compensate, but it's a small price to pay for a working circuit.

Place a solder blob between pins 4 & 5 as shown by the red dot. This will put the device in active low mode.

enter image description here

\$\endgroup\$
3
  • \$\begingroup\$ I must have bought some simplified version of the TTP223B (or maybe it's because of the "B" denomination) but mine doesn't have the shorting pads that the technical specs talk of. Unless I need to short pins on the IC directly, but they're unmarked. In addition, Kartman gave me a solution that works with my current setup. I'll upvote because your answer would actually work for the majority of cases, it's just the specific TTP223 that makes it impossible. \$\endgroup\$ Commented Feb 28, 2021 at 9:56
  • \$\begingroup\$ Still, for reference, the photos are arcuate on the description of the product I bought. If you believe that this board allows to change the operating mode, please let me know. I couldn't understand how I am expected to do it on this exact model but it could actually come in handy some day amazon.co.uk/gp/product/B08LL8JPWD/… \$\endgroup\$ Commented Feb 28, 2021 at 9:59
  • \$\begingroup\$ It is true that those boards do not have the jumpers and those pins are left open, but the pins are there and you can solder them directly to VCC if you want to change the mode. I'll post some images in my answer to show you how. \$\endgroup\$ Commented Feb 28, 2021 at 10:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.