Skip to main content
Version: FILS English

Line Follower

A robot that follows a black line on a white background.

info

Author: Vasilca Maria
GitHub Project Link: https://github.com/UPB-PMRust-Students/project-VasilcaMaria

Description

My project is a line-following robot programmed in Rust, using a Raspberry Pi Pico 2W as the microcontroller. The robot navigates autonomously by reading input from an 8-channel infrared line sensor module, which detects a black line on a white surface. Based on this sensor data, the robot makes real-time decisions to adjust its direction and stay on track. It uses two DC motors controlled through an L298N dual H-bridge motor driver to manage movement.

Motivation

I chose this project because I started developing a passion for robotics and I wanted a practical way to apply what I have been learning about electronics and embedded systems. A line-following robot is a great starting point for a beginner because it will give me a chance to work with sensor integration, motor control and real time decision-making, which are all fundamental concepts in robotics.

Architecture

The sensors detect the black line and send data to the multiplexer, which selects and sends the sensor's data to the Raspberry Pi Pico 2W, where it processes the information to determine the movement, then sends control signals to the L298N motor driver to drive the DC motors, while the battery powers all the components.

Diagram

Log

Week 5 - 11 May

Week 12 - 18 May

Week 19 - 25 May

Hardware

Raspberry Pi Pico 2W - Acts as the microcontroller, processing sensor input and controlling the motors.

8-Channel IR Line Sensors - These sensors detect the black line by reflecting infrared light off the surface.

CD4051BE Multiplexer - Selects between multiple sensor outputs, allowing the Pico to read them through a single ADC pin.

L298N Motor Driver - It controls the motor speed and direction using signals from the Raspberry Pi Pico 2W, connecting the microcontroller to the motors.

2 DC Motors - Provide movement and steering based on the motor driver's commands.

Chassis + 2 Tires + Swivel Wheel - Provide structural support and movement capabilities for the robot.

9V Battery - powers the robot by connecting to the motor power input of the L298N motor driver, whose onboard regulator steps it down to 5V; this 5V is then fed into the VSYS pin of the Raspberry Pi Pico 2W to power the microcontroller.

Schematics

Schematics

Bill of Materials

DeviceUsagePrice
Raspberry Pi Pico WThe microcontroller39,66 RON
L298N Dual H-Bridge Motor DriverThe motor driver10,99 RON
2 DC MotorsThe motors14,28 RON
8-channel infrared line sensorsUsed for line detection14,93 RON
9V BatteryPower supply15,14 RON
Battery SupportPower supply1,29 RON
CD4051BE MultiplexerSignal selection switch1,34 RON
Debug ProbeUsed for debugging57,56 RON
ChassisStructural support15 RON
2 TiresMovement10,72 RON
Swivel caster wheelMovement5,95 RON
Electronic Components KitBreadboard, wires, resistors, etc.60,38 RON

Software

LibraryDescriptionUsage
embassyFrameworkUsed for developing embedded applications in Rust
gpioGeneral-purpose Input/Output moduleUsed for controlling GPIO pins
ADCAnalog-to-digial converter moduleUsed for controlling ADC pins
defmtCompact logging crate for embedded systemsUsed for debugging
  1. How to build a line follower
  2. L298N - How it works