An autonomous mobile robot developed using STM32 microcontroller, capable of line tracking, automatic sensor calibration, and color-based navigation using a TCS3200 color sensor.
✅ PID Line Following Control ✅ 5-Channel Analog Line Sensor TCRT5000 ✅ Automatic Sensor Calibration ✅ Color Detection (TCS3200) ✅ State Machine Navigation ✅ Branch Decision Based on Package Color ✅ STM32 HAL Driver Implementation
| Component | Description |
|---|---|
| MCU | STM32F103C8T6 |
| Motor Driver | Tb6612FNG |
| Sensors | TCRT5000 |
| Color Sensor | TCS3200 |
| Motors | JGB37-520 12v 333rpm |
| Power | Li-ion Battery Pack |
START
↓
Go To Station
↓
Read Package Color
↓
Escape Station
↓
Follow Line + Branch Decision
↓
Finish
Weighted sensor method:
- Left → Negative Error
- Center → Zero Error
- Right → Positive Error
PID = Kp * Error + Ki * Integral + Kd * Derivative
Used to dynamically adjust left/right motor speeds.
TCS3200 sensor measures frequency response:
- RED filter measurement
- BLUE filter measurement
- Multiple sampling for reliability
- Majority voting color decision
Robot behavior:
- 🔴 Red Package → Turn Left
- 🔵 Blue Package → Turn Right
At startup the robot:
- Spins in place
- Records sensor MIN/MAX values
- Normalizes readings for robust tracking
├── Core/
│ └── Src/
│ └── main.c
├── Drivers/
├── images/
│ ├── robot.jpg
│ ├── demo.gif
│ └── system_diagram.png
└── README.md
- STM32CubeIDE
- STM32 HAL Library
- Embedded C
- DMA + Timer + ADC
- PWM Motor Control
- Clone repository
- Open project in STM32CubeIDE
- Build project
- Flash firmware to STM32 board
- Power robot and run 🚀
- Velocity PID control using encoder feedback
- Dynamic speed adjustment
- Obstacle detection
- ROS integration
Give it a ⭐ on GitHub!

