Uncategorized

BMP180 Press Sensor notes

Asked 
Active today
Viewed 35 times
0

im currently working on a Barometer sensor on my Raspberry Pi 3. Unfortunately its not really working. My BMP180 Sensor is wired up as following:

VIN -> 3V3 (1)
GND -> GND (9)
SCL -> GPIO3 (5)
SDA -> GPIO2 (3)

The cables and connections were double checked and replaced a few times so those are not the problem. I also enabled I2C in raspi-config. If I type in i2cdetect -y 1 i get something like this, so no connections are detected:

0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
00:          -- -- -- -- -- -- -- -- -- -- -- -- -- 
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
70: -- -- -- -- -- -- -- --

If I let an example/test code from Adafruit run when everything is connected properly and checked (~/BMP180Code/Adafruit_Python_BMP/examplessimpletest.py) I get an output like that:

Traceback (most recent call last):
    File "simpletest.py", line 37, in <module>
        sensor = BMP085.BMP085()
    File "build/bdist.linux-armv7l/egg/Adafruit_BMP/BMP085.py", line 69, in __init__
    File "build/bdist.linux-armv7l/egg/Adafruit_BMP/BMP085.py", line 72, in _load_calibration
    File "build/bdist.linux-armv7l/egg/Adafruit_GPIO/I2C.py", line 202, in readS16BE
    File "build/bdist.linux-armv7l/egg/Adafruit_GPIO/I2C.py", line 179, in readS16
    File "build/bdist.linux-armv7l/egg/Adafruit_GPIO/I2C.py", line 166, in readU16
    File "build/bdist.linux-armv7l/egg/Adafruit_PureIO/smbus.py", line 187, in read_word_data
IOError: [Errno 110] Connection timed out

I looked up a few solutions online, but nothing helped. I would be happy if someone of you has a solution for that. Thanks and have a good day, Leo

 New contributor

3 Answers

0

You can check this below link how to enable I2C Raspberry

Link

0

Answer (v0.2 Last update 2020feb19gmt0416)

Let me see. I assume you are using the following outdated python program. Please let me know otherwise.

(1) Adafruit /Adafruit_Python_BMP Archived (2014)

I found that following comments in lines 27~40 useful for debugging:

# For the Raspberry Pi this means you should hook up to the only exposed I2C bus
# from the main GPIO header and the library will figure out the bus number based
# on the Pi's revision.
# Optionally you can override the bus number:
# sensor = BMP085.BMP085(busnum=2)

Comments

(1) Old Rpi (2014) might use I2C0 instead of I2C1, the auto detect funtion might not be able to know Rpi3/4 and pick the wrong number not 1, but 0 or 2 (2 for BeagleBone perhaps)

(2) The python program is for BMP085 but you are using BMP180. You might like to check out any imcompatibilities and make necessary modifcations to the config functions.

(3) The error message is

"File "build/bdist.linux-armv7l/egg/Adafruit_PureIO/smbus.py", line 187, in read_word_data, IOError: [Errno 110] Connection timed out"

Your “i2cdetec -y 1” shows no I2C device is detected, it may mean

(a) Hardware wiring is not correct (OK, so your have double checked wiring (open/short all point to point, neighbouring points etc) or

(b) Software problem such as (i) Wrong config, (ii) Wrong software library.

Either way, you might get the above “Time out, cannot connect” error message.


Troubleshooting Suggestions

(1) You may like to try and error modify the relevant bus number in the program, say

change default I2C bus number from 2 to 1.

(2) To make sure the hardware wiring, and software drivers etc are OK, (a) Remove the no detect BMP guy, (b) swap in any other I2C guy and “i2cdetect – y 1” again. If the new guy can be happily detected, then obviously the old guy is bad 😦


References

(1) Adafruit /Adafruit_Python_BMP Archived (2014)

(2) BMP085 Datashet v2.5- Bosch 2009

(3) BMP180 Datasheet – Bosch 2009

(4) UM10204 I2C-bus specification and user manual (referred in BMP180 Datasheet Section 5, Max clock = 3.4MHz) – 2014 NXP


Appendices

Appendix A – I2C wiring and Pull up resistors etc

(1) You should be using the only two I2C Clock and Data pins in the Rpi 40 pin header.

(2) The the two pins already have strong enough 1k8 pull up. There is no need to add more pull up resistor, with the risk of too strong pull up.

(3) Actually if you are putting two many I2C devices, say, more than 4, on the same bus, and the other devices have 4k7 or 10k pullups, the resultant pull up might be much less than 1k8, and overload the I2C pin current. I usually REMOVE those on device pullups to not to overload the Rpi I2C pins.

(4) Remove all other I2C devices on the same bus, for reason (3) above.

(5) Your hardware I2C connection wires CANNOT be too long, preferably less than 30cm. Longer than that might result in too high impedance (For I2C, 400pf is the usual limit).


Appendix B – Difference between BMP085 and BMP180

I skim both datasheets to compare and contrast. My quick and dirty conclusion: (a) BMP180 is successor of BMP085, (b) They are functionally the same, meaning that software programming should be the “same”.

Usually industry practice is that new hardware version is backward compatible, ie, BMP085 program can run for BMP180, but not vice versa. WARNING: I am just a friendly hobbyist. No guarantee No nothing won’t melt down or blow up! Follow the hobbyist’s suggestion at your own risk! 🙂


End of answer

0

First, if you are using Raspberrian with GUI you need to enable i2c interface on raspberry: Pi Start Menu > Preferences > Raspberry Pi Configuration and in Interface tab turn on I2C. Or if you are using terminal just: sudo raspi-config -> Interfacing Options -> I2C

My second suggestion is to check wiring once again. I2C uses open drain connection on SDL and SCL pins. As far as I know sparkfun BMP180 sensors has build in pullup resistors to hold voltage on lines. Check if you model has pull up resistors. If not you have to put in circuit some resistors.

.END

Categories: Uncategorized

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: