Accessing the altimeter/pressure sensor from the Arduino IDE

The following are the steps associated with connecting this device to Arduino:

  1. The first step in accessing the device is to download the appropriate library. Here, you have a choice. You can use the library described in the Connecting an accelerometer/gyro to Arduino section, or you can download a library just for this device. The library supplied for the accelerometer/gyro is a more general library designed to communicate with many different I2C devices. The library for this device supports only this device. If you want to download the library for this device, go to www.sainsmart.com/sainsmart-bmp085-digital-pressure-sensor-module-board.html and select the Download Link selection at the bottom of the link. This will download a .rar file that will include an example sketch. I personally prefer to use the I2C library version; it is more up to date, so I will follow that example here.
  2. Open the example by navigating to File | Examples | BMP085 | Examples | BMP085_basic, as shown in the following screenshot:
    Accessing the altimeter/pressure sensor from the Arduino IDE
  3. You should now set the Serial Monitor baud rate to 38400 if you haven't already done so, as this is the baud rate set by the example program. Now, you can upload the sketch of Arduino, and when you open the Serial Monitor, you should see something similar to the following screenshot:
    Accessing the altimeter/pressure sensor from the Arduino IDE

You can see not only the altitude, but the temperature and pressure as well. Now, this altitude is not an absolute value, but a relative one. It will change with a change in weather, as the barometric pressure is dependent on weather pattern changes. This particular reading is, therefore, really only useful when you want to measure the relative changes in altitude, for example, when you want to know how far your flying project has either gone up or done from a reference position.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
13.59.200.206