BREAKING CHANGE: Replace separate anchor/tag firmware with single configurable codebase ## Major Changes - **Unified Firmware**: Single main.cpp replaces main_anchor.cpp and main_tag.cpp - **Modular Config**: Organized configuration system in src/config/ directory - **Dynamic Behavior**: Device behavior determined by build flags at compile time - **Simplified Builds**: Reduced from 8+ environments to 3 core environments ## New Architecture - src/main.cpp - Single firmware with config-driven behavior - src/config/device_config.h - Device role detection and unified behavior - src/config/anchor_config.h - Anchor-specific settings (positioning, communication) - src/config/tag_config.h - Tag-specific settings (USB streaming, coordinate collection) - src/config/positioning_config.h - Distributed positioning algorithm framework ## Build System Improvements - Simplified platformio.ini (anchor/tag/debug environments) - Support for custom device ID and network via PLATFORMIO_BUILD_FLAGS - Same firmware for all devices, behavior configured at compile time - Easy device configuration: set PLATFORMIO_BUILD_FLAGS=-DUWB_INDEX=5 -DNETWORK_ID=2000 ## Technical Benefits - Reduced code duplication from ~350 lines to unified ~200 lines - Consistent behavior across device types - Easier maintenance with single codebase - Framework ready for distributed positioning algorithm implementation - Modular configuration system for future algorithm expansion ## Positioning Framework Ready - Anchor discovery protocol framework established - Inter-anchor communication configuration ready - Position calculation algorithm structure in place - Coordinate storage and validation system configured - Tag coordinate collection and USB streaming framework prepared ## Testing - ✅ Anchor build successful (325KB flash usage) - ✅ Tag build successful (325KB flash usage) - ✅ Custom device ID/network configuration working - ✅ UWB initialization sequence fixed for active networks
118 lines
4.3 KiB
Markdown
118 lines
4.3 KiB
Markdown
# MaUWB ESP32-S3 Positioning System
|
|
|
|
Ultra-wideband (UWB) positioning system using ESP32-S3 and Makerfabs UWB modules for indoor positioning and warehouse mapping applications.
|
|
|
|

|
|
|
|
## Features
|
|
- ESP32-S3 based anchor and tag devices
|
|
- Real-time distance measurement with <10cm accuracy
|
|
- OLED display for status and measurements
|
|
- Multiple tag support (up to 64 tags)
|
|
- 6.8Mbps communication rate
|
|
- Complete AT command implementation
|
|
- Position calculation with trilateration
|
|
- Anchor auto-positioning system
|
|
- Real-time positioning with USB data logging
|
|
|
|

|
|
|
|
**Hardware:** [Makerfabs MaUWB ESP32-S3 UWB Module](https://www.makerfabs.com/mauwb-esp32s3-uwb-module.html) with SSD1306 OLED displays
|
|
|
|
## Unified Architecture
|
|
|
|
**Single Firmware** - All devices use the same `main.cpp` with config-driven behavior:
|
|
- `anchor`: Base station with distributed positioning framework (default: ID=0, Network=1234)
|
|
- `tag`: Mobile tracker with coordinate collection (default: ID=1, Network=1234)
|
|
- `debug`: Development build with debug output enabled
|
|
|
|
## Build & Upload
|
|
```bash
|
|
# Build with default settings
|
|
pio run -e anchor # Anchor ID=0, Network=1234
|
|
pio run -e tag # Tag ID=1, Network=1234
|
|
|
|
# Build with custom device ID and network
|
|
set PLATFORMIO_BUILD_FLAGS=-DUWB_INDEX=5 -DNETWORK_ID=2000
|
|
pio run -e anchor # Anchor ID=5, Network=2000
|
|
|
|
# Upload to device
|
|
pio run -e tag -t upload
|
|
|
|
# Monitor serial output
|
|
pio device monitor
|
|
```
|
|
|
|
## Project Structure
|
|
|
|
### Modular Configuration System
|
|
- `src/main.cpp` - Single unified firmware for all device types
|
|
- `src/config/` - Device behavior configuration
|
|
- `config.h` - Hardware pins and system settings
|
|
- `device_config.h` - Device role detection and unified behavior
|
|
- `anchor_config.h` - Anchor-specific settings (positioning, inter-anchor communication)
|
|
- `tag_config.h` - Tag-specific settings (USB streaming, coordinate collection)
|
|
- `positioning_config.h` - Distributed positioning algorithm parameters
|
|
- `lib/UWBHelper/` - Complete UWB AT command library with positioning support
|
|
- `platformio.ini` - Simplified build environments (3 instead of 8+)
|
|
|
|
## AT Command Support
|
|
|
|
Complete implementation of all AT commands from the official manual:
|
|
|
|
### Basic Commands
|
|
- `AT?` - Test connection
|
|
- `AT+GETVER?` - Get firmware version
|
|
- `AT+RESTART` - Restart module
|
|
- `AT+RESTORE` - Factory reset
|
|
- `AT+SAVE` - Save configuration
|
|
|
|
### Configuration
|
|
- `AT+SETCFG` / `AT+GETCFG?` - Device configuration
|
|
- `AT+SETANT` / `AT+GETANT?` - Antenna delay calibration
|
|
- `AT+SETCAP` / `AT+GETCAP?` - System capacity settings
|
|
- `AT+SETRPT` / `AT+GETRPT?` - Auto-reporting control
|
|
|
|
### Network & Power
|
|
- `AT+SETPAN` / `AT+GETPAN?` - Network ID configuration
|
|
- `AT+SETPOW` / `AT+GETPOW?` - Transmission power control
|
|
- `AT+SLEEP` - Sleep mode for battery conservation
|
|
|
|
### Data Communication
|
|
- `AT+DATA` / `AT+RDATA` - Custom data transmission
|
|
- Real-time range reporting via `AT+RANGE` parsing
|
|
|
|
## Library Features
|
|
|
|
The enhanced UWBHelper library provides:
|
|
- **Complete AT command coverage**
|
|
- **Advanced range data parsing** for multiple anchors
|
|
- **Position calculation algorithms** (trilateration, multilateration)
|
|
- **Anchor position management** for auto-positioning
|
|
- **Distance filtering** for improved accuracy
|
|
- **Backward compatibility** with existing code
|
|
|
|
## Configuration
|
|
- **Network ID**: 1234 (configurable via AT+SETPAN)
|
|
- **Baud Rate**: 115200
|
|
- **Communication**: 6.8Mbps (AT+SETCFG parameter)
|
|
- **Range filtering**: Enabled for accuracy
|
|
- **Refresh Rate**: 10Hz (configurable via AT+SETCAP)
|
|
- **Max Anchors**: Unlimited (tags connect to 8 closest)
|
|
- **Max Tags**: 64 per network
|
|
|
|
|
|
## Documentation
|
|
|
|
- [AT Command Manual](docs/manuals/Makerfabs%20UWB%20AT%20Module%20AT%20Command%20Manual(v1.1.1).pdf) - Complete AT command reference
|
|
- [Hardware Product Page](https://www.makerfabs.com/mauwb-esp32s3-uwb-module.html) - Official hardware documentation
|
|
- [Project Roadmap](docs/ROADMAP.md) - Development plan for indoor positioning system
|
|
|
|
## Applications
|
|
|
|
This system is designed for:
|
|
- **Indoor positioning** in warehouses and large buildings
|
|
- **Asset tracking** and inventory management
|
|
- **Navigation assistance** in GPS-denied environments
|
|
- **WiFi signal mapping** and coverage analysis
|
|
- **Research and development** in UWB positioning
|