- Microcontroller of your choice:
- Moisture sensor (Amazon)
IDE: Arduino
- ESP8266 Board (Github)
- PubSubClient 2.7.0 (Github)
- ArduinoJson 5.13.5 (Github)
- WifiManager 0.14.0 (Github)
- NTPClient 3.1.0 (Github)
- Install Arduino IDE from link above
- Add ESP8266 Addon (See tutorial from Sparkfun)
- Install all dependencies with library manager
- Sketch > Include Library > Manage Libraries
- Search for each dependency (see list above) except ESP8266 Board and install the appropriate versions.
- Download this repository and open it with the IDE
- Connect ESP8266 to the computer
- Select the board from Tools > Board > NodeMCU 1.0 (ESP-12E Module) (This might vary depending on the board you are using)
- Select the COM port where ESP8266 is connected Tools > Board > Port > COMxx
- Push
RST
andFLASH
button, releaseRST
and then releaseFLASH
(This might vary depending on the board you are using) - Flash the firmware from the Arduino IDE
- The microcontroller will create a new access point. Connect there and navigate with a browser to
192.168.4.1
. - Provide in the webinterface the SSID and password for your network.
- After the microcontroller connected to you network figure out the IP address of it. This can be done by:
- checking serial monitor Tools > Serial Monitor
- checking webinterface of your router
- use a network scanning tool
- Configure mqtt by issuing the following command:
curl -i -X PUT -d {\"host\":\"host\",\"port\":1234,\"client\":\"clientname\",\"user\":\"user\",\"pwd\":\"password\",\"ssl\":false} http://<ip of µC>/api/config/mqtt
- Configure actors by issuing the following command:
curl -i -X PUT -d [{\"pin\":1,\"topic\":\"topic\"}] http://<ip of µC>/api/config/actors
- Configure sensors by issuing the following command:
curl -i -X PUT -d "[{\"pin\":0,\"sensorName\":\"sensor name\",\"location\":\"location\",\"type\":\"water\"}]" http://<ip of µC>/api/config/sensors
- Restart the microcontroller