Introduction: ESP8266 With DHT11 Temperature Humidity Monitor
Hello,Creators:
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 : - >.
The Connection:
ESP8266-01|Device
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! : - >
Websites:
- 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
TODO:
- ESP8266 deep sleep mode.
19 Comments
5 years ago
Hi HelloYu
Following your instructions to configure my Esp-01
Thank you
Very Nice
6 years ago
Hi, I see ESP as being 3.3V in most places. Wouldn't you have issues with Arduino's TX and RX being 5V uploading the code to ESP ?
Another question did you remove the ATMega IC from the Arduino when you upload the code to the ESP ?
Thanks and excelente tutorial by the way!
Reply 6 years ago
I use a UART to upload my code, and don't need to remove IC.
6 years ago
And if i have already uploaded a different program in arduino, so will the program in arduino be affected due to this program of esp8266?
Reply 6 years ago
nope, I used a UART cable to upload the code to ESP8266 directly.
6 years ago
I want to ask where will be the program stored -in arduino or in esp8266?
Reply 6 years ago
in esp8266
6 years ago
Hi, great project !
Like you I'm also trying to lean a bit more about the ESP8266. So, I was wondering if its possibble to use this to control a relay, that will turn on a heater. I would like to control a heater over the web and this would be perfect if it can be adapted, is this possible ?
Thanx
Reply 6 years ago
Absolutely Yes! and recently I search the materials that talk about how to use websockets communicate with esp8266 and web app.
6 years ago
Awesome instructable! Trying to get started with ESP8266 modules at the moment, so I'll try it out. Regarding the dual capacitors, they definitely help ensure a cleaner DC output, especially by "filtering" any fluctuations in the supply voltage.
Reply 6 years ago
:->
6 years ago
I connected USB - TTL converter to ESP8266 for fusing code. But error is coming in downloading code into the board. How to run the three files you shared? (.ino, .ino and .fzz)
Reply 6 years ago
The source code files should be same folder, and it seems you didn't import DHT library yet.
Reply 6 years ago
Author: please see the above images of error. please reply.
6 years ago
in your sketches you seem to do a call to uploadDataToThingSpeak , however I cant seem to find that routine defined in any of your sketches
Reply 6 years ago
I checked out my sketch, the function is in the Connection sketch.
Reply 6 years ago
I must have missed it there. Ok tnx
6 years ago
Cool sensor design. Something like this would be perfect for monitoring house plants.
Reply 6 years ago
Thank you : - >