Skip to main content
Version: FILS English

Rusty Car-go line follower

A car that follows a light-absorbing black line using Infrared sensors.

info

Author: Mohamed Daoudo
GitHub Project Link: https://github.com/UPB-PMRust-Students/project-Joan-DwD

Description​

Rusty Car-go is a car programmed in Rust that follows a black colored tape that absorbs light compared to the surrounding surface which typically absorbs more light using IR (infrared) sensors that read digital low or digital high, and the Rasberry Pi Pico 2W reads these signals and adjusts the motors' speed/direction via L298N moto driver, and lights up a little LED when the car is going. This project serves as a door to building more more creative and fun projects.

Motivation​

As a little kid, the idea of seeing wires connected to each other causing machines to move and work, whether for fun or to assist us in our daily lives fascinated me. It led me to build simple projects, such as small fans during the summer or a cotton candy machine because I enjoyed sweets. Reminiscing about these days motivated me to work with DC motors and wires again and build a car with them.

Architecture​

The Raspberry Pi Pico 2W powered by L298N motor driver's onboard 5V regulator to ensure stable supply, It serves as a brain that directs the behaviour of the robot, it's technically responsible for data processing, It outputs directional control and PWM speed signals to the L298N Motor driver which is connected to it via several GPIO pins.

The IR sensors, powered by 3.3V power source of the pico, are connected to the Pico's GPIO pins, detect the line's position based on the color black and send digital signals to the microcontroller to keep the robot on it's track .

The L298N motor driver controls the speed and direction of DC motors connected to it via it's output terminals, whose role is to drive the robot's wheels according to Pico's commands, simultaneously, an LED connected to Pico's GPIO pin lights up whenever the motors are active, providing visual feedback.

Finally, the chassis, it provides a well-structured body for the components ensuring stable operation, protection, and ease of assembly.

alt text

Log​

Week 5-11 May​

I worked on the code a bit, but I started working on the car by assembling the components as soon as they arrived.

Week 12-18 May​

Week 19-25 May​

Hardware​

  • Raspberry Pi Pico 2W: The central controller of the robot aka the "brain".
  • Infrared sensors: Used for black or white line detection.
  • L298N motor driver: Controls DC motor speed or direction.
  • DC motors: used to move and steer the robot.
  • AA battery holder (4x): Supplies power to the motor driver.
  • LED: indication of motor activity.
  • The robot chassis: It serves as the body of the robot and holds all components

Pictures as of now​

carlv

carlv1

Schematics​

Schematic

Bill of Materials​

DeviceUsagePrice
Raspberry Pi Pico 2WMicrocontroller39.66β€―RON
IR sensorsline detection10,47β€―RON
DC motors with wheels & chassis (unassembled)Structure of the robot79.59 RON
L298N Motor DriverControl speed of DC motors10.99 RON
Male-Male jumper wires setConnecting components7.99 RON
10cm Female-Male jumper wiresConnecting components2.99 RON
20cm Female-Male jumper wiresConnecting components3.99 RON
LEDMotor activity indicationAlready had it
Battery holder 4 x R6Power supply9.43 RON
BreadboardCircuit building4.56 RON

Software​

LibraryDescriptionUsage
defmtLogging and debuggingprinting debug information
embassy_executorTask management system for asynchronous Rustspawning asynchronous tasks concurrently
embassy_rp::gpioPico GPIO control pinsconfiguring digital input/output pins
embassy_rp::pwmPulse width modulationto mainly control motor speed and direction
embassy_timeTime and delay handling in asynchronous Rustadds delays or wait for a specific duration in tasks

1.How to construct line following robot

2.Line following car with Raspberry Pi Pico

3.More guidance

4.Reasearch Article