Well water pumphouse esp8266 nodemcu 1.0 microcontroller project for monitoring the depth of a water tank and room temperature, reporting to the io.adafruit.com.
Dependencies required to build this...
Configure Arduino IDE for esp8266
Install the esp8266 boards through the Arduino IDE APP
Tools->Board->Board Manager
Search for "esp8266"
Adafruit Unified Sensor by Adafruit (Tested with 1.1.9)
DHT sensor library by Adafruit (Tested with 1.4.4)
ArduinoJson by Benoit Blanchon (Tested with 6.21.2)
Adafruit MQTT Library by Adafruit (Tested with 2.5.4)
Open the project with your favourite Arduino IDE. I use Visual Studio Code, but it should work from the default Arduino IDE
Create a file called configData.h and include two macros, WIFI_SSID and WIFI_PASSPHRASE like this
#define WIFI_SSID "MyWifiName"
#define WIFI_PASSPHRASE "MyWifiPassword"
Create an account at io.adafruit.com. Create a file called configAdafruitMqtt.h and define the following macros with the appropriate values.
#define AIO_SERVER "io.adafruit.com"
#define AIO_USERNAME "Your Adafruit account name"
#define AIO_KEY "Your Adafruit key"
#define AIO_SERVERPORT 1883
A design and components are available on EasyEDA. You can also order PCBs directly from them from them with this design. Note that the pin usage is slightly different than the code to make the PCB design a bit simpler. The code will be updated with the changes.
When the data is regularly published to io.adafruit.com, you can create a dashboard of various stats, including water depth, distance from sensor to water, temperature, and humidity.
Here is a 1 week duration depth chart showing the changes in water depth as the tank is filled and drained.
The original server project watermonitor_server. The intention was for the monitor to post to this server, but using the MQTT server at io.adafruit.com was easier. The server may find a dual purpose as a trigger notification from io.adafruit.com to trigger emails when exceptional events occur.