The use of the ESP8266 in the world of IoT

User avatar
By dperezq
#33877 I have designed a circuit to send the values of a DHT22 sensor to thingspeak using the ESP8266-01 and a 9V battery. The pin that I am using is the GPIO2 and I want to know if it is possible to send the voltage value through the GPIO0.

My question is how can I do it, if when I have to upload the code, this pin should be in ground. And the other question is if I would be able to upload the temperature and humidity values to thingspeak and at the same time create a webserver in my local network, which I will access through an IP, where I can see the current voltage of the battery to see it.

Thanks
User avatar
By martinayotte
#33885 Both GPIO2 and GPIO0 needs to be HIGH (Pulled Up) at boot time to run your application.
For upload new firmware, you simply have to bring GPIO0 to LOW during power up or reset.
What do you mean by "send the voltage value through the GPIO0" ?
Do you mean using GPIO0 for the DHT22 Data line ?
Of course you can since this line also needs a PullUp and shorting it to GND for programming new firmware won't damage anyone.
User avatar
By dperezq
#33887 My idea is to use the GPIO2 to send the temperature values and use the GPIO0 to send the voltage value, but I don't know if there is a command line or something to send directly the current voltage in the battery using the GPIO0 to thingspeak. By voltage value I mean to send the current voltage in the battery to know how much left on it. I don't know if this is the best option to know it, because I just started some days ago with this.
User avatar
By martinayotte
#33891 I've trouble following you : GPIO0 is a digital I/O pin, it is NOT an analog pin to read voltage.
For reading analog voltage, ESPs have only 1 analog pin, sometime call ADC, sometime TOUT.
Unfortunately, this pin is NOT available on ESP-01, only on ESP-07 or ESP-12.
A workaround would be to use an I2C ADC, but for I2C bus your need 2 pins, and you already have one used by your DHT22.
Or, you can remove the DHT22, freeing it pin, and use other kind of temperature sensors which are I2C, such as the LM75.