A line-following robot needs more than a good steering correction if it wants to run quickly: it also needs to know when to slow down. In Motoko Uprising, a project created in 2019 and shared on Hackaday.io by michal.nand, a small neural network classifies line shapes so the robot can run fast on straights and brake for curves. Conventional feedback controllers still handle steering and motor speed—the network supplies an extra judgment about the track.
That division of labor is the project's most useful idea. Rather than asking a neural network to drive everything, the builder gives it a narrow classification task with a small input and five possible answers.
Eight sensors become a short history of the line
The robot has eight line sensors built from phototransistors sensitive to green light around 540 nm and white LEDs. One set of readings describes the line beneath that sensor array; retaining eight successive sets produces the network's 8 × 8 input matrix.
This is a time history, not a camera image of the road ahead. The network looks for line-shape information in how the sensor pattern changes across recent samples. Its five output classes represent two kinds of left curve, two kinds of right curve, and a straight line.
Alongside that classifier, quadratic interpolation estimates the line's position. A PD controller handles steering, while two PID controllers regulate motor speeds. The main loop runs at 200 Hz, giving the control system a new cycle every 5 milliseconds. The classifier's job is therefore tightly bounded: distinguish useful track shapes quickly enough to inform speed control without displacing the rest of the loop.
A DenseNet has to fit beside the motor controllers
The processor is an STM32F303, a 72 MHz ARM Cortex-M4F. It drives two Pololu HP motors with 1:30 gearing and magnetic encoders through a TI DRV8834 motor driver. The chassis uses 28 mm tyres and a 180 mAh, two-cell lithium-polymer battery. An LSM6DS0 gyroscope/accelerometer and three infrared obstacle sensors are also listed, although the overview doesn't explain their role in the control strategy.
For line classification, michal.nand chose a densely connected convolutional neural network, or DenseNet. The stated tradeoff was robustness versus execution speed: the network needed to keep up with the 200 Hz loop, and the builder chose dense connections to reduce the number of kernels needed compared with a conventional convolutional network.
The listed architecture starts with a convolution and max pooling, continues through two densely connected convolutional layers, and ends in a five-output fully connected layer. It is a compact classifier, not a large vision model transplanted onto a small robot.
Getting it onto the microcontroller required another set of choices. The builder converted floating-point weights to scaled 8-bit integers and used an embedded inference framework with SIMD instructions. Two shared working buffers serve the layers, reducing the memory needed for intermediate results. Those details matter as much as the network topology: the robot still has sensors to sample and motors to control while inference runs.
Synthetic training makes the physical test important
The training data was artificially generated: 25,000 examples for training and 5,000 for testing, with luma noise and white noise used for augmentation. Training ran on a GPU using the builder's own Rysy framework.
The project reports 95% classification accuracy for the final architecture. In the context of the described synthetic dataset, that's a useful model result, but it isn't a measurement of lap completion, braking reliability, or performance under different real-world lighting conditions. The overview doesn't provide a separate physical-track accuracy figure or a comparison against a non-neural speed controller.
That distinction leaves a worthwhile engineering question. A classifier can label a pattern correctly yet still deliver that answer too late to improve corner entry. For this robot, the value of the network depends not just on the class it chooses, but on when that choice reaches the speed controller.
Debugging exposes the classifier alongside the mechanics
The builder also made an OpenGL debug application that displays raw line-sensor data, motor speeds and encoder information, IMU readings, neural-network classification activity, and raw USART data. Putting those signals together gives the project a useful diagnostic surface: a poor corner could originate in the sensed pattern, the classification, or the motor response rather than simply being a steering problem.
The overview links a video described by the creator as showing the working robot and the Motoko Uprising source repository. In a September 5, 2019 discussion reply, michal.nand estimated roughly €100–€150 for a final build, while noting that development could cost much more. That is a historical builder estimate, not a current parts quote.
The transferable lesson is the architecture: keep fast, familiar feedback loops in charge of motion, and use a small learned model for a specific judgment. The next revealing test would compare the same robot with and without neural speed selection, measuring corner-entry timing, track departures, and lap times. That would show whether the classifier's extra judgment earns its place in the 5-millisecond budget.