A while back we did a tutorial using the IC Station BMP085 Barometric Pressure Sensor. We wanted to do another tutorial using the newer BMP180, and the latest Unified Sensor Drivers from Adafruit. Another twist? We are using the Arduino Micro, which uses the Atmel ATmega32u4 like the Leonardo, instead of the ATmega328p like the UNO.
First, let’s talk about the BMP180. You will need to solder the included header to the board. There are 5 pins, of which only 4 are needed. there is a VCC pin for 5v operation, or a 3.3 pin for 3.3v operation. GND connects to Arduino GND, SCL connects to Arduino SCL (A5), and SDA which connects to Arduino SDA (A4).
Become the Maker you were born to be. Try Arduino Academy for FREE!
You will need to download and import two libraries (using the Arduino Sketch, Import Library, Add Library menu sequence). Those libraries are:
Adafruit Sensor
Adafruit BMP085 Unified
The code for a BMP085 and a BMP180 is identical. The BMP180 is a smaller, cheaper version of the older BMP085.
There is a example sketch on the File, Examples, Adafruit BMP085 menu called sensorapi. Load that into your IDE.
Because we are using the Arduino Micro, there is a small change that we have to make. This concerns the Leonardo as well. These units use the ATmega32u4 which not only is the processor, but is also the USB interface. As such, a reset not only resets the processor, but also resets the USB connection. We have to add a small delay after Serial.begin, or nothing in the Setup() will get printed to the serial monitor.
Serial.begin(9600);
while (!Serial) ; //needed for leonardo and micro
So, now that we have connected, and opened the example sketch, make sure you have chosen the correct board and port on the tools menu, go ahead and upload the sketch. When it says done uploading, open your Serial Monitor, and you should see something like the following:
Notice all the values are in metric (SI). I prefer US Customary (Standard) units myself, so I will probably add some conversion code to the units.