uno-revive-rs
References
Roadmap
Components & Controllers
- 1-2 Uno R3 m328p
- Soil moisture sensor: m328p-sensors
- 2 Uno R3 m2560
- OLED display shields for values on board near garden
- Boards B & C (displays): m2560-oled-shields
Board: Arduino Uno R3 m328p (sensors)
Controls all sensors, captures soil moisture inputs.
- Soil Moisture sensors:
Connections:
- In: Soil sensors
- Out-Channel 1: m2560 OLED displays
- Out-Channel 2: <some datalogger module I haven't chosen yet>
Installation: m328p-sensors
dependencies
- Rust
- avr-gcc
To compile and install the code for m328p-sensors you'll first need to have Rust installed. If you don't already, see https://www.rust-lang.org/tools/install.
You will also need in installation of avr-gcc, a GNU cross compiler to the avr architecture. avr-gcc can be installed with homebrew
brew tap osx-cross/avr && brew install avr-gcc
cloning the repo along with its submodules
git clone https://github.com/ethgallucci/uno-revive-rs
cd uno-revive-rs
git submodule init
git submodule update
building from source
ensure Rust toolchain is set to nightly-1.51.0
Since we are cross compiling from Rust to AVR, we need to make sure our Rust compiler is on the right channel (e.g. one that supports the avr fork of Rust).
rustc --version
Ensure the rust-toolchain.toml file is correctly enforcing the correct nightly channel (1.51.0-nightly). If it's not, you can switch to the correct nightly version (since we use override here, the Rust toolchain version will only be affected in this directory).
rustup override set nightly-2021-01-07
compiling and flashing to m328p
From the root directory of uno-revive-rs
cargo build-328p
Move into m328p-sensors and flash the code (ensure board is plugged in and recognized)
cd m328p-sensors
cargo run
Dev
There are a few ways to compile the system.
With both boards plugged in (builds and flashes to board)
avr-garduino/m328-sensors $ cargo run
avr-garduino/m2560-oled-shields $ cargo run
From root with provided aliases:
avr-garduino $ cargo build-sensors && cargo build-i2c
From root manual:
avr-garduino $ cargo build --verbose --package m328p-sensors --target=m328p-sensors/spec/avr-atmega328p.json
avr-garduino $ cargo build --verbose --package m2560-oled-shields --target=m2560-oled-shields/spec/avr-atmega2560.json
From package:
avr-garduino/m328p-sensors $ cargo build --verbose
avr-garduino/m2560-oled-shields $ cargo build --verbose
Special Thanks
I want to extend my gratitude to the contributors of the avr-hal crate. This project couldn't have done it without them :)