Hybrid Robot (Line Follower, Obstacle Avoider & Remote Tractor)

The Tractor
Servomotor hitch system

New Achievement
2nd Place - MRNC 2026 (1st Edition)
This robot is the result of hard work that led to a major new achievement: 2nd place in the very first edition of the Moroccan Robotics Challenge (MRNC 2026) at ENSMR.
Designed specifically for the "Top Parking" senior category technical challenge, this robot combines mechanical power and software flexibility. Its main mission was to tow 3D-printed trailers (empty, 150g, and up to 300g) up a 15-degree incline.
The rules required strict transitions between autonomous and manual modes. The robot uses a series of TCRT5000 sensors to follow the line and detect markers (perpendicular black lines) to intelligently switch modes.
The Avoider Mode: Thanks to two ultrasonic sensors mounted in a "V" shape at the front, the robot navigates alone in a plexiglass tunnel without crossing the line, constantly correcting its trajectory using distance-keeping algorithms. Switching to Bluetooth remote control then allows steering the SG90 servos to cleanly lock the trailer into the green zone.
Discover the parts that made it possible to climb the ramp with a 300g payload.

Here is the complete mapping used during the competition. To ensure logical signal stability and avoid any ESP32 "Brownout Reset", the power supply was divided into two distinct circuits.
| Origin Component | ESP32 Pin / Power | Function |
|---|---|---|
| Driver L298N | 13, 14, 12 | Right Wheel (enA, in1, in2) |
| 25, 27, 26 | Left Wheel (enB, in3, in4) | |
| Array IR (TCRT5000) | 18, 19, 21, 22, 23 | Line Reading (5 Channels) |
| HC-SR04 (Ultrasons) | Trig: 16, Echo: 35 | Main Sensor (Front) |
| Trig: 5, Echo: 17 | Side Sensor (Avoider Mode) | |
| Servos SG90 | 2, 4 | Hitch Mechanism / Gripper |
| LEDs | Vert: 32, Rouge: 33 | Autonomous/Manual Signaling |
| ⚡ Logic Power (Power Bank) | 5V / GND | Powers the 2 SG90 Servos |
| 5V / GND | Powers the TCRT5000 Sensor | |
| 🔋 Motor Power (Battery) | 12V / GND | Powers the L298N Driver (Motors) |
| Buck 5V | Powers ESP32 and Ultrasonics | |
| ⚠️ VERY IMPORTANT: It is imperative to connect all grounds (GND) of the Power Bank, Battery, L298N, and ESP32 together for a stable signal. | ||
This code contains the complete algorithm used for the finals. It includes the PWM timer conflict fix and anti-brownout for the trailer servos.
Important: Don't forget to install the ESP32Servo library before uploading.
We have prepared a Complete Pack containing everything you need to assemble this robot from A to Z. Don't waste time looking for parts one by one!
Contact us directly to order your pack: