Pluto Pico

We noticed that in previous groups the project was lacking embedded software developers. Each group always started their project by running motors from scratch. In order for the project to grow each year this needs to stop!

That’s why pluto-pico exists. Pluto-pico encapsulates any embedded software part and to make it easy to use and most suitable for pluto and its future developers.

Pluto can be used independently to any system. All it needs is a USB host in order to connect to the pluto-shell. That can be a raspberry pi but also any kind of computer.

Pluto-pico is also cheap since it runs on a 7.50€ raspberry-pico making so it is possible for for any project participant to have one pluto-pico to test and verify.

Pluto-shell provides a user-friendly and easy to use interface to test motordrivers or sensors that are used for Pluto.

Since the application has been developed as a zephyr application it is also possible to exchange the microcontroller or do any changes on the embedded part.

System

Overview pluto_pico
Pluto-pico parts functions

Functional component

Amount

Positioning

Function

Relay
8 (on one PCB)
No special needs
Please review datasheet
for dimensions
Switches various
electrical loads. Such as:
Lights, Fan, beer-cooler
Motordriver
2 (on one PCB)
No special needs
Please review datasheet
for dimensions
Controls motor speed
of each motor
(left & right)
Defines speed &
direction of Pluto
Distance sensor
4
Positioned at each
chain track (one in front,
one in the back)
Please review datasheet
for dimensions and specs
special requirements to
visual area apply!
Measures distances
of each chain
to obstacle of that chain
Will act as a part of
safety concept to stop
Pluto if an movement
is not possible.
GPS
1
Consists of antenna
and module
Antenna needs to be
flat and exposed to sky
Determines current
position and speed
of Pluto
Orientation
1
Needs to be away of
any magnets and flat
Determines current
orientation &
acceleration of Pluto
Temperature sensor
3
Needs to be at
location of
temperature
measurement
Determines current
temperature of:
Battery cells, pluto-ros2
or Beer
Battery cell measurement
4
No special needs
Monitoring voltage
of battery cells
Emergency Switch
1
Needs to be reachable
for Pluto users
Emergency switch to
turn OFF PLuto at any
moment
Steckplatine pluto_pico

Microcontroller

Pluto_pico uses the Raspberry Pi Pico microcontroller. To communicate with pluto-pico use the pluto-shell. Simply connect a usb-cable to and open a serial connection. A list of supported commands can be found in the table below.

available connections for pluto_pico

Working with Pluto_pico

Introduction

Pluto_pico simplifies the process of developing embedded applications, allowing developers to focus on higher-level functionality. Designed specifically for the Raspberry Pi Pico, it leverages the capabilities of the RP2040 microcontroller to provide a robust and versatile platform for robotics and other embedded projects.

Prerequisites

Before beginning, ensure you have the following:

  • A Raspberry Pi Pico with an RP2040 microcontroller

  • A USB cable compatible with the Raspberry Pi Pico

  • The zephyr.uf2 file specific to the Pluto_pico project

Flashing Pluto_pico

1. Prepare the Hardware: Connect the Raspberry Pi Pico to your host PC using the USB cable. Ensure that you hold down the BOOTSEL button on the Pico while connecting.

2. Enter Mass Storage Mode: Once connected, release the BOOTSEL button. Your Raspberry Pi Pico will now operate as a mass storage device.

3. Flash the Firmware: Drag and drop the zephyr.uf2 file onto the Raspberry Pi Pico drive. This process will flash the firmware to the Pico’s internal flash storage. This step is necessary once for each version of the firmware.

Using the Pico-Shell (version >= v0.1.0)

  1. Establish a Serial Connection:

    • To interact with Pluto_pico using the pico-shell, a serial port connection is required.

    • You can use a terminal program like PuTTY or minicom on your PC to connect to the serial port. The specific port can be found in your system’s device manager (for Windows) or /dev directory (for Linux and macOS).

    • Select a baudrate of 115200 in your terminal program.

  2. Verify the Connection:

    • Once connected, the onboard LED on the Raspberry Pi Pico will start flashing at a frequency of 1 second. This indicates a successful serial connection.

  3. Using Pico-Shell:

    • Once connected via the terminal program, you can interact with the Pluto_pico through various commands.

    • The pico-shell allows you to configure and control external peripherals, read sensor data, and manage the robot’s operations. Try one of the commands from the following table.

Command Overview

