geekinthesticks
Posts: 97
Joined: Fri Feb 08, 2013 7:22 pm

Accuracy of BMP180 sensor.

Sun Jan 17, 2016 3:47 pm

I have been using a BMP085 for some time. However, on a new project I decided to use a BMP180. Using the Adafruit simpletest.py I am getting the following resuts:

BMP085:

Code: Select all

Temp = 21.90 *C
Pressure = 101023.00 Pa
Altitude = 25.34 m
Sealevel Pressure = 101020.00 Pa

BMP180:

Code: Select all

Temp = 12.80 *C
Pressure = 157349.00 Pa
Altitude = -3872.78 m
Sealevel Pressure = 157349.00 Pa
The results from the BMP085 agree with the barometric sensor on my watch and temperature as measured using a DS18B20. However, the results from the BMP180 are very significantly different.

Any suggestions as to what might cause this? Faulty sensor, or bug in the Adafruit libarary?

hampi
Posts: 223
Joined: Fri May 31, 2013 11:29 am
Contact: Website

Re: Accuracy of BMP180 sensor.

Sun Jan 17, 2016 4:04 pm

Maybe I2C problem in reading the registers. I am using this C-program to read the BMP180

https://github.com/oh7bf/I2chipd

User avatar
DougieLawson
Posts: 35790
Joined: Sun Jun 16, 2013 11:19 pm
Location: Basingstoke, UK
Contact: Website Twitter

Re: Accuracy of BMP180 sensor.

Sun Jan 17, 2016 4:22 pm

Get this python code: https://github.com/keiichishima/RPiSensors it is 100% rock solid and easy to use.
Note: Having anything humorous in your signature is completely banned on this forum. Wear a tin-foil hat and you'll get a ban.

Any DMs sent on Twitter will be answered next month.

This is a doctor free zone.

geekinthesticks
Posts: 97
Joined: Fri Feb 08, 2013 7:22 pm

Re: Accuracy of BMP180 sensor.

Sun Jan 17, 2016 6:47 pm

Thanks. However, it seems to have problems connecting:

Code: Select all

>>> import smbus
>>> import bmp180
>>> bus = smbus.SMBus(1)
>>> sensor = bmp180.Bmp180(bus)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "bmp180.py", line 130, in __init__
    self._read_calibration_data()
  File "bmp180.py", line 183, in _read_calibration_data
    _REG_CALIB_OFFSET, 22)
IOError: [Errno 110] Connection timed out
I'll dig into the error a bit more tomorrow.

User avatar
DougieLawson
Posts: 35790
Joined: Sun Jun 16, 2013 11:19 pm
Location: Basingstoke, UK
Contact: Website Twitter

Re: Accuracy of BMP180 sensor.

Sun Jan 17, 2016 7:22 pm

Can you see your BMP180 on the I2C bus? Install i2c-tools and use the i2cdetect -y 1 command.

Code: Select all

[email protected]:~ $ i2cdetect -y 1
     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
00:          -- -- -- -- -- -- -- -- -- -- -- -- --
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
70: -- -- -- -- -- -- -- 77
[email protected]:~ $
Note: Having anything humorous in your signature is completely banned on this forum. Wear a tin-foil hat and you'll get a ban.

Any DMs sent on Twitter will be answered next month.

This is a doctor free zone.

geekinthesticks
Posts: 97
Joined: Fri Feb 08, 2013 7:22 pm

Re: Accuracy of BMP180 sensor.

Sun Jan 17, 2016 10:21 pm

DougieLawson wrote:Can you see your BMP180 on the I2C bus? Install i2c-tools and use the i2cdetect -y 1 command.
Yes, I can and since works with the Adafruit library (albeit giving erroneous readings). It may be a permissions problem, but I am a member of the i2c group with rw permissions.

Code: Select all

outsidepi2 ~ ls -la /dev/i2c*                                                                       1 ↵
crw-rw---- 1 root i2c 89, 1 Jan  1  1970 /dev/i2c-1

User avatar
DougieLawson
Posts: 35790
Joined: Sun Jun 16, 2013 11:19 pm
Location: Basingstoke, UK
Contact: Website Twitter

Re: Accuracy of BMP180 sensor.

Sun Jan 17, 2016 10:51 pm

Does this work?

Code: Select all

#!/usr/bin/python

import smbus
import bmp180

bus = smbus.SMBus(1)
sensor = bmp180.Bmp180(bus)
print sensor.pressure_and_temperature
Note: Having anything humorous in your signature is completely banned on this forum. Wear a tin-foil hat and you'll get a ban.

Any DMs sent on Twitter will be answered next month.

This is a doctor free zone.

