AIngle Minimal - Ultra-Light IoT Node
Complete IoT-ready implementation of AIngle for resource-constrained devices
Overview
AIngle Minimal is an ultra-lightweight node implementation designed for IoT devices with strict resource constraints (<1MB RAM, <5MB storage). It provides enterprise-grade features while maintaining minimal footprint.
Key Features
- Ultra-Light Footprint: Target <512KB RAM, optimized for embedded systems
- CoAP Transport: RFC 7252-compliant UDP protocol for constrained networks
- DTLS Security: Optional encryption with PSK or certificate-based auth
- Smart Discovery: Both mDNS and CoAP multicast peer discovery
- Sensor Abstraction: Unified interface for all sensor types
- Power Management: Adaptive battery-aware power profiles
- OTA Updates: Secure over-the-air firmware updates with rollback
- Mesh Ready: Support for WiFi Direct, BLE, LoRa (coming soon)
Quick Start
Installation
Add to your Cargo.toml:
[]
= { = "0.1", = ["coap", "sqlite"] }
Basic Usage
use ;
async
Complete IoT Device Example
use *;
use Duration;
async
Feature Documentation
1. DTLS Security
Secure your CoAP communications with DTLS:
use *;
// PSK (Pre-Shared Key) - Recommended for IoT
let dtls_config = psk;
// Or derive from passphrase
let psk = derive_psk_from_passphrase;
// Create secure server
let mut server = new?;
server.start.await?;
println!;
2. Sensor Management
Unified interface for all sensor types:
use *;
// Create sensor manager
let mut manager = new;
// Register sensors
manager.register;
manager.register;
manager.register;
// Read all sensors
for reading in manager.read_all
// Calibrate a sensor
let mut sensor = new;
sensor.calibrate?;
3. Power Management
Battery-aware adaptive power profiles:
use *;
let mut pm = new;
// Update battery status
pm.update_battery;
// Auto-adjust profile based on battery
pm.set_auto_adjust;
// Or manually set profile
pm.set_power_profile;
// Check recommended actions
if pm.should_enter_low_power
// Estimate time to empty
if let Some = pm.estimate_time_to_empty
// Enter sleep mode
let sleep_config = new;
pm.enter_sleep_mode?;
// Get power statistics
let stats = pm.get_stats;
println!;
4. OTA Updates
Secure firmware updates over the network:
use *;
let mut ota = new;
// Configure update server
ota.set_update_server;
ota.set_channel;
// Check for updates
if let Some = ota.check_for_updates.await?
// Monitor progress
let progress = ota.progress;
println!;
5. Device Discovery
Multi-protocol peer discovery:
use *;
// Create discovery service
let mut discovery = new?;
// Register for mDNS discovery
discovery.register?;
// Start browsing for peers
discovery.start_browsing?;
// Wait for peers to be discovered
after.await;
// Get discovered peers
let peers = discovery.get_peers;
println!;
for peer in peers
// CoAP multicast discovery (if enabled)
Power Profiles Comparison
| Profile | Network Sync | Sensor Rate | CPU % | Power (mW) | Battery Life* |
|---|---|---|---|---|---|
| High Performance | 1s | 100ms | 100% | 1000 | ~1 day |
| Balanced | 5s | 1s | 75% | 500 | ~3 days |
| Low Power | 30s | 10s | 50% | 200 | ~1 week |
| Ultra Low Power | 5min | 60s | 25% | 50 | ~1 month |
*Estimated with 3000mAh battery at 3.7V
Supported Sensor Types
- Environmental: Temperature, Humidity, Pressure, Air Quality
- Light: Ambient light, UV index
- Motion: Accelerometer, Gyroscope, Magnetometer, PIR
- Location: GPS coordinates with altitude
- Energy: Voltage, Current, Power consumption
- Proximity: Distance sensors
- Sound: Noise level (dB)
- Custom: Extensible via
Sensortrait
Memory Budget
| Component | Budget | Notes |
|---|---|---|
| Runtime | 128KB | Async executor + core runtime |
| Crypto | 64KB | BLAKE3 + DTLS state |
| Network | 128KB | CoAP server + buffers |
| Storage | 128KB | Graph cache + indexes |
| Sensors | 32KB | Sensor readings + calibration |
| Power | 16KB | Battery stats + profiles |
| OTA | 16KB | Update metadata (firmware in external storage) |
| Total | 512KB | Target RAM usage |
Build Profiles
Development (Debug)
Production (Release)
Ultra-Minimal (Embedded)
Feature Flags
| Feature | Description | Default |
|---|---|---|
std |
Standard library support | ✅ |
no_std |
Embedded/no_std mode | ❌ |
coap |
CoAP transport (RFC 7252) | ✅ |
sqlite |
SQLite storage backend | ✅ |
rocksdb |
RocksDB storage backend | ❌ |
mdns |
mDNS/DNS-SD discovery | ❌ |
mesh |
Mesh networking | ❌ |
ble |
Bluetooth LE transport | ❌ |
lora |
LoRa transport | ❌ |
wifi_direct |
WiFi Direct support | ❌ |
ai_memory |
Titans Memory integration | ❌ |
smart_agents |
HOPE Agents integration | ❌ |
Testing
Run all tests:
Run IoT integration tests:
Run benchmarks:
Hardware Compatibility
Tested on:
- ESP32 (WiFi, BLE)
- ESP8266 (WiFi only)
- STM32 (with external network)
- Raspberry Pi Zero W (full features)
- Arduino (via esp-rs)
Minimum requirements:
- RAM: 512KB (1MB recommended)
- Flash: 2MB (4MB recommended)
- CPU: 80MHz+ (240MHz recommended)
- Network: WiFi, Ethernet, BLE, or LoRa
Real-World Examples
Temperature Monitoring Station
// Read DHT22 sensor every minute
let mut sensor = new;
loop
Solar-Powered Weather Station
// Ultra low power mode for solar devices
let mut pm = new;
pm.set_power_profile;
// Wake every 5 minutes, take reading, sleep
loop
Smart Home Gateway
// Discover devices on local network
let mut discovery = new?;
discovery.register?;
discovery.start_browsing?;
// Handle device connections
loop
Performance
Benchmarks on ESP32 (240MHz, 520KB RAM):
| Operation | Time | Memory |
|---|---|---|
| Node startup | 450ms | 380KB |
| CoAP message send | 8ms | +2KB |
| Sensor reading | 120μs | +128B |
| DTLS handshake (PSK) | 45ms | +8KB |
| OTA update (1MB) | 35s | +16KB* |
| Graph query | 2.5ms | +4KB |
*Firmware stored in external flash
Contributing
We welcome contributions! Please see CONTRIBUTING.md for guidelines.
License
Licensed under Apache License 2.0. See LICENSE for details.
Links
- Documentation: https://docs.rs/aingle_minimal
- Repository: https://github.com/ApiliumCode/aingle
- Issues: https://github.com/ApiliumCode/aingle/issues
Roadmap
- CoAP Transport (RFC 7252)
- DTLS Security Layer
- Sensor Abstraction
- Power Management
- OTA Updates
- Device Discovery (mDNS + CoAP multicast)
- BLE Transport
- LoRa Transport
- WiFi Direct Mesh
- Edge ML Inference
- CBOR Encoding (smaller than JSON)
- LwM2M Protocol Support
Built with ❤️ for the IoT community