This is an old revision of the document!
What it does: This project consists of a small autonomous vehicle capable of maintaining a constant safe distance from a target vehicle or object in front of it.
Its purpose: The main goal is to implement a real-time closed-loop control system (Adaptive Cruise Control) on an 8-bit microcontroller. It demonstrates bare-metal embedded programming by utilizing hardware interrupts, hardware timers, and a PID (Proportional-Integral-Derivative) control algorithm.
The starting idea: The idea is inspired by modern Advanced Driver Assistance Systems (ADAS) used in the automotive industry to prevent rear-end collisions and improve driving comfort.
Why it is useful: It serves as a highly practical demonstration of low-level hardware control, bridging the gap between theoretical micro-processor architecture and real-world physical applications.
The system uses an array of ultrasonic sensors mounted on the front to continuously measure the distance to the vehicle ahead.
Based on the calculated distance error (the difference between the desired safe distance and the actual measured distance), a PID control algorithm calculates the necessary adjustments. These adjustments are sent as PWM signals to a TB6612FNG motor driver, enabling the car to smoothly accelerate or brake. An optical encoder on the rear wheel provides closed-loop speed feedback to ensure accurate motor control. Optionally, the front steering is controlled by a servo motor to follow the target's trajectory.
Block Diagram: To be uploaded
List of components:
Arduino Nano (ATmega328P Microcontroller)
3x HC-SR04+ Ultrasonic Sensors
TB6612FNG Motor Driver
1x DC Motor with Optical Encoder (Rear traction)
1x Servo Motor (Front steering)
LM2596 Step-Down Voltage Regulator
2x 18650 Li-Ion Batteries with holder
Breadboard and Dupont connecting wires
Electrical Schematic: To be uploaded after the circuit design is finalized.
Development Environment:
PlatformIO / Arduino IDE (using pure C/C++ and register-level programming)
Libraries and 3rd-party sources:
Standard AVR libc (<avr/io.h>, <avr/interrupt.h>)
No high-level Arduino libraries (like analogWrite or pulseIn) will be used for core functionalities, to adhere to the course requirements.
Algorithms and Structures:
PID Controller: A mathematical algorithm to smoothly calculate the motor speed based on the distance error.
Pin Change Interrupts (PCINT): Used to read the echo signals from the ultrasonic sensors without blocking the CPU.
Hardware Timers: Configured at the register level to generate the fast PWM signals for the motor driver and the precise signal for the servo motor.
This section will be updated after the hardware assembly and software implementation
This section will be updated at the end of the project
Source code and schematics will be uploaded here in a .zip archive and linked to a public GitHub repository at the end of the semester.
09.05.2026: Chosen the project topic, validated the idea with the laboratory assistant, and completed the initial OCW documentation (Introduction, General Description, Hardware List).
Hardware Resources:
ATmega328P Datasheet
HC-SR04+ Ultrasonic Sensor specifications
TB6612FNG Motor Driver datasheet
Software Resources:
AVR Libc Reference Manual