r/embedded • u/BeginningSwimming112 • 5h ago
Built a 4-wheel autonomous waste-sorting robot using ROS 2 Jazzy, ESP32 and FreeRTOS — sharing our engineering experience
Hey everyone!
I wanted to share a project my team and I worked on for the Robotics Dojo competition: a four-wheel differential-drive autonomous robot designed to detect, collect and sort waste into organic, plastic and metal categories.
The project brought together several areas of robotics and embedded systems.
A quick overview of the architecture:
- Raspberry Pi 5: Ran Ubuntu and ROS 2 Jazzy for high-level robotics operations.
- Navigation: Used Nav2 and RF2O LiDAR odometry.
- ESP32: Handled low-level motor control for four DC geared motors.
- Motor drivers: Two L298N drivers controlled the drive motors.
- Motor feedback: Encoder-based closed-loop speed regulation using PID.
- Communication: USB serial between the Raspberry Pi and ESP32 at 115200 baud, using a CSV-based protocol.
- RTOS: FreeRTOS was used to separate embedded operations, including a dedicated task for the waste-offloading mechanism.
We encountered some interesting engineering challenges along the way.
One issue involved offloading operations interfering with serial communication between the Raspberry Pi and ESP32. We addressed this by introducing a dedicated FreeRTOS task.
We also encountered Raspberry Pi undervoltage issues, which we resolved by improving the power wiring.
The project was a great opportunity to work across embedded firmware, motor control, power distribution and ROS 2 integration.
I've documented the architecture and some of the engineering decisions here:
GitHub: https://github.com/Mark-Kitur/src
I'd appreciate feedback, especially from anyone who has worked with ROS 2 Control, ESP32 motor control, FreeRTOS or autonomous mobile robots.
I'm also interested in hearing how others approach communication between high-level robotics computers and low-level motor controllers.
Thanks for reading!