In this episode, Milos upgrades his open-source PlatypusBot into Perry the PlatypusBot, transforming a simple Arduino-based rover into a full ROS2-powered robotics platform. He explains how the motor encoders work, implements PID control for precise movement, and connects an Arduino Uno R4 WiFi to a Raspberry Pi 4B running ROS2 Humble for real-time command and control. With a 3D-printed fedora and a name inspired by community feedback, Perry now moves, turns, and responds to ROS commands, laying the groundwork for future additions like sensors, LIDAR, and SLAM.
Watch the Build
Milos continues work on his small open-source mobile robotics platform, the PlatypusBot, which earned its name because it was made from scavenged and mismatched parts, “just like a platypus.” In this stage, he adds a Raspberry Pi 4B running ROS2 Humble, transforming the robot into a true robotics platform. To top it off, the robot now officially becomes Perry the PlatypusBot, complete with a fedora.
“Today we will continue work on our platypus bot from last time. This time are going to learn about encoders, we’re going to learn about PID controllers, and we’re going to make some highly requested additions.”
Recap of the Previous Stage
Previously, Milos dismantled a broken robot vacuum cleaner purchased online and reused its wheel actuators, brushed DC motors with gearboxes and encoders, ideal for a small mobile robot.
He finished that stage with a joystick-controlled robot that could be driven via Wi-Fi, using an Arduino Uno R4 WiFi and a Python interface on a PC. The PlatypusBot - Scavenging for Robotics Parts -- Episode 671
“This is a small mobile robot platform made from discarded parts from an old Roomba… controlled by a joystick or Wi-Fi using an Arduino Uno R4 WiFi.”
Mechanical Breakdown and Encoders
To better understand the actuators, Milos disassembled one of the motors, revealing the encoder cage and photodiode sensor used to measure rotation and speed. The gearing ratios and encoder counts were calculated precisely to allow accurate movement control.
“You can imagine the teeth coming between them and they’re breaking the signal. That’s what we use to actually know the position and speed of the motor.”
Through his calculations, he determined that six pulses from the encoder equal one millimeter of movement, a neat round number that simplifies control logic.

Building the Electronics
The electronics remained simple but effective. A 12V battery powers both systems, with a buck converter dropping voltage to 5V for the Raspberry Pi. The encoders are read through pull-up resistors and an optical sensing pair.
“Everything is powered by a 12 volt battery, but this time I added a buck converter to step that down to five volts so we can power the Pi.”
For convenience, Milos added WAGO connectors for modular disconnection, keeping the system neat and serviceable.
PID Control Implementation
Precise control of speed and distance required implementing PID controllers (Proportional–Integral–Derivative). Milos demonstrated how each term influences stability and responsiveness before applying it in Arduino code.
“The purpose of the PID controller is to actually minimize that error, ideally to have it at zero.”
A simplified version of his Arduino code illustrates this logic:
The result was reliable control of each wheel’s velocity and position. Milos used hardware interrupts on pins 2 and 3 to read the encoder pulses efficiently.
ROS2 Integration
With the fundamentals working, Milos connected the Arduino to a Raspberry Pi 4B running ROS2 Humble. He explained how ROS structures robot systems around nodes, topics, and services, allowing modular communication.
“Imagine nodes as independent parts of code running in a loop. Topics are message channels through which you can publish or subscribe to data, and services are event-based interfaces.”
Using Visual Studio Code remotely connected to the Pi, Milos created a ROS2 service node that sends string commands over serial to the Arduino. The corresponding handler in Python:
This setup allowed simple high-level commands such as:
-
Move a set distance
-
Turn a specific angle
-
Maintain constant speed
“In the end, Perry the Platypus could follow simple commands like keeping constant speed, moving a set number of millimeters, or turning a set number of degrees.”
Testing Perry the PlatypusBot
After assembling everything, Milos demonstrated Perry’s movements using ROS commands. The robot could drive forward, reverse, and spin accurately according to programmed commands.
“You can see Perry moving and actually stopping, not bad, a few millimeters before the line. That’s because of the accuracy of the controller.”
The testing validated that both speed and position control worked properly across the ROS–Arduino interface.


The Fedora and Future Plans
By popular request, Milos printed a fedora to turn the robot into Perry the PlatypusBot, using a model from Printables and adapting it to fit over the LIDAR module.
Future upgrades include integrating the hidden LIDAR, adding SLAM capabilities, and possibly using the “eyes” as a camera and laser pair for vision-based navigation.
“Since it’s named Platypus Bot, and since I actually guessed the color completely by luck, meet Perry the PlatypusBot!”
Milos concluded this stage by emphasising that this was a foundation for future iterations involving faster communication, sensor integration, and autonomous navigation.
“Thanks so much for watching Perry the PlatypusBot Stage Two. We’ve added the Raspberry Pi 4 running ROS2 Humble, communicating with an Arduino Uno, sending commands for precise wheel movements.”
Supporting Files and Links
- Episode 690 Supporting Files
- PlatypusBot - Scavenging for Robotics Parts -- Episode 671
- https://github.com/ros-realtime/ros-realtime-rpi4-image
- https://www.printables.com/model/477316-perry-the-platypus-speaker-attachments
Bill of Materials
| Product Name | Manufacturer | Quantity | Buy Kit |
|---|---|---|---|
| Arduino Uno R4 WiFi - ABX00087 | ARDUINO | 1 | Buy Now |
| L298N Motor Driver - 105990007 | SEEED STUDIO | 1 | Buy Now |
| RPI4-MODBP-4GB | RASPBERRY-PI | 1 | Buy Now |
Additional Parts
| Product Name | Manufacturer | Quantity |
|---|---|---|
| Broken/old robot vacuum cleaner | ||
| Aluminum 20x20 profile | ||
| Battery powered drill | ||
| PLA or PETG filament | ||
| M3 and M4 screws | ||
| Step Down Regulator for powering the Raspberry |



