|
1 | 1 | # Weather Station with Arduino Uno board, DHT11 Sensor, LCD screen and AWS IOT
|
2 | 2 |
|
3 |
| -This tutorial shows you how to use the [DHT11](https://amzn.to/2Qs9fcV) temperature and humidity sensors with the [Arduino Uno](https://amzn.to/3jmCpqx) board to build a simple weather station that displays current temperature and humidity on an [LCD](https://amzn.to/2FzJdT6) screen and pushes the data to AWS IoT through an [ESP8266](https://amzn.to/3hqqWom) board. |
| 3 | +This tutorial shows you how to use the [DHT11](https://amzn.to/2Qs9fcV) temperature and humidity sensors with the [Arduino Uno](https://amzn.to/2RnHhPY) board to build a simple weather station that displays current temperature and humidity on an [LCD](https://amzn.to/2FzJdT6) screen and pushes the data to AWS IoT through an [ESP8266](https://amzn.to/3hqqWom) board. |
4 | 4 |
|
5 | 5 | In the **first part**, we'll go through a quick introduction to the sensor, pinout, wiring diagram, and finally the Arduino sketch.
|
6 | 6 |
|
7 |
| -In the **second part**, we'll see how to connect out DYI weather station to AWS IoT in order to store the data, visualize it and run some analytics on it. |
| 7 | +In the **second part**, WIP... |
8 | 8 |
|
9 | 9 | PART ONE
|
10 | 10 | ========
|
11 | 11 |
|
12 | 12 | ⚡️ COMPONENTS AND SUPPLIES
|
13 | 13 | --------------------------
|
14 | 14 |
|
15 |
| -<img align="right" src="https://github.com/isbkch/esp32-aws-weather-station/blob/master/docs/esp-32.jpg?raw=true" style="max-width:100%;" height="200"> |
| 15 | +<img align="right" src="https://store-cdn.arduino.cc/usa/catalog/product/cache/1/image/1000x750/f8876a31b63532bbba4e781c30024a0a/a/0/a000066_iso_1_3.jpg" style="max-width:100%;" height="300"> |
16 | 16 |
|
17 |
| -* [ESP32 Board](https://amzn.to/3jmCpqx) |
| 17 | + |
| 18 | +* [Arduino Uno](https://amzn.to/2RnHhPY) |
| 19 | +* [LCD Screen](https://amzn.to/2FzJdT62Ehh2ru) |
18 | 20 | * [Breadboard](https://amzn.to/2Ei40tP)
|
19 | 21 | * [Jumper Wires](https://amzn.to/2Ehh2ru)
|
20 |
| -* [DHT11](https://amzn.to/2Qs9fcV) or [DHT22](https://amzn.to/31t7P8l) Temp & Humidity Sensor |
| 22 | +* [DHT11](https://amzn.to/2Qs9fcV) Temp & Humidity Sensor |
21 | 23 | * [10k Ohm resistor](https://amzn.to/2Qo7vkW)
|
22 | 24 |
|
23 |
| - |
24 |
| -EDIT: Or use this [KIT from WayinTop](https://amzn.to/3hxR01A) that already contains everything |
25 |
| - |
26 | 25 | 🚀APPS
|
27 | 26 | ------
|
28 | 27 |
|
29 |
| -* [Arduino IDE](https://www.arduino.cc/en/main/software) |
| 28 | +* [PlatformIO](https://platformio.org/) |
30 | 29 | * [AWS cli](https://docs.aws.amazon.com/cli/latest/userguide/cli-chap-install.html)
|
31 | 30 |
|
32 |
| -DHT11 vs DHT22 SENSORS |
33 |
| ----------------------- |
34 |
| - |
35 |
| -<img align="center" src="https://github.com/isbkch/esp32-aws-weather-station/blob/master/docs/DHT11-DHT22-Temperature-Humidity-Sensor.jpg?raw=true"> |
| 31 | +What is humidity? |
| 32 | +----------------- |
| 33 | +Humidity is the water vapor around you mixed with air. It is measured in %. So, if the humidity is 60%, then 60% of the air around you is water vapor. If it is 100%, then it means either the sensor is not correct, the sensor is broken/damaged, the Arduino crashed, the Arduino can't receive any signal, there's an error in the code or you're underwater(1). If it's 0%, it means all the reasons above except the last one, you're in space or you're in the middle of a desert(2). |
36 | 34 |
|
37 |
| -The [DHT11](https://amzn.to/2Qs9fcV) and [DHT22](https://amzn.to/31t7P8l) sensors are used to measure temperature and relative humidity. These are very popular among makers and electronics hobbyists. |
| 35 | +(1) Correction: it means the air cannot hold any more water.<br><br> |
38 | 36 |
|
39 |
| -These sensors contain a chip that does analog to digital conversion and spit out a digital signal with the temperature and humidity. This makes them very easy to use with any microcontroller. |
| 37 | +(2) The air in a desert does contain some water but it is a very little amount compared to a normal place. The Sahara Desert has a mean humidity of 25%.</p> |
40 | 38 |
|
41 |
| -The DHT11 and DHT22 are very similar, but differ in their specifications. |
42 | 39 |
|
43 |
| -The DHT22 sensor has a better resolution and a wider temperature and humidity measurement range. However, it is a bit more expensive, and you can only request readings with 2 seconds interval. |
| 40 | +How to measure Temperature & Humidity |
| 41 | +------------------------------------- |
44 | 42 |
|
45 |
| -The DHT11 has a smaller range and it's less accurate. However, you can request sensor readings every second. It's also a bit cheaper. |
| 43 | +<img align="center" src="https://github.com/MecaHumArduino/arduino-uno-aws-weather-station/blob/master/docs/dht11.jpeg?raw=true"> |
46 | 44 |
|
47 |
| -Despite their differences, they work in a similar way, and you can use the same code to read temperature and humidity. You just need to select in the code the sensor type you're using. |
| 45 | +This is a [DHT11](https://amzn.to/2Qs9fcV) sensor, it is a temperature and humidity combined sensor with calibrated digital signal output. It's is a reliable sensor for determining temperature and humidity. There is a newer and more accurate module on the market called DHT22 but we will stick with the DHT11 for this demo |
48 | 46 |
|
49 | 47 | Schematic Diagram
|
50 | 48 | -----------------
|
51 | 49 |
|
52 |
| -Wire the [DHT11](https://amzn.to/2Qs9fcV) or [DHT22](https://amzn.to/31t7P8l) sensor to the [ESP32](https://amzn.to/3jmCpqx) development board as shown in the following schematic diagram. |
| 50 | +Wire the [DHT11](https://amzn.to/2Qs9fcV) or [DHT22](https://amzn.to/31t7P8l) sensor to the [Arduino Uno](https://amzn.to/2RnHhPY) development board as shown in the following schematic diagram. |
53 | 51 |
|
54 | 52 | <img align="center" src="https://github.com/isbkch/esp32-aws-weather-station/blob/master/docs/schematic.png?raw=true" style="max-width:100%;" height="600">
|
55 | 53 |
|
56 |
| -Installing Libraries |
57 |
| --------------------- |
58 |
| - |
59 |
| -To read from the DHT sensor, we'll use the [DHT library from Adafruit](https://github.com/adafruit/DHT-sensor-library). To use this library you also need to install the [Adafruit Unified Sensor library](https://github.com/adafruit/Adafruit_Sensor). Follow the next steps to install those libraries. |
60 |
| - |
61 |
| -Open your Arduino IDE and go to **Sketch > Include Library > Manage Libraries**. The Library Manager should open. |
62 |
| - |
63 |
| -Search for **"DHT"** on the Search box and install the DHT library from Adafruit. |
64 |
| - |
65 |
| -<img align="center" src="https://github.com/isbkch/esp32-aws-weather-station/blob/master/docs/adafruit_dht_library.png?raw=true" style="max-width:100%;" height="600"> |
66 |
| - |
67 |
| -After installing the DHT library from Adafruit, type **"Adafruit Unified Sensor"** in the search box. Scroll all the way down to find the library and install it. |
68 |
| - |
69 |
| -<img align="center" src="https://github.com/isbkch/esp32-aws-weather-station/blob/master/docs/adafruit_unified_sensor_library.png?raw=true" style="max-width:100%;" height="600"> |
70 |
| - |
71 |
| -After installing the libraries, restart your Arduino IDE. |
72 |
| - |
73 |
| -THE CODE |
74 |
| --------- |
75 |
| - |
76 |
| -Rename the file [secret.h.public](https://github.com/isbkch/esp32-aws-weather-station/blob/master/secrets.h.public) to **secret.h** and edit it with your information: |
77 |
| - |
78 |
| -* 1\. Select your thing from [this page](https://console.aws.amazon.com/iot/home?region=us-east-1#/thinghub) |
79 |
| -* 2\. From the left menu, select **Security** and click the button "**Create Certificate**" |
80 |
| -* 3\. Now download both files *.cert.pem and *.private.key and replace their content in the **secret.h**. And don't forget to activate your Certificate. |
81 |
| -* 4\. Back to the left menu, click **Interact** and copy the HTTPS link then paste it into **secret.h** as well. |
82 |
| - |
83 |
| -Finally, open the file [esp32-aws-weather-station.ino](https://github.com/isbkch/esp32-aws-weather-station/blob/master/esp32-aws-weather-station.ino) with Arduino IDE |
84 |
| - |
85 |
| -PART TWO |
86 |
| -======== |
87 |
| - |
88 |
| -AWS SETUP |
89 |
| ---------- |
90 |
| - |
91 |
| -Now that parts are connected and the libraries are installed, it's time to setup the AWS part. |
92 |
| - |
93 |
| -As you see in the diagram below, the ESP board will be sending data through an MQTT topic to AWS IoT Core, we will be applying rules on the raw data and invoking a Lambda that writes the data to a dynamoDB table. Afterwards, we can read that data and display it on a webpage |
94 |
| - |
95 |
| -<img align="center" src="https://github.com/isbkch/esp32-aws-weather-station/blob/master/docs/aws-architecture.png?raw=true" style="max-width:100%;" height="350"> |
0 commit comments