🛠 Advanced GPIO Control on Arduino UNO Q

Arduino UNO Q SBC Controller Bundle · avance · Configurez des entrées-sorties personnalisées via les nœuds Modulino pour interagir avec le système Linux.

Objectives

This tutorial aims to master low-level interaction between Modulino nodes and the Linux system of the Arduino UNO Q. You will learn to map physical inputs (buttons, joystick) to system events and control outputs (pixels) for complex haptic or visual feedback, going beyond simple mouse/keyboard emulation.

Required Hardware

Steps

  1. Physical Connection: Assemble the UNO Q board in its 3D case. Connect Modulino nodes to dedicated ports. Ensure the USB-C hub is connected for network and display access.
  1. System Access: Open an SSH terminal to the UNO Q via its local IP. Verify peripheral detection using lsusb to confirm Modulino presence.
  1. App Lab Configuration: Launch Arduino App Lab. Select the "Custom Controller" project. In the "Mapping" tab, associate the physical button with a specific keyboard key (e.g., KEY_ESC) and the joystick with mouse axes.

import hid dev = hid.device(vid=0x2341, pid=0x0050) dev.open_path(dev.enumerate()[0]['path']) print(dev.read(64))

  1. GPIO Control Script: For advanced control, create a Python script using the hidapi library or direct GPIO interfaces if exposed. Example state reading:```python

5. **Dynamic Mapping**: Use `evtest` to monitor raw events. Create a `udev` rules file to trigger a shell script when a Modulino button is pressed, allowing system command execution (e.g., launching a Home Assistant app).

6. **Visual Feedback**: Configure Modulino pixels to light up based on system state. In App Lab, link the LED output to a logical GPIO signal or use a script to send HID LED control packets.

## Verification
Run `evtest` in the terminal. Press the Modulino button: you should see an `EV_KEY` event generated. Verify that pixels illuminate during action. If mapping fails, check udev permissions and restart the device management service.

## Going Further
Explore creating multiple profiles to switch between "Retro Gaming" and "Home Automation" modes. Integrate external sensors via extended GPIOs for increased environmental responsiveness.

Other tutorials for this board

Code examples for this board

← Back to the board 🛠 All tutorials