The following table contains in short all available commands.

Explore the detailed command list and examples provided in the subsequent sections to fully utilize the capabilities of Pluto_pico.

Happy developing!

Pluto Protocol

Command

Description

Supported Arguments

ANY_COMMAND

Calling without arguments:
Detailed info about command
only excpetion: version
--help
short info about command

echo

returns <message>
pluto-pico version: >= v0.1.0
<message>
respond with message

version

returns pluto-pico version
no argument := APP_VERSION_STRING
pluto-pico version: >= v0.1.0
--build-ver
APP_BUILD_VERSION

relays

control relays of pluto-pico
pluto-pico version: >= v0.1.0
--set-bytes <value[0..0xFF]>
--set-relay <name> <state[0||1]>
--list-relays
pluto-pico version: >= v0.2.0:
--get-relay <name>

motor1

control motor1 of pluto-pico
pluto-pico version: >= v0.3.0
set-dir <state[0||1]>
set-speed <value[0..100]>
(unsafe) Zset-speed <value[0..100]>
get-speed
get-dir
get-motor
config-acc-rate <value[0..100]>
config-brak-rate <value[0..100]>
config-acc-rate-delay <value[0..0xFFFF]ms>
config-brak-rate-delay <value[0..0xFFFF]ms>

motor2

control motor2 of pluto-pico
pluto-pico version: >= v0.3.0
set-dir <state[0||1]>
set-speed <value[0..100]>
(unsafe) Zset-speed <value[0..100]>
get-speed
get-dir
get-motor
config-acc-rate <value[0..100]>
config-brak-rate <value[0..100]>
config-acc-rate-delay <value[0..0xFFFF]ms>
config-brak-rate-delay <value[0..0xFFFF]ms>

motors

control motors of pluto-pico at once
pluto-pico version: >= v0.4.0
set <speed_m1[0..100]> <dir_m1[0||1]> <speed_m2[0..100]> <dir_m2[0||1]>

Developing Pluto_pico

Pluto_pico is based on zephyr. Please refer to the repo here: https://gitlab.com/pluto_ipek/pluto_pico

To start please refer to the Installation of zephyr. https://docs.zephyrproject.org/latest/develop/getting_started/index.html

It is necessary to install any dependencies, zephyr and the zephyr sdk. We highly recommend to test zephyr and get some understanding by building the blinky example. Following the zephyr tutorial the blinky example for the raspberry_pico can be built via:

west build -p always -b rpi_pico samples\basic\blinky

External pin mapping on the Pico W is identical to the Pico, but note that internal RP2040 GPIO lines 23, 24, 25, and 29 are routed to the Infineon module on the W. Since GPIO 25 is routed to the on-board LED on the Pico, but to the Infineon module on the Pico W, the “blinky” sample program does not work on the W (use hello_world for a simple test program instead). For more information about the Raspberry Pico in zephyr please visit: https://docs.zephyrproject.org/latest/boards/arm/rpi_pico/doc/index.html

After the installation is complete and verified the project can be cloned locally.

When opening the project with an IDE such as CLion the IDE will ask for the CMake target. Chose Build Type Default and leave everything else as it is. The application will find zephyr and any dependencies on its own.

After the CMake build has finished several targets are available to build. The default target “zephy_final” will build the pico application. The relevant binary for the raspberry_pico will be the zephyr.uf2.

Relays of Pluto_pico

Pluto_pico is able to control 8 relays such as from: https://www.az-delivery.de/products/8-relais-modul.

It is important that the jumper is set from VCC to JD-VCC!

Each relay has one NC-contact(normally-closed contact) and one NO-(normally-closed contact).

  • If the relay is OFF the NC-contact is closed and the NO-contact will be open.

  • If the relay is ON the NC-contact is open and the NO-contact is closed

  • At startup each relay is set to OFF!

Relays that are ON will trigger a bright red led. Before startup the leds will have a weak red led. This is due to the Optokopplers in that relay module. The relays are still OFF in that state! After startup the leds will signal the correct relay state.

Fritzing model with relays

Pin assignment:

GPIO Assignments and Relay Names

Raspberry Pi Pico Pin

Relay Module Pin

Relay Name

GND

GND

VBUS

VCC

GPIO9

IN_1

relay_0

GPIO8

IN_2

relay_1

GPIO7

IN_3

relay_2

GPIO6

IN_4

