
Line Following Robot
bsce26023/Line-Following-Robot
This repo is for a line following robot. I've designed this robot keeping in mind that this could be used in competitions. It is designed for high speed performance and complex line following

This repo is for a line following robot. I've designed this robot keeping in mind that this could be used in competitions. It is designed for high speed performance and complex line following
Sensor Array is an open-source printed circuit board by bsce26023, from the bsce26023/Line-Following-Robot repository on GitHub, published under the MIT licence. It is a 2-layer board of 125 × 71 mm with 40 parts on 41 nets, routed with 266 tracks and 24 vias.
It is built around the TCRT5000. Its parts include 12 capacitors, 12 resistors, 12 ICs and 1 connector. It belongs with the sensors and measurement and robots and motor control boards of this library.
Hi! I wanted to make a Line Following Robot(LFR) and I visited some shops and online marketplaces but I couldn't find a good, fast, compact and accurate robot with a reasonable price. So, I created a LFR from scratch including the PCBs for main board and sensor array for the hardware part and code in 5 separate files. Now I will explain Components, Wiring, Coding, and sensor array separately.
1. Hardware Assembly : To Use this robot first you need to get the PCBs printed and then solder the components to them and then attach these to the chasis. Now plug and connect everything into its place and then you can move to software part.
2. Uploading the Code : Now connect Raspberry Pi Pico to your computer and open the LFR_Code.ino file and upload that to the Pico.
3. Tuning the Constants : Place the robot on a Black line with a White Background and adjust the Kp and Kd values such that the robot stops wobbling and runs smoothly.
4. Ready to Race : Now the robot is ready, You just need to turn it on and Race.
I've decided the components based on affordability, speed, availability and ease of use. Starting with the micro controller I've selected Raspberry Pi Pico RP2040 because it has much more processing power than Arduino nano and I've not selected ESP 32 because I wanted to make the robot completely offline and autonomous and for motors I've selected 600rpm 6v N20 motors with encoders for fast speed and high torque to drive these motors I've chosen TB6612FNG motor driver because it has low voltage drop and also it is way lighter than L298N. I've used decided to use a 2S Li-Po battery which is about 7.4v which can power the motors with ease and to power Pico I'd use a step down buck converter to convert these 7.4v into 5v so we don't damage the Pico to charge the battery I'd use a 2S charger and for the sensors I've designed a custom sensor array.
To talk about the connections, I'd Start with the Power connections. The battery provides 7.4v which goes to VMOT pin of motor driver and buck converter. the buck converter then outputs 5v which goes to VSYS on Pico. Now we have 3 voltages. i.e. 7.4v, 5v and 3.3v. now the 3.3v goes to VCC and STBY pin of TB6612FNG and VCC pin on Sensor Array. Now lets talk about the Data and Logic Signals. The GPIO pins from 0 to 18 will be connected to sensor array and GPIO pins 19,20, 21, 22, 26, 27 will be connected to PWMA, AIN1, AIN2, PWMB, BIN1 and BIN2 respectively. At the end the AO1, AO2 and BO1, BO2 will be connected to left and right motors respectively.
| Schematics | Tracks |
|---|---|
Now for the most difficult problem that I've faced in this project. I wanted to get analog sensor readings but Raspberry Pi Pico had only 3 analog pins. So I could add a Multiplexer chip which would make the PCB bulky. So I designed a workaround using an RC discharge Circuit. Instead of reading analog voltages, I paired 16 TCRT5000 sensors with 10nF capacitors and 220-Ohm Resistors. This converts the analog voltage signal to a digital timing signal. Working: The pico sends a brief signal to charge all 16 capacitors. Then it acts as a high-speed stopwatch to measure how fast each capacitors discharges.
| Schematics | Tracks |
|---|---|
After doing my research, the most affordable components I've got are as follows,
| Component | Quantity | Est. Cost (USD) | Purchase Links |
|---|---|---|---|
| Custom PCBs (JLCPCB) | 2 Sets | $15.00 | https://jlcpcb.com/quote |
| Raspberry Pi Pico | 1 | $5.00 | https://ln.run/yanB3 |
| TCRT5000 Transceivers | 16 | $4.00 | https://ln.run/hACwF |
| SMD Passives (0805) | 32 | $2.00 | https://ln.run/qddHJ |
| SPDT Limit Switches | 2 | $1.00 | https://ln.run/QSFtx |
| TB6612FNG Module | 1 | $3.00 | https://ln.run/ssqYa |
| 6V N20 Motors (600 RPM) | 4 | $50.00 | https://ln.run/JM7nX |
| N20 Wheels & Brackets | 4 | $6.00 | https://ln.run/CkKDZ ---- https://ln.run/MqKmx |
| 2S Battery (7.4V) | 1 | $3.00 | https://ln.run/iZsS- |
| Power Modules | 2 | $2.00 | https://ln.run/E-0I9 ---- https://ln.run/bBDg- |
| Misc. Hardware | 1 | $5.00 | N/A |
| Total Build Cost: | ~$96.00 USD |
Because I designed the electronics to use standard, readily available modules, The robot is highly modular. If a motor driver or battery charger ever burns out during a competition, I can just unplug it and swap in a $3 replacement without having to desolder or rebuild the entire robot.
| Qty | Value | Footprint | References |
|---|---|---|---|
| 12 | 220R | Resistor_SMD:R_0805_2012Metric_Pad1.20x1.40mm_HandSolder | R1, R2, R3, R4, R5, R6, R7, R8, R9, R10, R11, R12 |
| 12 | C | Capacitor_SMD:C_0805_2012Metric_Pad1.18x1.45mm_HandSolder | C1, C2, C3, C4, C5, C6, C7, C8, C9, C10, C11, C12 |
| 12 | TCRT5000 | tcrt5000:tcrt5000 | U1, U2, U3, U4, U5, U6, U7, U8, U9, U10, U11, U12 |
| 2 | MountingHole | MountingHole:MountingHole_3.2mm_M3 | H1, H2 |
| 1 | Conn_01x16 | Connector_PinHeader_2.54mm:PinHeader_1x16_P2.54mm_Horizontal | J1 |
| 1 | SW | Button_Switch_THT:SW_XKB_DM1-16UC-1 | SW |
It measures 125 × 71 mm and has 2 copper layers, 1.6 mm thick.
40 parts, built around the TCRT5000. The full list of its parts is on this page, with links to each part's symbol and footprint where PCBKit's library has them.
From the bsce26023/Line-Following-Robot repository on GitHub, at the commit this page was made from: the board is Sensor Array/Sensor Array.kicad_pcb and its schematic PCB/PCB.kicad_sch. PCBKit opens the board in the browser, with nothing to install.
Its repository publishes it under the MIT licence: you may reuse it on that licence's terms (keep the author's notice, and for a copyleft licence share your changes alike).

bsce26023/Line-Following-Robot
This repo is for a line following robot. I've designed this robot keeping in mind that this could be used in competitions. It is designed for high speed performance and complex line following

bsce26023/Line-Following-Robot
This repo is for a line following robot. I've designed this robot keeping in mind that this could be used in competitions. It is designed for high speed performance and complex line following

Squalius-cephalus/OpenRidingController
D.I.Y horse riding controller for the PC.


xtarke/automated_buggy
This shield connects microcontroller (MSP-EXP430FR2355) pins to the car's power board. Go to Power Board for more hardware information.

Amrlxyz/esp-lfr-buggy
2nd Year Embedded Systems Project (ESP) - Line Following Robot Buggy


ciiiutnfrc/eduromaa
Versión educativa del robot móvil RoMAA (EduRoMAA)

billtsol/Maze
This project demonstrates how to use an Arduino board, IR sensors, and a motor driver shield to create a maze-solving robot.

Potato-eater/Legacy2026
github repo for Robocup Junior Australia lightweight soccer team