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 quit 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:

  1. AMS1117 Voltage Regulator (It is very very very cheap in my country ;-] ).
  2. 0.1uF ceramic capacitor.
  3. 100uF tantalum electrolytic capacitor.
  4. 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!

  1. opening Arduino IDE (which my version is 1.6.9)
  2. select Tools - > Board - > Generic ESP8266 Module.
  3. select Tools - > Port - > select a suitable serial port.
  4. select File - > Examples - > ESP8266 - > Blink.
  5. 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:

  1. ensuring you get enough voltage above 3.3V.
  2. ensuring you get enough current above 200mA.
  3. ensuring ESP8266-01 GPIO 0 connected to Ground.
  4. 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:

TODO:

  1. ESP8266 deep sleep mode.

Comments

author
NicolasQ5 (author)2017-02-18

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!

author
HelloYu (author)NicolasQ52017-02-19

I use a UART to upload my code, and don't need to remove IC.

author
FarheenS2 (author)2017-02-01

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?

author
HelloYu (author)FarheenS22017-02-02

nope, I used a UART cable to upload the code to ESP8266 directly.

author
FarheenS2 (author)2017-02-01

I want to ask where will be the program stored -in arduino or in esp8266?

author
HelloYu (author)FarheenS22017-02-01

in esp8266

author
lodgemoorlad (author)2017-01-03

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

author
HelloYu (author)lodgemoorlad2017-01-03

Absolutely Yes! and recently I search the materials that talk about how to use websockets communicate with esp8266 and web app.

author
Mercurion925 (author)2016-12-06

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.

author
HelloYu (author)Mercurion9252016-12-06

:->

author
DILONTRONICS (author)2016-11-18

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)

file1.pngfile2.png
author
HelloYu (author)DILONTRONICS2016-11-20

The source code files should be same folder, and it seems you didn't import DHT library yet.

author

Author: please see the above images of error. please reply.

author
diy_bloke (author)2016-09-17

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

author
HelloYu (author)diy_bloke2016-09-17

I checked out my sketch, the function is in the Connection sketch.

author
diy_bloke (author)HelloYu2016-09-18

I must have missed it there. Ok tnx

author
DIY Hacks and How Tos (author)2016-09-03

Cool sensor design. Something like this would be perfect for monitoring house plants.

author

Thank you : - >