Control a physical Arduino board from SolveIt (or any cloud environment) through SSH tunnels. This project enables AI assistants to write, compile, and upload Arduino sketches to hardware on your local workstation.
The magic: Your Arduino is connected to your local machine, but AI tools running in the cloud can directly flash code to it. No manual copy-paste required.
┌─────────────────┐ SSH ┌─────────────┐ reverse SSH ┌─────────────────┐ USB ┌─────────┐
│ SolveIt Cloud │ ───────────▶ │ VPS │ ◀───────────── │ Workstation │ ───────────▶ │ Arduino │
│ (AI + Tools) │ │ (gateway) │ (autossh) │ (arduino-cli) │ │ Board │
└─────────────────┘ └─────────────┘ └─────────────────┘ └─────────┘
| Component | Purpose |
|---|---|
arduino_remote.py |
Core Python module with 7 tool functions |
setup_guide.ipynb |
Complete setup guide (Part 1) |
module.ipynb |
Module development walkthrough (Part 2) |
CRAFT.ipynb |
SolveIt auto-loading configuration (Part 3) |
| Tool | Description |
|---|---|
detect_board() |
Auto-detect connected Arduino port and board type |
create_sketch(name, code) |
Write Arduino code to a temp file |
send_sketch(name) |
Transfer sketch to workstation |
compile_sketch(name) |
Compile using arduino-cli |
compile_lib_sketch(name) |
Compile with external libraries |
install_lib(lib_name) |
Install Arduino libraries |
upload_sketch(name) |
Flash to the Arduino board |
- Python 3.12+
- Fabric - SSH connection management
- arduino-cli - Command-line Arduino toolchain
The system uses a reverse SSH tunnel to reach your local workstation from the cloud:
- Your local machine maintains an
autosshconnection to your VPS - This creates a reverse tunnel (e.g., port 2222 on VPS → port 22 on local)
- SolveIt SSHs to your VPS, then through the tunnel to your workstation
- Commands are executed via
arduino-clion your local machine
fabric>=3.0
- A VPS with SSH access
arduino-cliinstalled on your local workstationautosshfor maintaining the reverse tunnel- SSH key authentication configured
-
Follow Part 1 setup guide for complete setup:
- Installing arduino-cli
- Configuring SSH keys
- Setting up the reverse tunnel with autossh
- Testing the connection
-
Configure the module - Edit the module to match your setup (doc):
ARDUINO_PATH = "/path/to/your/arduino/sketches" ARDUINO_CLI = "/path/to/arduino-cli" SSH_CMD = "ssh your-vps ssh -p 2222 -i /path/to/.ssh/solveit your-user@localhost" LIB_PATH = "/path/to/Arduino/libraries"
-
For SolveIt integration, place files in your instance and use the CRAFT pattern to auto-load the tools.
What started as a simple SSH reverse tunnel to flash my Arduino from the cloud evolved into a complete AI-integrated tooling system.
I wanted to program my Arduino from SolveIt, a cloud-based development environment, but my board was physically connected to my local workstation. Solution: set up a reverse SSH tunnel through my VPS to bridge the gap.
After manually running SSH commands repeatedly, I wrapped everything into a clean Python module with 7 functions: detect board, create/send/compile/upload sketches, and manage libraries. One import, and I had full Arduino control from the cloud.
The real breakthrough: making these functions available as AI tools. By adding proper type hints and docstrings, SolveIt's AI assistant could now directly call these functions autonomously.
I can now write my code by learning with AI, compile it, and upload it to my physical board in one place.