Skip to content
Β 
Β 

Latest commit

Β 

History

125 Commits

Folders and files

NameName
Last commit message
Last commit date
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Flock-You ESP32 - Complete Build Package

License Author

WiFi promiscuous-mode detector for Flock Safety surveillance cameras

Ported to standard ESP32 hardware for maximum accessibility and cost savings.


πŸš€ Quick Links


✨ What's Included

This package contains everything you need to build and deploy your own Flock-You detector:

πŸ“ Firmware (/firmware)

  • main.cpp - Modified for ESP32 (GPIO 25, 2, 17)
  • platformio.ini - ESP32 DevKit configuration
  • partitions_4mb.csv - Optimized for 4MB flash
  • api/ - Flask dashboard for GPS wardriving
  • datasets/ - OUI lists & research data

πŸ”§ Hardware (/hardware)

  • openscad/ - Parametric case source files
  • stl/ - Ready-to-print STL files (coming soon)
  • assembly_photos/ - Step-by-step build photos (coming soon)

πŸ“š Documentation

  • Complete user manuals
  • Troubleshooting guides
  • Business planning resources
  • Technical specifications

πŸ’° Cost Breakdown

Build Type Components Total Cost Detection Accuracy
Minimal ESP32 + USB cable $5 βœ… 100%
Breadboard + Buzzer + breadboard $9-11 βœ… 100%
With Case + 3D printed enclosure $10-12 βœ… 100%
OUI-SPY Pre-built board $85 βœ… 100%

Same detection performance, 85% cost savings!


🎯 Three Ways to Build

Option 1: LED-Only (Cheapest)

Cost: $5 | Time: 5 minutes | Difficulty: β­β˜†β˜†β˜†β˜†

  • ESP32 DevKit + USB cable
  • Onboard LED provides visual feedback
  • Perfect for testing or silent operation
  • Instructions

Option 2: Breadboard Build (Recommended)

Cost: $9-11 | Time: 10 minutes | Difficulty: β­β­β˜†β˜†β˜†

  • Add passive buzzer module + breadboard
  • Audio chirps on detection
  • No soldering required
  • Full Guide

Option 3: Enclosed Build (Professional)

Cost: $10-12 | Time: 15 minutes + 3hr print | Difficulty: β­β­β­β˜†β˜†

  • 3D printed case with snap-fit lid
  • LED light pipe
  • USB strain relief Case Design

πŸ› οΈ Quick Start

1. Get Hardware

Minimum:

Recommended:

2. Flash Firmware

# Install PlatformIO
pip install platformio

# Clone / enter the repo
cd flock-you-esp32

# WiFi-only (recommended first flash β€” works on any ESP32 DevKit)
pio run -e esp32dev -t upload && pio device monitor

# WiFi + BLE coexistence (continuous BLE scan + WiFi simultaneously)
pio run -e esp32dev-ble -t upload && pio device monitor

# M5Atom variants β€” use the unified flasher script
./flash.sh          # interactively identifies your device
./flash.sh --once   # flash one device and exit

All supported environments:

Environment Board BLE
esp32dev ESP32 DevKit β€”
esp32dev-ble ESP32 DevKit βœ… COEX
m5atom-lite M5Atom Lite β€”
m5atom-lite-ble M5Atom Lite βœ… COEX
m5atom-echo M5Atom Echo β€”
m5atom-echo-ble M5Atom Echo βœ… COEX
m5atom-voice M5Atom Voice β€”
m5atom-voice-ble M5Atom Voice βœ… COEX
m5atom-voices3r Atom VoiceS3R (S3) β€”
m5atom-voices3r-ble Atom VoiceS3R (S3) βœ… COEX
lilygo-t-dongle-c5 LILYGO T-Dongle C5 β€”
lilygo-t-dongle-c5-ble LILYGO T-Dongle C5 βœ… NimBLE 2.x

3. Test Detection

  • Device boots with Super Mario 1-2 startup tune
  • LED flashes on WiFi traffic
  • Buzzer chirps on Flock camera detection
  • Drive near known camera locations to verify

That's it! You're detecting.


πŸ“Š Detection Methodology

