Overview

Autonomax is an RC car converted into an obstacle avoidance car built as part of my NSI (Numérique et Sciences Informatiques) high school project. The goal was to transform a standard remote-controlled car into a self-driving vehicle capable of detecting and avoiding obstacles using ultrasonic sensors, all controlled by an Arduino Mega board.

Project slides

Tech stack

Functionality

Obstacle detection

The car uses HC-SR04 ultrasonic sensors mounted on the front to continuously measure the distance to nearby objects. The sensor's Trig pin emits ultrasonic pulses, and the Echo pin receives the reflected signal — the time delay is proportional to the distance. When an obstacle is detected within a threshold (around 25 cm), the car stops, reverses, and scans left and right to decide the best direction to turn.

"Autonomous" navigation

The main loop reads distance data from both front and rear sensors, displays the values on an onboard LCD screen, and makes driving decisions accordingly. If the path ahead is clear, the car moves forward. If an obstacle is detected, it stops, backs up, then uses the front-mounted servo to look right and left, comparing the distances to choose the clearer path.

Motor control

The DC motors are controlled via relays rather than a traditional motor shield, as the original shield did not provide enough current to drive the motors despite having the correct voltage. Voltage regulators were added for both the front and rear motors to ensure proper power delivery.

Problems and solutions

Motor shield power issue

The initial motor control shield couldn't deliver enough torque to the DC motors — the voltage was correct but the current was insufficient, while the servomotors worked fine. The solution was to bypass the shield entirely and use relays connected directly to the battery through voltage regulators, giving the motors the full current they needed.

Arduino power issue

The Arduino Uno R3 originally used didn't have enough pins or power capacity for all the components. Upgrading to an Arduino Mega 2560 solved this, providing more I/O pins and better power handling for the sensors, servos, relays, and LCD display.

Improvements

A second ultrasonic sensor was added on a front-mounted servo, allowing the car to actively scan its environment by looking left and right before choosing a direction. The code was also refactored to use the NewPing library for more reliable distance readings, replacing the manual pulse calculation from the initial version.