So, you want to build your own weather station and you don’t know where to begin?
The BMP180 (Barometric Pressure) is the perfect component to start with! This sensor will enable you to measure not only air pressure but also since air pressure varies with altitude, you can also measure that! And that’s not all! There’s also a temperature sensor included to provide even more information about the weather. Cool, right?
Why is it useful to measure barometric pressure?
The standard pressure at sea level is 101 325 pascals (the unit for pressure). The pressure decreases with height, so you can use this to determine the altitude. Temperature and humidity also affect the pressure. This way you can use this sensor to measure changes in pressure and predict the weather. Generally, increasing pressure indicates stable and often sunny weather and decreasing pressure indicates chances for rain and cloudy skies.
In this tutorial, you’ll learn how to use the GY-68 BMP180 breakout board for Arduino and hopefully after, combine it with more sensors and create your own weather station.
For this tutorial you will need:
Step 1: Solder the Header Pins
The first task will be to solder the pins to the through-holes (you can also use wires instead of the header pins). Make sure you have good alignment, it will be easier to connect your Arduino board to the sensor.
If you have trouble soldering the header pins onto the sensor, you can plug the long part of the header into a breadboard. It will support the sensor while you solder.
If you don't know how to solder, look around on Instructables, you're guaranteed to find an excellent guide!
Step 2: Connect the Sensor to Arduino
When you’re done soldering, here’s what to connect:
This sensor uses I2C protocol: Only two wires (Serial Clock and Serial Data) are required for communication between the devices so it’s easy to connect the sensor to the Arduino board. The BMP180 uses 3V3 so make sure you don’t connect it to 5V or it will damage the sensor.
BMP180 > Arduino Uno
VIN > 3V3
GND > GND
SCL > A5
SDA > A4
Step 3: Upload Your Code and Run It
Upload the code:
- Connect your Arduino device to the computer using a USB cable
- Open your Arduino IDE (Install the IDE if you haven’t already at www.arduino.cc/en/Main/Software)
- Verify that you have the correct board selected under Tools > Board
- Verify you have the correct COM Port selected under Tools > Port
Install the Arduino library (We use the same library and the same code for the BMP180 as we do for the BMP085). The BMP180 is the new version of the sensor (smaller and cheaper).
- Download the Adafruit BMP085 Library as a .zip file
- Import the Adafruit BMP085 Library
- In the Arduino IDE, go to Sketch > Include Library > Add .zip library
- Choose the file that you just downloaded
- You should see that the library was added successfully
- Follow the same steps for the Arduino Sensor Library
- In Arduino IDE, navigate to File > Examples > Adafruit BMP085 > sensorapi
- Upload the code and enjoy!
The picture above is what you should obtain on your serial monitor (Make sure you chose the right baud rate: 9600). The pressure is in hectoPascals (1 hPa = 100 Pa).
To use this sensor to its full potential, keep it dry, under ambient light and air, and don’t expose it to rapid temperature changes
Now you’ve learned successfully how to use this barometric sensor, you can start building your own weather station with a raindrop sensor or even a soil humidity sensor, for example, and you will always be one step ahead of the bad weather!