# Car Danger Zone

用 ESP32 车辆遥测、地理围栏和 Android 导航实现动态限速与危险区预警。

Dynamic Car Speed Controller (DSC) & Danger Zone Detection: Cyber-physical vehicle speed regulation with ESP32 telemetry, geospatial geofencing, and Android Jetpack Compose supervisory navigation.

用 ESP32 车辆遥测、地理围栏和 Android 导航实现动态限速与危险区预警。

- id: omkar703-car-dangerzone-detection
- author: omkar703
- repository: https://github.com/omkar703/Car_DangerZone_detection
- license: Apache-2.0
- shape: robot
- scenes: tools
- boards: ESP32
- browser_playable: no
- preview: Project screenshots
- html: https://esp32gallery.com/projects/omkar703-car-dangerzone-detection/
- html_zh: https://esp32gallery.com/zh/projects/omkar703-car-dangerzone-detection/
- json: https://esp32gallery.com/data/catalog/projects/omkar703-car-dangerzone-detection.json

## Hardware

ESP32-class board. Verify the exact board revision, display, power source and wiring in the upstream build guide.

ESP32 类开发板；请在上游构建文档中核对具体板型、屏幕、供电与接线。

## English

```
A four-wheel test car carries an ESP32 DevKit with a NEO-6M GPS on UART2, an HC-SR04 on the front bumper, an L298N driving the motors and a 5 V piezo horn; a Kotlin and Jetpack Compose phone app does the map, the geofencing and the talking. 61 accident hotspots from Indian highways are stored as 500 m circles, split into high (40 km/h) and medium (50 km/h) risk, and the car's position is compared with the Haversine formula. Inside a zone, PWM drops from 100% to 65% or 31%; below 35 cm the ultrasonic sensor forces 0% and stops the car. Reported latencies are 42.5 ms for a geofence and 28 ms for the emergency stop. Building the app needs Android SDK 35, JDK 17 and Google Maps, OpenRouteService and Firebase keys; the firmware is one .ino that needs TinyGPSPlus.
```

## 中文

```
一辆四轮小车当试验台：ESP32 DevKit 接 NEO-6M GPS（UART2）、车头 HC-SR04、L298N 双 H 桥和 5V 蜂鸣器，手机上的 Kotlin + Jetpack Compose 应用负责地图、地理围栏和语音提示。数据里是印度几条干线上的 61 个事故热点，每个按 500 米半径成圈，分高（40 km/h）、中（50 km/h）两档限速，车辆位置用 Haversine 公式比对。进圈后 PWM 从 100% 降到 65% 或 31%，前方 35 cm 内有障碍时超声直接压到 0% 刹停。论文里给的围栏延迟是 42.5 ms，急停反应 28 ms。手机端要 Android SDK 35、JDK 17，还要自己填 Google Maps、OpenRouteService 和 Firebase 的密钥；单片机端只有一个 .ino，依赖 TinyGPSPlus。
```
