Driver for Adafruit BMP280 Barometric Pressure & Temperature Sensor

Hello,
My first time ever using a BB platform. ID10T newbie.

I’m trying to use the board along with a BMP280 sensor for Pressure and Temperature.
I’m having no skill or luck with it. I’ve sprungboard off of a post showing how to implement a driver for the BMP085 which is an earlier version of the same sensor.
The link: BMP_on_the_Beagle_Bone_Black

I’ve tried the command line commands as such.

`

echo bmp280 0x77 > /sys/class/i2c-adapter/i2c-1/new_device
root@beaglebone:~# dmesg | grep bmp
[ 785.694384] i2c i2c-1: new_device: Instantiated device bmp280 at 0x77

root@beaglebone:~# cat /sys/bus/i2c/drivers/bmp280/1-0077/temp0_input
root@beaglebone:~# cat /sys/bus/i2c/drivers/bmp280/1-0077/temp0_input: No such file or directory

`
Not working as you can see.

Then I tried to modify and re-use Juan Corez example. Also, the same output. No such file or directory.

`

BMP280.js************

  • Created on: 6-12-2013
  • Revised on: 6-13-2013
  • BMP085 Author: Juan Cortez, Modified by me for the BMP280.
  • Works on: 06-08-12 image or later on both BeagleBone and BeagleBone Black
  • Reads temperature and pressure from the BMP280 Sensor
  • Input: Sensors on the BMP280 Sensor
  • Output: Outputs the readings on the console.
  • Special Instructions: Run code once as it is. You will get an error but it is OK.
  • Comment out the b.writeTextFile(bmp280…); line, save and run the code again.
    *******************************************************************************/
    var b = require(‘bonescript’);
    var bmp280= ‘/sys/class/i2c-adapter/i2c-1/’;

//Sensor Locations on the BeagleBone Black
var temperature= ‘/sys/bus/i2c/drivers/bmp280/1-0077/temp0_input’;
var pressure= ‘/sys/bus/i2c/drivers/bmp280/1-0077/pressure0_input’;

/* We will initialize the driver for the BMP280 sensor located at I2C location 0x77./
/
!NOTE!: You only have to initialize the driver once. Once you run the code once, comment out the next line. (i.e. b.writeTextFile…) /
//b.writeTextFile(bmp280 + ‘new_device’, ‘bmp280 0x77’);
/Comment out the line above after you run the code once
**********/

/* Opens,reads, and prints pressure and temperature. */
b.readTextFile(pressure, printPressure);
b.readTextFile(temperature,printTemperature);

/* Prints Pressure */
function printPressure(x) {
console.log("Pressure: “, x.data/100 + " millibar”);
}

/* Prints Temperature */
function printTemperature(x){
console.log("Temperature: “, x.data/10 + ‘\xB0’ + " Celcius”); // ‘\xB0’ is decimal in hexademical
x.data /= 10;
x.data *= 1.8;
x.data += 32;
console.log("or: “, x.data + ‘\xB0’ + " Fahrenheit”);
}

`

Could someone please gently point me in the right direction?

Thanks in advance,
Mike

Update:
I anticipate someone will want to know how the sensor is interfaced: Again, using the BMP085 as a reference for my BMP280
The actual BMP280 pinout BMP280 Pinout
the below steps snipped from this link: BMP On the Beaglebone Black

  1. Connect GND from the BMP085 to P9.1 of your BBB.
  2. Connect VIN from the BMP085 to P9.3 of your BBB.
  3. Connect SCL from the BMP085 to P9.19 of your BBB.
  4. Connect SDA from the BMP085 to P9.20 of your BBB. (NOTE: the BMP280 does not have SDA, so I’m using SDI instead)

You might want to make sure that you are using the BMP280 in I2C mode,
instead of SPI mode, as it supports both.

Before assigning a driver to it (your echo command), you can try to see
if it's actually being detected on the i2c bus and dump its registers
using the i2c tools (i2cdetect, i2cdump)

