Line Follower
A robot that follows a black line on a white background.
Author: Istudor Victor Mihai
GitHub Project Link: https://github.com/UPB-FILS-MA/project-istudormihai
Description
This robot will be capable of following a trajectory given by a black line on a white background, with the help of two infrared sensors placed in the front. The robot will be powered by a 9V battery that will give current to 4 DC motors connected to a L298N motor driver.
Motivation
I chose this project because i started to have a passion for robotics. Being a member of the robotics club within the FILS faculty, i had to build a similar robot for the PoliFest event, but it used an Arduino UNO and the coding part was fairly simple, as it was written in C. As soon as i saw the project rules, i thought that i can give myself a bit of a challenge by building the same robot, but in this case using a Raspberry Pi Pico, having its software written in Rust.
Architecture
Instructions
Compiling: cargo build --release --target thumbv6m-none-eabi
Log
Week 6 - 12 May
- My parts order arrived and i started to think about the way i can build this robot.
- Looked up on the internet for some Rust libraries that could help me write the software.
Week 7 - 19 May
- Finished the KiCad schematic and built the robot.
- Started working on the software.
Week 20 - 26 May
- As i was working on the software, i realised that the sensors are sending analog values and i have to convert them to digital values, so i moved the sensors from pins GP2 and GP3 to pins GP26 and GP27 (respectively ADC0 and ADC1). As the EN_A and EN_B pins on the L298N are used for enabling and controlling the speed of the motor, i set them as PWM pins. This also meant that i did not have to use additional crates for the L298N or the DC motors.
- Worked on the functions for the motors and the logic that the robot will have to use.
- Finished the software.
- Created a track that the robot will have to follow.
- Updated the documentation.
Hardware
The "brain" of this robot will be the Raspberry Pi Pico microcontroller. The IR sensors and motor driver will be connected to it. The battery will be able to power the motor driver and the Pico. All 4 of the 3V-6V DC motors will be hooked-up to the H-bridge.
These are the components that i will use:
Soldering:
The final product!
I added some stickers.
Schematics
Bill of Materials
Device | Usage | Price |
---|---|---|
Rapspberry Pi Pico W | The microcontroller | 35 RON |
2x IR Sensor Module | Used for line detection | 8,78 RON |
4x DC Motors | Motors | 19,28 RON |
L298N Dual H Bridge | The motor driver | 11,49 RON |
Female to female jumper wires | Wires | 11,07 RON |
Male to female jumper wires | Wires | 5,18 RON |
Jumper set | Wires | 8,68 RON |
Breadboard | - | 3,35 RON |
4x Rubber Wheels | Wheels | 42.84 RON |
Software
Library | Description | Usage |
---|---|---|
embassy | Framework | Used for building embedded applications in Rust |
gpio | General-purpose Input/Output (GPIO) module | Used to control GPIO pins |
ADC | Analog-to-digial converter module | Used to control ADC pins |