Please select To the mobile version | Continue to access the desktop computer version

OrangePi

 Login            
 Register            
Search
Hot search: orangepi
View: 5502|Reply: 3

BMP180 barometric sensor OK

[Copy link]

12

Threads

30

Posts

150

Credits

Registered member

Rank: 2

Credits
150
Post time 2015-12-25 16:56:26 | Show all posts |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
Post time 2016-2-2 16:59:17 | Show all posts
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
Post time 2019-10-22 00:10:32 | Show all posts
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
Post time 2019-10-23 04:27:54 | Show all posts
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 have to log in before you can reply Login | Register

Points Rules

Archiver|Mobile edition|Darkroom|OrangePi En ( 粤ICP备14086627号-2

2020-6-3 07:12 GMT+8 , Processed in 0.028415 second(s), 22 queries .

Powered by Discuz! X3.2

© 2014-2015 orangepibbs en.

Quick Reply To Top Return to the list