Smart airsoft target — Arduino-based hit detection, Flutter mobile app, Wi-Fi web interface for shot counting and miss tracking. Built for shooting practice.
- Real-time hit detection with a piezo vibration sensor
- Shot counter and miss tracking from the app
- Native Flutter app for Android and iOS
- Built-in web UI — any browser on the LAN works, no install needed
- Fully local: ESP8266 runs its own Wi-Fi access point, zero cloud
- Live WebSocket link with sub-100 ms latency
flowchart LR
S[Piezo sensor] -->|analog| ESP[ESP8266 NodeMCU]
ESP -->|drives| L[Red / Green LEDs]
ESP -->|Wi-Fi AP<br/>SSID: Sniper| W{{WebSocket + JSON}}
W --> M[Flutter mobile app]
W --> B[Browser<br/>Flutter web build<br/>served from LittleFS]
Firmware (sniper_firmware/)
- Arduino C++ on ESP8266 (NodeMCU v2), built with PlatformIO
- Piezo vibration sensor for hit detection, red/green status LEDs
ESPAsyncWebServer— async HTTP + WebSocket serverArduinoJson— message serializationLittleFS— onboard filesystem hosting the Flutter web build- Custom flash partitioning (
sniperPartitions.ld,eagle.flash.4m3m.ld)
Mobile / Web client (sniper_client/)
- Flutter (Dart, SDK 2.18+), Android / iOS / Web targets
web_socket_channel— real-time link to the targetintl— formattingflutter_launcher_icons— app icon generation
Communication
- Wi-Fi (ESP8266 acts as a softAP, SSID
Sniper) - WebSocket transport with JSON payloads for shot events, hit/miss counters, and LED control
- Flutter web build is served directly from the ESP filesystem, so any browser on the network gets the same UI as the mobile app
| Part | Notes |
|---|---|
| NodeMCU v2 (ESP8266) | Main MCU + Wi-Fi |
| Piezo vibration sensor | Hit detection (analog) |
| Red LED | Status / hit indicator |
| Green LED | Status / ready indicator |
| 2× current-limiting resistors (~220 Ω) | One per LED |
| 5 V power source | USB or battery |
| Function | NodeMCU pin | GPIO |
|---|---|---|
| Piezo sensor | A0 | A0 |
| Red LED | D6 | 12 |
| Green LED | D7 | 13 |
Firmware
cd sniper_firmware
pio run -t uploadfs # upload Flutter web build to LittleFS
pio run -t upload # flash firmwareMobile app
cd sniper_client
flutter pub get
flutter runThen connect your phone to the Sniper Wi-Fi network (password: bulletproof) and launch the app — or open the ESP's IP in any browser.
MIT