Introduction: Arduino UNO Mini-Weather Station

This is the first generation of my Arduino based mini-weather station with wi-fi connection, which is able to post data publicly online using ThingSpeak platform.

The weather station collects the following data related to the weather and environment using different sensors:

  • Temperature;
  • Humidity;
  • Atmospheric pressure;
  • Light intensity;
  • UV index;
  • Dust concentration.

The aim is to make a small and simple weather station, using open hardware.

Let's get start and have fun!

Step 1: Electronic Components

For this project you'll need the following components:

  1. Arduino Uno (buy)
  2. Grove light sensor (buy)
  3. Grove UV sensor (buy)
  4. Barometric pressure sensor (BMP085) (buy)
  5. DHT22 (buy)
  6. Grove dust sensor (buy)
  7. ESP8266 (buy)
  8. Protoshield (for a more compact version) or an ordinary breadboard (buy / buy)
  9. 1 kohm resistor (x2)
  10. 10 kohm resistor (x1)
  11. 4k7 ohm resistor (x1)
  12. Some jumper wires
  13. A computer (for compiling and uploading Arduino code)

You won't need specific tools for the assembly of this project. All the components can be found online on your favourite e-commerce store.

The circuit is powered by the USB port (connected to a computer or a ordinary phone charger), but you may also add an external DC power supply or a battery connected to the Arduino power jack.

A case for the weather station circuit is out of the scope of this project.

Step 2: Connecting the Parts

Connect all the componets according to the schematic. You'll need some jumper wires to connect each sensor to the breadboard. You might use a protoshield (for a more compact circuit), an ordinary breadboard, or design you own Arduino shield.

Plug the USB cable to the Arduino Uno board and proceed to the next step.

Step 3: Coding

Assuming you have already installed the latest Arduino IDE, download and install the following libraries:

DHT22 library:

https://github.com/adafruit/DHT-sensor-library

Adafruit BMP085 library:

https://github.com/adafruit/Adafruit-BMP085-Library

For instructions on how to add the libraries to Arduino IDE, check the following Arduino guide:

https://www.arduino.cc/en/Guide/Libraries

Download Arduino code (weatherBox.ino). Replace XXXXX by your wifi router SSID YYYYY by router password and ZZZZZ by your ThingSpeak channel write API key (see how to obtain it on next step).

Connect the Arduino board to your computer USB port and upload the code.

Step 4: ThingSpeak Configuration

  1. Create a ThingSpeak account;
  2. Create a new Channel;
  3. Specify the name and description of your weather station. Assign the following channels and save the channel:
    • channel 1 = light
    • channel 2 = humidity
    • channel 3 = temperature (from DHT22)
    • channel 4 = UV index
    • channel 5 = dust concentration
    • channel 6 = pressure
    • channel 7 = temperature (from BMP085)
  4. Copy API write key. It is used in the previous step in Arduino code;
  5. When the station is turned on, sensor values will be uploaded to the channel periodically. You may configure public and private visualizations of each variable.

Example of a public channel: https://thingspeak.com/channels/35540

Step 5: Using Android App

You'll be able to visualize weather station data in any browser. But you might also check it on you Android based smartphone and visualize it whenever you want.

  1. Download and install ThingsView app from Google Play store on your Android device;
  2. On the app, insert your channel ID number and click add. You'll find the ID on your ThingSpeak channel configuration;
  3. The current values of each variable will be displayed in a graph;
  4. Have fun!

Comments

author
bsangeeth (author)2017-06-23

Hi Igor,

please help me to get rid of theses errors.

WARNING: Spurious .github folder in 'Adafruit BMP085 Library' library

WARNING: Spurious .github folder in 'DHT sensor library' library

C:\Users\sangeeth\Downloads\weatherbox_ino\weatherbox_ino.ino:6:31: fatal error: Adafruit_BMP085_U.h: No such file or directory

#include <Adafruit_BMP085_U.h>

^

compilation terminated.

Multiple libraries were found for "DHT.h"

Used: C:\Users\sangeeth\Documents\Arduino\libraries\DHT_sensor_library

Not used: C:\Users\sangeeth\Documents\Arduino\libraries\DHT-sensor-library-master

exit status 1

