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 componentsLegged robots look hard but follow a simple pattern: each leg lifts, swings forward and pushes back in turn. The most common reason a kit robot walks badly is servos mounted off-centre, so this build starts by centring every servo with a servo tester before assembly. A PCA9685 board gives 16 clean servo channels over I2C and takes the load off the Nano.
Lithium batteries need a proper charger and must never be left charging unattended.
Keep fingers clear of the joints when the servos are powered.
Tick anything you already have and the total updates.
Runs the gait if your kit does not include a controller
MG90S metal gear micro servos, if your kit does not include them
8-DOF biped frame (servos sold separately)
Serial bus servo driver for robots with smart servos
8-channel servo shield that plugs onto an Arduino
AI vision camera to make the robot follow colours or tags
Follow the colours: red is power, dark grey is ground, blue is a signal.
Eight servos can draw 3 A or more together. Use a 2-cell battery with a 5-6 V BEC or a 5 V 3 A supply on the PCA9685 V+ terminal.
spider_gait.inoVerify & upload in Electrolark#include <Wire.h>
#include <Adafruit_PWMServoDriver.h>
Adafruit_PWMServoDriver pwm;
int TRIM[8] = {0, 0, 0, 0, 0, 0, 0, 0}; // degrees, set during trimming
const bool WALK = true;
void servo(int ch, int deg) {
deg = constrain(deg + TRIM[ch], 0, 180);
int us = map(deg, 0, 180, 500, 2500);
pwm.writeMicroseconds(ch, us);
}
void leg(int n, int hip, int knee) { servo(n * 2, hip); servo(n * 2 + 1, knee); }
void stand() { for (int n = 0; n < 4; n++) leg(n, 90, 90); }
void step(int n) { // lift, swing forward, put down
int dir = (n == 0 || n == 3) ? 1 : -1; // mirrored sides
leg(n, 90, 60); delay(120);
leg(n, 90 + 25 * dir, 60); delay(120);
leg(n, 90 + 25 * dir, 90); delay(120);
}
void push() { // all hips back together moves the body forward
for (int a = 0; a <= 25; a += 5) {
for (int n = 0; n < 4; n++) {
int dir = (n == 0 || n == 3) ? 1 : -1;
servo(n * 2, 90 + (25 - a) * dir);
}
delay(30);
}
}
void setup() {
pwm.begin();
pwm.setOscillatorFrequency(27000000);
pwm.setPWMFreq(50);
stand();
delay(1000);
}
void loop() {
if (!WALK) return;
int order[4] = {0, 2, 1, 3}; // front-left, back-right, front-right, back-left
for (int i = 0; i < 4; i++) step(order[i]);
push();
}
The servos pull the supply down. Power V+ from a separate battery or BEC that can give 3 A or more.
That servo is mirrored; flip its direction in the code or use a signal reverser.
Normal under load; if they get hot, the leg is fighting the body, so check the TRIM values.
Check the product page of the kit. If not, eight MG90S servos are a strong choice.
It makes all 16 servo signals in hardware, so the code stays simple and the timing is steady.
Short pile, yes. Add rubber feet for smooth floors.
14 parts: Quadruped Spider Robot Kit (Arduino Nano), PCA9685 16-Channel PWM / Servo Driver, RC Servo Motor Tester (3-Channel), Nano CH340 Development Board (Soldered), 8 × TowerPro MG90S Metal Gear Micro Servo, Quadruped Dog and 4-DOF Arm 2-in-1 Kit, Otto Pro Humanoid DIY Robot Kit, 8 DOF Humanoid Biped Robot Kit (Without Servos), Waveshare Serial Bus Servo Driver Board, Cytron 8-Channel Servo Shield for Arduino, plus 4 more. Tools: 24 in 1 Precision Screwdriver Set and Digital Multimeter. 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 6 steps.
No. This page has the complete, tested code (spider_gait.ino).
About ₹25,399 for the parts at the prices on this page, plus tools if you do not have them. Quantity price breaks lower the cost when you build several.
Centring and trimming servos; Driving servos over I2C with a PCA9685; A basic creep gait for four legs.
Lithium batteries need a proper charger and must never be left charging unattended. Keep fingers clear of the joints when the servos are powered.
Ideas that reuse this build: Teensy USB MIDI knob controller. They are listed under Take it further on this page.
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.
Learning project. Check every circuit and the datasheet of each part before you power it up.