Introduction: Mini Weather Station Using Arduino and ThingSpeak

About: I am a student of Bachelors of Engineering in Computer Science. I am very passionate to explore new technology and continuously keeps working on some cool projects.

Hello all. In this Instructable, I will be guiding you through the steps to make a personalized mini weather station. Also, we will be using the ThingSpeak API to upload our weather data to their servers, or else what is the purpose of a weather station if we even can't keep track of our weather data. You can build it for your school/college projects or for your personal interests, that's completely up to you. So let's start.

First and foremost, we need the following items ready before we start building our mini weather station. For pin references, you can check images in this section of the instructable.

Supplies

Arduino Uno R3

ESP8266 WiFi module

BMP180 Barometric Pressure sensor

FC37 rain sensor

DHT22 Temperature and Humidity sensor

Jumper wires and power supply

ThingSpeak account

Arduino IDE

Step 1: Creating and Setting Up ThingSpeak Account

1. For creating your ThingSpeak account, go to this link.

2. If you already have an account then Sign in otherwise create a new account.

3. Once you are in your dashboard, click on 'New Channel' to create a new channel.

4. Enter the channel name of your choice in the 'Name' field.

5. Check the first four fields and name them 'Temperature', 'Humidity', 'Barometric Pressure', and 'Rain' respectively. Leave other fields empty as we don't need them for this project. Hit the 'save' button at the bottom.

6. Now you will be taken to the channel screen. Click on the 'API Keys' tab.

7. You will see Write API key and Read API key. For this project, we are interested in the Write API key. Note this key down as we will need it later.

(For reference, see the images of this section numbered from 1 to 3)

Step 2: Connections

This is a very important and crucial step. Make the connections carefully as sensors are sensitive to power supplies. If excess voltage is provided, sensors may permanently damage. For convenience, check the image of this section. It contains all the connections.

BMP180 ------> Arduino Uno R3
SDA PIN ----> A4

SCL PIN ----> A5

GND ----> GND

3V0 ----> 3.3V

DHT22 -------------> Arduino Uno R3

1st PIN (VCC) ------------> 5V Power Supply

2nd PIN (DATA) ----------> D4

3rd PIN (NC) -----------> NOT USED

4th PIN (GND) -----------> GND

Rain sensor connections (rain sensor comes with a sensing panel)

I) Rain Sensor -------------> Arduino UNO R3:

VCC -------------> 5V Power Supply Pin

A0 -------------> A1

D0 -------------> D7

GND -------------> GND

II) Rain sensor ----------------> Sensing panel

+ve terminal ---------------> +

-ve terminal ---------------> -

ESP8266 --------------------> Arduino Uno R3

RX --------------------> D3

TX ---------------------> D2

VCC & CH_EN ---------------------> 3.3V

GND ---------------------> GND

Notes: *3rd pin of DHT is unused.

*Cross-check the connection of power and ground pins of each sensor with the Arduino board.

*Your BMP180 may or may not have 5 pins. That is because it has one pin for +5v supply and another for +3.3V. If you have only one, just connect the power pin to +3.3V

Step 3: Code and Final Steps

1. In the first step, you noted down the Write API key from ThingSpeak. Assign that key as a value to my API variable in the code.

2. Enter your WiFi SSID (name of your wifi connection) and password in mySSID and myPWD variables in the code.

3. Click the verify button to confirm that code is running properly.

4. Upload the code. Also, I suggest removing pins that are providing power to the sensors (3.3V and 5v) before uploading the code and re-connecting them after successful upload to the Arduino board.

*Note: Before compiling the code, you might need to download and install the libraries that I have used. Download them from following links

DHT library

BMP180 library

After downloading, install them by going to Sketch -> Include Library -> Add .Zip Library... in your Arduino IDE.

*You can search included libraries on google also.

Step 4: Video

Special Note: I built this project a year ago. When I recorded this video on the publishing date of this Instructable, I found out that my BMP sensor was broked. So I had to comment out BMP code and removed the pressure field from ThingSpeak. But the BMP code should be working fine as long as you have a working BMP sensor unlike me. Plus, I had checked a month ago and it was working fine. Thanks.

Build a Tool Contest

Participated in the
Build a Tool Contest