1

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

3
  • 1
    I2C is disabled by default, did you enable it?
    – Mohsen
    Feb 18, 2020 at 5:59
  • 1
    Yes I did enable it Feb 18, 2020 at 14:08
  • 2
    If it doesn't show up in i2cdetect you can stop right there and not bother running any Python. Your sensor, wiring, Raspberry Pi or config is wrong. Try a different sensor, or a different Raspberry Pi or different cables. Feb 19, 2020 at 7:28

2 Answers 2

1

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.

2
  • 1
    I already had the I2C Interface enabled. I tried to add a 1k resistor but it didnt work Feb 18, 2020 at 14:13
  • 1
    Maybe sensor is dead. If you have another i2c device you could check if you see it.
    – GoRo3
    Feb 19, 2020 at 6:51
1

Answer (v0.5 Last update 2020feb19gmt1914 Appendix F)

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 :(


Discussion and Recommendation

The AdaFruit BMP180 Library the OP uses is depreciated and no longer supported.

I would suggest the OP to switch to

AdaFruit BMP280/BME280 CircuitPython Library

or

Pimoroni BMP280/BME280 Python Library

.


References

(1) Adafruit_2014 BMP085/BMP180 Python Library (Depreciated, No Longer Supported)

(2) BMP085 Datashet v2.5- Bosch 2009

(3) BMP180 Datasheet - Bosch 2009

(4) BMP280 Digital Pressure Sensor Datasheet v1.14 Bosch 2015

(5) BME280 Combined Humidity and Pressure Sensor Datasheet v.16 - Bosch 2018sep

(6) What's the difference between the BMP280 and the BME280 atmospheric sensors - 20,565 views 2017mar02

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

(8) Adafruit BMP280 I2C or SPI Barometric Pressure & Altitude Sensor - US$10

(9) BMP280 Temperature, Pressure, & Altitude Sensor Python Library - Pimoroni 2019nov08

(10) BMP280 Pip Install - PyPi


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 too 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! :)


Appendix D - Suggestion to modify AdaFruit BMP180 Program for Rpi3/4

The main test program is actually very short.

The critical setup problem is the I2C bus number.

The program's default is I2C Bus #2. I would suggest to change default to I2c Bus #1.

# AdaFruit BMP180 Program Author: Tony DiCola 
# https://github.com/adafruit/Adafruit_Python_BMP/blob/master/examples/simpletest.py
import Adafruit_BMP.BMP085 as BMP085
# Default constructor will pick a default I2C bus.
# 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.
sensor = BMP085.BMP085()
# Optionally you can override the bus number:
# sensor = BMP085.BMP085(busnum=2)  
print('Temp = {0:0.2f} *C'.format(sensor.read_temperature()))
print('Pressure = {0:0.2f} Pa'.format(sensor.read_pressure()))
print('Altitude = {0:0.2f} m'.format(sensor.read_altitude()))
print('Sealevel Pressure = {0:0.2f} Pa'.format(sensor.read_sealevel_pressure()))

Next is to update the class bmp085. See next Appendix E below.


Appendix E - AdaFruit BMP085 Library BMP085 Class using Eazy Steup - Tony DiCola for Adafruit

The following notice from the AdaFruit BMP085 library says the library is depreciated. AdaFruit recommends:

(a) switch to AdaFruit CircuitPython sensor library (Note 1),

(b) Switch to BMP280.

Now we have a problem. This old library uses AdaFruit EasySetup tools which are no longer supported and might be incompatible to Raspberry Pi

Note 1 - Circuit Python is not 100% compatible to Raspberry Pi operating system Raspbian 10 buster.

DEPRECATED LIBRARY Adafruit Python BMP This library has been deprecated!
https://github.com/adafruit/Adafruit_Python_BMP/blob/master/README.md
the bmp085 and bmp180 are no longer made, and are replaced by the bmp280
we are now only using our circuitpython sensor libraries in python
we are leaving the code up for historical/research purposes but archiving the repository.
check out this guide for using the bmp280 with python! https://learn.adafruit.com/adafruit-bmp280-barometric-pressure-plus-temperature-sensor-breakout
Adafruit Python BMP
Python library for accessing the BMP series pressure and temperature sensors like the BMP085/BMP180 on a Raspberry Pi or Beaglebone Black.
Designed specifically to work with the Adafruit BMP085/BMP180 pressure sensors ----> https://www.adafruit.com/products/1603
To install, download the library by clicking the download zip link to the right and unzip the archive somewhere on your Raspberry Pi or Beaglebone Black. Then execute the following command in the directory of the library:~~
sudo python setup.py install
Make sure you have internet access on the device so it can download the required dependencies.

Appendix F - BME280 Learning Notes

I have been playing with Gyrometer, Accelerometer, and Magnetometer, but never Pressure meter. I also played with Temperature and Humidity sensors, but never Pressure Sensor, because I always thing that Pressure or Altitude sensor is only for mountain climbers, not for my hobby home automation. But after studying the OP's question, I found that there is a new sensor with three measurements in one chip, Temperature, Humidity, and Pressure. I also found that though the OP's AdaFruit BMP085 and even BMP180 Library is depreciated, there is actually another new successor BMP280 and BME280. I also found that Pimoroni seems has joined force with Lada Ada, sell her BEM280 breakout board, and at the same created a library. I am hoping that Pimoroni's python library is NOT CircuitPython, but standard Python.

I am reading Pimoroni's product and writing up some learning notes for future reference:

/ to continue, ...


Update 2022sep17 hkt1258

Appendix G - Pico W testing BME680

1. Introduction

Now I am setting up a Rpi Pico W prototyping board for testing BME680.


2. References

References

(1) Rpi Pico

(1.1) Rpi Pico W Datasheet – Rpi 2022jun29 https://datasheets.raspberrypi.com/picow/pico-w-datasheet.pdf

(1.2) Rpi Pico W Pinout Diagram https://datasheets.raspberrypi.com/picow/PicoW-A4-Pinout.pdf

(1.3) Rpi Pico W Schematic – Appenix B – Pico Datasheet https://www.etechnophiles.com/wp-content/uploads/2022/07/Pico-W-Schematic.pdf

(1.4) New Pi Pico W- WiFi Features, Specs & Pinout Simplified – etechnophiles https://www.etechnophiles.com/raspberry-pi-pico-w-wifi-specs-pinout/


(2) BME680

(2.1)

bme680


(3) Schottky Diode References

I surveyed Schottky diodes and found 1N5822 good (only 0.4V drop at 1A).

https://forums.raspberrypi.com/viewtopic.php?p=1417588&hilit=schottky+diode+tlfong01#p1417588

1N5408 Datasheet - Vishay https://www.vishay.com/docs/88516/1n5400.pdf

schottky_diode

/ to continue, ...


End of answer

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.