Battery powered ESP8266 controlled temperature and humidity sensor communicating via MQTT protocol (with Home Assistant).
ESPtemp is a battery-powered device that detects temperature and humidity and transmits them to a server (like Home Assistant) via WiFi using MQTT. It measures the current temperature, humidity and battery voltage, transmits them and then goes into deep sleep for 5 minutes to save energy. After that, the process is repeated. To make the connection to the WiFi as fast as possible, the WiFi channel and the MAC address of the router are stored in the RTC memory of the microcotroller and used to speed up the next connection attempt.
The device uses an ESP-12F microcontroller to process and transmit the data. Temperature and humidity are measured by a HTU21D sensor. The required operating voltage of 3.3V for the MCU and the sensor is provided by a MCP1700-3302E low dropout voltage regulator. The power supply is a lithium-ion battery type 18650 with 3.7V and 3500mAh. The protection of the circuit and the lithium-ion battery is ensured by a 200mA fine-wire fuse. The circuit is built on a double-sided prototype PCB board for ESP8266 and ESP32.
- Prototype PCB board for ESP8266
- ESP-12F
- HTU21D
- MCP1700
- 18650 lithium-ion battery
- Battery Holder
- 1N4007 Diode
- 12 kΩ Resistor (5 pieces)
- 68 kΩ Resistor
- 220 kΩ Resistor
- 1000 µF Electrolyte capacitor
- 100 nF Ceramic capacitor (2 pieces)
- 1 nF Ceramic capacitor
- Micro push button switch (4 pin)
- Jumper connectors
- 200 mA Fuse
- Fuse holder
- Wire
The firmware is written in C++ using Visual Studio Code with the PlatformIO extension.
⚠️ Before building the firmware be sure to copy the fileinclude\config.h.example
toinclude/config.h
and change the WiFi and MQTT credentials as well as the other settings in the new file.
Connect RX, TX and GND to your serial interface or USB-to-TTL converter. To enter flash mode on the ESP-12F you must connect GPIO0 to GND and reset the MCU.
To flash the ESP8266 Over-The-Air, connect GPIO 14 to VCC and reset the ESP8266. After reboot it will enter the "OTA wait loop". The flashing blue LED indicates that the MCU is waiting for the OTA firmware update.
- Create an ESPHome configuration to use the hardware without the firmware provided here