relay_3

GPIO5

IN_5

relay_4

GPIO4

IN_6

relay_5

GPIO3

IN_7

relay_6

GPIO2

IN_8

relay_7

Usage:

  • relays -–set-bytes <value>

    Set relays via a bit mask. Value in decimal from 0..255.

    Examples for values:

    • 0: all relays OFF

    • 5: relais_2 and relais_0 ON, others OFF

    • 255: all relays ON

  • relays –get-relay <name>

    Gets the state of the relay <name>. State can be 0 (OFF) or 1 (ON).

    <name> can be found by calling relays -list-relays

  • relays -–set-relay <name> <state>

    Set relay by name to specific state. State can be 0 (OFF) or 1 (ON).

    <name> can be found by calling relays -list-relays

  • relays -–list-relays

    show all relay names

Examples:

Showing the GPIO signals of the raspberry pico by switching relay_0.

Controlling relay_0 cli view

Notice that the optocoppler are LOW_ACTIVE!

Controlling relay_0 oscilloscope view

Motors of Pluto_pico

The Motor Control Module, as part of the larger pico-pluto project, offers comprehensive functionality for controlling motor drivers in embedded systems. This module is critical for applications such as robotics and automation, where precise motor control is essential.

Features

  • Control of motor speed and direction using PWM and GPIO.

  • Ability to query the current state of motors.

  • Integration of a command-line interface for motor control.

  • Initialization and configuration capabilities for motor control hardware.

Pluto_pico is able to control 2 DC motors using the following motorshield MDD10A: https://www.cytron.io/p-10amp-5v-30v-dc-motor-driver-2-channels.

Also other motorshields could be used just notice that the pwm frequency is set to 20kHz.

Each motor has one PWM and one DIR contact.

motors can be controlled either individually using the commands motor1 or motor2 or at once using the motors command.

Fritzing model with motors

Pin assignment:

GPIO Assignments and MDD10A Names

Raspberry Pi Pico Pin

MDD10A

motor name

GND

GND

GPIO11

DIR1

motor_1

GPIO12

DIR2

motor_1

GPIO14

PWM1

motor_2

GPIO15

PWM2

motor_2

NC

B+ (5V to 30VDC)

NC

B-

Usage:

motorX stands for either motor1 or motor2 Command motorX Zset-speed <0-100> skipped since it is not recommended to use.

  • motorX set-dir <0/1>

    Sets the direction of motorX. 0 for one direction, 1 for the opposite direction.

  • motorX set-speed <0-100>

    Sets the speed of motorX. Specify the speed as a percentage of the maximum speed (0 to 100).

  • motorX get-speed

    Retrieves the current speed of motorX. Returns the speed as a percentage of the maximum speed.

  • motorX get-dir

    Retrieves the current direction of motorX. Returns the direction as 0 (one direction) or 1 (opposite direction).

  • motorX get-motor

    Retrieves the current configuration and status of motorX. Outputs details like speed, direction, acceleration rate, braking rate, etc.

  • motorX config-acc-rate <0-100>

    Configures the acceleration rate of motorX. Specify the rate as a percentage (1 to 99).

  • motorX config-brak-rate <0-100>

    Configures the braking rate of motorX. Specify the rate as a percentage (1 to 99).

  • motorX config-acc-rate-delay <ms>

    Configures the acceleration rate delay of motorX. Specify the delay in milliseconds (1 to 0xFFFF).

  • motorX config-brak-rate-delay <ms>

    Configures the braking rate delay of motorX. Specify the delay in milliseconds (1 to 0xFFFF).

  • motors set <speed_motor1> <dir_motor1> <speed_motor2> <dir_motor2>

    Sets the speed (0-100) and direction (0/1) for both motor1 and motor2 simultaneously. Provide each motor’s speed and direction as separate arguments.

Examples:

Setting speed one individual motor:

Setting speed motor1 cli view Setting speed motor1 osci view

Changing braking or acceleration rate and delay:

Changing acceleration motor1 cli view Changing acceleration motor1 osci view

Change direction on one motor while running:

Direction change on running motor1 cli view Direction change on running motor1 osci view

Set movement on both motors and change direction on both:

Direction change on motor1 & motor2 cli view Direction change on motor1 & motor2 osci view

Proximity sensors of Pluto_pico

The pico uses VL53L0x sensors for proximity and distance sensing.