BalenaSense sensor is not working

Hi, I just installed BalenaSense on my pi and I’m getting this error with sensor :

15.04.20 16:03:30 (+0200) ----------------------------------------
15.04.20 16:03:31 (+0200) user_i2c_write: Remote I/O error
15.04.20 16:03:33 (+0200) Capture thread exited; restarting
15.04.20 16:03:38 (+0200) user_i2c_write: Remote I/O error
15.04.20 16:03:40 (+0200) 172.17.0.6 - - [15/Apr/2020 14:03:40] “GET / HTTP/1.1” 200 -
15.04.20 16:03:40 (+0200) ----------------------------------------
15.04.20 16:03:40 (+0200) Exception happened during processing of request from (‘172.17.0.6’, 44406)
15.04.20 16:03:40 (+0200) Traceback (most recent call last):
15.04.20 16:03:40 (+0200) File “/usr/local/lib/python3.5/socketserver.py”, line 313, in _handle_request_noblock
15.04.20 16:03:40 (+0200) self.process_request(request, client_address)
15.04.20 16:03:40 (+0200) File “/usr/local/lib/python3.5/socketserver.py”, line 341, in process_request
15.04.20 16:03:40 (+0200) self.finish_request(request, client_address)
15.04.20 16:03:40 (+0200) File “/usr/local/lib/python3.5/socketserver.py”, line 354, in finish_request
15.04.20 16:03:40 (+0200) self.RequestHandlerClass(request, client_address, self)
15.04.20 16:03:40 (+0200) File “/usr/local/lib/python3.5/socketserver.py”, line 681, in init
15.04.20 16:03:40 (+0200) self.handle()
15.04.20 16:03:40 (+0200) File “/usr/local/lib/python3.5/http/server.py”, line 422, in handle
15.04.20 16:03:40 (+0200) self.handle_one_request()
15.04.20 16:03:40 (+0200) File “/usr/local/lib/python3.5/http/server.py”, line 410, in handle_one_request
15.04.20 16:03:40 (+0200) method()
15.04.20 16:03:40 (+0200) File “/usr/src/app/scripts/sensor.py”, line 123, in do_GET
15.04.20 16:03:40 (+0200) measurements = balenasense.sample()
15.04.20 16:03:40 (+0200) File “/usr/src/app/scripts/sensor.py”, line 95, in sample
15.04.20 16:03:40 (+0200) return self.apply_offsets(self.sensor.get_readings(self.sensor))
15.04.20 16:03:40 (+0200) File “/usr/src/app/scripts/bme680.py”, line 45, in get_readings
15.04.20 16:03:40 (+0200) ‘temperature’: float(self.data[‘temperature’]),
15.04.20 16:03:40 (+0200) TypeError: ‘NoneType’ object is not subscriptable

How can I fix it please?

Hi there,
could you give us more information about the hardware used ?

Hi,
I’m using a Raspberry pi 4 and a BME680 sensor.
The sensor is working when I get the data via the pythom3 bme680 library.
Thanks for your help :slight_smile:

Hi there.

I have a couple of follow up questions:

  1. Is the i2c_arm=on DT parameter set in the device or fleet configuration? (this is the default so I would expect so).
  2. Did you modify the project at all before deploying it?
  3. When you say that you can access the BME680 via the python3 library - are you using Raspbian or a balenaOS container?

Thanks,
James.

Hi

I didn’t modify the project at all, so i2c_arm=on is set, I didn’t touched anything.
I used raspbian to read the data with the python3 Adafruit BME680 Library.

Thanks for the help :slight_smile:

Hi,
From the logs you presented the following line points to problems in communication between the app and the sensor hardware over I2C:

user_i2c_write: Remote I/O error

This is the reason why James asked about i2c_arm setting. It’s not a parameter that is set by the application, but rather a part of the device configuration. So we suggest you double-check if it’s actually set (going to the device configuration page and looking at “DT parameters” in the table there).

If it’s set, I would also suggest checking a similar issue open on github earlier:


In that case, it was a hardware problem (physical connection to the sensor).

Keep us posted, thanks!

Hi,

DT parameters are set to image

I tried the solution from the issue on github but nothing changed, I don’t think that it’s a hardware problem because the sensor is working on raspbian as I said.

Thank you

Hi there, there is a discussion here around this being a potentially a hardware bug related to clock stretching. If the error is intermittent, it may be worth investigating this venue further, potentially switching to software mode. Also, if the error is intermittent, it may be worth putting in some retry logic in the code.

Hi Guys,

Any news or solution with this issue ? I have the same error with Balena Sense.

I’am using B3+ with Environmental Sensor (Qwiic) - BME680 (sparkfun) and i’am getting the same errors. Identical!

Tks,
Sami

So, the solution was downgrading from Balena Sense v1.9.2 to v1.8.3.
After downgrading the sensor started to work

hope this solution will help others and the developers to find what is wrong with the new version

Tks,
Sami

1 Like

Thanks for the update on this one Sami, glad to hear it’s working for you.

I can confirm, it’s working on Balena Sense v1.8.3. Thank you!

I am experiencing the same problem with v1.9.7.

28.08.20 09:50:36 (-0400)  sensor  ================ Starting Balena Sense ================
28.08.20 09:50:37 (-0400)  sensor  Enviro Plus hat not found
28.08.20 09:50:37 (-0400)  sensor  BME680 not found on 0x76, trying 0x77
28.08.20 09:50:37 (-0400)  sensor  BME680 found on 0x77
28.08.20 09:50:37 (-0400)  sensor  user_i2c_write: Remote I/O error
28.08.20 09:50:37 (-0400)  sensor  Sensor HTTP server running
28.08.20 09:50:39 (-0400)  sensor  Capture thread exited; restarting

I am using a Raspberry Pi 3 B+ and the Environclick BME680 board

I tried the solution in user_i2c_write: Remote I/O error #33 to no affect.

However, downgrading to v1.8.3 worked.