# Introduction

For many projects, you may need to control or have access to some external hardware via interfaces like GPIO, I2C or SPI. For single-container fleets, you will automatically have access to `/dev` and these interfaces as the container is run in [**privileged** mode](https://docs.docker.com/engine/reference/commandline/run/#/full-container-capabilities-privileged). This means you should be able to use any hardware modules like you would in a vanilla Linux environment.

Multicontainer fleets do not run containers in privileged mode by default. If you want to make use of hardware, you will have to appropriately configure your `docker-compose.yml` file to either set some services to privileged, using `privileged: true`, or use the `cap_add` and `devices` settings to map in the correct hardware access to the container.

As an example, here the `gpio` service is set up to use i2c and serial uart sensors:

```
gpio:
	build: ./gpio
	devices:
	  - "/dev/i2c-1:/dev/i2c-1"
	  - "/dev/mem:/dev/mem"
	  - "/dev/ttyACM0:/dev/ttyACM0"
	cap_add:
	  - SYS_RAWIO
```

{% hint style="warning" %}
If you are not using one of the Docker base images recommended in our [base images wiki](/reference/base-images/balena-base-images.md), then it's most likely you will need to handle the updating of `/dev` via [udev](https://www.freedesktop.org/software/systemd/man/udev.html) yourself.
{% endhint %}

For more details on interacting with external hardware, check out these guides:

* [GPIO](/learn/develop/hardware/gpio.md)
* [i2C and SPI](/learn/develop/hardware/i2c-and-spi.md)
* [USB](/learn/develop/hardware/usb.md)
* [Jetson Orin devices](/learn/develop/hardware/jetson-orin.md)


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.balena.io/learn/develop/hardware/introduction.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
