Cloud-Connected Soil Moisture Sensor Using ESP8266

Thu Dec 22, 2016

Today I’ve built a soil moisture sensor connected to the Internet of Things for less than 5€ using an ESP8266-12E and a cheap moisture sensor. The idea is to read the moisture value every x hours and put the ESP8266 into deep sleep mode.

1.Materials

1x ESP8266-12E

1x ESP8266-12E Break-Out Board (optional)

1x Soil Mositure Sensor

some wires and resistors for the voltage divider


2.Build

Wire up the components like shown in the following picture. Please make sure to use a voltage divider because the ESP8266’s analog in has a range from 0 V - 1 V, but the sensor ranges from 0 V - 3.3 V sketch prototype esp8266 soil moisture


3.Program

The prototype code can be found on GitHub

I’ve been using IBM’s IoT Platform to send my data to, but you can use every IoT platform you like to use. Before uploading the code, adjust the config0.lua file which contains all properties for WIFI and IoT connectivity. Make sure to upload all .lua files to your device using a tool like LuaLoader.


4.Saving A Plant’s Life

esp8266 plant


5.Next Steps

In the future I’ll add a solar panel, a lithium-ion battery pack and a MOSFET to disconnect the sensor while deep sleep.



Next: »