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

by sibuntu in Circuits > Arduino

19357 Views, 141 Favorites, 0 Comments

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

20151015_152506.jpg

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.

Parts

download.jpg
esp_breakout_with_esp12_wm.jpg
F0L52G7IFGNQLYD.MEDIUM.jpg
5-PCS-LOT-Single-Bus-DHT11-Digital-Temperature-and-Humidity-Sensor-DHT11-Probe-090345.jpg
F5YN3MIIF4IJJB6.MEDIUM.jpg
F2PPRWXIFGNQM21.MEDIUM.jpg
FD125UAIFGNQM22.MEDIUM.jpg
FS59QDNIFGNQM25.MEDIUM.jpg
images.jpg

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

Prepare the Hardware

20151015_152506.jpg
20151015_152524.jpg
20151015_152528.jpg
20151015_152544.jpg

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.

Prepare Arduino IDE

F07HMSMIFGNR5VJ.MEDIUM.jpg

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.

F2E2W5KIFGNR6Q0.MEDIUM.jpg

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

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.

Configure GadgetKeeper

thing.png

Create the "weatherStation" thing first:

temprature.png
thing.png

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.

GadgetKeeper Console - Mozilla Firefox_045.png

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.

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.

Create GadgetKeeper Dashboard Widget

GadgetKeeper Console - Mozilla Firefox_050.png
  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

weather Station - Mozilla Firefox_053.png
GadgetKeeper Console - Mozilla Firefox_047.png
GadgetKeeper Console - Mozilla Firefox_051.png
GadgetKeeper Console - Mozilla Firefox_052.png
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