You also didn't mention what linux/kernel versions you are running.
There's support for BMP280 on newer linux kernels within the kernel iio
framework as of 2014/2015.

regards,
Nuno

Update:
I anticipate someone will want to know how the sensor is interfaced:
Again, using the BMP085 as a reference for my BMP280
The actual BMP280 pinout BMP280 Pinout
<Pinouts | Adafruit BMP280 Barometric Pressure + Temperature Sensor Breakout | Adafruit Learning System>
the below steps snipped from this link: BMP On the Beaglebone Black
<http://elinux.org/Beagleboard:BMP_on_the_Beagle_Bone_Black>

1. Connect GND from the BMP085 to P9.1 of your BBB.
2. Connect VIN from the BMP085 to P9.3 of your BBB.
3. Connect SCL from the BMP085 to P9.19 of your BBB.
4. Connect SDA from the BMP085 to P9.20 of your BBB. (NOTE: the BMP280
   does not have SDA, so I'm using SDI instead)

You might want to make sure that you are using the BMP280 in I2C mode,
instead of SPI mode, as it supports both.

Before assigning a driver to it (your echo command), you can try to see
if it's actually being detected on the i2c bus and dump its registers
using the i2c tools (i2cdetect, i2cdump)

You also didn't mention what linux/kernel versions you are running.
There's support for BMP280 on newer linux kernels within the kernel iio
framework as of 2014/2015.

The kernel outputs to its own log rather than your terminal. Use 'dmesg' to report the kernel response after your attempt to load the driver.

Getting back to this after some days…
I imagine the difference between I2C mode vs SPI is how it’s physically interfaced to the board.
I believe that my board is connected for I2C.

debian@beaglebone:~$ i2cdetect -r 2
WARNING! This program can confuse your I2C bus, cause data loss and worse!
I will probe file /dev/i2c-2 using read byte commands.
I will probe address range 0x03-0x77.
Continue? [Y/n] Y
0 1 2 3 4 5 6 7 8 9 a b c d e f
00: – -- – -- – -- – -- – -- – -- –
10: – -- – -- – -- – -- – -- – -- – -- – --
20: – -- – -- – -- – -- – -- – -- – -- – --
30: – -- – -- – -- – -- – -- – -- – -- – --
40: – -- – -- – -- – -- – -- – -- – -- – --
50: – -- – -- UU UU UU UU – -- – -- – -- – --
60: – -- – -- – -- – -- – -- – -- – -- – --
70: – -- – -- – -- – --

How do I interpret what I am seeing? The I2C docs don’t make much sense to me.

Thanks
Mike

and I’m sorry for the spam. I forgot to post that I just updated the board to the latest 8.3 debian.
I flashed it with this:
bone-debian-8.3-lxqt-4gb-armhf-2016-01-24-4gb.img

I can confirm that when I SSH to the board I see the following:

Debian GNU/Linux 8

BeagleBoard.org Debian Image 2016-01-24

Support/FAQ: http://elinux.org/Beagleboard:BeagleBoneBlack_Debian

Thanks again,
Mike

Update:
I think it’s actually at Address 0x77. If I remove the SDI wire from the breadboard to the BB, then it does not detect anything on 77. That should be a good confirmation that it’s on the bus.
Where do I go from here?

debian@beaglebone:~/sudo i2cdetect -r 2
WARNING! This program can confuse your I2C bus, cause data loss and worse!
I will probe file /dev/i2c-2 using read byte commands.
I will probe address range 0x03-0x77.
Continue? [Y/n] y
0 1 2 3 4 5 6 7 8 9 a b c d e f
00: – -- – -- – -- – -- – -- – -- –
10: – -- – -- – -- – -- – -- – -- – -- – --
20: – -- – -- – -- – -- – -- – -- – -- – --
30: – -- – -- – -- – -- – -- – -- – -- – --
40: – -- – -- – -- – -- – -- – -- – -- – --
50: – -- – -- UU UU UU UU – -- – -- – -- – --
60: – -- – -- – -- – -- – -- – -- – -- – --
70: – -- – -- – -- – 77