Different LCD sizes for different devices in a multicontainer application

Hi,

I have a use case in a multicontainer application where some devices have a XPT046 3.5 inch LCD touchscreen and others use a 5 inch HDMI lcd touchscreen (used as a biometric access point). Other devices don’t have any display connected (used as a security camera).

Some of these devices have a raspberry pi camera connected and others have a USB webcamera.

All devices do facial recognition (common centralized face database) and log any detections to a central (influxdb) database via MQTT.

I need help building a docker-compose file for the different LCD configurations since some require /dev/fb1 and others do not. Additionally there are different dtoverlay, dtparam configs for LCDs so is there any way to group this using device tags?

Hi @surekap
WRT the docker-compose part, each application has a single one and this is used ahead of time to build an image that reaches all the devices of the application. So, if you can’t have dev/fb1 enabled for all the devices of your fleet, then you will probably need to use a different application for each docker-compose configuration that you need and then have the respective devices on each application.

About setting device config vars based on the device tags, you could create a script to do that. The balena-sdk does the primitives to fetch all devices of an application and filter on specific tags and also offers methods for setting device config vars. You could have such a script on your computer and run it whenever needed but you could also make it part of your application (if the device can boot even w/o the proper config vars).
In that case you could have a script as part of your application to

  • fetch the tags & the current device config vars for the device it’s running on by using the device uuid that the supervisor makes available in the containers as the RESIN_DEVICE_UUID env var
  • check whether the device config vars have the appropriate values based on the tags that the device has and set them if they are different/missing.

This will need some testing to make sure you don’t endup in bootloops, since the device gets restarted when a device config var gets updated. Ideally, if you are using a multicontainer enabled application, you could have all this logic running on a single container, so that you don’t mix it at all you the rest of your application code.

Kind regards,
Thodoris

Thanks,

I’ve split the applications into two - one for devices with a display and the other without.

For the device config vars, I’m planning on using the Balena API to orchestrate these via a custom web control panel - Will have to include the LCD size config there and add the requisite device variables.