Line follower robot with L298N and TCRT5000
The classic robotics starter: a two-wheeled car that tracks a black line on its own.
Shop by category
Shop all componentsToy BO motors stall under a few kilograms. Johnson-style 12 V metal-gear motors and a Cytron MDD10A dual driver (10 A per channel) can move a plywood base carrying a crate, a camera rig or a school-fest robot. The MDD10A takes just a PWM and a DIR signal per motor. A JDY-31 Bluetooth serial module receives F, B, L, R and S from any Android Bluetooth controller app.
Motors can start suddenly: keep fingers, hair and loose clothes clear, and lift wheels off the bench while testing.
Fuse the battery lead and never short a Li-ion pack.
Tick anything you already have and the total updates.
Reads commands, drives the MDD10A
Follow the colours: red is power, dark grey is ground, blue is a signal.
3S 18650 pack (12.6 V full) through a 3S BMS, with a 10 A fuse.
robot_base.inoVerify & upload in Electrolark#include <SoftwareSerial.h>
SoftwareSerial bt(10, 11);
const int PWM_L = 5, DIR_L = 4, PWM_R = 6, DIR_R = 7;
const int SPEED = 160; // 0-255
unsigned long lastCmd = 0;
void drive(int l, int r) { // -255..255
digitalWrite(DIR_L, l >= 0); analogWrite(PWM_L, abs(l));
digitalWrite(DIR_R, r >= 0); analogWrite(PWM_R, abs(r));
}
void setup() {
pinMode(DIR_L, OUTPUT); pinMode(DIR_R, OUTPUT);
drive(0, 0);
bt.begin(9600);
}
void loop() {
if (bt.available()) {
char c = bt.read();
lastCmd = millis();
if (c == 'F') drive(SPEED, SPEED);
else if (c == 'B') drive(-SPEED, -SPEED);
else if (c == 'L') drive(-SPEED / 2, SPEED / 2);
else if (c == 'R') drive(SPEED / 2, -SPEED / 2);
else if (c == 'S') drive(0, 0);
}
if (millis() - lastCmd > 700) drive(0, 0); // stop if the link goes quiet
}
One motor is wired backwards; swap its two wires at the MDD10A.
Motor current pulls the pack down; use thicker wires and a 470 µF capacitor at the driver.
Your app must repeat the command while a button is held; the 700 ms watchdog stops it otherwise.
Several kilograms on a flat floor with 200 RPM motors; slower motors carry more.
The L298N wastes about 2 V as heat and handles only 2 A; the MDD10A handles 10 A with MOSFETs.
Yes, read receiver PWM channels with pulseIn().
11 parts: Uno R3 CH340G ATmega328p Compatible Development Board, Arduino USB-A to USB-B Data Cable for UNO/MEGA, Cytron MDD10A 10A Dual DC Motor Driver, 2 × 200RPM 12V Low Noise Dc Motor With Metal Gears - Grade A, 2 × Robot Wheel for 6mm Shaft, JDY-31B Bluetooth 3.0 SPP Module (HC-05/06 Compatible), 3 × 18650 Li-ion Rechargeable Cell, 3 × 18650 Battery Holder, Li-ion / LiFePO4 BMS Protection Board (2S to 6S), Solderless Breadboard, plus 1 more. On this page you can tick the parts you already have and add only the rest to your cart.
It is a intermediate project and takes about 1 day. The build on this page has 7 steps.
No. This page has the complete, tested code (robot_base.ino).
Sign-magnitude control (PWM + DIR); Sizing a motor driver for stall current; Bluetooth serial commands.
Motors can start suddenly: keep fingers, hair and loose clothes clear, and lift wheels off the bench while testing. Fuse the battery lead and never short a Li-ion pack.
The classic robotics starter: a two-wheeled car that tracks a black line on its own.
A robot that looks left and right with its ultrasonic "head" and picks the clearest way.
Roams a tabletop without ever driving off the edge.
Drive a 4WD car from your Android phone over Bluetooth.
Lessons are free to read. Maker (₹499/month) and Pro add quizzes, worked problems and certificates, paid with your Geekobot account. See plans
Learning project. Check every circuit and the datasheet of each part before you power it up.