Introduction to ROS Part 12: Talking to Microcontrollers @digikey
Introduction to ROS Part 12: Talking to Microcontrollers  @digikey
Uploaded December 2025 | Updated September 2026, 2 weeks ago
In this final episode of the ROS 2 tutorial series, we bridge the gap between simulation and the real world by integrating ROS 2 with actual robot hardware. A common point of confusion for newcomers is why ROS does not include many seemingly obvious hardware libraries for controlling robots (e.g. motors and sensors). The reason is that ROS is designed as a middleware: it works best as a modular, scalable multiprocessing communication platform. It’s not meant for hard, real-time control.
In this video, we’ll look at why time-critical tasks (like PWM motor control) and interrupt handing are better handled by a microcontroller and how ROS 2 nodes can communicate with that microcontroller to control a physical robot.

The written guide for this episode can be found here: digikey.com/en/maker/tutorials/2025/intro-to-ros-part-12-talking-to-microcontrollers

The GitHub repository containing the Docker image and example code for this series can be found here: github.com/ShawnHymel/introduction-to-ros

The demo uses a Raspberry Pi 4B running Ubuntu 24.04 and ROS 2 Jazzy as the high-level computer, paired with a Raspberry Pi RP2350-based controller on the XRP educational robotics platform for low-level motor control.

We walk through setting up serial communication over USB, writing simple Arduino firmware to parse motor commands, and building a Python ROS 2 node that sends those commands in real time. Along the way, you’ll see practical considerations like Linux’s non-deterministic scheduling, why microcontrollers are essential for real-time robotics, and how this SBC + MCU architecture scales to more complex systems.

We’ll briefly cover installing ROS 2 on a Raspberry Pi, configuring SSH and VS Code for remote development, setting up a Python virtual environment, and creating a custom ROS 2 package with colcon. The example driver node implements a small state machine that drives, turns, and stops the robot by sending serial commands, which demonstrates a clean separation between high-level robot logic in ROS 2 and low-level hardware control on the microcontroller.

To close out the series, the video shows how this architecture enables more advanced robotics features like computer vision and autonomy. Using OpenCV, a ROS 2 vision node tracks a colored object and publishes bounding box data, while a driver node subscribes to that data and steers the robot toward the target in real time. This final project highlights the real power of ROS 2: combining perception, decision-making, and hardware control into a scalable system.

eXperiential Robotics Platform (XRP): digikey.com/en/products/detail/sparkfun-electronics/28009/26266382

0:00 Intro
1:06 Overview of the hardware
4:32 Writing the Arduino motor controller
14:47 Setting up ROS on the Raspberry Pi
20:56 Writing the ROS node
27:13 Running the simple ROS demo on real hardware
28:28 Ball tracking vision demo
29:15 Conclusion

Maker.io - digikey.com/en/maker
DigiKey’s Blog – TheCircuit digikey.com/en/blog
Connect with DigiKey on Facebook facebook.com/digikey.electronics
And follow us on X: https://x.com/digikey
Introduction to ROS Part 12: Talking to MicrocontrollersReading a Quadrature Encoder | Byte Sized #short3D Printer Bed Level Visualizer #3Dprinting #Octoprint #Visualizer #MakerUpdateAutopilot Engage [Maker Update] | Maker.ioHow AI Vision Modules Work #BeckyStern #DigiKey #shortWhat is Rubber Duck Debugging? #Code #Debugging #Coding #MakerUpdateShaping What Comes Next - Sustainable Futures S2E3 | DigiKeyDesigning for Aluminum Extrusions With Free Online CAD Tools #Aluminum #Extrusion #CAD #MakerUpdatePick-Me-Up [Maker Update] | Maker.ioIntroduction to Zephyr Part 12: How to Create a Custom Board Definition | DigiKeyRebuilding the Line: Automation and the Workforce Revolution - Factory Tomorrow S5E3 | DigiKeyIntroduction to ROS Part 7: Custom Interfaces | DigiKey
DigiKey |

Introduction to ROS Part 12: Talking to Microcontrollers

SHARE TO X SHARE TO REDDIT SHARE TO FACEBOOK WALLPAPER