Line Follower
A robot that follows a black line on a white background.
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.
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
Bill of Materials
Device | Usage | Price |
---|---|---|
Raspberry Pi Pico W | The microcontroller | 39,66 RON |
L298N Dual H-Bridge Motor Driver | The motor driver | 10,99 RON |
2 DC Motors | The motors | 14,28 RON |
8-channel infrared line sensors | Used for line detection | 14,93 RON |
9V Battery | Power supply | 15,14 RON |
Battery Support | Power supply | 1,29 RON |
CD4051BE Multiplexer | Signal selection switch | 1,34 RON |
Debug Probe | Used for debugging | 57,56 RON |
Chassis | Structural support | 15 RON |
2 Tires | Movement | 10,72 RON |
Swivel caster wheel | Movement | 5,95 RON |
Electronic Components Kit | Breadboard, wires, resistors, etc. | 60,38 RON |
Software
Library | Description | Usage |
---|---|---|
embassy | Framework | Used for developing embedded applications in Rust |
gpio | General-purpose Input/Output module | Used for controlling GPIO pins |
ADC | Analog-to-digial converter module | Used for controlling ADC pins |
defmt | Compact logging crate for embedded systems | Used for debugging |