Chat freely about anything...

User avatar
By Steph
#37350 Hi all,
I've just received my ESP8266-01 and I'd like to use it to monitor a water meter.
The water meter is quite simple : it has 2 pins (A & B) that acts like a switch : each 0->0,5 l, the "switch" is closed, each 0,5 -> 1 l, it is open.
I plan to connect pin A to the GND and pin B to the ESP-01 with a pull-up resistor connected to Vcc (so that the ESP-01 will either read LOW, or HIGH)

The main problem I'm facing concerns the boot of the ESP-01 : the GPIO #0 must not be LOW (connected to GND) otherwise it would start in 'program' mode so I can't connect the water meter on it as I can't know whether the water meter will be "open" or "closed" (so if the pin will be HIGH or LOW)
It seems that I can't either use the GPIO #2 as to boot in running mode, the ESP-01 need the GPIO #2 to be either unconnected, or HIGH.

I've tried Google but could not find any way. Can anybody explain me how to deal with this situation ?

Many thanks
Steph
User avatar
By Barnabybear
#37395 Hi, both GPIO 0 & 2 need to be pulled high (10K resistor) at boot to ensure you enter normal running mode. If you connect Pin A to GPIO 0 & Pin B to GPIO 2, after boot you can toggle one GPIO and read on the other. This will tell you whether the switch is open or closed. If you don't want to use two GPIOs post back and we can look at some other methods but that is the simplest.
User avatar
By Steph
#37404 Hi Barnabybear, thanks a lot for your reply.
To be honest, I already thought about a similar solution but I was also expecting to use the second GPIO to connect a DTH11 or DTH22 to measure both temperature and humidity.
So, if you have a solution that will only need one GPIO to read the inputs from my water meter, it would be really great ;)
Many thanks,
Steph.