Rusty Secure is a comprehensive IoT security system implemented entirely in Rust, demonstrating advanced embedded development with ESP32 microcontrollers, WiFi connectivity, and a complete client-server architecture.
This project demonstrates a fully-functional IoT security system with the following components:
- ESP32 Main Controller (
esp32-main): A baremetalno_stdRust implementation running on ESP32 - ESP32 Camera Module (
esp32-cam): ESP32 with camera usingesp-idfand standard library - API Server (
api-server): Rust-based web server handling image processing and authorization - Desktop Client (
desktop-client): Cross-platform GUI application for system management (planned)
- Dual ESP32 Architecture: Showcases both
no_std(ESP32-Main) and std-based (ESP32-Cam) Rust embedded programming approaches - Multi-sensor Integration: Ultrasonic distance sensor, camera module, LED indicators, and LCD display
- WiFi Connectivity: Secure communication between devices using WiFi
- Image Capture & Analysis: On-demand photo capture with server-side processing
- Authorization System: API-based security authorization flow
- Rust Throughout: 100% Rust implementation across embedded, server, and client components
- Implemented with
no_stdRust using Embassy framework - Runs on standard ESP32 microcontroller
- Features:
- Distance sensor integration (ultrasonic)
- I2C LCD display for status information
- LED indicators for system status
- WiFi client for communication with ESP32-CAM
- Triggers image captures when motion is detected
- Implemented with std Rust and ESP-IDF bindings
- Runs on ESP32-CAM board with OV2640 camera
- Features:
- Embedded web server for on-demand image capture
- Camera control with configurable settings
- Flash LED control
- Image transmission to API server
- Secure WiFi communication
- Rust-based web server using Actix-Web
- Features:
- Image reception and storage
- Authorization management
- Status reporting
- RESTful API design
- Planned Rust GUI application using Iced toolkit
- Features (planned):
- Google OAuth authentication
- Image review and management
- Authorization controls
- Real-time system monitoring
- Rust (latest stable)
- ESP-IDF toolchain
- espup for Rust on ESP32 setup
- ESP32 development board
- ESP32-CAM board with OV2640 camera
- Ultrasonic distance sensor (HC-SR04)
- I2C LCD display (16x2)
- Jumper wires and breadboard
-
Install Rust and required components:
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh rustup update
-
Install ESP32 toolchain using espup:
cargo install espup espup install
-
Add necessary targets:
rustup target add riscv32imc-unknown-none-elf rustup target add xtensa-esp32-none-elf rustup target add xtensa-esp32s3-none-elf
Each component requires proper configuration before use:
-
Create
secrets.rsfiles in each component:esp32-main/src/config/secrets.rsesp32-cam/src/config/secrets.rsapi-server/src/config/secrets.rsdesktop-client/src/config/secrets.rs
-
Configure WiFi credentials:
// Example for esp32-cam/src/config/secrets.rs and esp32-main/src/config/secrets.rs pub const WIFI_SSID: &str = "your_wifi_ssid"; pub const WIFI_PASSWORD: &str = "your_wifi_password"; pub const API_URL: &str = "http://your_api_server_ip:8080/analyse";
Connect components to your ESP32 board:
- Ultrasonic Sensor:
- Trigger: GPIO5
- Echo: GPIO19
- I2C LCD Display:
- SDA: GPIO21
- SCL: GPIO22
- LED Indicator: GPIO2
The ESP32-CAM board already includes the OV2640 camera module and a flash LED on GPIO4.
cd esp32-main
cargo +esp run --releasecd esp32-cam
cargo +esp run --releasecd api-server
cargo run --release- Power on the ESP32 Main Controller
- Power on the ESP32-CAM module
- Start the API server
- The system will:
- Display status information on the LCD
- Monitor for motion using the ultrasonic sensor
- Trigger the ESP32-CAM to capture images when motion is detected
- Process images through the API server for authorization
- Indicate authorization status via the LED
- ESP32 Main Controller: Functional prototype
- ESP32-CAM Module: Functional prototype
- API Server: Basic implementation, needs enhancement
- Desktop Client: Planned, not yet implemented
Contributions are welcome! Here are some areas where help is needed:
- Enhancing the API server functionality
- Implementing the desktop client
- Improving documentation and examples
- Adding new features to the ESP32 components
This project is licensed under the MIT License - see the LICENSE file for details.
