Thanh Le / bench notes
ROBOTICS · ROBOT HUB · IN PROGRESS

Hokuyo URG-04LX lidar (2D, 240°)

An old USB laser scanner: talking SCIP 2.0 by hand, then fixing the demos that ran on it

#robotics#lidar#usb
Last change2026-11-22: hub page with two STAR write-ups

Hokuyo URG-04LX lidar (2D, 240°)

Hokuyo cover: 682 steps per scan, 0 bad lines 682 steps per scan, 0 bad checksum lines, a frame every 100.6 ms.

One GD scan from my desk, plotted from the raw distances

The URG-04LX-UG01 is Hokuyo’s small 2D laser scanner. It spins at 600 rpm, sweeps 240° in 682 steps of 0.3516° (360/1024, exactly), and measures 20 to 5600 mm. It’s USB powered and shows up on Linux as a plain CDC-ACM serial port, /dev/ttyACM0, no driver. Mine reports firmware 3.4.03 from December 2012. Hokuyo discontinued it and says indoor use only.

I had eight little demos for it on top of Hokuyo’s open-source urg_cpp library (a point reader, an object clusterer, safety zones, a CSV logger, a people counter and a few more). In September 2026 I plugged it in again and wanted two things: see the protocol for myself, without the library, and find out whether those demos actually worked. Most of them had never run on the sensor.

The stories

#StoryResultStatus
1 Talking SCIP 2.0 to the URG-04LX by hand
A raw client in Python and C++: 6-bit text encoding, a checksum that skips the semicolon, and two stream bugs of my own
682 steps per scan with 0 bad checksum lines, 100.6 ms per frame, σ 3 to 4 mm at 14 cm (the spec allows ±30 mm) Done
2 A safety zone that was always CLEAR, and an intrusion alarm that never stopped
Running my eight urg_cpp demos on the sensor for the first time: a step-versus-index bug and mixed pixels
zone_monitor now flags the object at 113 mm it used to call CLEAR; scan_diff: 0 false alarms in 280 frames (before: every frame) Done

Still open

Three checks need someone in front of the sensor: wave a hand or a box through the scan while scan_diff runs (I only proved it no longer raises false alarms, not that it still catches real changes), put an object down for dimension_measure, and hold a hand on the sensor’s left to see whether the zones called LEFT and RIGHT are swapped. I suspect they are, because angles grow counter-clockwise on the URG line, but I haven’t checked. I also never measured how the error codes behave on dark, shiny or edge-on surfaces, and I haven’t tried the commands that change the bit rate or motor speed.