The WeatherProject

A simple project has run into that infamous scope-creep but in a good way. To that end, I decided to take the little bits and pieces I have scattered on the web and condenses them into one place, a domain I have had sitting around just looking for a purpose and these does seem to be at great one.

 

Arduino Basic Indoor Weather Station

This project is for a basic, Arduino based, weather monitoring station. While this project is for indoor use only, one could easily find an appropriate weather proof case; and using battiers or solar power with wireless place it outside. This kit is meant as an introduction to the Arduino platform, using sensors, and a door to a fun world.

Parts needed:

1 x Arduino Uno clone
1 x 25cm micro USB data cable
1 x DHT22 sensor
1 x BMP280 sensor
1 x 5110 84×48 LCD screen
xx x Male to Female Jumper Cables
xx xx Female to female Jumper Cables
2 x 10k resistors – for sensors
1 x 470Ohm resistor – for LCD

Software needed:

Arduino IDE 1.6.x Various Libraries, find links in the docs.

Let’s get started!

The order of the parts listed below are the order I wired up and tested each part. It makes trouble shooting easier to take each component, wire it up, install the library, load a test sketch, and make sure it works. Nothing is more frustrating than plugging in 14 wires and nothing happening.

Be sure and check your connections. I will admit to pulling an oops and damaging a component by not paying attention to where those pesky Vcc and ground wires were going. If you have issues, check your wiring first. If you have a multimeter, you can also make sure you have continuity and expected voltages.

The DHT22

DHT22 Pins Arduino Pins
1 – Vcc 5v
2 – Signal + 10k 2
3 – Open Open
4 – Gnd Ground

The DHT22 is a low-cost, but accurate, digital temperature and humidity sensor. It has a captive humidity sensor and a thermistor for reading the ambient temperature. It is 3-6v tolerant for both the Vcc (power in) and digital signal line (pin 2). The pins are 1 -4, left to right, looking at the front (the grill side).

Arduino pin 2 is used in this sketch, but any other pin could be used.

Here is a link to the DHT22 datasheet.

The BMP280

BMP280 Pins Arduino Pins
Vcc 5v
Gnd Ground
SCL A5
SDA A4
CSB Open
SD0 High – 0x76
Low – 0x77

The BMP280 is a barometric pressure and temperature sensor. It is a sensor with great accuracy. In fact with a little work one can obtain an altimeter reading within +/- 1M the sensors are so accurate. (I haven’t tested that claim yet) It communicates with the Arduino via the I2C interface. The address must be set either high or low as if it is left at default it won’t work. To set the address high (0x76) use a 10k resistor and connect it to power. If you connect it to ground in the same fashion it will use the low address (0x77).

A good troubleshooting tool to use when first working with I2C is an I2C Scanner. There is a copy of it in my github. I have started a cheatsheet list of the devices I have and what addresses they have. Each time I get a new one I will run it against i2c to make sure it works and see what address to use. 

Here is a link to the BMP280 datasheet.

And here is the link to the BME280 library used here.

The LCD

LCD Pin Arduino Pin
1 – RST 12
2 – CE 11
3 – DC 10
4 – Dir 9
5 -Clk 8
6 – Vcc 3.3v
7 – BL 7 – with 470Ohm resistor
8 – GND Ground

The LCD is based on the old Nokia 5110 LCD screen used in their past phones. It is a decent sreen and easy to find. Its’ display is 48 rows by 84 columns. It has a PCD8544 controller used for all LCD functions. This model uses SPI for its communication with the Arduino. There are other ones out there that use the I2C protocol which only requires 4 pins. There are some different libraries out there too. I used xxx in this project. The basic functions are well-documented and they also have an additional library with graphical functions.

To Do:
Keeping some historical data and being able to graph them over time is a good additional project. One could store the data on an SD card or rely it via wireless. There is a section of code that shows how to output data in a CVS format for later analysis. 

The library used is located here.

Code it up

As of this writing the lastest version of the sketch is 0.6. Check back for updated versions. I have tried to comment the code to make it easy to follow. I know that good comments make it easier to follow along what is happening. And when one is learning this is a good thing.

Launch the Arduino IDE, open up the sketch Weather0.6.ino found in this github. From the Tools, make sure you are working with the right board, both model and serial port used. A quick verify and compile, then upload. If you have not used the Arduino IDE before there are several great tutorials out there. Here is a good starting point for the first timers, head to this Instructable. Launch the Arduino IDE, open the weather sketch.

© 2016, wrightmac. All rights reserved.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.