geekinthesticks
Posts: 97
Joined: Fri Feb 08, 2013 7:22 pm

Re: Accuracy of BMP180 sensor.

Mon Jan 18, 2016 6:54 am

Unfortuately not. I get the same error about timing out.

Code: Select all

Python 2.7.11 (default, Dec 11 2015, 05:34:18) 
[GCC 5.3.0] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import smbus
>>> import bmp180
>>> bus = smbus.SMBus(1)
>>> sensor = bmp180.Bmp180(bus)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "bmp180.py", line 130, in __init__
    self._read_calibration_data()
  File "bmp180.py", line 183, in _read_calibration_data
    _REG_CALIB_OFFSET, 22)
IOError: [Errno 110] Connection timed out

I'll compare the code with the Adafruit library, which has no problem reading calibration data.

geekinthesticks
Posts: 97
Joined: Fri Feb 08, 2013 7:22 pm

Re: Accuracy of BMP180 sensor.

Mon Jan 18, 2016 6:57 pm

Before diving into the code, I decided to order another sensor from another supplier (which I'll need soon anyway) That should rule out any fault with my current sensor.

User avatar
DougieLawson
Posts: 35790
Joined: Sun Jun 16, 2013 11:19 pm
Location: Basingstoke, UK
Contact: Website Twitter

Re: Accuracy of BMP180 sensor.

Mon Jan 18, 2016 7:25 pm

What model of RPi are you running? grep -e 'Revision' -e 'Hardware' /proc/cpuinfo;

What do you get from sudo i2cdetect -y 0; sudo i2cdetect -y 1;?
Note: Having anything humorous in your signature is completely banned on this forum. Wear a tin-foil hat and you'll get a ban.

Any DMs sent on Twitter will be answered next month.

This is a doctor free zone.

geekinthesticks
Posts: 97
Joined: Fri Feb 08, 2013 7:22 pm

Re: Accuracy of BMP180 sensor.

Tue Jan 19, 2016 11:29 am

Problem solved! I have got a few pi's. I have been running on a pi2, so I decided to try and see what happened if I moved the sensor to a B+. i2c detect couldn't find it on the bus. So moved it back to the pi2 again, which now couldn't find the sensor on the bus. Checked the solder on the connectors to make sure it was OK. Same problem couldn't see sensor on i2c bus.

Decided to try different jumper leads and it all worked perfectly. Did some jiggling with the original wires, testing the continuity and it seems as though one of them had an intermittent connection.

I don't know if it's possible to check what's connected to i2c from Python. However, if I can find a way to do it, I'll modify the code to throw an exception, with an error message, if it can't find anything on the bus.

User avatar
DougieLawson
Posts: 35790
Joined: Sun Jun 16, 2013 11:19 pm
Location: Basingstoke, UK
Contact: Website Twitter

Re: Accuracy of BMP180 sensor.

Tue Jan 19, 2016 8:51 pm

This is a bit crude, but it finds the two MCP23017s connected to the RPi I ran it on

Code: Select all

#!/usr/bin/python
import smbus
bus = smbus.SMBus(1)
low_addr=0x03
hi_addr=0x78
for addr in range(low_addr, hi_addr):
  try:
    bus.read_byte_data(addr,0x00)
    print "Addr: ", hex(addr)," OK"
  except:
    print "Addr: ", hex(addr),"BAD"
Note: Having anything humorous in your signature is completely banned on this forum. Wear a tin-foil hat and you'll get a ban.

Any DMs sent on Twitter will be answered next month.

This is a doctor free zone.

strikesrule
Posts: 3
Joined: Mon Sep 09, 2019 1:10 pm

Re: Accuracy of BMP180 sensor.

Mon Sep 09, 2019 1:55 pm

I have 4 BMP180s, 3 DHT11s, and a single TMP102 connected to a Raspberry Pi 3B+. These are all placed within a foot of each other, along with a room digital thermometer. The goal is to be able to accurately sample temperature at each sensor. Right now every device gives a different temperature, and none match the room thermometer.

I am looking for the best sensor for the job of giving accurate temperature first.

So far the BMP180 has been better than the others but none can be said to be accurate. The DHT11s tend to drop and give false readings a lot. They don't give pressure. The TMP102 is too fragile. Anything coming near it causes a fatal error in the script. I'm using the published scripts to read these devices.

I have also tried this with only one kind of sensor and these differences also exist among the same sensors.

The issue is how to get these to be accurate and on what is this accuracy will be based. The project needs to be able to use as many sensors as required. Changes in temperature and pressure are being measured between sensors. There is, at times, as much as a 6 degree variance between all the sensors and generally 2-4 degrees between those of one type.

Return to “Automation, sensing and robotics”