#AzureIoT – Granting access to Raspberry Pi GPIO from an ☁ Azure IoT Edge Module

Buy Me A Coffee

Hi !

Today let’s face a cool question:

How do I grant GPIO access in a Raspberry Pi to an Azure IoT Module?

So, the main goal is to access the GPIO to interact with sensors and actors. Usually, when we run programs in the device that’s easy to accomplish, however running an Azure IoT Module we need to grant these permissions to the module definition.

In the Container Create Options, we need to add the following lines:

{
  "HostConfig": {
    "Binds":[
        "/dev/i2c-1:/dev/i2c-1"
        ],
    "Privileged": true
  }
}

Enabling access to the i2c and also running the module with elevated privileges:

And, of course, if the module is also running as a HTTP server, you need to add here the TCP open ports, and more. That’s it! super easy!

Happy coding!

Greetings

El Bruno



¿Con ganas de ponerte al día?

En Lemoncode te ofrecemos formación online impartida por profesionales que se baten el cobre en consultoría:

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.