Skip to content

An example using Tauri to build a Desktop app for Raspberry PI with Arduino.

Notifications You must be signed in to change notification settings

JimJ92120/raspberry-pi-arduino-serial-tauri

Repository files navigation

raspberry-pi-arduino-serial-tauri

Project is an example with Tauri (VueJS + Vuetify) as Desktop app to communicate with an Arduino in Serial.
Project aims to attempt development under a single language, Rust.



directory stucture

/
  /src # vuejs client
  /src-arduino # arduino program in rust to upload
  /src-tauri # rust backend


installation

requirements

rust 1.74.1
nodejs >= 20.0
typescript >= 5.0
vue-cli >= 5.0

others

Please check Tauri documentation for additional packages: https://tauri.app/

For aarch64 compilation, additional packages are also required: https://tauri.app/v1/guides/building/linux#cross-compiling-tauri-applications-for-arm-based-devices

For Arduino compilation and build from Rust, follow this tutorial: https://blog.logrocket.com/complete-guide-running-rust-arduino/
To consume Arduino C++ librairies (from Arduino Library Manger), follow this tutorial: https://dev.to/kgrech/five-simple-steps-to-use-any-arduino-c-library-in-a-rust-project-1k78

setup

Default serial port used is /dev/ttyACM0.
This can be changed in main.rs.



arduino

Upload the script from arduino/arduino.ino to an Arduino board.

board schema

In arduino/arduino.ino, the GPIO pin #2 is used.

image


commands

development

For full stack:

npm run tauri dev

Client only:

npm run serve

tauri build

View Tauri building.

build will be output in src-tauri/release/bundle/${APP_NAME}.${EXTENSION}.

# default
npm run tauri build

# `aarch64` (Raspberry PI 64-bits):
export PKG_CONFIG_SYSROOT_DIR=/usr/aarch64-linux-gnu/
npm run build:arm

arduino build

The src-arduino will get compiled and upload to the Arduino board.
avrdude is used to compile for Arduino boards.

npm run upload:arduino


how to

The default app will render 2 buttons to toggle a LED (on / off) via commands given through USB Serial to Arduino.

image

serial logs

Some "logs" are printed in serial monitor (e.g VSCode):
image



documentation and links

About

An example using Tauri to build a Desktop app for Raspberry PI with Arduino.

Topics

Resources

Stars

Watchers

Forks