michaelkamprath / rust-robot

A two-wheel Arduino robot with firmware written in Rust

Repository from Github https://github.commichaelkamprath/rust-robotRepository from Github https://github.commichaelkamprath/rust-robot

rust-robot

Robot controller code in Rust for a two wheel robot driven by a Arduino Mega 2560.

This is a Work in Progress

Robot Construction

Bill of Materials

The robot this code is designed to control is built with the following parts (some links are affiliate links):

Name Link Notes
YIKESHU 2WD Chassis Kit Amazon
ELEGOO MEGA R3 Board Amazon Any Arduino Mega 2560 variant will do
MEGA Sensor Shield V1 Amazon Not strictly necessary, but it does make wiring much easier
L298N Motor Drive Controller Board Module Dual Amazon There are many makers of this fairly standard board
Infrared Slotted Optical Optocoupler Module Amazon Many variations on optocoupler models. This form factor works best with chassis.
Multicolored Dupont Wires Amazon You will use the female to female wires mostly in this build.
Right angled DC power connector Amazon Will be used to connect the Mega 2560 to power.
6 AA Battery Holder Amazon The chassis kit comes with a 4 AA battery holder, but th robot works better with a 9V power supply
Big Button Module Amazon Adding a button or two to the robot will allow interactions with the control software.
microSD Module Pololu Used to collect telemetry while the robot is running autnomously

Furthermore, You might find the following useful:

Name Link Notes
Machine Screws, Bolts, Washers, and Nuts Kit Amazon You will need some hardware to connect parts to the chassis.
Brass Spacer Standoff Kit Amazon Using standoffs to connect various items to the chassis makes construction easier.
Ball Caster Pololu The tail caster that comes with the chassis kit creates turning error. A ball caster works better

Finally, some soldering is required, so material and equipment required for soldering is required.

Assembly

Robot Firmware

The goal of this project is to write the robot firmware in Rust. For this, this project is using avr-hal as the hardware abstraction layer for the Arduino Mega 2560.

Build Instructions

  1. Install prerequisites as described in the avr-hal README (avr-gcc, avr-libc, avrdude, ravedude).

  2. Run cargo build to build the firmware.

  3. Run cargo run to flash the firmware to a connected board. If ravedude fails to detect your board, check its documentation at https://crates.io/crates/ravedude.

  4. ravedude will open a console session after flashing where you can interact with the UART console of your board.

License

Licensed under either of

at your option.

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

About

A two-wheel Arduino robot with firmware written in Rust

License:Apache License 2.0


Languages

Language:Rust 100.0%