I have an ESP-01 (GPIO0 and GPIO2 only) running on the RTOS 0.94 sdk.
I'm trying to get a read from the PIR sensor output into one of the available GPIOs, and while it does work I'm having trouble getting the PIR's output with a pull-up to stabilize.
The ESP is powered with a 3.3v regulator, which works fine.
The PIR sensor (https://www.sparkfun.com/products/8630) needs 5v and outputs an open drain 3.3v signal so it needs a pull-up resistor, it works fine with an Arduino and a 10k pull-up resistor.
Connecting the PIR sensor's 3.3v output signal to one of ESP gpios does work, but the signal is not getting a strong enough pull-up no matter what I do, and after triggering it I am getting signal oscillations (GPIOs input reads 1 when triggered correctly but then oscillates continuously between 1 and 0 non-stop which does not happen with the arduino).
The GPIOs are configured as input, and anything above 1k pull-up allows for the dreaded oscillations to happen (pull-up is not strong enough), anything equal or below and the pull-up is too strong so I'm only getting an input of 1 (internal pull-up or pull-down GPIO configuration does not seem to matter as it's not strong enough). The pins do work as connecting the GPIOs to 3.3v VCC or GND reads correctly as 1 or 0 respectively.
My configuration is this:
* The ESP is powered by the 5v->3.3v regulator. (all GNDs are connected together)
* The PIR is directly connected to 5v/GND, the output pin (3.3v signal, open drain) is connected to a 1k+ resistor that's connected to the 3.3v regulator VCC (for a strong pull-up) - following that, it is also connected to GPIO0 (or 2, does not matter - same result).
This works effortlessly with an Arduino, but the signal refuses to stabilize on the ESP. Once the PIR is triggered I correctly read the signal as 1, but couple of seconds later it just keeps on changing between 0 and 1 without end as if the pull-up is not strong enough. I've tried so many configuration I've just came to the conclusion that I'm missing something.
I do realize that the Arduino has 5v input and the ESP has 3.3v input so that comes into play with how strong the pull-up needs to be to get the same result (I've calculated that 10k pull-up with VCC being 5v is around 6.6k with VCC being 3.3v, but anything above 1k and it's as if there's no pull-up at all).
I thought it might be something with my code not setting the GPIO input mode correctly, but it's almost directly copied from the SDK and works fine with any strong signal / other devices that are not open drain. The code for setting a GPIO pin to INPUT (normally / internal pullup/pulldown) also works fine, I've tested this.
Any ideas?
Thanks!