View: 10246|Reply: 3

BMP180 barometric sensor OK

[Copy link]

12

threads

30

posts

150

credits

Registered member

Rank: 2

credits
150
Published in 2015-12-25 16:56:26 | Show all floors |Read mode
connected to two-wire (i2c)
i2cdetect -y 0 (shows up at 0x77)
modprobe bmp085 (you have to compile this module, is not included in loboris modules)
cd /sys/class/i2c-adapter/i2c-0
echo "bmp085 0x77" > new_device
cat /sys/bus/i2c/drivers/bmp085/0-0077/temp0_input
to get temperature
cat /sys/bus/i2c/drivers/bmp085/0-0077/pressure0_input
to get pressure

0

threads

7

posts

70

credits

Registered member

Rank: 2

credits
70
Published in 2016-2-2 16:59:17 | Show all floors
Edited by dimmas375 at 2016-2-5 19:13
modprobe bmp085 (you have to compile this module, is not included in loboris modules)

Well, I've spent 2 whole days to compile this module under Debian Jessie and Wheezy minimal and without success. Tried cross-compiling on PC, compiling directly on OPI, but in most cases build failed. And finally I've successfully compiled the module, but it is unusable - modprobe says 'exec format error'.I don't know how you're guys compiling these sources - they're bugged crap patched to make more different and colorful bugs.
Will try to get this module working under Armbian.

0

threads

2

posts

28

credits

Novice

Rank: 1

credits
28
Published in 2019-10-22 00:10:32 | Show all floors
I struggle to get this to work, I have installed the GPIO pyA20 package and GPIO works fine. i2cdetect find the BMP180 as device 0x77. I can also read the pressure and temperature using "cat /sys/bus/i2c/drivers/bmp085/0-0077/temp0_input" etc.
The problem is to get a library like Adafruit BMP for Orange Pi. The module for BMP is updated to MBP280 in the new kernel and OS, hence it might be that libraries are incompatible. Any suggestions would be nice.

Ole

0

threads

2

posts

28

credits

Novice

Rank: 1

credits
28
Published in 2019-10-23 04:27:54 | Show all floors
While playing with the BMP 180 I have managed to make it to work, but not the way it should. Added two lines to /etc/module bmp280-i2c and bm280, and added an entry in init.d and with a link to rc5.d namely the file bmp180 and the link S02bmp180.
It contains :
#!/bin/sh
cd  /sys/class/i2c-adapter/i2c-0/
echo  "bmp180 0x77" > new_device

Having done this a simple Python script returns the pressure and temperature:
import math
pressure=open("/sys/bus/i2c/drivers/bmp280/0-0077/iio:device1/in_pressure_input","r").read()
# Correct for 150 m above sea level
P=float(pressure)*10.0*math.exp(150.0/8500.0)
print P,"hPa"
temperature=open("/sys/bus/i2c/drivers/bmp280/0-0077/iio:device1/in_temp_input","r").read()
T=float(temperature)/1000.0
print T,"\xb0C"

While this works, it not as elegant as it should have been when using a library like the BMP Adafruit library.

Ole
You need to log in before you can reply login | Register

Points Rule

Quick reply Top Return list