This directory provides code for the firmware of a smart home gateway prototype.
ADD PICTURE
In order to build the firmware you need to install the Rust programming language (see Rust install) and Docker. Mind that Rust implicitly expects a linker to be installed on your system.
After installing Rust, run:
cargo install cross --git https://github.com/cross-rs/crossfor easy cross compilation;rustup default 1.75.0to get the Rust toolchain version required to build this project binaries;rustup target add wasm32-wasito install the wasm build target needed by virtual device drivers.
You can skip the cross and Docker setup steps if you are installing Rust on a Raspberry Pi for the LoRa proof of concept illustrated below.
Test with following commands from this directory
cargo build -p virt_dev --target wasm32-wasi --releasecargo run -p smart_gwThis will run a mockup version of the gateway where reception of messages from LoRa is emulated.
If you have two Raspberry Pi 3B with Dragino LoRa GPS HAT modules, we also provide code for a physical proof of concept. Install Raspberry Pi OS (tested on this version) and make sure the SPI interface is enabled with sudo raspi-config.
You can either clone this repo and install rust on the Raspberry Pis (as above, minus the installation of cross and Docker) to automatically build & run for their architecture, or you can cross compile the binaries with
cross build -p <crate> --target aarch64-unknown-linux-gnu --releaseand transfer them over via ssh with scp or using an USB drive. When cross-compiling, the output binaries can be found under target/aarch64-unknown-linux-gnu/release/. For this proof of concept we provide the following executables:
-
The
phy_devcrate provides a binary to send LoRa transmissions emulating multiple end-devices. Transfer the binary on the first Raspberry Pi and run it with./phy_dev. -
The
smart_gwcrate provides a binary to run the smart home gateway. Before running the smart gateway, build the virtual device driver as in the previous section (cargo build -p virt_dev --target wasm32-wasi --release). If you are cross-compiling, transfer the virtual device driver wasm binary under the directory structuretarget/wasm32-wasi/release/virt_dev.wasmwhere you placed the smart gateway binary. Now you can run the smart gateway in LoRa mode with.smart_gw --lora.