Introduction: ESP8266 With DHT11 Temperature Humidity Monitor
I'm Jeffrey Yu, an electronics beginner, I want to use ESP8266 and DHT11 to make a temperature and humidity monitor, then I can monitor the data on the Internet,also I just want to get rid of Arduino and using ESP8266-01 as a Microcontroller, so I dave into the materials which are talking about how to build one, but most of them are unreadable and quite confused(because I tried some of them). This is my first instructable that describe how I made this project step by step, may this article will help you out :- >.
I separate the project into three parts:
- Power Supply (two capacitor and one AMS117 voltage regulator)
- WIFI Module (ESP8266-01,also you can use another version of ESP8266)
- Temperature And Humidity Monitor (DHT11, DHT22 is nice as well)
I will try to explain them clearly and easy to understand. First of all, follow materials you will needed：
- ESP8266-01 (or another family member of ESP8266 ).
- AMS1117Voltage Regulator.
- Capacitors (one 0.1uF ceramic and one 100uF tantalum electrolytic capacitor).
- A Power Supply (I used a battery charger which outputs 5V voltage and 500mA current and a Barrel Power Jack).
- An USB to TTL Serial Converter(PL2303 which I used).
- Some Wires.
- A Breadboard.
- Two Breadboard Adapters (one for ESP8266, one for DHT11, learn to make one here).
- An account with Thingspeak.
- Arduino IDE (with ESP8266 board module, learn how to set up in here)
Some soldering skills (which I did very bad, you could see it later : - p) may be needed , check out this tutorial.
Step 1: Power Supply
ESP8266 all models run on 3.3V, first time I thought I could use Arduino 3.3V to power up the ESP8266-01, but this didn't work, because the pin which Arduino provide outputs current just merely 50mA, If you looking through the datasheet of ESP8266, you will find out that ESP8266 require 200mA in maximum. so that is the way lay in before us, we should external power supply!
so Let's make a external power supply, I used a phone power charger which provide 5V and 500mA outputs, and we also need a voltage regulator to step down the voltage into 3.3V. OK, In this step you should get below materials:
- AMS1117 Voltage Regulator (It is very very very cheap in my country ;-] ).
- 0.1uF ceramic capacitor.
- 100uF tantalum electrolytic capacitor.
- a breadboard.
(You may ask, why we should use two capacitors? I thought, this is for ensuring a more clean DC output. do you have more reasonable explain? please tell me, it is very grateful.)
AMS 1117 has three pins which are GND, Voltage Output, Voltage Input from left to the right. Looking the schematic of power supply and try to soldering them on the breadboard then test the outputs.
Step 2: Setting Up ESP8266
Setting up ESP8266 take me some time to figure out the right way. Now you have a 3.3V External Power Supply and a USB to TTL Serial Converter, then you could upload the sketch to test the power supply with ESP8266.
Fellowing the picture shows above, connecting the wires, in the picture, I demonstrate using Arduino to act as a USB to TTL Serial Converter (If you have one that is more easy to achieve this purpose, connect the convert RX to TX of ESP8266 and TX to RX). It's time to armour our soldier!
- opening Arduino IDE (which my version is 1.6.9)
- select Tools - > Board - > Generic ESP8266 Module.
- select Tools - > Port - > select a suitable serial port.
- select File - > Examples - > ESP8266 - > Blink.
- click Upload.
(try to leave other configurations be default, I don't set any of them).
Probably, you can't upload the sketch yet, you may encounter some error messages like below:
warning: espcomm_sync failed <p>error: espcomm_open failed</p>
This is the way I solved this problem:
- ensuring you get enough voltage above 3.3V.
- ensuring you get enough current above 200mA.
- ensuring ESP8266-01 GPIO 0 connected to Ground.
- Turn the ESP8266-01 power off and on then upload it again.
If the sketch upload completed the built-in led which is Blue will blink.
Step 3: Down Into the Wonderland
We are almost in the door of wonderland, let's down into the rabbit hole right now.
A picture worth thousand words, I upload more than one, so it's worth tons of words : - >.
GND | GND
GPIO2 | DHT11 data pin
GPIO0 | -
TX | -
RX | -
CH_PD | 3.3V
VCC | 3.3V
RST | -
Just four pins, that's all you need to wire up, now upload the sketch I uploaded or your sketch,test the result.
Step 4: In the End
I don't mention how to create a channel of ThingSpeak, you can easily google it. This is my first Instructable, I offer my apology for my bad grammar and misspelling, I'm glad hear your reply and correct my mistakes, leave your comments and advices. I hope you will enjoying it and stay in creative! : - >
- My Temperature and Humidity ThingSpeak Channel
- The Project source code in GitHub
- How to: battery powered temperature and humidity sensors
- ESP8266 Datasheet
- DHT11 Tutorial
- ESP8266 using POST method to upload data to ThingSpeak
- ESP8266 Deep Sleep Mode
- Uploading Sketch to ESP8266
- ESP8266 deep sleep mode.