T ThinkEdge Learn

Autonomous Vehicles: What the Car Actually Senses

A self-driving car is not a big Arduino, but the logic is the same. Several sensors of different kinds watch the world, their readings are combined into one picture of the road, and a controller turns that picture into steering and speed.

autonomous vehicles self driving car electronics autonomous car sensors
Robotics · Each sensor's blind spot, and why fusion beats any one of them

What a self-driving car actually senses

Production systems use a mix, and each one covers a gap the others leave. Cameras give the richest scene but struggle in glare, fog and heavy rain, and they cannot measure distance directly, only infer it from apparent size. Lidar gives accurate distance and shape in almost any light, but a spinning unit is expensive and its returns carry no colour, so a lidar on its own cannot tell a red light from a green one.

Radar fills in the speed gap, because it measures the rate at which distance changes and therefore gives closing velocity directly, which is exactly what a camera and a lidar both have to infer from two frames. Ultrasonic sensors are short range and cheap, and are used for the last few centimetres, such as parking and kerb detection. Satellite positioning and an inertial unit give the vehicle its own position and heading, which is the frame of reference every other measurement is expressed in.

Why one sensor is never enough, and how fusion works

Fusion is not just averaging. It is a filter that predicts where objects should be, weights each sensor by how much it should be trusted right now, and corrects the prediction with the measurements. In a simple classroom version that can be a weighted average: the ultrasonic reading counts for less when the radar says something is closing fast, and the camera counts for more when the scene is well lit.

Timing is where most student projects go wrong. A camera at 30 frames per second, a lidar at 10 Hz and an ultrasonic sensor at 20 Hz are not describing the same instant, and a control loop that fuses them without timestamps will chase its own tail. Log every reading with a millisecond timestamp, then study the raw data before you write the filter.

Step by step

  1. Start with the ego vehicle

    Add wheel encoders or an IMU and work out how far the robot has travelled and which way it faces. Every other measurement is relative to this frame, so get it right first.

  2. Add one ranging sensor

    An HC-SR04 reading forward gives you a stopping distance. Log it with a timestamp and study the noise at different distances and angles before you trust any threshold.

  3. Add a second, different sensor

    An IR reflectance sensor or a light sensor near the ground adds a different kind of evidence. Two sensors of different types are the minimum for anything worth calling fusion.

  4. Write the fusion rule

    Combine the readings with explicit weights and change those weights with conditions, such as trusting the ultrasonic less when the reading is near its minimum range.

  5. Close the driving loop

    Turn a distance reading into a steering command with a proportional controller and watch the error fall. Then layer obstacle avoidance on top as a higher priority rule, the same structure as a traffic light state machine.

  6. Log a whole drive

    Record every reading and command with timestamps and then plot them. The plots show which sensor failed and when, which is exactly what a fleet diagnosis looks like.

What you'll need

ItemQtyWhy
Arduino Mega 25601Four hardware serial ports, so the range sensors, the IMU and the logging link can run at once without blocking each other.
HC-SR04 ultrasonic sensor2Front and rear obstacle ranging for $4 to $8 each, which is the range a student build can afford.
MPU6050 IMU module1Gives heading and angular rate for dead reckoning between the range readings.
Light sensor with resistive divider1A crude but real brightness channel, standing in for the signal a camera would contribute.
L298N dual H-bridge module1Drives the drive motors with independent speed control for a differential steer chassis.
9 V battery and barrel jack1A separate motor supply, so motor noise does not show up as false sensor readings.

Practise it before you build it

Every step above has a matching circuit in the ThinkEdge Learn simulator. The simulator runs a real Arduino sketch against a modified-nodal-analysis solver, so digitalWrite actually drives the LED on screen and the readings change when you change the wiring — no hardware, no burnt components.

Common questions

What sensors do autonomous vehicles use?

Usually a camera for scene content, lidar for accurate shape and distance, radar for closing speed in bad weather, ultrasonics for the last few centimetres, and satellite positioning plus an inertial unit for the vehicle's own position. The reason for so many is that each one fails in a different condition, so combining them covers more of the envelope than any of them alone.

How much does it cost to build a self-driving car for a school project?

A scaled down car costs $90 to $220: $25 to $60 for a chassis with two drive motors and casters, $6 to $12 for the driver, $8 to $16 for the ultrasonic sensors, $3 to $6 for the IMU, and $15 to $30 for the board and battery. Full size autonomy hardware is out of reach by a very wide margin, and no classroom build is road legal.

Can an Arduino run a self-driving car?

It can run the control logic for a small scale vehicle: ranging, thresholding, obstacle avoidance and differential steering all fit comfortably. It cannot run a neural network for perception, a lidar point cloud filter or a localisation system, because those need far more memory and compute. Use the Arduino for the real time layer and hand the slow, heavy perception work to a Raspberry Pi or a computer over serial.

Related guides

Robotics and Autonomous Systems: The Four Sub-AreasRobotics and autonomous systems split into perception, planning, control and SLAM. Here is what each needs, and which parts an Arduino can reach. How to Build a DroneHow to build a drone from scratch: the four subsystems every drone needs, the parts that make them work, and the Arduino projects that teach each one before you fly. How to Build a RobotHow to build a robot from scratch: one motor and a switch, then sensors, then a line-follower that steers itself. Every stage runs in a browser simulator first. Robotic Lawn Mowers: Boundary, Blades and BalanceHow robotic lawn mowers find the edge of the grass, why the blade motor causes brownouts, and what a $30 ultrasonic sensor can and cannot do.

Try the full simulator with your class

103 guided circuit projects, 21 lessons and an in-browser Arduino simulator. The first 15 projects are free, no account needed. NCERT Science mapping on 47 projects, with Arabic and English copy in the regional builds.