-->
Page 1 of 1

how to use GPIO0 as input pin w/out going into UART dl mode

PostPosted: Sat Oct 11, 2014 3:01 pm
by kikko_fr
Hi,

I'd like to use the ESP8266 in my next project without any external mcu.

This project needs an output pin to toggle a mosfet/relay and an input pin to detect change on a sensor.
But since these pins are being used to changed the module's mode during boot, I'm having trouble completing my circuit.

With a small capacitor, I managed to use the GPIO2 in output mode to toggle the mosfet

But I can't find how to use the GPIO0 for my sensor without getting the module stuck during boot.

Has anyone faced similar problems ? I'm new to electronics so I might be missing something simple...

Any hint would be appreciated!

Re: how to use GPIO0 as input pin w/out going into UART dl m

PostPosted: Sat Oct 11, 2014 3:55 pm
by Squonk
Instead of tying the pins directly to GND or VCC, you can use a "weak" series pull-up or pull-down resistor, a 10 k to 47k value is typical. If you take 33k with a 3.3V power supply for example, the current drained will be U/R=I=3.3/33k=100µA max, instead of relying on the ESP8266 OFF resistance value to fix the current.

And provided that your relay/sensor have their default state matching the GPIO bootstrap value, you can then both guarantee that:
  • you will have the expected value upon startup for the ESP8266 boostrap value and your relay/sensor
  • you will still be able to control/read them by "forcing" the level opposite to the weak pull resistor

By "forcing", here is what I mean: if the ON resistance of your output pin (ESP8266 or sensor output) is low enough (which is normally the case), the corresponding input (MOSFET gate or ES8266 input) will be like connected to it by a voltage divider made up of the low ON value output resistor and the high value weak pull resistor, resulting in a negligible voltage across the pull resistor and almost unchanged voltage value between output and input.

Re: how to use GPIO0 as input pin w/out going into UART dl m

PostPosted: Sun Oct 12, 2014 2:11 pm
by kikko_fr
Hi Squonk,
Thanks so much for your feedback! Things worked way better this way!
Merci!

Re: how to use GPIO0 as input pin w/out going into UART dl m

PostPosted: Sun Oct 12, 2014 3:08 pm
by Squonk
De rien ;)