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 componentsThe LDRobot D200 kit has a triangulation lidar that spins and measures distance in every direction up to about 8 m, plus a USB adapter. It streams packets with a start angle, an end angle and twelve distance points each. This Python script parses those packets and draws them on a polar plot with matplotlib. The same data feeds ROS SLAM packages when you move on to mapping.
Tick anything you already have and the total updates.
LDRobot D200 triangulation lidar kit with USB adapter
Follow the colours: red is power, dark grey is ground, blue is a signal.
USB from the computer.
lidar_plot.pyimport serial, struct, math
import matplotlib.pyplot as plt
PORT, BAUD = "/dev/ttyUSB0", 230400
def packets(s):
buf = b""
while True:
buf += s.read(512)
while len(buf) >= 47:
i = buf.find(b"\x54\x2c")
if i < 0: buf = b""; break
if len(buf) - i < 47: buf = buf[i:]; break
p, buf = buf[i:i + 47], buf[i + 47:]
start = struct.unpack_from("<H", p, 4)[0] / 100
end = struct.unpack_from("<H", p, 42)[0] / 100
pts = [struct.unpack_from("<HB", p, 6 + 3 * k) for k in range(12)]
step = ((end - start) % 360) / 11
for k, (dist, conf) in enumerate(pts):
if dist and conf > 100:
yield (start + step * k) % 360, dist / 1000
s = serial.Serial(PORT, BAUD, timeout=0.1)
plt.ion(); ax = plt.subplot(projection="polar"); ax.set_rmax(8)
scan = {}
for n, (ang, d) in enumerate(packets(s)):
scan[round(ang)] = d
if n % 400 == 0:
ax.clear(); ax.set_rmax(8)
ax.scatter([math.radians(a) for a in scan], list(scan.values()), s=3)
plt.pause(0.01)
The baud rate is wrong; check the manual and try 115200 or 230400.
The USB port gives too little power; try another port.
Lidars count angles clockwise; set ax.set_theta_direction(-1).
It measures where a laser spot lands on a sensor, accurate at short range.
Yes, LDRobot publishes ROS and ROS 2 drivers.
It is a Class 1 laser, safe in normal use.
1 part: LDRobot D200 Triangulation Lidar Sensor – 8m Range, 360° Scanning. 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 2 hours. The build on this page has 6 steps.
No. This page has the complete, tested code (lidar_plot.py).
About ₹6,459 for the parts at the prices on this page. Quantity price breaks lower the cost when you build several.
How a 2D lidar scans; Parsing a binary packet format; Plotting polar data live.
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.