# Case Study: MADPAW — Pet Tracker, GPS + Activity ML, 30-Gün Pil Ömrü
Problem: Pet tracker hardware (collar device) için 30+ gün pil ömrü hedefi. Cihaz GPS lokasyon + 3-axis accelerometer'dan activity (uyku/yürüme/koşma) sınıflandırma yapacak, sahibinin iPhone'una sync edecek.
Sonuç: 32-gün battery test pass (lab ortamı), %95 activity accuracy, 12K device sold, App Store rating 4.8/5.
1. Power Budget
Pet tracker LiPo 800mAh. 30 günde tükenmemesi gereken işlem:
Component | Daily budget | |
|---|---|---|
GPS fix (every 60 min) | 24 fix × 2sn lock | ~3% battery |
Accelerometer (continuous) | %1.5/gün | |
BLE advertise (every 5sn) | %2/gün | |
ML inference (every 5dk) | %0.4/gün | |
Wi-Fi sync (sahibinin home, daily) | %1/gün | |
**Toplam** | **~8% / gün** | |
**30-day projection** | **240% — fail!** |
Optimization gerekti.
2. Smart Scheduling
Native cihaz sleep'te kalır, sadece motion algılandığında uyanır:
- Accelerometer interrupt: (motion threshold) wake-up
- Motion detected → ML inference + GPS fix
- No motion → sleep mode, GPS off
Bu pattern ile daily budget %3/gün seviyesine düştü. 30-day = %90. 32 gün lab test pass.
3. On-Device ML Pipeline
3-axis accelerometer 25Hz → 60-sample window → Core ML model.
Model: Create ML Activity Classifier, 4 class (sleep/walk/run/play). Training:
- 200 saat veri (15 köpek, çeşitli ırk + boyut)
- Train 80% / val 10% / test 10%
- Validation accuracy: %94.2
- Model size: 18KB (.mlmodelc)
ESP32-class hardware Apple Neural Engine yok — Core ML model converted to TFLite micro. Inference: 8ms / window.
4. iOS App: Sahibinin Tarafı
iOS app low-power BLE listener:
swift
1@MainActor2final class TrackerManager: ObservableObject {3 private var central: CBCentralManager?4 @Published var lastSyncedAt: Date?5 @Published var lastActivity: ActivityClass?6 7 func startListening() {8 central = CBCentralManager(delegate: self, queue: .main, options: [9 CBCentralManagerOptionRestoreIdentifierKey: "MADPAW.tracker"10 ])11 }12}Background BLE scan only when phone home (geofence) — battery savings.
Map UI: GPS history last 24 saat, activity heatmap.
5. Cloud Sync
iOS app proxy:
- BLE \<-\> Firebase Realtime DB
- Activity events: tracker → BLE → iOS → Firebase
- Owner can share with multiple family members (Firestore family-id collection)
Daily volume per device: ~3MB. Firebase free tier OK (12K device → ~36GB/ay).
6. Hardware Pin-out & Firmware
- ESP32 (S3, ARM Cortex M4)
- u-blox NEO-M9N GPS module
- ADXL355 accelerometer
- Power management IC (TI BQ24295)
- BLE-only (no Wi-Fi during travel — power)
Firmware in C (Arduino IDE → ESP-IDF migration v2'de):
- FreeRTOS task layout
- 4KB ML model embedded
- OTA via BLE (iOS app uploads firmware)
7. Manufacturing & Production
- 12K device sold
- China supplier (Shenzhen)
- 4 hardware revisions over 18 months
- App Store-side approval pretty smooth (no NFC, no health regulatory)
- Returns: %1.8 (industry %3-5)
8. Öğrenimler
1. Battery target ön ödeme şart. "Sonra optimize ederim" yetmedi — power profile day 0'da hedef.
2. Always-on listener vs scheduled %95 battery tasarrufu. Motion-triggered wake-up DIY hardware'in best practice.
3. ML model boyutu önemli. 18KB Core ML → TFLite micro ile çalışıyor. 100KB+ olsaydı hardware'e sığmazdı.
4. BLE-only design. Wi-Fi consumed too much in travel. Wi-Fi sadece home dock + sync için.
5. iOS background BLE CBCentralManagerOptionRestoreIdentifierKey zorunlu — restoration olmadan owner ev dışındayken sync kayboluyordu.
6. Activity training data 200 saat — ilk modelde 50 saatti, validation %78. 4x data → %94 jump.
7. App Store reviews driver: battery accuracy claim. "30 günde 1 şarj" iddiası kanıt ister. Lab + 100-customer beta test data ile App Store description supported. Trust → %35 conversion artar.
Sonuç: IoT hardware + iOS app birleşik problem. Battery optimization, ML on-device, BLE state machine — her biri 2 ay teknik borç. Birleşik 6-8 ay R&D. Output sınıfının en iyi pet tracker olunca worth it.

