joshriang
← Back to portfolio

Hardware & embedded·Assembly·Course project

4-Way Car Radar Detector

A four-channel ultrasonic parking sensor on an ATmega328P, written in pure AVR Assembly rather than through the Arduino IDE. Four HC-SR04 sensors share a single trigger line on PC4 and return echoes on PC0 to PC3, and I measure pulse width with Timer1 using the mandatory low-byte-then-high-byte read order so a 16-bit read cannot tear mid-value. Timer0 fires every 500 microseconds to generate a 1 kHz square wave for the passive buzzer, with a 1:20 tick divider driving LED blink timing. The 7-segment display hangs off a 74HC595 shift register that I bit-bang in assembly, showing the nearest obstacle's direction as F, b, L, or r. A Python script on the other end reads the UART stream at 9600 baud and turns it into a live distance dashboard. Measured accuracy was within about 1 cm across 2 to 200 cm, and a 35 ms cooldown between polls stopped the sensors from hearing each other's echoes.

Date
2025
Role
Embedded developer
Main stack
Assembly
Code
github ↗
01
02
  • Reading a 16-bit timer requires low-byte-before-high-byte order; anything else can tear mid-read.
  • Staggering sensor polls with a cooldown prevents cross-talk between identical ultrasonic modules.
  • Doing audio timing inside an interrupt forces the main loop to stay non-blocking, or the tone stutters.
03

Scale 0–100: how much this project relied on each skill.