1. Component list
- 1× ESP8266-07
- 1x CP2102 usb to uart bridge
- 1x Bread Board Power Supply
- 1x 12V AC-DC Power Adaptor
- 2x 400pin Breadboard Wires
- 1× DHT11 temperature/Humidity sensor
- 1x 10k resistor
- 1x mini push button
- Wires
2. Overall idea
We have discussed on one of other tutorial, how to use Raspberry Pi to monitor temperature/humidity using the GadgetKeeper.(Temperature monitoring with Raspberry Pi and DHT11/22 temperature and humidity sensor), and also how to use Arduino board instead of Raspberry Pi (Arduino Weather Station). But this time wi will use ESP8266 WiFi SoC as standalone device without Arduino to send data to GadgetKeeper Cloud.
3. Prepare the hardware
ESP8266 Wiring
PIN name | Connection |
---|---|
Reset | via push button to gnd |
GPIO12 | DHT11 data pin |
VCC | 3V3 |
TXD | CP2102 TXD |
RXD | CP2102 RXD |
GPIO0 | GND |
GND | GND |
CP2102 Wiring
PIN name | Connection |
---|---|
TDX | ESP8266 TXD Pin |
RXD | ESP8266 RXD Pin |
GND | GND |
DHT11 Wiring
PIN name | Connection |
---|---|
VCC | 3V3 |
DATA | ESP8266 GPIO12 Pin and 3V3 via 10K resistor |
GND | GND |
NOTE: for DHT11 sensor, don't forget to connect a 10K resistor from the data pin to VCC
NOTE: to upload code to ESP8266 first connect GPIO0 pin to ground, reset the ESP8266 WiFi module (I have done it via push button connected to ESP8266 reset pin and GND) then upload code. After uploading code GPIO0 can be disconnected again.
4. Configure Arduino IDE
Download Arduino IDE from Arduino.cc (1.6.4 or greater) - don't use 1.6.2! You can use your existing IDE if you have already installed it
Open File -> Preferences and end enter:
http://arduino.esp8266.com/stable/package_esp8266com_index.json
into Additional Board Manager URLs field.
Click OK and go to Sketch -> Include Library -> Manage Libraries to open Board manager
In Boards Manager search for esp8266 and install the ESP8266 package.
5. Add required additional Arduino libraries
The required libraries can be downloaded from following link:
DHTlib
All other required libraries are available as standard libraries with the IDE.
Installing Additional Arduino Libraries guidelines can be found on official Arduino site.
6. Configure GadgetKeeper
reate the "weatherStation" thing first:
Then create the "temprature" and "humidity" properties under weatherStation as follows.
Then create the "weather Station" API Key
- Open "API Keys"tab in GadgetKeeper Console
- Click "New" to open "Create API key" dialog
- Set name "weather Station API key"
- Select things: "weatherStation"
- Check in Granted permissions "All"
- Save API Key
7. Arduino sketch
This is the esp8266 sketch for uploading temperature and humidity values to the GadgetKeeper. It can be also downloaded form github esp_weather_station.