Has anyone had any luck adding a capacitive sensor to an ESP board?
To my understanding, there seems to be a general problem across all boards so the specific board is not important. I am pretty new to coding but I looked at the CapacitiveSensor library and it doesn't seem to be compatible with the ESP module. I would have quit there but there seem to be select cases online where people have said that they have managed to make it work.
The general issue is that no matter what pins are used (I've tried every combination), the Serial reports a continuous stream of -1's or -2's.
I wish I could report more information but it's 'supposed' to be a pretty simple code with a straightforward process.
In regards to my personal situation, I'm using a Wemos D1 and 2 wires with a 1M between going from D4 - D2 and my code follows:
Unless you actually use machine code and wish to measure the actual capacitance, I find attempting to use capacitive sensing impractical.
If you want a simple on-off capacitive "touch" sensor, use the device made for the purpose, a TTP223.
Note however, that this senses only the onset of touch or proximity and not persistence as it resets itself after a few seconds.
I see where you're coming from but I do disagree with the blanket statement. The application for this sensor is to detect when someone touches my doorknob and in this case, only needing a wire that wraps around the inside knob was the simplest solution.
My issue wasn't with the pins, it ended up being the resistor I was using. It was commonly stated online that one should use a 1M resister but after trying out numerous values, there was only a small amount that would actually work. In my case, I landed on the 100K resistor. In addition to that, the pins did matter to some extent.
I used the (D3 IO, 10k Pull-up GPIO0) for the send pin, and (D6 IO, MISO GPIO12) for the receive pin. Though, the receive pin could have been any of the standard IO pins.