This firmware uses five research-proven techniques with a confidence score (0–100):

1. WiFi Promiscuous Sniffing (@NitekryDPaul)

  • Monitors 2.4 GHz management & data frames
  • Three OUI confidence tiers (PR#39):
    • HIGH (32 OUIs) β€” exclusively Flock Safety registered β†’ score 40, always alerts
    • MFR (6 OUIs) β€” Liteon/USI contract manufacturer β†’ score 20, silent log only
    • SoundThinking (1 OUI) β€” acoustic sensor co-deployed with Flock β†’ score 35, alerts
  • addr1 receiver-side detection (catches sleeping cameras)
  • addr3 BSSID fallback for randomized addr2 frames (now ON by default)

2. Wildcard Probe Signature (DeFlockJoplin)

  • Flock cameras send probe requests with empty SSID
  • Combined score OUI+probe = 62 β†’ HIGH CONFIDENCE on first match
  • Field-tested: 11/12 cameras detected, only 2 false positives

3. SSID Pattern Matching β€” including LAA-MAC cameras (issue #43)

  • Patterns: "Flock Camera net.", "Flock-XXXXXX", "FLOCK-XXXXXX", "penguin", "pigvision"
  • "Flock Camera net." cameras use locally-administered MACs (OUI matching won't work)
  • ALERT_LAA_SSID type detects these β€” SSID is the sole WiFi handle
  • Sequential-MAC heuristic: :DE/:DF last-byte pair on adjacent channels β†’ +10 pts

4. BLE Cross-Correlation (ENABLE_BLE_SCAN=1)

  • Passive NimBLE scan for Flock BLE advertisements
  • Checks: mfr-ID 0x09C8 (XUNTONG/Flock), Raven 128-bit service UUIDs (GainSec), device names
  • BLE_COEX_MODE=1 (default for all -ble environments): ESP-IDF SW coexistence scheduler runs WiFi promiscuous + BLE simultaneously β€” no promiscuous pause needed
  • BLE hit within 60 s of WiFi hit β†’ +20 confidence bonus

5. Multi-Address Matching

  • addr2 (transmitter) β€” standard detection
  • addr1 (receiver) β€” catches cameras receiving probe responses
  • addr3 (BSSID) β€” fallback for randomized MACs

Confidence tiers: < 30 = LOW (log only) Β· 30–59 = PROBABLE Β· β‰₯ 60 = HIGH (alert)

See DETECTION_IMPROVEMENTS.md for full scoring tables and examples.


πŸ§ͺ Native Unit Tests

The detection pattern library (fy_detect.h) is fully tested via a host-side Unity test suite β€” no ESP32 hardware needed:

cd flock-you-esp32
pio test -e native                         # run all 38 tests
pio test -e native -f test_ble_matching    # MAC / BLE name / mfr-ID tests (22)
pio test -e native -f test_uuid_matching   # Raven UUID / firmware version (16)

All 38 tests pass against the current fy_detect.h. The test suite covers:

  • All 32 high-confidence Flock OUI prefixes (case-insensitive)
  • All 6 contract-manufacturer OUIs (Liteon/USI)
  • SoundThinking OUI isolation (not in high or mfr lists)
  • BLE device name substring matching (case-insensitive)
  • BLE mfr-ID 0x09C8 match + rejection of the old incorrect 0x05A7
  • All 8 Raven 128-bit GATT service UUIDs (case-insensitive)
  • Raven firmware version estimation from UUID categories

🎡 Audio Feedback

Startup Sound

Super Mario Bros. World 1-2 (underground theme)

  • 6 notes: C5 β†’ C4 β†’ A4 β†’ A3 β†’ G#4 β†’ G#3
  • Confirms buzzer is working

New Detection

Two fast ascending beeps (2000 Hz β†’ 2800 Hz)

  • First time seeing a camera MAC
  • Or camera reappears after 30+ seconds
  • This is the only runtime audio alert β€” the firmware does not emit any periodic/idle "still tracking" beep. Audio fires exclusively on a genuine new-detection event (confidence >= CHIRP_MIN_CONFIDENCE).

Visual

Onboard LED flashes on every detection

  • Works even without buzzer
  • Visible through case light pipe

πŸ“± Flask Dashboard (GPS Wardriving)

Features

  • Real-time detection visualization
  • GPS coordinate tagging (USB puck or browser)
  • Export formats: JSON, CSV, KML (Google Earth)
  • Multi-device support
  • Historical tracking

Quick Setup

cd firmware/api
pip install -r requirements.txt
python flockyou.py

Open http://localhost:5000 and select your serial port.


πŸ“Ί LILYGO T-Dongle C5 β€” Display & RGB LED

The lilygo-t-dongle-c5 and lilygo-t-dongle-c5-ble environments target the LILYGO T-Dongle C5 β€” a USB-C dongle packing an ESP32-C5 (dual-band WiFi 6 + BT 5), an ST7735S 80Γ—160 colour TFT, and a WS2812B RGB LED.

What shows on the TFT

State Display RGB LED
Startup Splash screen "T-Dongle C5 ready" β†’ "Scanning…" Blue blink Γ— 3, then green
Idle scanning Scanning… Β· Channel & detection count Dim green
Detection (conf < 30) Detection type (large) Β· MAC tail Β· RSSI Β· Channel Β· Confidence% Dim green
Detection (conf 30–59) Same, dark-orange background Amber
Detection (conf β‰₯ 60) Same, dark-red background Red

Pin reference

Signal GPIO
TFT SCLK 5
TFT MOSI 6
TFT CS 4
TFT DC 2
TFT RST 3
TFT Backlight 1
RGB LED (WS2812B) 11
BOOT button 9

Flash commands

# WiFi-only (no BLE)
pio run -e lilygo-t-dongle-c5 -t upload

# WiFi + BLE (NimBLE 2.x required for ESP32-C5 BLE support)
pio run -e lilygo-t-dongle-c5-ble -t upload

Note: The T-Dongle C5 environments are marked experimental (continue-on-error in CI) because ESP32-C5 toolchain support is still maturing in espressif32@6.7.0.


πŸ”¬ Technical Specs

Detection

  • Channels: 1, 6, 11 (customizable)
  • Dwell time: 350ms per channel
  • RSSI threshold: -95 dBm (configurable)
  • Range: 50-100m typical, 300m with external antenna
  • Latency: <10ms from RF frame to alert

Hardware

  • MCU: ESP32-WROOM-32 (dual-core 240 MHz)
  • RAM: 520KB (uses ~85KB)
  • Flash: 4MB (uses ~1.2MB)
  • Power: ~180mA @ 3.3V (WiFi active)
  • Battery: 6-8 hours on 3,000mAh 18650

Storage

  • SPIFFS: 1MB partition
  • Capacity: 200 unique detections with full metadata
  • Persistence: CRC32-validated, atomic writes
  • Recovery: Survives power loss mid-save

πŸ“¦ What Makes This Special?

vs. Original Flock-You (XIAO ESP32-S3)

βœ… 85% cheaper ($6 vs $85 for OUI-SPY)
βœ… Same detection (identical WiFi chipset)
βœ… More available (ESP32 everywhere, XIAO only Seeed)
βœ… Easier to prototype (breadboard-friendly)
βœ… Larger community (ESP32 has huge support)

vs. Other Solutions

βœ… Passive detection (no transmission, legal)
βœ… Proven accuracy (field-tested research)
βœ… Open source (modify freely)
βœ… Portable (pocket-sized with case)
βœ… Expandable (add GPS, batteries, external antenna)


πŸš— Use Cases

Privacy Awareness

  • Know when you're being surveilled
  • Document camera locations
  • Share data with DeFlock community
  • Raise awareness in your area

Security Research

  • Test detection algorithms
  • Map surveillance infrastructure
  • Contribute to open research
  • Develop counter-measures

Wardriving

  • GPS-tagged detection mapping
  • Export to Google Earth (KML)
  • Build community databases
  • Identify high-surveillance zones

Vehicle Integration

  • Dashboard mount (case design included)
  • USB power from car
  • Audio alerts while driving
  • Optional battery for portability

πŸ“‹ Complete BOM

Electronics

Part Qty Unit Price Total
ESP32 DevKit 1 $5-6 $5-6
KY-006 Passive Buzzer 1 $1-2 $1-2
400-pt Breadboard 1 $2 $2
Male-Male Jumpers (3) 1 <$1 <$1
USB Micro Cable 1 $1 $1
Subtotal $9-11

3D Printed Case (Optional)

Part Material Cost
Case Base 15g PLA $0.30-0.50
Case Lid 8g PLA $0.15-0.25
LED Light Pipe 2g Clear $0.05
Mounting Bracket 12g PLA $0.25
Subtotal $0.75-1.00

Grand Total: $10-12


πŸ› Troubleshooting

No startup sound?

  • Check passive (not active) buzzer
  • Verify GPIO 25 connection
  • Try swapping buzzer polarity
  • Disable in code: #define USE_BUZZER 0

No detections?

  • No cameras nearby (drive to known locations)
  • Check serial output (should show channel hopping)
  • Lower RSSI threshold: #define RSSI_MIN -100
  • Verify WiFi promiscuous mode enabled

Compilation errors?

  • Update PlatformIO: pio upgrade
  • Check board definition: esp32dev
  • Verify partition file exists
  • Clean build: pio run -t clean

Case doesn't fit?

  • Scale STL by 101% for looser fit
  • Sand snap-fit tabs if too tight
  • Check component dimensions against specs
  • Use OpenSCAD to customize

Full Troubleshooting Guide


🀝 Contributing

Ways to Contribute

  • πŸ“Έ Share your build photos
  • πŸ› Report bugs & issues
  • πŸ’‘ Suggest features
  • πŸ“ Improve documentation
  • 🎨 Design case variants
  • πŸ§ͺ Field-test and report accuracy
  • πŸ—ΊοΈ Submit camera locations to DeFlock

Remix Culture

This project is licensed CC-BY-SA 4.0:

  • βœ… Use commercially
  • βœ… Modify and remix
  • βœ… Share freely
  • πŸ“ Credit original authors
  • πŸ”„ Share-alike license

πŸ† Credits

Original Firmware

  • colonelpanichacks - Original Flock-You creator
  • Γ˜ΡΔΓΆΓ˜Ρ†ΡΓΆΠͺâяцฐ (@NitekryDPaul) - WiFi research, 30 OUIs, addr1 technique
  • Michael / DeFlockJoplin - Wildcard-probe signature, 31st OUI
  • Will Greenberg - BLE manufacturer ID detection
  • DeFlock / FoggedLens - Crowdsourced ALPR data
  • GainSec - Raven BLE service UUIDs

This ESP32 Port

  • Modified for standard ESP32 (4MB flash, UART)
  • Solderless assembly guide
  • 3D printable case design
  • Business analysis & documentation
  • Community testing & feedback

βš–οΈ Legal & Disclaimer

What This Device Does

  • Passively receives publicly-broadcast WiFi frames
  • Does not transmit any signals
  • Does not authenticate to networks
  • Does not decrypt any data
  • Educational/research purposes

Legality

  • Passive WiFi reception is legal in most jurisdictions
  • Equivalent to listening to public radio broadcasts
  • No different from WiFi analyzers or network sniffers
  • Always comply with local laws

Use Responsibly

  • Respect privacy and property rights
  • Use for legitimate security research
  • Contribute findings to public good (DeFlock)
  • Don't use to enable illegal activity

The authors assume no liability for misuse.


πŸ”— Resources

Community

Hardware

Learn More


πŸ“ˆ Project Stats

  • Hardware Cost: $5-12 (vs $85 OUI-SPY)
  • Build Time: 5-15 minutes
  • Detection Accuracy: Same as premium hardware
  • Supported Boards: Any ESP32 with 4MB+ flash
  • Community: Growing!

πŸŽ‰ Get Started!

You're 3 steps away from detecting surveillance:

  1. Buy hardware β†’ $5-11
  2. Flash firmware β†’ 10 minutes
  3. Build case β†’ Optional

Questions? Check the docs or open an issue!

Ready? Start Building β†’


Built with love for privacy, security, and open knowledge.
Detect. Document. DeFlock.

About

flock cam detection for normal esp32

Resources

Stars

8 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages