DIY Weather Station With Bluetooth
by Matej Blagšič in Circuits > Arduino
59043 Views, 472 Favorites, 0 Comments
DIY Weather Station With Bluetooth
Hello everybody.
Recently I attended a course in our University of Electrical Engineering and we were making ourselves a small weather station. It included learning about soldering, sensors and arduino. It was super fun making it with little kids and other high school kids my age. I will show you how you can build it yourself, what components do you need and explain you the code and how can you upgrade it with more sensors.
PARTS
To do this project, you will need these items:
Seeeduino v4.0 or Arduino Uno
BMP180 temperature and pressure sensor
DHT22 temperature and humidity sensor
HC-06 bluetooth module
Project case / outdoor case
Why Seeeduino V4
The main question is why did I/we choose the Seeeduino V4. If we were going for a cheap Chinese alternative, we could have gone with Funduinos or anything like that, as the Seeeduino is only a few bucks cheaper. The answer is the features. I see it as an upgrade to the Arduino Uno. It has all the features labeled with arrows. Some are subtle like the micro USB port, as many of us have smart phones that uses the same plug, option for soldering male headers parallel to female ones and the convenience of the already built in ports form I2C and serial data.
The major ones are really blessed by me. The 3.3V - 5V logic switch is priceless because so many arduino peripherals and mostly sensors work with 3.3V. I wasn't aware about this a few years ago, as 5V stood to me as a standard but really a lot of sensors work with 3.3V and the most of 5V ones can operate with that voltage without any problem. Refer to the sensors datasheet for that information.
This board will work on 3.3V great with one of our I2C sensor and the other one that operates with 5V. Also some of the bluetooth modules work with 5V, but the logic works with 3.3V. I will address this topic in the bluetooth step of this tutorial.
BMP180 I2C Temperature and Pressure Sensor
So firstly, we're going to take a look at the first sensor that is BMP180 and it is an I2C type of sensor. It works with 3.3V and NOT 5 as many of the Arduino boards. That means that the voltage supply and the communication lines work with 3.3V. This is one of the reasons why we bough the Seeeduino but more about that in the next few steps.
The whole connection to the main processing board (Arduino/Seeeduino) will be shown after the introduction of the components.
The picture also shows you the pinout of the device, so you will later know how to connect it to the rest of the circuitry later.
DHT22 Temperature and Humidity Sensor
The next sensor is the DHT22 Temperature and Humidity sensor. It works with 5V or 3.3V so it could be used in 2 different scenarios with the Seeeduino board or normal 5V Arduino Uno. The pinout is explained in the picture, but you can see, that it operates in a different way. Instead of using let's say I2C, analog output it uses digital output. For that we will need a library, that will grab the data from the sensor at the correct times and transform it to usable numbers. I will link to adafruit library for this sensor.
One thing to note is that this sensor is quite precise therefore it measures data every 2 seconds. This will be dealt with in the code, as we will be updating data every 5 seconds or less, as the ambient temperature doesn't change as fast.
The Schematic for Working With Seeeduino or Any 3.3V Operating Board
The picture shows all the connection with the sensors to the Seeeduino board. The board is V3, but just imagine that the logic switch is turned on the 3.3V. Everything connects pretty simple. BMP180 connects to the supply and the SCL to A5 and SDA to A4. DHT22 needs a pull up resistor between Vcc and data pin. Than you connect that data pin to any of the digital pins on the Seeeduino. I chose pin 2.
The code for the sensors is in down available to download. It collects data and puts in on the Serial line as you can watch it on the Serial monitor or via an Android app. The app is described in the one of the next steps.
How to Wire the Componets on a 5V Microcontroler Board
Now comes the picture as how to connect everything together on a 5V only board. The board can however supply 3.3V like Arduino Uno but the logic level is at 5V.
To do this, we are going to need level shifter/converter like this one, I bought on ebay (http://www.ebay.co.uk/itm/400953346213?_trksid=p2057872.m2749.l2649&var=670492331993&ssPageName=STRK%3AMEBIDX%3AIT)
They often address them as I2C logic switcher but that's mainly because that's the most often purpouse. However, you can only use it for small loads, as for say communication lines and not to regulate 5v to 3.3v, as it isn't designed for that.
The picture may be confusing but hold with me.
-The supply voltage for the components is 3.3V that the Uno can output
-all the communication lines including TX/RX, SCA/SCL and dataPin 2 are connected to level conveter on the LV(low voltage) part and are connected from the HV side of the converter to the Uno --> so everything like before with the level switcher in between.
Now you might be asking yourself why did I put the bluetooth module and the 5v sensor to the logic switcher as well.
I did it to simplify everything and as the lowers amount of channels of the level shifter that you can buy is around 6 or something. Anyway, you can connect the 5V sensor directly to 5V separately and the data line directly to the Uno digital pin.
THIS IS IMPORTANT
I had a bluetooth module that operated on 5V on Vcc and logic. But a lot of them have markings that it poerates on 3.6-6V on supply, but with a text "level:3.3V" .
The picture shows the back of it, so it's good to connect it all to the Vcc and it worked fine with me. If the range decreases because the Vcc is connected to 3.3V and not the minimum 3.6, you can allway connect Vcc to 5V and the logic will work on 3.3V.
The Code
At the bottom is the code that you can download. It's output should look like on the picture. The code also has variables at the beginning of it to calibrate the sensor if any offset is recorded. Note that sensors accuracy can vary at a different range. DHT22 for example is an upgrade to DHT11 with better accuracy thru out the range
Here are also the links to the libraries for both sensors: Just click "Download Zip" and extract it into your libraries folder
BMP180
DHT library is universal for all DHT type sensors, and you define the version in the code.
I almost forgot the app. It's called Bluetooth terminal and it's great as the whole screen is dedicated to showing serial data and sending it on the bottom. The picture shows the app on Google play and the inside of the app.
Downloads
Conclusion
Thank you for watching my instructable. I hope that you make it work and if you have any question about the project and something is not working, be sure to leave a comment below or on private message.
If anyone is interested how I put it all in the case, make sure you leave a comment on that one :)
I will do it with ESP8266 module in the future, as my instructable about it is quite popular, so look for that one soon.
ESP8266 tutorial