Arduino sketch for the ESP8266 and a DHT22 sensor to allow collection of temp/humidity readings via HTTP.
Configure the WiFi and IP address details found in the sketch and flash to your device. Once the device is attached to your network, temperature and humidity readings can be accessed via HTTP per the following examples:
curl http://192.168.0.200
returns 78.9,56
curl http://192.168.0.200/json
returns {"temperature":"78.9", "humidity":"56"}
curl http://192.168.0.200/temp
returns 78.9
curl http://192.168.0.200/humid
returns 56
curl http://192.168.0.200/html
returns a web page with the current sensor readings in HTML format
- A Windows, OSX, or Linux computer with an available USB port
- A micro-USB cable
- An ESP8266 development board (sketch is configured for the WeMos D1 Mini)
- A DHT22 Humidty/Temperature sensor compatible with your ESP8266 board.
Download the Arduino IDE for your operating system and install with the instructions linked below
Once the Arduino IDE is available we can add support for the development boards we'll be using.
- Launch the Arduino application
- Select the "File" menu ("Arduino" menu on OSX), then "Preferences"
- Paste the following URL in the box labeled "Additional Boards Manager URLs":
http://arduino.esp8266.com/stable/package_esp8266com_index.json
The page should look something like this: - While we're here, check "Display line numbers"
- Click OK to accept the changes
- Select the "Tools" menu, "Board" menu, then "Boards Manager"
- Search for ESP8266, click on the "esp8266" board and select "Install"