A robust offroad-capable autonomous robot platform that proves stepper motors can be excellent vehicle drives when paired with Field-Oriented Control (FOC). This modular platform demonstrates 20° slope climbing capability on grass with a 10kg vehicle, while maintaining precise wall-following navigation using dual-core ESP32 processing.
Key Features:
- Rocker-Differential-Suspension to tackle off-road terrain
- Stepper motors integrated directly into the steering knuckle
- Four-wheel drive and steering
- FOC stepper motor control for high torque and smooth operation
- Dual-core ESP32 architecture (sensor processing + navigation logic)
- 8x HC-SR04 ultrasonic sensors with median filtering
- PI controller for precise wall-following
- Dynamic speed control based on obstacle proximity
- Modular design: Motor control (MC1) + Navigation brain (MC2)
- Open source platform for agricultural and offroad applications
Performance Highlights:
- Climbs 20° slopes on grass (10kg vehicle weight)
- Autonomous wall-following with angle and distance control
- Real-time obstacle detection and avoidance
- Sub-400ms sensor update cycle with dynamic sensor activation
Target Applications:
- Agricultural robotics (lawn care, crop monitoring)
- Offroad automation (cleaning, inspection)
- Educational platform for robotics and control systems
- Research platform for autonomous navigation
This project serves as proof-of-concept for a modular, open-source offroad robot chassis that can be adapted for various applications including robotic lawn mowers, agricultural assistants, and autonomous inspection vehicles.
Difficulty: Advanced, - Build Time: 2-3 weeks License: GPLv3
Story: When Stepper Motors Meet Field-Oriented ControlThe Myth That Needed Breaking"Stepper motors don't work for vehicles."
This is what you'll hear from most robotics forums and engineering discussions. The conventional wisdom is clear: steppers lack the torque, lose steps under load, and simply aren't suitable for mobile robots, especially outdoors.
I had firsthand experience with this limitation. My first robot - a 4.0kg vehicle using NEMA17 steppers with DRV8825 drivers - couldn't even move on flat grass. The motors would stall immediately, proving the conventional wisdom correct.
But what if the problem wasn't the motor type, but the control method?
The FOC BreakthroughField-Oriented Control (FOC) changes everything. By treating stepper motors like brushless DC motors and applying sophisticated control algorithms, FOC drivers unlock the true potential of steppers:
- Smooth torque deliveryacross the entire speed range
- High holding torqueeven at low speeds
- Efficient power usagethrough precise current control
- Silent operationcompared to traditional step/direction control
The proof? My current robot - weighing 10kg and using the same NEMA17 motors but with FOC drivers - can climb 20° slopes on grass. Not just climb, but start from a standstill on the slope. The difference is dramatic and definitively proves that stepper motors can be excellent vehicle drives.
From "It Moves" to Autonomous NavigationOnce the FOC-powered drivetrain proved itself, I wanted to go further. What started as a simple "can it drive?" experiment evolved into a complete autonomous navigation system. The goal: create a modular platform that could serve as the foundation for various offroad applications.
The architecture splits into two independent microcontrollers:
MC1 (Motor Control Unit):
- Controls FOC stepper drivers
- Manages steering servo
- I2C slave interface
- Can be swapped/upgraded independently
MC2 (Navigation Brain):
- ESP32 dual-core for sensor processing + logic
- 8× HC-SR04 ultrasonic sensors
- TFT display for debugging
- PI controller for wall-following
- I2C master for MC1 communication
- Can be swapped/upgraded independently
This separation means the navigation logic is completely independent of the motor hardware - swap to different motors? Just update MC1. Want better sensors? Only change MC2.
Technical Challenges Solved1. Dual-Core Sensor ProcessingWith 8 ultrasonic sensors, timing is critical. Each HC-SR04 needs a trigger pulse and blocks while waiting for the echo (up to 23ms timeout). Processing all sensors sequentially on one core would create unacceptable latency.
- Solution: ESP32 dual-core architecture
- Core 1: Dedicated sensor task with median filtering
- Core 0: Navigation logic, I2C communication, display
- Thread-safe data exchangevia FreeRTOS mutex
The sensor task only measures active sensors (4 during wall-following vs. 8 during initialization), cutting measurement cycles from ~700ms to ~400ms.
2. Wall-Following with PI ControlSimple P-control (proportional only) can follow straight walls but struggles with curves. When the wall curves and the vehicle steers but the angle doesn't change, a P-controller just maintains the same (insufficient) steering angle.
- Solution: PI controller with Anti-Windup
- P-component: Immediate response to current error
- I-component:Accumulates persistent errors over time
- Anti-Windup: Prevents integral overflow
- Separate dead zones for distance (±20mm) and angle (±2°)
The I-component automatically increases steering when the wall curves, allowing smooth navigation through non-straight corridors.
# insert Video
3. Dynamic Sensor ActivationRunning all 8 sensors continuously wastes time measuring irrelevant data. During wall-following, only 4 sensors matter:
- 2 side sensors (front + rear) for the wall
- 2 front sensors for obstacle detection
- Solution: State-based sensor management
- Initialization: All 8 sensors active (detect which wall to follow)
- Wall-following: Only 4 relevant sensors
- Corner detection: Front sensor OK, rear sensor loses echo → use front only
This adaptive approach provides fast updates where needed while handling corner scenarios gracefully.
4. Obstacle Handling Without ConflictsEarly versions had two competing stop mechanisms:
Dynamic speed reduction based on distance and binary obstacle detection. These would fight each other, causing unreliable stopping.
Solution: Unified control through state machine
- STATE_INIT → Detect wall, choose side
- STATE_DRIVING → Normal operation with dynamic speed
- STATE_OBSTACLE → Stopped until clear
- STATE_ERROR → No wall detected, requires reset
One central speed calculation function (calculateDynamicSpeed()) handles all obstacle scenarios with graduated responses:
- <1000mm: Start braking (90% speed)
- <800mm: 75% speed
- <600mm: 50% speed
- <400mm: 25% speed
- <200mm: STOP
This isn't just a robot that follows walls. It's a foundation for practical offroad applications:
Potential Use Cases:
- 🌾 Agricultural robots (weeding, monitoring, harvesting)
- 🧹 Autonomous cleaning vehicles
- 🔍 Inspection robots for facilities
- 📦 Outdoor material handling
- 🎓 Educational platform for robotics
The modular architecture means each application just needs:
- Keep MC1 (proven motor control)
- Replace MC2 with application-specific logic
- Add task-specific sensors/actuators
What Works: ✅ FOC stepper motors with 20° slope capability ✅ Dual-core sensor processing (400ms cycle) ✅ PI-controlled wall-following ✅ Dynamic obstacle avoidance ✅ Reliable stopping (20/20 test success rate) ✅ Automatic corner handling
Next Evolution: The ultrasonic sensors work well but have limitations:
- Indoor echo problems
- Limited object classification
- No height detection
The next iteration will integrate computer vision using a Radxa Dragon Q6A and a stereo camera module, enabling:
- Object recognition (overdriving vs. Avoiding)
- Path planning beyond wall-following
- Terrain analysis
- Advanced navigation strategies
But that's a story for another project...
Lessons Learned- Question conventional wisdom - "Steppers can't drive vehicles" was wrong with the right control
- Separation of concerns - MC1/MC2 split enables independent evolution
- Multi-core pays off - Sensor processing on dedicated core dramatically improves response time
- PI beats P - The integral term is essential for real-world navigation with curved walls
- State machines prevent chaos - Clear states eliminate competing control mechanisms
- Test incrementally - Each subsystem verified independently before integration
This project is fully open-source (GPLv3). All code, schematics, and documentation are available on GitHub. Whether you want to replicate the exact build or adapt it for your own application, the modular design makes it accessible.
The FOC stepper breakthrough opens new possibilities for affordable, powerful mobile robots. Combined with modern microcontrollers and smart algorithms, we can build capable autonomous platforms that work reliably in challenging outdoor environments.
The myth is broken. Steppers can drive. Let's see what we build next.
Have questions or built something similar? Share your experience in the comments below!







Comments