Introduction: ESP8266 (Standalone) Weather Station Using Arduino IDE and GadgetKeeper Cloud Platform

This is an upgrade of my earlier project GadgetKeeper-Weather-Station. In this project I am building the same functionality but only using ESP8266 WiFi SoC standalone with DHT11 temperature and humidity sensor. In the previous project i used Arduino Uno and Arduino Ethernet Shield to send temperature and humidity readings to GadgetKeeper Cloud Platform which I replaced with ESP8266 WiFi SoC for this one.

Step 1: Parts

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

Step 2: Prepare the Hardware

ESP8266 Wiring

PIN name | Connection

Reset | via push button to gnd

GPIO12 | DHT11 data pin

VCC | 3V3

TXD | CP2102 TXD

Pin RXD | CP2102 RXD

Pin 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.

Step 3: Prepare 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

Enter

http://arduino.esp8266.com/stable/package_esp8266com_index.json

into Additional Board Manager URLs field in the Arduino v1.6.4+ preferences.

Step 4:

Next, use the Board manager to install the ESP8266 package.

Step 5:

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.

Step 6: Configure GadgetKeeper

Create the "weatherStation" thing first:

Step 7:

Then create the "temperature" and "humidity" properties under weatherStation as follows.

  1. In the "Thing: weatherStation" tab, open "Property"
  2. Click to open "Create Property" dialog
  3. Set name of the property "temperature"
  4. Select "persistent" as the property type (property value would be persisted by the GK)
  5. Select "float" as the data type for this property
  6. Save property
  1. In the "Thing: weatherStation" tab, open "Property"
  2. Click to open "Create Property" dialog
  3. Set name of the property "humidity"
  4. Select "persistent" as the property type (property value would be persisted by the GK)
  5. Select "float" as the data type for this property
  6. Save property

If you need detailed "point and click" UI instructions how to create thing see "Create, Read, and Write Property" on GadgetKeeper Documentation.

Step 8:

Then create the "weather Station" API Key

  1. Open "API Keys"tab in GadgetKeeper Console
  2. Click "New" to open "Create API key" dialog
  3. Set name "weather Station API key"
  4. Select things: "weatherStation"
  5. Check in Granted permissions "All"
  6. Save API Key

For more information see "GadgetKeeper API" on GadgetKeeper Documentation.

Step 9: Arduino Sketch

This is the arduino sketch for this cheap homemade IoT device.

esp_weather_station

Information about uploading Arduino Sketch can be found here.

Step 10: Create GadgetKeeper Dashboard Widget

  1. Open "Dashboards" tab in GadgetKeeper Console
  2. Click "New" to open "Dashboards" dialog
  3. Set Title "weather Station"
  4. Save Dashboard

Go to Add Widget and select "Event/Property Gauge"

Select Title: "Temperature

Select Thing: "weatherStation"

Data source: "Property"

Select Attributes: "value"

Select Refresh rate, seconds: 5

Click Apply and Save widget

Step 11:

Create temperature dashboard
  1. Open "weather Station Dashboard" tab
  2. Go to Add Widget and select "Event/Property Gauge"
  3. Select Title: "Temperature"
  4. Select Thing: "weatherStation"
  5. Data source: "Property"
  6. Select Property: "temperature"
  7. Select Attributes: "value"
  8. Select Refresh rate, seconds: 5
  9. Click Apply and Save widget

Create humidity dashboard

  1. Open "weather Station Dashboard" tab
  2. Go to Add Widget and select "Event/Property Gauge"
  3. Select Title: "Humidity"
  4. Select Thing: "weatherStation"
  5. Data source: "Property"
  6. Select Property: "humidity"
  7. Select Attributes: "value"
  8. Select Refresh rate, seconds: 5
  9. Click Apply and Save widget