The use of the ESP8266 in the world of IoT

User avatar
By darryl.lawler
#85624 Hello and thank you for this great forum.

I would like some assistance with solving a challenge which likely has a simple solution.

I am developing a remote, battery powered RH/Temp sensor unit using the nodeMCU ESP8266 (ESP-12e).

Each unit is powered by a 3.7V, 1200mAh Lithium Ion Polymer (LiPo) battery connected directly to GND and 3.3V (the ASM1117 regulator is bypassed). A DHT22 RH/Temp sensor is connected to GPIO4 as a 1-wire sensor and functions within specified parameters.

Using deep sleep mode with periodic wake ups, I should be able to run the remote sensors for at least 2 weeks. Even with the fan (mentioned below) running for a very short period prior to each wake up.

The challenge I have encountered is that before the sensor takes a reading, I would like to turn on the fan LINK (3.3V 20mA) for 3-5 seconds using an available GPIO pin.

The max current draw on a GPIO pin, for the ESP8266 (ESP-12e) is 12 mA.

Given my inexperience, I do not know how to make up the additional 8+ mA of current demand from the load of the fan. I know that the battery can handle it, but I don't know of a device (relay?), within the specifications of this application, that would provide what is needed. I have little knowledge of transistors, but I think that may be the device I need.

I am open to suggestions. Thank you for any advice you can contribute.
User avatar
By btidey
#85691 Yes. You need a driver between the GPIO pin and the fan. This can be a biploar transistor or a mosfet transistor


This is bipolar version. GPIO pin drives the base via a resistor with another resistor to 0V to ensure transistor defaults to off. The collector turns on when GPIO is high and turns the fan on. The diode ensure that any voltage spike that cna happen when a motor turns off is safely handled. Almost any npn transistor will work (e.g. BC184L)


This is the mosfet version. Similar to the bipolar the drain turns on when GPIO is high and turns fan on. No resistor in feed to the gate is needed. Advantag eis that a mosfet has very low voltage drop when turned on so fan will see the full 3.3V whereas the bipolar version will lose about 0.2V (probably no big deal in this case). The mosfet must be a low gate threshold voltage device to turn on when 3.3V is applied to its gate (e.g. AO3400)

Note that your battery although nominally 3.7V will be nearer 4.2V when fully charged so will be exceeding the rated supply to the ESP
You do not have the required permissions to view the files attached to this post.