element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • Community Hub
    Community Hub
    • What's New on element14
    • Feedback and Support
    • Benefits of Membership
    • Personal Blogs
    • Members Area
    • Achievement Levels
  • Learn
    Learn
    • Ask an Expert
    • eBooks
    • element14 presents
    • Learning Center
    • Tech Spotlight
    • STEM Academy
    • Webinars, Training and Events
    • Learning Groups
  • Technologies
    Technologies
    • 3D Printing
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • Technology Groups
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents Projects
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • Project Groups
  • Products
    Products
    • Arduino
    • Avnet & Tria Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • About Us
  • Store
    Store
    • Visit Your Store
    • Choose another store...
      • Europe
      •  Austria (German)
      •  Belgium (Dutch, French)
      •  Bulgaria (Bulgarian)
      •  Czech Republic (Czech)
      •  Denmark (Danish)
      •  Estonia (Estonian)
      •  Finland (Finnish)
      •  France (French)
      •  Germany (German)
      •  Hungary (Hungarian)
      •  Ireland
      •  Israel
      •  Italy (Italian)
      •  Latvia (Latvian)
      •  
      •  Lithuania (Lithuanian)
      •  Netherlands (Dutch)
      •  Norway (Norwegian)
      •  Poland (Polish)
      •  Portugal (Portuguese)
      •  Romania (Romanian)
      •  Russia (Russian)
      •  Slovakia (Slovak)
      •  Slovenia (Slovenian)
      •  Spain (Spanish)
      •  Sweden (Swedish)
      •  Switzerland(German, French)
      •  Turkey (Turkish)
      •  United Kingdom
      • Asia Pacific
      •  Australia
      •  China
      •  Hong Kong
      •  India
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      • Americas
      •  Brazil (Portuguese)
      •  Canada
      •  Mexico (Spanish)
      •  United States
      Can't find the country/region you're looking for? Visit our export site or find a local distributor.
  • Translate
  • Profile
  • Settings
Project Videos
  • Challenges & Projects
  • element14 presents
  • Project Videos
  • More
  • Cancel
Project Videos
Documents Meet the PlatypusBot: Now Powered by Raspberry Pi & ROS -- Episode 690
  • Documents
  • Members
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
Join Project Videos to participate - click to join for free!
Related
EMI-Reduction-Techniques
Recommended
Engagement
  • Author Author: cstanton
  • Date Created: 13 Nov 2025 9:08 AM Date Created
  • Last Updated Last Updated: 13 Nov 2025 10:07 AM
  • Views 128 views
  • Likes 5 likes
  • Comments 3 comments

Meet the PlatypusBot: Now Powered by Raspberry Pi & ROS -- Episode 690

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

You don't have permission to edit metadata of this video.
Edit media
x
image
Upload Preview
image

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.”

image

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.”

image

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.

image

image

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.

image

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:

error = reference - measuredSpeed; accumulator += error; output = Kp * error + Ki * accumulator + Kd * (error - lastError); lastError = error;

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.

attachInterrupt(digitalPinToInterrupt(2), encoderLeftISR, RISING); attachInterrupt(digitalPinToInterrupt(3), encoderRightISR, RISING);

image

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:

def handle_serial_command(self, request, response): self.serial.write(request.command.encode()) response.success = True response.message = "Command sent" return response

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.”

image

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.

imageimage

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

  • arduino raspberry pi integration
  • Robot operating System
  • pid controller arduino
  • ros2 humble
  • raspberry pi 4b
  • open source robot
  • brushed dc motor encoder
  • encoder motor control
  • diy robotics project
  • mobile robot platform
  • arduino uno r4 wifi
  • robot control systems
  • diy autonomous robot
  • robotics with ros2
  • arduino robot build
  • Share
  • History
  • More
  • Cancel
Actions
  • Share
  • More
  • Cancel
  • Sign in to reply
  • kmikemoo
    kmikemoo 6 hours ago

    milosrasic98 Excellent episode.  Fantastic overview of PID.  Very nice.  The detail of setting up the ROS2 was impressive.  BUT... nothing tops the beak and the fedora! Laughing
    Very well done. Thumbsup 

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • genebren
    genebren 12 hours ago

    Great project! I really like the use of recycled goods to build your robot.  I look forward to seeing your progress of this project.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • DAB
    DAB 13 hours ago

    Great episode.

    You did a very good job of explaining your software and explaining the results.

    Took me back to the days when I was doing embedded programming for a FLIR on a search and rescue helicopter.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
element14 Community

element14 is the first online community specifically for engineers. Connect with your peers and get expert answers to your questions.

  • Members
  • Learn
  • Technologies
  • Challenges & Projects
  • Products
  • Store
  • About Us
  • Feedback & Support
  • FAQs
  • Terms of Use
  • Privacy Policy
  • Legal and Copyright Notices
  • Sitemap
  • Cookies

An Avnet Company © 2025 Premier Farnell Limited. All Rights Reserved.

Premier Farnell Ltd, registered in England and Wales (no 00876412), registered office: Farnell House, Forge Lane, Leeds LS12 2NE.

ICP 备案号 10220084.

Follow element14

  • X
  • Facebook
  • linkedin
  • YouTube