Error compiling for board Arduino/Genuino Uno.

author
IgorF2 (author)bsangeeth2017-06-23

Thi there!
Arduino IDE has an issue when a library folder contains a "-" on its name. Maybe it's not compiling due to the "DHT-sensor-library-master" library. Did you try to remove it from the libraries folder?
This way the IDE will see only the "DHT_sensor_library" folder and might compile your code.

author
АндрейБ7 (author)2017-05-17

Hi Igor.
I have a few questions about your project, please clarify:
According to the scheme it is not quite clear where the power is taken (3v or 5v +) for the light sensor, UV, dust sensor, temperature sensor;
When connecting DHT22 library, Adafruit BMP085 library when compiling the sketch, error - VHLGBXIOYPYS5O.ino: 5: 29: fatal error: Adafruit_Sensor.h: No such file or directory. When adding the library Adafruit_Sensor - error FVHLGBXIOYPYS5O: 15: error: 'dht' does not name a type
Arduino 1.8.1. Best regards Andrew.

author
IgorF2 (author)АндрейБ72017-05-25

Hi there.

There was a mistake regarding dust sensor power input, and I forgot to add a jumper between Arduino Uno 5V pin and the breadboard. I corrected it on the drawings and added a higher resolution pdf file.

All the sensors are powered from Arduino Uno 5V pin. 3.3V is only used as ESP8266 power supply.

Regarding the problems you are facing with the libraries, please verify if their folders has a hyphen in their names (DHT-sensor-library-master, for instance). If that's the case, rename the folders, removing all "-". For some reason Arduino IDE doesn't recognize folders with hyphens.

author
herneise (author)2016-12-02

hi. perfect system! congrats!

i am planning to use it for my little greenhouse :)

one question:could you tell me please, how can i add this system "a soil humidity sensor" and a lcd screen 2x16 for real time checking on board? how can we add them to code? if you not to busy, could you write this part of code please? i am still not good at coding. thanks.

author
IgorF2 (author)herneise2016-12-08

Hi there. I've never used those LCD screens. In order to add a soil humidity sensor to the Arduino code you'll have to add the following pieces of code:

- line 28:int soilPin = A2;

- line 109: float soil = analogRead(soilPin);

- line 125: String soilStr = dtostrf(soil, 4, 1, buffer);

- line 126: soilStr.replace(" ","");

- line 127: updateSensors(luminanceStr, humidityStr, temperatureStr, uvStr, dustStr, pressureStr, temperature1Str, soilStr);

- line 146: void updateSensors(String luminanceStr, String humidityStr, String temperatureStr, String uvStr, String dustStr, String pressureStr, String temperature1Str, String soilStr) {

- between lines 167 and 168:

cmd += "&field8=";

cmd += soilStr;

I hope it helps.

author
herneise (author)IgorF22016-12-08

thanks Igor. i ordered already soil humity sensor. i hope i will make.

but now i am trying to compile the original version of weather station.i am getting some errors. it is the 3th day that i can not resolve. could you help please when it will be ok for you?( thanks in advance)

"weatherboxORJINAL:14: error: 'dht' does not name a type

dht DHT;

^

weatherboxORJINAL:15: error: 'Adafruit_BMP085_Unified' does not name a type

Adafruit_BMP085_Unified bmp = Adafruit_BMP085_Unified(10085);

^

/Users/omac/Documents/Arduino/full wather station nemli/weatherboxORJINAL/weatherboxORJINAL.ino: In function 'void setup()':

weatherboxORJINAL:42: error: 'bmp' was not declared in this scope

if(!bmp.begin())

^

/Users/omac/Documents/Arduino/full wather station nemli/weatherboxORJINAL/weatherboxORJINAL.ino: In function 'void loop()':

weatherboxORJINAL:96: error: expected primary-expression before '.' token

int chk = DHT.read22(DHT22_PIN);

^

weatherboxORJINAL:97: error: expected primary-expression before '.' token

float humidity = DHT.humidity;

^

weatherboxORJINAL:98: error: expected primary-expression before '.' token

float temperature = DHT.temperature;

^

weatherboxORJINAL:101: error: 'bmp' was not declared in this scope

bmp.getEvent(&event);

^

exit status 1

'dht' does not name a type

author
IgorF2 (author)herneise2016-12-08

Did you install the libraries for the DHT22 and BMP085 sensors before compiling the code?

You can find the links for those libraries on Step 3.

author
herneise (author)IgorF22016-12-11

yes. couple of times. fist of all, iinstall libs. than i download weatherBox.ino

open it, didnt work. rewrite the "include lib " lines.

couple of times, several variations i tried.

but did not worked

author
IgorF2 (author)herneise2016-12-11

That's strange. If I remove the "#include <library_name> from my code I have the error you described above. So maybe it's an issue related to the instalation of those libraries.

Can you find those libraries if you access Sketches > Include library on the Menu? Did you try to add the libraries that way?

author
herneise (author)IgorF22016-12-11

oh God.

i made it :)

