adding a simple-sensor

I am trying to spin up a new simple-sensor to connect to my sense server. I tried just installing the simple-sense image as-is on a pi zero w and it just keeps restarting the sensor service. I compared the sensor service in the docker-compose for sense and simple-sensor and I noticed that sense uses a Dockerfile and a startup script with the sensor service. So I brought those changes over to my clone of the simple-sensor repo and did a balena push from my local machine. The build appears to do the right thing adding in the call to the startup script:

user@User-PC:~/work/simple-sensor$ balena push simple-sensor -c --release-tag=1.0.4
[Info]     Starting build for simple-sensor, user xxxxxxx
[Info]     Dashboard link: https://dashboard.balena-cloud.com/apps/xxxxxxxxx/devices
[Info]     Building on arm01
[Info]     Pulling previous images for caching purposes...
[Success]  Successfully pulled cache images
[sensor]   Step 1/4 : FROM balenablocks/sensor
[sensor]    ---> e3f96d181e09
[sensor]   Step 2/4 : WORKDIR /usr/src/app
[sensor]    ---> Running in 26c61146ae17
[sensor]   Removing intermediate container 26c61146ae17
[sensor]    ---> 82a64f3605d3
[sensor]   Step 3/4 : COPY start.sh start.sh
[sensor]    ---> f473c455c12f
[sensor]   Step 4/4 : CMD ["bash", "start.sh"]
[sensor]    ---> Running in 25fb763243ed
[sensor]   Removing intermediate container 25fb763243ed
[sensor]    ---> 8388de2d5c1c
[sensor]   Successfully built 8388de2d5c1c
[Info]     Uploading images
[Success]  Successfully uploaded images
[Info]     Built on arm01
[Success]  Release successfully created!

and this build also just keeps restarting as well. I’ve tried manually starting the container locally with the same parameters and this seems to fail as well.

`root@8e6eced:~# balena -D -l debug run 8388de2d5c1c --name sensor-manual -l “io.balena.features.kernel-modules:1” -l “io.balena.features.supervisor-api:1” -l “io.balena.features.sysfs:1” -e COLLAPSE_FIELDS=1 -e RAW_VALUES=0 “/usr/bin/entry.sh bash start.sh”
DEBU[2021-07-23T15:24:02.569171997Z] [hijack] End of stdout
root@8e6eced:~# echo $?
139

Am I missing something and/or do you have suggestions to further debug this? Since the container exits so quickly there are no logs generated so I have little to go on.

I have ruled out hardware issues since I am able to run sense on this hardware without a problem but since I already have a sense server I don’t really need a second one.

thanks!

Hello, often when the sensor service restarts repeatedly it’s because the attached sensor is not supported. The list of supported sensors varies by device type. All of our lists show the sensors supported for the Raspberry Pi 3. For the Pi Zero, the BME680 and BMP280 are supported, but the BME280 is not. (We’ll make this distinction clearer in the documentation.) Which type of sensor are you trying to use?

By the way, both methods you mentioned of using the sensor block are acceptable. The only reason balenaSense uses the startup script is to also change the device’s host name.

Thanks for the reply. The sensor is a BMP280. I also tried to start it without any sensors attached and that also resulted in constant restarts. I’m going to try a different pi zero w and see if I get the same result…

Hi, did you have any luck? I was able to get a BMP280 working on a Pi Zero WH using Simple Sensor, so if you’re still having issues let us know more about your set up. OS version, Pi Zero model, etc…

I got it to work although I’d love to hear how you did it. I ended up adding “raspberry-pi” as a supportedDeviceType and as the default deviceType in balena.yaml. Without these, it would continue the reboot cycling

I’m glad to hear you got it to work. I was probably using the CLI (as opposed to the “Deploy with Balena” button) so that missing device type did not affect me. I added raspberry-pi to the balena.yaml file so hopefully it won’t be a problem for anyone in the future. Thanks for letting us know!