Drive and orchestrate Arduinos, ESPs, nodeMCU, RaspberryPis and all kind of Firmata-compatible hardware in pure async Rust. Control LEDs, sensors, motors from your laptop with the safety and speed of Rust.
Program robots and embedded devices with confidence. Hermes-Five gives you high-level APIs to remotely control boards ( Arduino, ESP, nodeMCU, RaspberryPI, ..), extenders (PCA9685, PCF8575, ..) LEDs, sensors, servos and more, all from safe and asynchronous Rust code. Think Johnny-Five, but safer, faster, and fully async.
Hermes-Five offers three main documentation sources:
- The user documentation for tutorials and concepts.
- The API documentation for developer reference.
- The examples directory to learn by doing.
- 🧠 High-level abstractions: Control LEDs, sensors, buttons, servos and all kind of devices. Write expressive, async Rust code to control them.
- 🛜 Protocol-agnostic: Serial, WiFi and Bluetooth supported (via Firmata).
- 🧩 Modular design: Plug-and-play support for boards and devices. Arduino, ESP32, nodeMCU, Raspberry Pi, etc.
- 🕹️ Animation engine: Interpolate servo movements, LED fades and more with ease.
- 🧪 Test-friendly: Includes mocks to run and test logic without hardware.
🖱️ Prefer a GUI over code? Try Hermes-Studio - a visual programming interface powered by Hermes-Five.
- Flash the compatible Firmata Protocol client via Arduino IDE on your board.
- Create a new Rust project:
cargo new my_awesome_project
cd my_awesome_project
- Add this crate to your dependencies in the
Cargo.toml
file.
[dependencies]
hermes-five = "0.1.0"
- Modify your
src/main.rs
as needed ( see examples for inspiration). - Start by exploring the examples code, the user documentation
- or the API documentation
Tip
Feature flags:
- libudev -- (enabled by default) Activates
serialport
crate libudev feature under-the-hood (required on Linux only for port listing). - serde -- Enables serialize/deserialize capabilities for most entities.
- mock -- Provides mocked entities of all kinds (useful for tests mostly).
The following example shows the simplest possible program: from your computer, command a serially connected Arduino to blink its built-in LED on pin 13.
use hermes_five::hardware::{Board, BoardEvent};
use hermes_five::devices::Led;
#[hermes_five::runtime]
async fn main() {
// Register a new board
// (of type arduino + auto-detected serial port by default)
let board = Board::start().unwrap();
// When board communication is ready:
board.on(BoardEvent::OnReady, |board: Board| async move {
// Register a LED on pin 13 (arduino embedded led).
// Pin: 13; OFF by default
let mut led = Led::new(&board, 13, false)?;
// Blinks the LED every 500ms: indefinitely.
led.blink(500);
Ok(())
});
}
All available examples can be found in the examples folder.
To start an example, run the following command:
cargo run --example folder_examplename
To run an example in a file called examples/folder/examplename.rs
, use the concatenation name
as folder_examplename
.
If you want the "full" log output you can use:
RUST_LOG=DEBUG cargo run --example folder_examplename
For details, see the full roadmap: currently working toward release 0.2
All contributions are more than welcome through PR and the issue queue.
- Fork the repository
- Create a new branch:
git checkout -b feature-branch
- Commit your changes:
git commit -am 'Add new feature'
- Push to the branch:
git push origin feature-branch
- Create a new Pull Request
The author does not claim to know everything about Rust programming or IoT, and all ideas are welcome as long as they respect the project's original philosophy.
This project is licensed under the MIT License. See the LICENSE file for details.
For support, please open an issue or reach out to the author.