CYBER MONDAY SALE - Get 15% off! Use the code CYBERMONDAY15 on checkout *some restrictions apply.
The Raspberry Pi and Beaglebone Black include support for Python, which makes it easy to get access to a lot of low-level hardware and software stacks -- USB, TCP/IP, multiple file systems etc. This is a good thing since it means you don't need to wrap your head around all the obscure details that go along with these complex stacks or the implementation details of various serial buses: you can focus on getting your data off your sensor and into your project as quickly as possible. Hurray for abstraction!

Most sensors tend to communicate with other devices based on one of three well-defined mechanisms: I2C, SPI or good old analog output. There are dozens of other serial buses and communication protocols out there (CAN, 1-Wire, etc.), and they all have their strengths and weaknesses, but I2C, SPI and analog cover the overwhelming majority of sensors you're likely to hook up to your development board.

I2C is a particularly useful bus with the for two main reasons:
  • It only requires two shared lines: SCL for the clock signal, and SDA for the bi-direction data transfers.
  • Each I2C device uses a unique 7-bit address, meaning you can have more than 120 unique I2C devices sharing the bus, and you can freely communicate with them one at a time on an as-needed basis.
This tutorial will show you how you can read data from the I2C-based BMP085 or BMP180 Barometric Pressure Sensor using Python on a Raspberry Pi or Beaglebone Black.

A Note on Distributions

Please note for the Raspberry Pi that this tutorial is based on Occidentalis, Adafruit's own educational Linux distro for Pi. It should work just as well with the latest Wheezy distro, etc., but it hasn't yet been tested on anything else.

For the Beaglebone Black this tutorial is based on the Debian distribution that's shipping with recent Beaglebone Black boards. If you're using an older Beaglebone Black with the Angstrom distribution it's highly recommended that you grab a micro SD card and load it with Debian!
Last updated on 2015-05-04 at 04.27.56 PM Published on 2012-08-14 at 01.07.18 PM