A high-performance line following robot built using the STM32 Blue Pill microcontroller with a 5-channel IR sensor array for precise line detection.
This robot autonomously follows a black line on a white surface using IR sensors to detect the line position and control the motors accordingly. The STM32 Blue Pill provides fast processing for smooth and accurate line tracking.
| Component | Description |
|---|---|
| STM32 Blue Pill (STM32F103C8T6) | Main microcontroller |
| 5-Channel IR Sensor Array | Line detection |
| N20 Micro Gear Motors | Drive motors |
| Motor Driver | Controls motor speed and direction |
| LiPo / 7.4V Battery | Power supply |
- The 5-channel IR array continuously reads the line position
- Sensor data is sent to the STM32 Blue Pill
- STM32 processes the data and calculates the error using PID control
- The motor driver adjusts left and right motor speeds based on PID output
- The robot steers itself to stay centered on the line
- PID (Proportional-Integral-Derivative) control for smooth steering
- Weighted sensor reading to calculate line position error
- Dynamic speed adjustment based on curve sharpness
| STM32 Pin | Connected To |
|---|---|
| PA0 - PA4 | IR Sensor Array (S1 - S5) |
| PB6, PB7 | Motor Driver IN1, IN2 (Left Motor) |
| PB8, PB9 | Motor Driver IN3, IN4 (Right Motor) |
| PA8, PA9 | PWM Speed Control (ENA, ENB) |
- STM32CubeIDE or Arduino IDE with STM32 board support
- ST-Link V2 programmer
- Clone this repository
git clone https://github.com/dineshpec25-sys/line-follower - Open the project in STM32CubeIDE
- Connect ST-Link to the Blue Pill
- Build and flash the code
line-follower/
├── src/
│ └── main.c # Main source code
├── inc/
│ └── pid.h # PID controller header
├── README.md
└── circuit_diagram.png
| Role | Name |
|---|---|
| PCB | Denanath S |
| Coding and Tuning | Dinesh P |
| Assembly | Ponmudi M R |
| Assembly | Hariharan V T |
| Design | Hindula |
Group No. 100234
This project is open source and available under the MIT License.