heitjer
Posts: 7
Joined: Sat Jul 27, 2019 5:42 pm

read.unsigned_short - I am at a complete loss

Sun Oct 27, 2019 11:50 pm

Guys,
I need some help. I was working on my weather station build and had everything working and moved everything from bread board to the final build. My BME280 suddenly gave me this error message:

Code: Select all

Traceback (most recent call last):
  File "/home/pi/weather/WebSensor/test_bme280.py", line 9, in <module>
    bme280.load_calibration_params(bus,address)
  File "/usr/local/lib/python3.5/dist-packages/bme280/__init__.py", line 153, in load_calibration_params
    compensation_params.dig_T1 = read.unsigned_short(0x88)
  File "/usr/local/lib/python3.5/dist-packages/bme280/reader.py", line 40, in unsigned_short
    return self._bus.read_word_data(self._address, register) & 0xffff
  File "/usr/local/lib/python3.5/dist-packages/smbus2/smbus2.py", line 453, in read_word_data
    ioctl(self.fd, I2C_SMBUS, msg)
OSError: [Errno 121] Remote I/O error
It does it from the complex python and from a simple one like this:

Code: Select all

import bme280
import smbus2
from time import sleep

port = 1
address = 0x77 # Adafruit BME280 address. Other BME280s may be different
bus = smbus2.SMBus(port)

bme280.load_calibration_params(bus,address)

while True:
    bme280_data = bme280.sample(bus,address)
    humidity  = bme280_data.humidity
    pressure  = bme280_data.pressure
    ambient_temperature = bme280_data.temperature
    print(humidity, pressure, ambient_temperature)
    sleep(1)


At first I thought i was the soldering and I replaced the sensor with another BME280. Same issue, same with a third BME280 although that one worked for a brief day.

So I ordered new BME280s and same result. Then I installed a brand new "rasbian stretch" and same result, I thought maybe its the PI and used the new install SD-card in a new PI with a new sensor - same result. So now I am perplexed. That would make it now 4 sensors dead including the one I just took out of the package.

BTW - the cmd of i2cdetect shows the following:

Code: Select all

pi@raspberrypi:~ $ 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: -- -- -- -- -- -- -- -- 
heitjer

heitjer
Posts: 7
Joined: Sat Jul 27, 2019 5:42 pm

Re: read.unsigned_short - I am at a complete loss

Mon Oct 28, 2019 1:25 am

weird gets weirder....

no change - expect tries a new program.
https://www.raspberrypi-spy.co.uk/2016/ ... in-python/

Now I get

Code: Select all

pi@raspberrypi:~ $ 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: -- -- -- -- -- -- 76 --  
Back to 76.....

And the program nicely presents:

Code: Select all

Chip ID     : 96
Version     : 0
Temperature :  27.29 C
Pressure :  1013.0530926893761 hPa
Humidity :  37.39007100116412 %
The other program still provides the error from the first post.

Return to “Advanced users”