Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Docs on I2C on the Raspberry Pi are outdated #2716

Open
lmbarros opened this issue May 23, 2023 · 6 comments
Open

Docs on I2C on the Raspberry Pi are outdated #2716

lmbarros opened this issue May 23, 2023 · 6 comments

Comments

@lmbarros
Copy link
Contributor

Our docs that explain how to use I2C with the Raspberry Pi family are outdated: they still assume a single container app, while we have been recommending multi-container apps for some time now. The example project we link to is also very old.

(Our docs on multiple containers give some hints on the right way to go, but don't spell out the solution clearly enough either.)

I am not completely sure what a modern I2C example would look like, but here's what I can see for now:

# docker-compose.yml
version: "2"

services:
  my-service:
    # ...
    devices:
      - "/dev/i2c-1:/dev/i2c-1"
      # - "/dev/mem:/dev/mem" # <--- not sure if needed, I don't think so
    cap_add:
      - SYS_RAWIO # <--- not sure if this us the right capability to add. Alternatively, using `privileged: true` should work.)
    labels:
      io.balena.features.kernel-modules: '1'
@jellyfish-bot
Copy link

[lmbarros] This has attached https://jel.ly.fish/2c01bec6-5d4a-4c5b-9668-9e5fdee085d0

@vipulgupta2048
Copy link
Member

Thanks @lmbarros for pointing this out. Maybe we can work with @acostach to figure out the best way to modernize these examples. @acostach What do you think the improvements can be?

@acostach
Copy link
Contributor

@vipulgupta2048 why not link to https://github.com/balena-labs-projects/balena-sense ? It's modern and updated, supports a variety of i2c sensors and is multi-container too

@vipulgupta2048
Copy link
Member

Sounds good to me! @acostach Let's do that, will you make the PR?

@lmbarros
Copy link
Contributor Author

balena sense would be a better example than the one we currently provide, for sure.

FWIW, last Friday I started a little experiment to try these things out myself. For now it is not a good example to share (not documented, and I still have doubts about how it really works), but maybe someday it can become a more focused I2C example. I mean, IMHO, balena sense may be a bit too big as an I2C example. (For example, if you look at the docker-compose.yml , how do you know if some config is required to support I2C or something else used by the project?)

@acostach
Copy link
Contributor

@lmbarros your project doesn't look far from being used as a focused example. Looking at balena-sense's docker-compose I believe privileged was used to allow for the sensors to be used with any device-type, regardless of the i2c busses used. Anyway, I opened #2723 to link to it until a more focused example will be available.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants