Arduino Yun compatibility with bmp180

I recently purchased the Arduino Yun and the BMP180 Barometric Pressure/Temperature/Altitude Sensor ( from Adafruit and was hoping to log some data and possibly push the data up to the cloud somewhere (TBD). However, I’m having trouble getting the sensor to work with the Yun. I’ve modified the code from the example given on the adafruit site for this sensor. The original code uses a Serial object to write data to the serial monitor. However, from what I understand, that isn’t possible since I’m using Yun and connnected to it wirelessly. So instead, I’m using the Console object. When using the non-modified code from adafruit and instead connecting the sensor to an Arduino Uno, the sensor works perfectly. But when using my modified code on the Yun, it appears to get stuck when trying to check if the bmp sensor is running ( at this line: if(!bmp.begin())). Any thoughts? I’m probably overlooking the obvious. Here’s my code:

#include <Wire.h>
#include <Adafruit_Sensor.h>
#include <Adafruit_BMP085_U.h>
#include <Console.h>

/* This driver uses the Adafruit unified sensor library (Adafruit_Sensor),
   which provides a common 'type' for sensor data and some helper functions.
   To use this driver you will also need to download the Adafruit_Sensor
   library and include it in your libraries folder.

   You should also assign a unique ID to this sensor for use with
   the Adafruit Sensor API so that you can identify this particular
   sensor in any data logs, etc.  To assign a unique ID, simply
   provide an appropriate value in the constructor below (12345
   is used by default in this example).
   Connect SCL to analog 5
   Connect SDA to analog 4
   Connect VDD to 3.3V DC
   Connect GROUND to common ground
   2013/JUN/17  - Updated altitude calculations (KTOWN)
   2013/FEB/13  - First version (KTOWN)
Adafruit_BMP085_Unified bmp = Adafruit_BMP085_Unified(10085);

    Displays some basic information on this sensor from the unified
    sensor API sensor_t type (see Adafruit_Sensor for more information)
void displaySensorDetails(void)
  sensor_t sensor;
  Console.print  ("Sensor:       "); Console.println(;
  Console.print  ("Driver Ver:   "); Console.println(sensor.version);
  Console.print  ("Unique ID:    "); Console.println(sensor.sensor_id);
  Console.print  ("Max Value:    "); Console.print(sensor.max_value); Console.println(" hPa");
  Console.print  ("Min Value:    "); Console.print(sensor.min_value); Console.println(" hPa");
  Console.print  ("Resolution:   "); Console.print(sensor.resolution); Console.println(" hPa");  

    Arduino setup function (automatically called at startup)
void setup(void) 
  while (!Console){
    ; // wait for Console port to connect.
  Console.println("Pressure Sensor Test"); Console.println("");
  /* Initialise the sensor */
    /* There was a problem detecting the BMP085 ... check your connections */
    Console.print("Ooops, no BMP085 detected ... Check your wiring or I2C ADDR!");
  /* Display some basic information on this sensor */

    Arduino loop function, called once 'setup' is complete (your own code
    should go here)
void loop(void) 
  /* Get a new sensor event */ 
  sensors_event_t event;
  /* Display the results (barometric pressure is measure in hPa) */
  if (event.pressure)
    /* Display atmospheric pressue in hPa */
    Console.print("Pressure:    ");
    Console.println(" hPa");
    /* Calculating altitude with reasonable accuracy requires pressure    *
     * sea level pressure for your position at the moment the data is     *
     * converted, as well as the ambient temperature in degress           *
     * celcius.  If you don't have these values, a 'generic' value of     *
     * 1013.25 hPa can be used (defined as SENSORS_PRESSURE_SEALEVELHPA   *
     * in sensors.h), but this isn't ideal and will give variable         *
     * results from one day to the next.                                  *
     *                                                                    *
     * You can usually find the current SLP value by looking at weather   *
     * websites or from environmental information centers near any major  *
     * airport.                                                           *
     *                                                                    *
     * For example, for Paris, France you can check the current mean      *
     * pressure and sea level at:                   */
    /* First we get the current temperature from the BMP085 */
    float temperature;
    Console.print("Temperature: ");
    Console.print(" C/");
    Console.print(((1.8)*temperature) + 32);
    Console.println(" F");

    /* Then convert the atmospheric pressure, SLP and temp to altitude    */
    /* Update this next line with the current SLP for better results      */
    float seaLevelPressure = SENSORS_PRESSURE_SEALEVELHPA;
    Console.print("Altitude:    "); 
    Console.print(" m/");
                                        temperature) * 3.28084)); 
    Console.println(" Ft");

    Console.println("Sensor error");


I found the answer on another post. The SCL pin on the Yun goes to pin 3 and the SDA pin goes to pin2. This is different from the Arduino Uno, which the original sketch was based on.

Helpful forum post

Board details

Thanks, benddennis

Hi, I tried your code but it didn't work for me, the serial gets stuck on "Pressure sensor test". Have made other changes to make it work? I would very much appreciate if you could confirm the code and the Pin position of the BMP805. thanks! olivier