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 componentsA Pi cannot make steady servo pulses for many servos at once, so the Waveshare Servo Driver HAT (B) uses a PCA9685 chip: the Pi sends angles over I2C, and the chip keeps 16 channels pulsing on its own. Metal-gear MG996R servos are strong enough for an acrylic arm, and the claw kit comes with its own MG996R. Servos draw several amps when they move together, so they get their own supply on the HAT's power terminal and never run from the Pi's 5 V pin.
Keep fingers out of the claw and joints while it is powered; MG996R servos are strong.
Tick anything you already have and the total updates.
Waveshare 16-Ch servo driver HAT (B)
Servo supply for the HAT terminal; pick the voltage its wiki lists
Follow the colours: red is power, dark grey is ground, blue is a signal.
Pi on its own USB-C supply; servos from the HAT's power terminal.
arm.pyimport sys, termios, tty
from adafruit_servokit import ServoKit
kit = ServoKit(channels=16, address=0x40)
LIMITS = {0: (10, 170), 1: (40, 150), 2: (30, 160), 3: (60, 120)} # base, shoulder, elbow, claw
KEYS = {"a": (0, -3), "d": (0, 3), "w": (1, 3), "s": (1, -3), "i": (2, 3), "k": (2, -3), "o": (3, 3), "l": (3, -3)}
pos = {ch: 90 for ch in LIMITS}
for ch in pos:
kit.servo[ch].set_pulse_width_range(500, 2500)
kit.servo[ch].angle = 90
def key():
fd = sys.stdin.fileno(); old = termios.tcgetattr(fd)
try:
tty.setraw(fd); return sys.stdin.read(1)
finally:
termios.tcsetattr(fd, termios.TCSADRAIN, old)
print("a/d base, w/s shoulder, i/k elbow, o/l claw, q quit")
while True:
k = key()
if k == "q":
break
if k in KEYS:
ch, step = KEYS[k]
lo, hi = LIMITS[ch]
pos[ch] = max(lo, min(hi, pos[ch] + step))
kit.servo[ch].angle = pos[ch]
print(pos, end="\r\n")
The servo supply is too weak or shared with the Pi; give the HAT its own supply with enough current.
I2C is off or the HAT is not seated; check the address jumpers too.
It is pushing against the frame; narrow its LIMITS.
Sixteen channels, but the power supply decides how many can move at once.
Yes, add a small Flask page with sliders that sets the same angles.
No, an acrylic arm lifts small light objects like a bottle cap or a pen.
8 parts: Waveshare 16-Ch 12-bit Servo Driver HAT (B) for Pi I2C, Acrylic Robotic Arm Kit (Servo Not Included), Mechanical Claw for Robot Arm with MG996R Servo, 3 × TowerPro MG996R Metal Gear Servo (180°), DC Power Adapter (5.5x2.1mm), Raspberry Pi 4 Model B 2GB RAM Single Board Computer, Official Raspberry Pi 32GB A2 Class Micro SD Card and Official Raspberry Pi 4 USB-C Power Supply – 15.3W. 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 (arm.py).
About ₹13,867 for the parts at the prices on this page. Quantity price breaks lower the cost when you build several.
I2C servo drivers (PCA9685); Powering servos separately from the computer; Moving joints smoothly in small steps.
Keep fingers out of the claw and joints while it is powered; MG996R servos are strong.
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.