kiwx
Junior Member
Posts: 65
|
Post by kiwx on Jan 16, 2020 18:43:34 GMT -8
I don't question the RaspberryPi because every other sensor works, but unfortunately this PI4 is the only one I have available right now. I do have a PiZero I could try...maybe.
SO.....
On cold boot up, BMP280 0x77 shows up using the TCA9545 test python file. -----------BUS 0------------------- tca9545 control register B3-B0 = 0x1 ignore Interrupts if INT3' - INT0' not connected tca9545 control register Interrupts = 0x0 0 1 2 3 4 5 6 7 8 9 a b c d e f 00: -- -- -- -- -- -- -- -- -- -- -- -- -- 10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 30: -- -- -- -- -- -- -- -- -- -- -- -- 3c -- -- -- 40: -- -- -- -- -- -- -- -- 48 -- -- -- -- -- -- -- 50: -- -- -- -- -- -- -- 57 -- -- -- -- -- -- -- -- 60: -- -- -- -- -- -- -- -- 68 -- -- -- -- -- -- -- 70: -- -- -- 73 -- -- -- 77
When I start the GroveWeatherPi.py file, BMP280 is Present
When this code runs: if (config.BMP280_Present): try: bmp180Temperature = bmp280.read_temperature() bmp180Pressure = bmp280.read_pressure()/1000 bmp180Altitude = bmp280.read_altitude() bmp180SeaLevel = bmp280.read_sealevel_pressure(config.BMP280_Altitude_Meters)/1000 except: print("Unexpected error:", sys.exc_info()[0])
The exception is called and 0x77 no longer shows up on the BUS0. Any subsequent launches of GroveWeatherPi.py mark the BMP_280 as not present until I cold boot again.
This is a new Raspbian card and fresh setup of all files.
I may try again without the I2CMux board just to see what happens. It really didn't go well week when I tried, but I've learned a few things since then. I think the I2CMux is only needed for the lightning detector.
|
|
kiwx
Junior Member
Posts: 65
|
Post by kiwx on Jan 17, 2020 5:12:54 GMT -8
pi@weatherpi:~/SDL_Pi_GroveWeatherPi $ python Adafruit_Python_BMP/examples/simpletest_280.py Temp = 26.29 *C Pressure = 68048.00 Pa Altitude = 3234.38 m Sealevel Pressure = 68048.00 Pa pi@weatherpi:~/SDL_Pi_GroveWeatherPi $ python Adafruit_Python_BMP/examples/simpletest_280.py Traceback (most recent call last): File "Adafruit_Python_BMP/examples/simpletest_280.py", line 10, in <module> sensor = BMP280.BMP280() File "build/bdist.linux-armv7l/egg/Adafruit_BMP/BMP280.py", line 48, in __init__ File "build/bdist.linux-armv7l/egg/Adafruit_GPIO/I2C.py", line 143, in readU8 IOError: [Errno 121] Remote I/O error
One read is all I get from it. Even using sudo. But it's all wrong. Pressures are equal. I am not at 3000+ altitude. It might be 80 degrees in the attic, but I doubt it since outside temp is about 60.
I2CMux is still in place. More work on this later.
|
|
kiwx
Junior Member
Posts: 65
|
Post by kiwx on Jan 18, 2020 15:11:13 GMT -8
Tried the PiZero. Exact same results. 0x77 is there and present on the GroveWeather startup. Then fails on the query and is no longer listed on the bus.
|
|
|
Post by SDL on Jan 19, 2020 11:11:05 GMT -8
Kiwx,
Haven't seen your board come back yet. Can you just hook up the WeatherBoard and NO other sensors? Maybe something else is hosing it. I'm pretty confused by this thread now so I'm not sure if you have tried that. We know it is not the Pi now.
With two boards, I'm pretty sure the board (and the Pi now) that is not the problem.
BP
|
|
kiwx
Junior Member
Posts: 65
|
Post by kiwx on Jan 19, 2020 17:56:49 GMT -8
I have not returned the other board yet. Sorry about that. Been a bit crazy around here. but....SUCCESS!!!! This will be a long post. Setup first: PI4, Pi2Grover, and WeatherBoard.....no other sensors or boards..... FAILED: Using GroveWeatherPi.py script...same results. 0x77 BMP280 is available at cold boot. Passes detect on startup of GroveWeatherPi.py. Fails at the pressure query and then 0x77 is not listed on the bus using i2cdetect. SUCCESS: Using a python script I found for BME280 board, I was able to get successful readings and the device remains listed using i2cdetect. I was able to query successfully numerous times. www.raspberrypi-spy.co.uk/2016/07/using-bme280-i2c-temperature-pressure-sensor-in-python/That is the link to the BME280 code and instructions. I did have to modify to 0x77, but that is all I did. Chip ID : 88 Version : 1 Temperature : 23.23 C Pressure : 1027.04607049 hPa Humidity : 0.0 % At this point, I am mostly convinced it is a software issue. Now why is the question of the day. I am just learning python and while mostly straight forward, combining all the register codes for the hardware is tripping me up a bit. I may just try to adapt the BME280 working code and replace the GroveWeatherPi.py call for the BMP280.
|
|
|
Post by SDL on Jan 20, 2020 6:31:16 GMT -8
Are you building a GWP or SkyWeather kit?
BP
|
|
kiwx
Junior Member
Posts: 65
|
Post by kiwx on Jan 20, 2020 16:05:28 GMT -8
GWP
|
|
|
Post by SDL on Jan 23, 2020 6:21:15 GMT -8
Would you take a picture of your Weatherboard and post it? I want to check on which barometer is on that board.
BP
|
|
kiwx
Junior Member
Posts: 65
|
Post by kiwx on Jan 23, 2020 17:41:33 GMT -8
I hope this is good enough for you to tell.
|
|
|
Post by SDL on Jan 24, 2020 12:15:44 GMT -8
Perfect.
There were a couple of versions of that board and I just wanted to check.
It is an BMP280.
BP
|
|
kiwx
Junior Member
Posts: 65
|
Post by kiwx on Jan 26, 2020 13:40:01 GMT -8
This post might be confusing, but I have tried so many combinations with and without I2Mux, other sensors.....but in the end I went back to the basics and reloaded the Pi and connected everything as specified in the documentation. Once I verified the same issue of BMP280 0x77 on cold boot then fails after starting GroveWeatherPi.py, I started looking into the code.
Some success. I have found the line of code that causes my BMP280 to stop working.
SDL_Pi_GroveWeatherPi/Adafruit_Python_BMP - line 53 self._device.write8(BMP280_CONTROL, 0x3F)
When I comment out this line of code, my BMP280 replies back with data (I haven't verified the values) and continues to work for every cycle of the GWP script. I can stop the script, restart, test the I2Mux....BMP280 0x77 shows consistently.
Any idea what this line of code is doing?
|
|
|
Post by SDL on Jan 27, 2020 10:58:16 GMT -8
Here is the code in context:
# Load calibration values. self._load_calibration() self._device.write8(BMP280_CONTROL, 0x3F)
And from the BMP280 specification:
Register 0xF4 “ctrl_meas” Name Description Bit 7, 6, 5 osrs_t[2:0] Controls oversampling of temperature data. See chapter 3.3.2 for details. Bit 4, 3, 2 osrs_p[2:0] Controls oversampling of pressure data. See chapter 3.3.1 for details. Bit 1, 0 mode[1:0] Controls the power mode of the device. See chapter 3.6 for details.
Now, understand that you are the only person we have heard from with this problem and so I am just guessing here:
Add the following code to SDL_Pi_GroveWeatherPi/Adafruit_Python_BMP/BMP280.py
Before self._device.write8(BMP280_CONTROL, 0x3F)
put:
import time time.sleep(0.5)
That will deploy 0.5 seconds before the next write. Tell me if that makes any difference.
BP
|
|
kiwx
Junior Member
Posts: 65
|
Post by kiwx on Jan 27, 2020 16:19:23 GMT -8
No sir. Adding the pause (sleep) didn't change anything about this issue.
While I don't generally wish ill on others, I do wish someone else had this issue and could help us both find a solution.
Thanks for all you help.
|
|
|
Post by SDL on Jan 27, 2020 18:33:36 GMT -8
Ha! Kiwx you are right. Ours works fine. Go ahead and comment out that Control Line.
BP
|
|
kiwx
Junior Member
Posts: 65
|
Post by kiwx on Jan 28, 2020 17:40:43 GMT -8
I have to adjust the altitude a bit without that line, but at least it works.
Thanks.
|
|