now adding the additional lines for soil humidity sensor...

author
IgorF2 (author)herneise2016-12-11

How did you solve that?

author
herneise (author)IgorF22016-12-11

thank you Igor. seems, everything is ok. i ordered the sensors.when i received them, i will make the weather station and inform you; whether i made or not.

i also planningt to order this part:

http://www.ebay.com/itm/322206596553?_trksid=p2057...

could we add this to our weather station?

i remember, you mentioned about it before. could you add this part of code to the main code :)

i would be very appreciated if you could write this part of code too.

author
IgorF2 (author)herneise2016-12-13

Yes, it's possible to add this component. I'm not sure on how to add this to the code. I think you'll have to measure the number of pulses in a given time, and from that calculate the wind speed.

author
herneise (author)IgorF22016-12-11

as you said; reinstalled them again.

the last picture is:

#include <dht.h>

#include <DHT.h>

#include <DHT_U.h>

#include <Adafruit_Sensor.h>

#include <Adafruit_BMP085.h>

#include <Adafruit_BMP085_U.h>

other variations did not worked.

author
herneise (author)IgorF22016-12-11

i reduced the errors to :

In file included from /Users/omac/Documents/Arduino/FVHLGBXIOYPYS5O/FVHLGBXIOYPYS5O.ino:6:0:

/Users/omac/Documents/Arduino/libraries/DHT-sensor-library-master/DHT_U.h:68:3: error: 'DHT' does not name a type

DHT _dht;

^

exit status 1

Error compiling for board Arduino/Genuino Uno.

no further

author
IgorF2 (author)herneise2016-12-11

I think the problem is the related to name of your library folde (DHT-sensor-library-master).

The IDE will not load files with certain characters in the
name, like dashes ('-') for instance. Replace each dash (‘-‘) with and
underscore (‘_’) and maybe it will work.

author
GeraldoR3 (author)2016-07-08

Amazing project!

author
IgorF2 (author)GeraldoR32016-12-08

Thanks!

author
RichardW16 (author)2016-12-03

Hi Igor

I'm trying to build you weather station. I'm a complete amateur at this but are there some items missing from you schematic, I can see the sensors on the photo but they are lacking in the breadboard image, I've just brought all the gear and apparently I have know idea, please can you advise. best regards R

author
IgorF2 (author)RichardW162016-12-03

Hi Richard,
Which sensors you couldn't find on the breadboard imagem? I verified it, and I think all the sensors are there (dust sensor, UV sensor, light sensor, humidity and temperature sensor, and pressure and temperature sensor). Please let me know, so that I can correct breadboard imagem.
Notice that some sensors measure more than one variable. DHT22, for instance, measures air temperature and humidity.

author
DIY Hacks and How Tos (author)2016-07-08

Cool project. I always wanted to build my own weather station

author

Thanks! Now you can build yours! :D

author
RamblinLane (author)2016-07-08

nice instructable. it would be cool to add wind speed and direction too

author
IgorF2 (author)RamblinLane2016-07-08

Thanks, RamblinLane! I'm plan to add other sensor (wind sensors and some gas sensors for instance). The problem is that wind sensors are too expensive and I haven't found cheap ones yet.

About This Instructable

5,196views

67favorites

License:

More by IgorF2:3D Printed Articulating Lamp3D Printed Tool HangerWiDC - Wi-Fi Controlled FPV Robot (with Arduino, ESP8266 and DC Motors)
Add instructable to: