mcjhn
January 16, 2023, 7:02pm
1
Hi,
I’ve had a lot of success with the bmp680 but I cannot get the bmp280 to work yet.
Version - balenaOS 2.108.18
Device - Raspberry Pi 3+ 32-bit
sensor-block output:
sensor IIO context has 1 devices:
sensor iio:device0: bmp280
sensor 2 channels found:
sensor pressure: (input)
sensor 2 channel-specific attributes found:
sensor input, value: 97.622214843
sensor oversampling_ratio, value: 16
sensor temp: (input)
sensor 2 channel-specific attributes found:
sensor input, value: 14860
sensor oversampling_ratio, value: 2
sensor GET / HTTP/1.1
sensor Host: sensor:7575
sensor User-Agent: Go-http-client/1.1
sensor Accept-Encoding: gzip
sensor
sensor
sensor Transforming bmp280 value(s)…
sensor Exception in thread Thread-1:
sensor Traceback (most recent call last):
sensor File “/usr/local/lib/python3.9/threading.py”, line 954, in _bootstrap_inner
sensor self.run()
sensor File “/usr/local/lib/python3.9/threading.py”, line 892, in run
sensor self._target(*self._args, **self._kwargs)
sensor File “/usr/src/app/sensor.py”, line 74, in background_web
sensor response = ‘HTTP/1.0 200 OK\n\n’+ json.dumps(balenasense.sample())
sensor File “/usr/src/app/sensor.py”, line 53, in sample
sensor return self.sensor.get_readings(self.context)
sensor File “/usr/src/app/reading.py”, line 87, in get_readings
sensor x = reading.write_reading()
sensor File “/usr/src/app/reading.py”, line 35, in write_reading
sensor new_fields = device_transform(dev.name, device_fields)
sensor File “/usr/src/app/transformers.py”, line 38, in device_transform
sensor for field in fields:
sensor RuntimeError: dictionary keys changed during iteration
Any help greatly appreciated.
mcjhn
January 16, 2023, 7:31pm
3
ps. here is the startup message from the sensor-block:
sensor OKWeb server listening on port 7575…
sensor Initializing sensors…
sensor ======== Searching i2c bus for devices… ========
sensor Found (busy) device at 0x76
sensor ======== Removing existing devices from the i2c bus… ========
sensor Deleting device found at 0x76.
sensor ======== Unloading any existing modules… ========
sensor Unloading module bmp280 as bmp280-i2c.
sensor modprobe: FATAL: Module bmp280 is in use.
sensor New active: [118]
sensor ======== Loading devices found… ========
sensor Loading device bmp280-i2c (chip ID 88) on address 0x76.
sensor Loaded 1 of 1 device(s) found
sensor initializing reading
sensor IIO context created: local
sensor Backend version: 0.16 (git tag: v0.16)
sensor Backend description string: Linux 664add9758ac 5.10.95-v7 #1 SMP Thu Feb 17 11:43:01 UTC 2022 armv7l
sensor IIO context has 1 attributes:
sensor local,kernel: 5.10.95-v7
sensor IIO context has 1 devices:
sensor iio:device0: bmp280
sensor 2 channels found:
sensor pressure: (input)
sensor 2 channel-specific attributes found:
sensor input, value: 97.618246093
sensor oversampling_ratio, value: 16
sensor temp: (input)
sensor 2 channel-specific attributes found:
sensor input, value: 14900
sensor oversampling_ratio, value: 2
Hello, I’ll see if I can reproduce the error to troubleshoot. Just to clarify, are you using a Pi 3A+ or 3B+?
mcjhn
January 16, 2023, 7:47pm
5
OK, many thanks!
I’ve had the same error starting afresh with a 3A+ and a 3B+, the messages above are from a 3B+.
mcjhn
January 16, 2023, 8:23pm
6
Hi,
I looked over the error output and saw:
sensor File “/usr/src/app/transformers.py”, line 38, in device_transform
sensor for field in fields:
sensor RuntimeError: dictionary keys changed during iteration
and guessed /usr/src/app/transformers.py might be the problem.
using info from:
I tried RAW_VALUES
set to 1
and it works beautiful like with the bmp680, however the output of the temperature is 14860 instead of 14.9 degrees
Is it possible to fix?
Yes, I’m seeing the same issues with transformers.py using the BMP-280. I’ll see if we can make a quick fix to allow RAW_VALUES
to be set to 1
so the temperature is a usable value.
mcjhn
January 16, 2023, 10:14pm
8
OK, thanks so much, actually the value is not too much of an issue as its simply a factor of 1000.
We are using the sensors to save energy at our small school in the Highlands, Scotland, many thanks for the amazing software.
You’re welcome, sounds like a great use case!
I actually meant “RAW_VALUES
to be set to 0
for usable temperature” before. Anyway, I rebooted and now it’s working fine for me, so tough to troubleshoot further at the moment.
My plan is to replace the existing sensor block with one more like this: GitHub - alanb128/big-sensor: Instantly read data from 15+ popular Adafruit sensors without any configuration. (should still be backwards-compatible) in the near future so it may not matter…
mcjhn
January 24, 2023, 7:12pm
11
Linked to another thread about intervals here:
Hi,
I’m very new to this and I apologies for the basic question. How do you change the reporting interval from the default 8 seconds to another value? From the link below, I think it’s something to do with MQTT_PUB_INTERVAL?
Any help greatly appreciated.
I followed the end of the guide and used GitHub - balena-io-experimental/simple-sensor: Read sensor data and send via MQTT and that worked a lot better (it has the latest version of the Sensor block)