This is a hackathon result. Which has been cleaned up a bit since.
One this is flashed, its all self-contained. You can set up an MQTT client that will push updates via a wifi of your choice. No hardcoded strings. You can also reset the settings by pressing "reset" sevral quick times.
The supported sensors are:
- Moisture sensore
- Tempreture sensor DS18B20
- PH sensor - like this one
You can see the project in action in this video
- ESP8266 (I used Node MCU 1.0). One that has an analog pin and an SPIFFS.
- A sensor
- A moisture sensor with an analog pin one that looks like this (will also work with this, but its not recommended because they die after about 24 hours in water, for more info see this.
- Tempreture sensor using DS18B20 - they also go really cheap on Aliexpress and ebay.
- Connect pin VCC of the moisture sensor to VCC on your ESP8266
- Connect pin GND of the moisture sensor to the GND on your ESP8266
- Connect A0 pin on the moisture sensor to the A0 pin on your ESP8266
- Connect pin VCC of the moisture sensor to VCC on your ESP8266
- Connect pin GND of the moisture sensor to the GND on your ESP8266
- Connect the data pin to pin D4
- Connect pin VCC of the moisture sensor to VCC on your ESP8266
- Connect pin GND of the moisture sensor to the GND on your ESP8266
- Connect second pin GND of the moisture sensor to the GND on your ESP8266
- Connect P0 pin on the moisture sensor to the A0 pin on your ESP8266
- Preform calibraion of POTs as explained here
Arduino Libs used (all can be downloaded from the Library Manager):
- DoubleResetDetect
- ArduinoJson (version 5.x, does not work with version 6.x+)
- WiFiManager
- PubSub
- DallasTemperature
- OneWire
When flashing, set in your Arduino IDE the flash size to be 4M and above, you want to have flah space to start the saved settings of wifi manager.
Flash mqtt_wifi_manager_moisture_sensor.ino to the ESP.
Flash mqtt_wifi_manager_temp_sensor.ino to the ESP.
Flash mqtt_wifi_manager_temp_sensor.ino to the ESP.
You are done, thats is it!
- Press reset sevral times, a wifi access point should appear with the name ESPxxxxxxxx (where x is the id number of the ESP).
- Connect to that access point and go to the router IP. For example, if your phone/laptop connected to 192.148.4.xxx then connect to http://192.168.4.1. You should see a webpage to set up. Note: the IP might change depending on your library settings. So see what IP you are assigned.
- Pick your access point you wish to connect to and set up the password.
- Set a mqtt server and mqtt topic to send to
- Save, and your ESP should connect and start sending the moisture data as a percentage
- If you want to enter the setup mode again, press the reset button quickly for sevral times, and you should get the access point page again.
Thats it, enjoy. Some of this is still a crude hackaton code, so if you like it and want to PR and make it stable you are more than welcome!