ESP8266 MQTT based soil moisture measuring plant monitor.
This project is intended to use battery powered, solar panel charged ESP8266 ESP-12E with 16 channel analog multiplexer sensing up to 16 analog sources.
There is also voltage divider providing measuring of battery voltage, output of voltage divider is connected to channel 0 of analog multiplexer.
there is file ESP8266-PlantMonitor/espPlantMonitor/src/user_config.h where you should adjust settings such as your SSID and password, MQTT broker address, Name of device, address of NTP server and so on. You can also adjust sleep interval .
#define SLEEP_TIME 1800 // [SleepTime] Time to sleep (0 = sleep forever, 1 - X seconds)
There is functionality of AP configuration. If device cannot connect to WiFi in config, or if there are no settings saved on flash, device boots into Access Point mode, so you can connect to it, you will be forwarded to configuration page where you can adjust basic settings.
Device wakes up every period of time (default 30 minutes), connects to WiFi, connects to MQTT broker, turn on GPIO 5 which provides power for voltage regulator, powering all soil moisture circuits.
It then multiplex through first 9 channels in my case, measuring and calculating each humidity in percentage. After sending all data through MQTT it goes for sleep for configured period. I use soil moisture circuit with voltage comparator, providing analog output which is inversely proportional to the input voltage.
To save some power there is voltage regulator providing 3,3 V (for stable calculations of measured output from sensors) , which is turned on just for necessary time.
Battery consumption of whole device is quite big because of ESP8266, It can probably operate from few hours to few days, of course it depends on sleep interval. There is small solar pannel providing about 4,5 Volts, with circuit for charging Li-po batteries, which can juice up the battery through day so device can operate independently for long time.
There are 2 buttons connected, one is for restarting device, and second one to boot device into firmware upload mode. You need to connect FTDI programmer to TX and RX pins as ususal.
I'll sum up all links I bought for this setup. ESP-12E
- Allowing for waking up remotely, so we can configure device through web browser and then ability to put the device back to sleep
- Adding more configuration items to web interface