keita
Posts: 2
Joined: Thu Oct 01, 2020 12:37 am

It is possible to connect two raspy pico to raspberry pi4?

Mon Jun 21, 2021 11:09 pm

I want to use two raspi pico and raspi4 to control a 6 legged robot.
The robot has 18 motors. So, if I move the motors, I need to two raspi picos.
But I don't know it is possible to connect raspi4 to two picos.
So, please teach me anyone.

aBUGSworstnightmare
Posts: 3212
Joined: Tue Jun 30, 2015 1:35 pm

Re: It is possible to connect two raspy pico to raspberry pi4?

Tue Jun 22, 2021 6:23 am

keita wrote:
Mon Jun 21, 2021 11:09 pm
I want to use two raspi pico and raspi4 to control a 6 legged robot.
The robot has 18 motors. So, if I move the motors, I need to two raspi picos.
But I don't know it is possible to connect raspi4 to two picos.
So, please teach me anyone.
which type of motors do you use, servos? The pico has 16PWM channels --> you can connect 16 servo motors to one Pico.
For the remaining two motors a software PWM might be o.k..

jamesh
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 29039
Joined: Sat Jul 30, 2011 7:41 pm

Re: It is possible to connect two raspy pico to raspberry pi4?

Tue Jun 22, 2021 9:40 am

keita wrote:
Mon Jun 21, 2021 11:09 pm
I want to use two raspi pico and raspi4 to control a 6 legged robot.
The robot has 18 motors. So, if I move the motors, I need to two raspi picos.
But I don't know it is possible to connect raspi4 to two picos.
So, please teach me anyone.
Yes, there are a few options.

You could use serial UARTs.

You could make the Pico's I2C slaves (viewtopic.php?f=146&t=302978)

Probably the second is best as you can plug all the I2C slaves in to one I2C port on the Pi4.
Principal Software Engineer at Raspberry Pi (Trading) Ltd.
Working in the Application's Team.

User avatar
joan
Posts: 15656
Joined: Thu Jul 05, 2012 5:09 pm
Location: UK

Re: It is possible to connect two raspy pico to raspberry pi4?

Tue Jun 22, 2021 10:39 am

The simplest method might be to connect them to a USB port on the Pi4 via a USB to micro USB cable. Each pico will appear at the Pi as /dev/ttyACM0, /dev/ttyACM1 etc.

They can then be controlled with my picod software.

http://abyz.me.uk/picod/

E.g. to flash the LEDs on three connected picos.

Code: Select all

import time
import picod

LED=25

PICOS = ['/dev/ttyACM0', '/dev/ttyACM1', '/dev/ttyACM2']

npicos = len(PICOS)

pico = [None]*npicos

for i in range(npicos):
   pico[i] = picod.pico(transport='rgpio', device=PICOS[i])

   if not pico[i].connected:
      exit()

   status, uid = pico[i].uid() # get Pico's unique Id

   if status == picod.STATUS_OKAY:
      print("Pico {} UID is 0x{:x}".format(i, uid))

for i in range(npicos):
   pico[i].tx_pwm(LED, 7.5, 25)

time.sleep(5)

for i in range(npicos):
   pico[i].tx_close(LED)

Return to “Advanced users”