Dev Setup for Pi5 Classic
Last Updated: Jul 12, 2024
This is for Pi5 Mbot Classic Developers to set up from scratch. For any mbot repository, the dev branch will always have the latest code for development (when it exists).
1. Prepare Your Raspberry Pi
You will need:
- SD card reader
- Laptop
Download Raspberry Pi Imager from Raspberry Pi Official Website.
Then open the Imager, select the options as following:
- Device: Raspberry Pi 5
- OS: Raspberry Pi OS (64-bit) - Bookworm
- Storage: Your SD card
Click NEXT; no need to edit settings.
Wait until the process is done, then take out the SD card.
2. Customize Your Raspberry Pi
You will need:
- External Monitor
- Micro HDMI cable
- Mouse and Keyboard
Basic Setup
- Insert the SD card into the Pi, connect the Pi to an external monitor, and turn on the power.
- Once the UI appears, follow the setup steps.
- username: mbot
- password: i<3robots!
- select Firefox as the default browser
- skip the Wi-Fi setup and software update parts.
- Once you get to the desktop, connect to the “MSetup” network. Open Firefox and go to the “log in to network” page to reach the UM WiFi configuration page. Click “Laptop, Phone, or Tablet”, select “Linux”, and click “Join Now”. The file “SecureW2_JoinNow.run” will download automatically.
- Open a terminal, navigate to the file “SecureW2_JoinNow.run”, run
chmod +x SecureW2_JoinNow.run
to give it permission, then run./SecureW2_JoinNow.run
. Enter your credentials to connect to the Wi-Fi.
Congrats, you have discovered the Internet!
Remote Access Setup
- Run:
sudo apt update sudo apt upgrade
- Download Visual Studio Code on Raspberry Pi OS by running:
sudo apt install code
- Open Firefox, log in to GitHub, then open a terminal run:
cd ~ mkdir workspace cd workspace # git clone mbot_sys_utils here cd mbot_sys_utils # dev branch has the latest version of the code git checkout dev cd install_scripts ./install_nomachine.sh
- Run
sudo raspi-config
:- Interface Options -> SSH -> Enable
- Advanced Options -> Wayland -> X11 (important for NoMachine) -> Reboot
Congrats, you have discovered remote access and remote desktop! An external monitor is no longer required. Check your IP address using ip address
:
- SSH into the Pi:
ssh mbot@pi_ip
- Connect to the desktop using NoMachine
System Setup
- Open
mbot_sys_utils
, findrpi5_config.txt
, and adjust settings as needed. - Copy
rpi5_config.txt
to/boot/firmware
:sudo cp rpi5_config.txt /boot/firmware
- Modify
config.txt
to include your customizedrpi5_config.txt
:sudo nano /boot/firmware/config.txt
Then add the following line under the [all] section:
[all] include rpi5_config.txt
- Check details at config.txt - Raspberry Pi Documentation
- Copy
mbot_config.txt
to/boot/firmware
:sudo cp mbot_config.txt /boot/firmware
- Edit the configuration:
sudo nano /boot/firmware/mbot_config.txt
3. Set Up Your Development Environment
Install Packages and Services
mbot_sys_utils
- Install dependencies:
cd ~/workspace/mbot_sys_utils git checkout dev sudo ./install_scripts/install_mbot_dependencies.sh ./install_scripts/install_lcm.sh
- Install udev rules:
cd udev_rules ./install_rules.sh
- Install services:
cd services ./install_mbot_services.sh
mbot_firmware and mbot_lcm_base
- Clone
mbot_firmware
andmbot_lcm_base
repositories. - Install LCM related components:
cd ~/workspace/mbot_lcm_base git checkout dev ./scripts/install.sh
- Now you have mbot system cli tools available.
- Run the firmware setup script:
cd ~/workspace/mbot_firmware git checkout dev ./setup.sh
- Build the firmware:
cd ~/workspace/mbot_firmware mkdir build cd build cmake .. make
- Calibrate your mbot (place the mbot on the floor first):
cd ~/workspace/mbot_firmware sudo ./upload.sh flash build/tests/mbot_calibrate_classic.uf2
- Flash the firmware to the control board:
sudo ./upload.sh flash build/src/mbot_classic.uf2
- Test the setup
python3 python/mbot_move_simple.py
- Warning: The mbot will move forward quickly with this script. Modify as needed.
rplidar_lcm_driver and mbot_web_app
- Clone rplidar_lcm_driver:
cd ~/workspace/rplidar_lcm_driver/ ./scripts/install.sh
- Clone mbot_web_app:
- If no
dev
branch there, use the latest version. - Follow the setup instructions in the README.md.
- If no
mbot_autonomy
- Clone mbot_autonomy
- Install:
cd ~/workspace/mbot_autonomy git checkout dev ./scripts/install.sh
- Follow the README.md if instructions differ.