In this part you fit a Raspberry Pi 5 to Frindo's deck, install Ubuntu and ROS 2 on it, and drive the robot from your computer's keyboard. Then you use ROS 2 to check, and if necessary fine-tune, how accurately Frindo measures its own movement.
Allow an afternoon. Most of the time goes on downloads and installs, which run by themselves.
- What you need
- Step 1: Fit the Raspberry Pi
- Step 2: Prepare the microSD card
- Step 3: Start the Pi and log in
- Step 4: Update Ubuntu
- Step 5: Install ROS 2
- Step 6: Install the MC1 driver
- Step 7: Let the Pi talk to MC1
- Step 8: Check each piece works
- Step 9: Drive the robot
- Step 10: Check how far it thinks it has gone
- Step 11: Back up the card
- Switching off
- If something doesn't work
- Pi power cable
What you need
You need a finished Frindo chassis, built and configured with the chassis build guide up to the end of step 14.
Parts to print
| Part | File | Qty | PLA | Time |
|---|---|---|---|---|
| Raspberry Pi mount | accessories/Pi Mount.stl |
1 | 11 g | 18 min |
The file is in the 3D files folder, and the print
settings are the same as for the chassis.
Parts to buy
| Item | Qty | Step |
|---|---|---|
| Raspberry Pi 5, 4 GB or more. 4 GB is enough for all three parts of this project. Choose 8 GB if you plan to go on to mapping and navigation (SLAM, Nav2) | 1 | 1 |
| Low-profile heatsink for the Raspberry Pi 5 | 1 | 1 |
| 64 GB A2-rated microSD card, from a brand you recognise | 1 | 2 |
| M3 x 10 mm screws, M3 washers and M3 nuts, to fix the Pi mount to the deck | 4 of each | 1 |
| M2.5 x 5 mm screws, to fix the Pi to its mount | 4 | 1 |
| USB-C to USB data cable, from MC1 to the Pi. Already in your RIK if you bought the Rapid Integration Kit | 1 | 1 |
| Pi power cable, from MC1's 5 V output to the Pi: see Pi power cable. Already in your RIK if you bought the Rapid Integration Kit | 1 | 1 |
You will also need
- A computer (Windows, macOS or Linux) with a microSD card reader, connected to your Wi-Fi network
- Raspberry Pi Imager, free from Raspberry Pi
- The name and password of your Wi-Fi network
- The block, box or mug you stood the robot on in the chassis build
Step 1: Fit the Raspberry Pi
Keep the battery unplugged for this step.
If you are not using the Rapid Integration Kit, make up the Pi power cable first: see Pi power cable at the end of this guide.
- Fit the mount. Fix the Pi mount near the middle of the deck with four M3 x 10 mm screws, with an M3 washer and nut on each under the deck. The photos also show the camera mount at the front edge of the deck, which you add in part 3 (coming soon). Leave that space free.
- Fit the heatsink to the Pi, following the instructions that come with it.
- Fit the Pi to its mount with four M2.5 x 5 mm screws. Its USB and Ethernet ports face the back of the robot.
- Connect the USB data cable. Pass it down through the large hole in the deck beside the Pi's USB ports. Plug the USB-C end into J7 on MC1, and the other end into one of the Pi's blue USB 3 ports.
- Connect the Pi's power. Pass the Pi power cable
through the same hole. Plug it into J4 (
AUX 5V) on MC1 and into the Pi's USB-C power socket. The Pi now runs from the robot's battery, through MC1.
Step 2: Prepare the microSD card
The Pi's operating system lives on the microSD card. You write it from your computer with Raspberry Pi Imager.
We use Ubuntu Server 24.04, not Raspberry Pi OS. ROS 2 Jazzy is made for Ubuntu 24.04 and installs on it in a few commands. On Raspberry Pi OS you would have to build it from source.
- Put the microSD card in your computer and open Raspberry Pi Imager.
- Choose the device first: Raspberry Pi 5. Imager then only offers operating systems that work on it.
- Choose the operating system: Other general-purpose OS, then Ubuntu, then Ubuntu Server 24.04 LTS (64-bit).
- Choose the storage: your microSD card. Check you have picked the card and not another drive, because Imager erases it.
- When Imager asks whether to apply OS customisation settings, choose
Edit settings and set:
- Hostname:
frindo - Username and password: choose your own and write
them down. This guide calls the username
you, so wherever you seeyou, type your own. - Wireless LAN: your Wi-Fi network's name and password, and your country
- On the Services tab, tick Enable SSH and choose Use password authentication
- Hostname:
- Save the settings, then write the card. It takes a few minutes.
Step 3: Start the Pi and log in
Put the microSD card in the Pi. Plug in the robot's battery and turn on the switch.
Wait about 3 minutes. The first start takes longer than usual while Ubuntu sets itself up.
On your computer, open a terminal: Terminal on macOS or Linux, or PowerShell on Windows.
Log in to the Pi over the network:
ssh you@frindo.localThe first time, it asks whether you trust the computer you are connecting to. Type
yes, then your password. Nothing appears on screen while you type a password. That is normal.
If frindo.local is not found, wait another minute and
try again. If it still fails, look up the Pi's address in your router's
list of connected devices, and use that instead, for example
ssh you@192.168.1.50.
You are now typing commands on the Pi. Everything from here to step 10 is typed into this terminal.
Step 4: Update Ubuntu
Some Ubuntu images for the Pi are missing part of the list of places they download software from. Without it, installing ROS 2 fails with an alarming message about held broken packages. This command checks for the problem and fixes it if needed:
grep -q noble-updates /etc/apt/sources.list.d/ubuntu.sources || \
sudo sed -i -E 's/^(Suites: noble)$/\1 noble-updates/' \
/etc/apt/sources.list.d/ubuntu.sources
sudo runs a command as the administrator, so it asks for
your password.
Then bring everything up to date, and install the tool that makes the
name frindo.local work reliably:
sudo apt update && sudo apt upgrade -y
sudo apt install -y avahi-daemon
sudo reboot
The Pi restarts and your terminal disconnects. Wait a minute, then
log in again with ssh you@frindo.local.
Step 5: Install ROS 2
These commands come from the official ROS 2 Jazzy installation guide. Type them one block at a time.
Add the ROS 2 software source:
sudo apt install -y software-properties-common curl
sudo add-apt-repository -y universe
export ROS_APT_SOURCE_VERSION=$(curl -s https://api.github.com/repos/ros-infrastructure/ros-apt-source/releases/latest | grep -F "tag_name" | awk -F\" '{print $4}')
curl -L -o /tmp/ros2-apt-source.deb "https://github.com/ros-infrastructure/ros-apt-source/releases/download/${ROS_APT_SOURCE_VERSION}/ros2-apt-source_${ROS_APT_SOURCE_VERSION}.$(. /etc/os-release && echo $VERSION_CODENAME)_all.deb"
sudo dpkg -i /tmp/ros2-apt-source.deb
Install ROS 2, its build tools and the keyboard driving program:
sudo apt update
sudo apt install -y ros-jazzy-ros-base ros-dev-tools ros-jazzy-teleop-twist-keyboard
This is a large download and takes 10 to 20 minutes.
ros-base is the version of ROS 2 without the graphical
tools, which a robot with no screen has no use for.
Step 6: Install the MC1 driver
Install Python's package installer, and the orcp library
the driver uses to talk to MC1:
sudo apt install -y python3-pip git
pip install --break-system-packages orcp
--break-system-packages sounds alarming, but it only
tells pip it is allowed to install alongside Ubuntu's own
Python packages, which is what you want here.
You may also see a warning that a script called
orcp-drive is installed in a folder that is not on
PATH. That is expected, and you can ignore it: the last part of
this step fixes it.
Download and build the driver:
mkdir -p ~/orcp_ws/src && cd ~/orcp_ws/src
git clone https://github.com/orcp-protocol/orcp-ros2.git
cd ~/orcp_ws
source /opt/ros/jazzy/setup.bash
colcon build --symlink-install
Download the Frindo files, which include two small helper scripts used in step 10 and the game controller files for part 2:
git clone --depth 1 https://github.com/frindo-robot/frindo.git ~/frindo
Finally, set every new terminal up for ROS 2 automatically. Copy
these lines exactly, including the capitals in $HOME and
$PATH:
echo 'source /opt/ros/jazzy/setup.bash' >> ~/.bashrc
echo 'source ~/orcp_ws/install/setup.bash' >> ~/.bashrc
echo 'export PATH="$HOME/.local/bin:$PATH"' >> ~/.bashrc
Without them, every new terminal answers
ros2: command not found, which is the most common first
problem with ROS 2.
Step 7: Let the Pi talk to MC1
Give yourself permission to use MC1's USB port:
sudo usermod -aG dialout $USER
Give MC1 a fixed name. Linux names USB devices in
the order it finds them, so MC1 might be /dev/ttyACM0 today
and /dev/ttyACM1 tomorrow. This rule makes it always appear
as /dev/mc1, and stops another Ubuntu service from
interfering with it:
sudo tee /etc/udev/rules.d/99-motion-core.rules >/dev/null <<'RULES'
SUBSYSTEM=="tty", ATTRS{idVendor}=="0483", ATTRS{idProduct}=="a5f6", SYMLINK+="mc1", ENV{ID_MM_DEVICE_IGNORE}="1"
SUBSYSTEM=="tty", ATTRS{idVendor}=="0483", ATTRS{idProduct}=="a5ea", SYMLINK+="mc1-boot", ENV{ID_MM_DEVICE_IGNORE}="1"
RULES
Let the Pi 5 power its USB devices fully. A Pi 5 limits its USB ports to 600 mA in total unless it recognises a special 5 A power supply, and it does not recognise MC1's. MC1's 5 V output can supply plenty, so tell the Pi:
echo -e '\n[pi5]\nusb_max_current_enable=1' | sudo tee -a /boot/firmware/config.txt
Restart so all of this takes effect. A new terminal is not enough:
sudo reboot
Wait a minute, then log in again.
Step 8: Check each piece works
Run these one at a time. Each one tests one more layer, so if one fails, you know where the problem is.
ls -l /dev/mc1
Shows /dev/mc1 -> ttyACM0 (or similar). If it says
No such file or directory, check the USB cable is in J7 and the
battery is on.
groups
The list must include dialout. If not, you missed the
reboot in step 7.
python3 -c "from orcp import ORCP; print(ORCP('/dev/mc1').info())"
Prints MC1's details, including its firmware version and serial number. This proves the Pi can talk to MC1 without ROS 2.
ros2 run orcp_ros2 orcp_driver --ros-args -p port:=/dev/mc1
Starts the driver. It should connect and keep running without errors. Press Ctrl-C to stop it. If the third command works but this one does not, the problem is the ROS 2 setup in step 6, not the robot.
Step 9: Drive the robot
For the first run, stand the robot on its block so the wheels are off the table.
You need two terminals logged in to the Pi. Open a
second terminal window on your computer and log in again with
ssh you@frindo.local.
Terminal 1: start the driver
ros2 run orcp_ros2 orcp_driver --ros-args -p port:=/dev/mc1
Leave it running. It shows any warnings or faults from MC1.
Terminal 2: start keyboard driving
ros2 run teleop_twist_keyboard teleop_twist_keyboard
Keep this terminal selected and use the keys it lists. The main ones are:
| Key | Does |
|---|---|
i |
Forward |
, |
Backward |
j / l |
Turn on the spot, left / right |
u / o |
Curve forward, left / right |
k |
Stop |
q / z |
Faster / slower |
Each key press sends one command, and the robot keeps doing it until you press another key.
Once both wheels turn the right way, put the robot on the floor and
drive it around. MC1 starts in its gentle SLOW mode every
time it powers up, which limits the motors to 30% power, so it is safe
to learn on.
Tip
When you are confident, you can switch to the faster
NORMAL mode. Leave the driver running in terminal 1, and in
terminal 2:
Press Ctrl-C to stop keyboard driving.
Switch to
NORMALand turn the motors on:ros2 param set /orcp_driver preset NORMAL ros2 service call /orcp_driver/enable std_srvs/srv/SetBool "{data: true}"Start keyboard driving again:
ros2 run teleop_twist_keyboard teleop_twist_keyboard
NORMAL needs that second command to switch the motors
on. MC1 goes back to SLOW whenever it is switched off.
If the robot stops and MC1's red light flashes, MC1 has found a problem and stopped the motors on purpose, for example because a wheel was blocked or the battery is low. This is called a fault. The motors stay off until you switch them back on, so the robot can't suddenly drive off again by itself.
Look in terminal 1 for a line starting
controller FAULT:. The word after it is the reason, and Faults below says what each one means. Deal with the cause first.Switch the motors back on. In terminal 2, press Ctrl-C, then:
ros2 service call /orcp_driver/enable std_srvs/srv/SetBool "{data: true}" ros2 run teleop_twist_keyboard teleop_twist_keyboard
Warning
Don't press the reset button on MC1 to clear a fault. Resetting MC1 cuts its USB connection, and the driver does not reconnect by itself, so nothing works until you restart the driver. If you have pressed it, press Ctrl-C in both terminals and start again from terminal 1.
Step 10: Check how far it thinks it has gone
As the robot drives, MC1 counts each wheel's turns and works out how far the robot has gone and which way it is facing. ROS 2 calls this odometry. If the wheel radius or track width you entered in the chassis build are slightly out, the odometry is too. Every ROS 2 program that uses the robot's position inherits the error, so it is worth checking now.
You need the robot on the floor with clear space, a tape measure, and a strip of masking tape.
Check the distance.
Put a piece of tape on the floor and line up the front of the robot with it.
With the driver still running in terminal 1 and teleop in terminal 2, open a third terminal and start the checker:
python3 ~/frindo/projects/ros2/files/odom_check.pyIt prints how far the robot has gone, and how far it has turned, since the checker started.
In terminal 2, drive straight forward about 1 m, then stop.
Measure how far the robot really went, and compare it with the checker's distance.
If they agree within about 1 cm, the wheel radius is right. If not, work out a new wheel radius:
new wheel radius = 0.026 x (distance you measured / distance the checker shows)
For example, if the robot really went 0.98 m but the checker says 1.00 m, the new radius is 0.026 x 0.98 / 1.00 = 0.0255.
Check the turning. Do this after the distance, because a wrong wheel radius also spoils the turn.
- Stop the checker with Ctrl-C and start it again, so it counts from zero.
- Line the robot up with a straight line of tape.
- Use
jto spin it on the spot, and stop when it has turned exactly one full turn and lines up with the tape again. - Note the angle the checker shows.
If it shows between 355 and 365 degrees, the track width is right. If not:
new track width = 0.172 x (angle the checker shows / 360)
To change either value, stop the driver in terminal 1 with Ctrl-C first, because only one program at a time can talk to MC1. Then set and save the new values, for example:
python3 ~/frindo/projects/ros2/files/mc1_set.py kin.wheel_radius=0.0255 kin.track_width=0.170
The script saves the values on MC1 and reads them back to confirm. If
you changed the wheel radius, update the linear speed cap too, as in the
chassis build: kin.max_v = 8.0 x the new radius. If you
changed either value, update the angular speed cap:
kin.max_w = 8.0 x 2 x radius / track width. For
example:
python3 ~/frindo/projects/ros2/files/mc1_set.py kin.max_v=0.204 kin.max_w=2.400
Start the driver again, and repeat the checks until they agree. The driver reads these values when it starts, so always restart it after a change.
Step 11: Back up the card
Once everything works, make a copy of the microSD card. A card can be damaged if the power is cut while the Pi is writing to it, and a backup turns that from a lost afternoon into a five-minute swap.
Shut the Pi down (see below), take the card out and use a card imaging tool on your computer, such as balenaEtcher or Win32 Disk Imager, to save an image of it. Then write the image to a second card and check that the Pi starts from it. A backup you have never tried is not one you can rely on.
A larger card works fine as a replacement: Ubuntu grows to fill it the first time it starts.
Switching off
Press Ctrl-C in each terminal to stop the programs.
Shut the Pi down properly:
sudo shutdown nowWait about 20 seconds, until the Pi's green light stops flickering, then turn off the robot's switch or unplug the battery.
Cutting the power without shutting down can damage the microSD card.
Next: part 2: add a game controller.
If something doesn't work
| What you see | What to do |
|---|---|
ros2: command not found |
That terminal is not set up for ROS 2. Check the three
echo lines in step 6, then log out and in again |
ModuleNotFoundError: No module named 'orcp' |
The pip install in step 6 did not run. Run it
again |
ImportError: cannot import name 'HoldRefused' |
An old version of the orcp library. Run
pip install --break-system-packages --upgrade orcp |
held broken packages while installing |
The software source fix in step 4 was missed. Run it, then try again |
/dev/mc1 does not exist |
Check the USB cable is in J7 and MC1's light is on. MC1 needs the battery even when the Pi is on |
| The robot stops and MC1's red light flashes | A fault. See step 9 and Faults |
| Nothing works after pressing MC1's reset button, or after unplugging its USB cable | The driver has lost its connection and does not reconnect by itself. Press Ctrl-C and start the driver again |
Permission denied on /dev/mc1 |
You are not in the dialout group yet. Check step 7, and
reboot |
| Odd errors, timeouts or garbled replies from MC1 | Two programs are talking to MC1 at once, perhaps a second driver,
the mc1_set.py script or the configurator. Only one can run
at a time: stop the others |
The robot does nothing and the driver shows ESTOP or
CHARGER |
Check the links or switches on J3 and J2 |
| The robot races off on a small command | An encoder is counting backwards. Repeat part 2 of step 14 of the chassis build |
| Turns come out wider than they should | Check that motor.max_rads is still 8.0 and the speed
caps match your wheel radius and track width |
| Settings have gone after switching off | They were not saved. mc1_set.py saves automatically; in
the configurator, click Save to Flash |
Faults
When MC1 stops the motors because of a fault, the driver prints
controller FAULT: and the reason. These are the ones you
are most likely to see:
| Reason | What it means | What to do |
|---|---|---|
ENCODER_STALL |
MC1 was driving a wheel but its encoder said it wasn't turning | Check nothing is jamming the wheel, and that the encoder cable is plugged in. If it happens every time a wheel should turn, check the JP1 jumper is fitted |
MOTOR_LEFT, MOTOR_RIGHT,
MOTOR_BOTH |
A motor drew far too much current, often because the wheel was stalled against something | Free the wheel. If it happens with the wheels off the table, check the motor wires for a short |
OVERCURRENT_LEFT, OVERCURRENT_RIGHT,
OVERCURRENT_BOTH |
A motor drew more than its set limit for too long | Usually pushing against a wall or a carpet edge. Back off and carry on |
LOWBATT |
The battery is nearly flat | Charge it. Switching the motors back on won't last |
HEARTBEAT |
In NORMAL mode, MC1 stopped hearing from the
driver |
Was the driver stopped or the Pi very busy? Restart the driver if it has stopped |
ESTOP, CHARGER |
The emergency stop or charger input on J3 or J2 is open | Check the links or switches on J3 and J2 |
After any of these, switch the motors back on as in step 9. If the same fault comes straight back, the cause is still there.
Pi power cable
The Pi runs from the robot's battery, powered from J4, MC1's 5 V auxiliary output. The Rapid Integration Kit includes this cable ready-made (option A). Otherwise you need a USB-C pigtail: a short cable with a USB-C plug at one end and bare wires at the other. J4 is a 2-pin JST VH connector, so the bare end needs one fitted.
There are three ways to do this, the same as for the motors in the chassis build.
| Option | What you need | Best if |
|---|---|---|
| A. Use the Rapid Integration Kit | The Rapid Integration Kit: it includes a ready-made MC1-to-Pi power cable | You want the cable ready to use, with no crimping or soldering |
| B. Fit a new connector | A 2-way JST VH housing (VHR-2N), two JST VH crimp terminals (SVH series), and a JST VH crimp tool | You already have the crimp tool |
| C. Solder on the Cable Kit | The aux 5 V cable from the Motion Core Cable Kit, a soldering iron and heat-shrink sleeving | You can solder but have no crimp tools |
Wiring
| Pigtail wire | Function | J4 pin |
|---|---|---|
| Red | +5 V | 1, marked + on the board |
| Black | Ground | 2 |
Caution
Get this the right way round. Reversing +5 V and ground can damage the Raspberry Pi. Check your pigtail's own labelling, as not every maker uses red and black.
Option A: use the Rapid Integration Kit
The kit's MC1-to-Pi power cable is ready to use: plug it into J4 and the Pi's USB-C socket. There is nothing to make. Mind the polarity warning above.
Option B: fit a new connector
- Strip each wire by the length JST specifies, and crimp on an SVH terminal using the JST VH crimp tool.
- Push the red wire into pin 1 of the VHR-2N housing and the black wire into pin 2, until each one clicks. Tug each wire gently to check that it is locked in.
Option C: solder on the Cable Kit
- Plug the Cable Kit's aux 5 V cable into J4 before you cut anything, and use the + marking on the board to note which wire goes to pin 1.
- Cut the cable to length, leaving enough to reach from J4 to the Pi's USB-C socket, as in step 1.
- Slide a piece of heat-shrink sleeving onto each wire, then solder the pigtail's red wire to the pin 1 wire and its black wire to the pin 2 wire.
- Slide the sleeving over each joint and shrink it, so no bare metal is showing.
This guide is also on GitHub, released under CC BY-SA 4.0. Spotted a mistake? hello@frindo.org