Arduino Bluetooth Car with Obstacle Stop
Level 15 · Level 15 — Don't Let Me Crash · 35 minutes
The robot takes your orders, and turns down the ones that would hurt it.

Preview the project free; a course seat is required to run and submit. No hardware kit needed.
Your project challenge
Rebuild Level 14's car, then add the ultrasonic sensor. Wire the sensor: - VCC to 5V, GND to GND - TRIG to D5 - ECHO to D4 Then refuse a forward command when something is closer than 20cm, and obey every command that is safe.
Components you’ll use
- Arduino Uno
- L298N Motor Driver
- DC Gear Motor × 2
- Battery
- HC-05 Bluetooth Module
- HC-SR04 Ultrasonic Distance Sensor
What you'll build
Level 14's car, now with an eye. A command stops being an order and becomes a request.
How it works
- Your letter still arrives over Bluetooth. F, B, L, R go. Lowercase stops.
- Between hearing it and doing it, the robot gets to look. Its ultrasonic sensor measures distance ahead.
distanceCm()is already written for you, unchanged since Level 11.- The sensor points only forwards, so forward is the only command you refuse.
- Reverse backs away. A turn spins in place. Neither moves you toward what is in front.
The one number
TOO_CLOSE_CM = 20
You start parked facing a wall. The sensor reads about 8cm. 8 is under 20, so the first F must be refused.
Change it and the robot becomes braver or more timid.
⚠ Watch out
The hard part is not stopping. It is stopping only when you should.
Most students refuse too much and block reverse too. Then it never backs away. You send B and it stays pinned to the wall. A robot that sits still whatever you send is not careful. It is broken, and this level grades it as broken.
The interactive editor includes the wiring guide, code editor and simulation controls.