loading

In this instructable, we are going to learn how to build a distant weather monitoring system using arduino , esp8266 and ThingSpeak. Arduino calculates the temperature and humidity in your home . ESP2866 acts as a web-server that transmits this information to the internet. ThingSpeak is an open source “Internet of Things” application and API to store and retrieve data from things using HTTP over the Internet or via a Local Area Network. With ThingSpeak, the user can create sensor logging applications, location tracking applications, and a social network of things with status updates. We use ThingsSpeak to collect and monitor the weather information from Arduino.

Step 1: Components Needed

1) Arduino Mega 2560

2) ESP8266 Wi-Fi Module

3) DHT11 Temperature-Humidity Sensor

Step 2: Create an Account in ThingSpeak

## go to https://thingspeak.com/ , sign up , login , create a channel named weather station or any other name and create two fields in it ( temperature , humidity). Channel is like the Project and fields are various parameters of the project which you want to monitor.

## go to my channels , click on your channel , go to API Keys , note down the "WriteAPIKey" somewhere. That's the unique key associated with your channel. We will be using it in code later on.

For more info on how to create channel , go to - https://in.mathworks.com/help/thingspeak/getting-started-with-thingspeak.html?requestedDomain=www.mathworks.com

Step 3: Setting Up ESP8266

Next we are going to see how to setup ESP8266 Wi-Fi Module. The module costs less than 5$ and hence a pretty good choice for our project. Follow the below steps in order.

1) Note that we are going to use a separate 3.3V supply for ESP8266. Do not use 5V supply and Do not use 3.3V supply from MEGA.

2) Connect ESP8266 with Arduino MEGA as shown in the figure.

3) Be careful about the connection between RX of ESP8266 and TX of MEGA. We implement this Resistive Divider because the logic high level of TX of MEGA is 5V. We have to bring it down 3.3V for our ESP8266. Otherwise ESP8266 chip burns off !!

4) Make sure that the GND of MEGA , GND of 3.3V Supply , GND of ESP8266 are all common grounded.

5) Power ON MEGA and ESP8266.

6) Check if BLUE LED of ESP8266 blinked 2-3 times quickly and went OFF. Check if the RED LED lighted up and stays ON. if it does, your ESP8266 chip is working fine. Good for you ! ;-)

7) If the BLUE LED didnt blink or if it stays ON, Hang on ! your firmware may be corrupt and you will need to re-flash the firmware of ESP8266. ;-(

8) To know how to flash ESP8266 , download the attachments and check the following link :

https://www.instructables.com/id/Intro-Esp-8266-firmware-update/

Step 4: Testing ESP8266

After successfully setting up ESP8266, we now proceed to test it. Main aim of this step is to find the baudrate of your ESP8266 and test if it properly accepts AT commands.

1) Note that in MEGA , we have 4 serial ports. We are gonna use pins 16,17 (TX,RX) of MEGA.

2) Wire up the circuit as mentioned in previous step.

3) Upload ESP8266_test_MEGA.ino.

4) Refer to the attached PDF to find various AT commands.

5) Input 'AT' and check if you get OK as response.

6) If you get junk response, make sure your serial monitor is set to the same baud rate as in the program(115200).

7) If you still dont get an OK response, it might be because the baudrate of your ESP8266 is not 115200. Change the baudrate to 9600,19200,57600 in the program and upload again. Check the response for each baudrate. You should get an OK response for one of the baudrates.

8) In most cases the baudrate will be 115200. If its 9600, then you can implement this project it in UNO also, using software serial. If its above 9600, then you will need MEGA itself, because UNO's software serial is limited to 9600. In MEGA we can use the hardware serial itself for baudrates upto 115200.

9) Connect your ESP8266 to home-wifi using AT+CWJAP= command. Check the format in the attached PDF.

10) If you successfully connected ESP8266 to the home-wifi, then proceed to next step.

Step 5: Wiring Up the Main Circuit

-- Wire up the circuit as in the figure.

-- The final code , Thingspeak_final_code.ino and DHT11 library have been attached here.

-- Make a note that the baudrate for ESP8266 in the code is 115200. If it differs for your ESP8266, change it in the code accordingly.

-- If you are using UNO at baudrate 9600, replace "Serial2" in the code with software serial and wire the circuit accordingly.

-- Don't forget to edit your APIKey for the channel in the code.

-- Finally upload the .ino file attached to this and check serial monitor, if properly working.

-- Now login to ThingSpeak and check your channel :) ! There you go ! you can now see real time plotting of temperature and humidity in ur computer screen. Access the weather info of your home from anywhere around the world ! Enjoy ;-)

For queries, clarifications, leave comment below or mail - iammituraj@gmail.com

About This Instructable

1,360views

13favorites

License:

More by AmCoder:Distant Weather Monitoring Using Arduino and ESP8266 Design of UART in VHDL Setting up Raspberry Pi 3 
Add instructable to: