An Edrys module that enables remote control of microcontrollers and development boards through a Digilent Analog Discovery 2 (AD2). Students can interact with hardware remotely by controlling buttons and potentiometers through a web interface, while the station with the physical hardware executes the commands.
To add the module to your Edrys class, import the following URL:
https://edrys-labs.github.io/module-hardware-control/index.html
The system consists of three main components:
- Frontend Module: An Edrys module that provides the user interface for controlling hardware
- Backend Server: A Flask server that runs locally on the station machine and communicates with the AD2
- Hardware: Microcontroller or development board connected to the AD2 (e.g., Arduino Uno, AVR128DB48, ESP32...)
- Students interact with buttons and sliders in the Edrys module
- The module sends messages to all participants via Edrys
- Only the station executes hardware commands by calling the backend server
- The AD2 controls the connected hardware (digital I/O for buttons, analog output for potentiometers)
- UI state is synchronized across all users in real-time
- ✅ Remote button control (digital I/O)
- ✅ Remote potentiometer control (analog output 0-3.3V)
- ✅ Multiple simultaneous users with synchronized UI
- ✅ Real-time connection status monitoring
- ✅ Dynamic component configuration
- ✅ Support for multiple buttons and potentiometers
- Docker installed (Get Docker)
- Digilent Analog Discovery 2 connected via USB
- Microcontroller/development board connected to AD2
You can run the server using Docker:
docker run -it -p 5005:5005 --device=/dev/bus/usb:/dev/bus/usb edryslabs/module-hardware-control-server:latest- Add the Hardware Control module to your Edrys class (it should only be visible in station)
- In the station configuration, set:
- serverUrl: The URL of your backend server (e.g.,
http://localhost:5005) - components: Array of hardware components to control
- serverUrl: The URL of your backend server (e.g.,
Example configuration:
{
"serverUrl": "http://localhost:5005",
"components": [
{"type": "button", "name": "Button 1", "pin": 4},
{"type": "button", "name": "Button 2", "pin": 5},
{"type": "potentiometer", "name": "Voltage Control", "channel": 0}
]
}- Digilent Analog Discovery 2: Connected to the station computer via USB
- Microcontroller/Development Board: Connected to AD2 (Arduino Uno, AVR128DB48, ESP32, etc.)
- Proper wiring: See wiring examples below
The backend server provides these endpoints:
GET /: Health check - returns server status and device informationPOST /press: Press a button{ "pin": 4 // DIO pin number }POST /release: Release a button{ "pin": 4 // DIO pin number }POST /toggle: Toggle a button (50ms press){ "pin": 4 // DIO pin number }POST /potentiometer/set: Set potentiometer voltage{ "channel": 0, // Analog output channel (W1=0, W2=1) "voltage": 1.65 // Voltage in volts (0.0-3.3) }POST /potentiometer/percent: Set potentiometer percentage{ "channel": 0, // Analog output channel (W1=0, W2=1) "percent": 50 // Percentage (0-100) }
AD2 Device Arduino Uno
───────── ───────────
DIO4 ────────→ Digital Pin 2 (button input)
W1 ────────→ A0 (analog input)
GND ────────→ GND
AD2 Device AVR128DB48
───────── ──────────
DIO4-7 ────────→ PC4-PC7 (button inputs)
W1 ────────→ PF3 (analog input)
GND ────────→ GND
For local development without Docker:
# Install dependencies
pip3 install flask flask-cors
# Run server
python3 server.py