Search code examples
javaandroidandroid-sensorsandroid-things

BMP280 ServiceSpecificException: I/O error (code 5)


I try to use AndroidThings to measure temperature with Raspberry Pi 3 and BMP280.

enter image description here

3,3V i have choosed because of specification of BMP280:

To power the board, give it the same power as the logic level of your microcontroller

Then i want to initialize sensor

mTemperatureSensorDriver = new Bmx280SensorDriver("I2C1");

And by execution i receive following exeption

Error configuring sensor
    com.google.android.things.pio.PioException: android.os.ServiceSpecificException: I/O error (code 5)
    at com.google.android.things.pio.I2cDeviceImpl.readRegByte(I2cDeviceImpl.java:81)
    at com.google.android.things.contrib.driver.bmx280.Bmx280.connect(Bmx280.java:215)
    at com.google.android.things.contrib.driver.bmx280.Bmx280.<init>(Bmx280.java:193)
    at com.google.android.things.contrib.driver.bmx280.Bmx280.<init>(Bmx280.java:180)
    at com.google.android.things.contrib.driver.bmx280.Bmx280SensorDriver.<init>(Bmx280SensorDriver.java:55)

Also by 5V Power i receive the same exception.

I have found this. But i have no idea how to check, if the BMP280 is realy connected to Raspberry with adb.

By own testing the connectivity i receive by device.readRegByte(0xD0) the same exeption.

Does it mean, that BMP280 is not correctly connected? If yes, how to correctly connect BMP280 with Raspberry?

Is some resistor needed by connection?

UPDATE

solved by soldering BMP280 with header strip.

Also to work with sensor is permission requiered that could be granded only in command line. ref

adb shell pm grant app.package com.google.android.things.permission.MANAGE_SENSOR_DRIVERS


Solution

  • To read data from IoT Device, the contact should be fixed without any loose connection.

    This could be only reached with soldering of BMP280 with header strip

    Only then the connection could be etablished