Is it possible to have six Raspberry Pi Pico’s connected via a 6 port USB hub, which connects to a Raspberry Pi Zero, so I can receive sensor data from each Pico.
Thanks,
Is it possible to have six Raspberry Pi Pico’s connected via a 6 port USB hub, which connects to a Raspberry Pi Zero, so I can receive sensor data from each Pico.
Thanks,
Hey Ashton,
It is possible, but may cause unforeseeable issues in regards to the data that comes across to the Pi. If you could give us a bit more information on what your project idea is, we may be able to find a more reasonable solution for you?
Cheers,
Blayden
Hi Ashton,
Hmmm … What just might work is something like a polling system where each ‘child’ Pi has a unique ‘identity’ i.e. you need to code in some value to each one, and then poll each one by its’ unique value to ask it to send it’s data to the host.
Because there is no other method of management re who can talk now, the possibility of data collisions and corrupted info is very high.
Unless you want to code up the standard ethernet CSMA/CD system (Carrier Sense Multiple Access / Collision Detection) onto the USB interfaces of everything – host AND child systems … . . . . hmmm probably not …
Edit - Carrier-sense multiple access with collision detection - Wikipedia
Murray
Hi Ashton,
What sensor are you looking at using?
The Pico is very flexible so you might not need 6 of them to begin with.
Otherwise if you program them in Micropython you’ll be able to access the REPL, loading a program in the boot.py file will let you initialise sensors, and then you could write a program to call on them.
Thanks for your response,
I want to use load cells with the HX711 load cell amplifier.
Thanks for response, linked is what I plan on making https://forum.core-electronics.com.au/t/raspberry-pi-scale-system/17013
Thanks for your response, sound like a good idea to give each a unique identity, how hard is it to put this into practice, I’m new to this.
Hi Ashton,
There are two ways to easily setup a unique identity
The first option is often taken to be the easiest, but if all your child systems are the same device that are going to be deployed in different zones, then this rapidly becomes a pain as you have to remember to change the code value in each device as you program them… and if you need to swap out a device, you have to reset the code value in the program first.
The second method is to setup some pins as inputs that can be grounded as needed ( by jumper wires or a DIP switch) then the identical program can be loaded into each device and the external ‘grounding’ can determine the identity as needed - this is especially useful if you need to relocate a device - all you then need to do is set the grounding pattern…
I used this in my Borg Cube project to enable/disable bits of code while functional testing
“Programming” Pins
During development I found it useful to be able to completely disable one or two of the LED systems to
allow me to concentrate on creating the appropriate mode cycles and patterns. And I could also bypass
the range sensor - sometimes it was removed while making the mounting for it, and sometimes it was
easier to develop code with a stable ‘distance’ value.
#
# setup the 'programming' pins
# default 1, if grounded is 0
#
# allow up to 2 grounded (using jumpers from Ground in phys pin 3 and/or phys pin 8
#
# P2 P3 P4 P5
# 1 1 1 1 normal operation
# 0 x x x No Glowbit
# x 0 x x No Neopixels (TBD)
# x x 0 x No 3watt LEDs
# x x x 0 Bypass range sensor
#
P2 = Pin(2, Pin.IN, Pin.PULL_UP)
P3 = Pin(3, Pin.IN, Pin.PULL_UP)
P4 = Pin(4, Pin.IN, Pin.PULL_UP)
P5 = Pin(5, Pin.IN, Pin.PULL_UP)
And lines like this to initialise / enable / disable functions appropriately throughout the code.
if P5.value() == 1: # using PiicoDev Ldistance sensor
distSensor = PiicoDev_VL53L1X() # initialise distance sensor
#
In your case I would use some code to convert the pin state into a number like this
# setup the 'programming' pins
# default 1, if grounded is 0
P2 = Pin(2, Pin.IN, Pin.PULL_UP)
P3 = Pin(3, Pin.IN, Pin.PULL_UP)
P4 = Pin(4, Pin.IN, Pin.PULL_UP)
P5 = Pin(5, Pin.IN, Pin.PULL_UP)
#
# this will generate a digit in the range 0 - 15)
# P5 P4 P3 P2 nb order reversed from example above
# 0 0 0 0 = 0
# 0 0 0 1 = 1
# 0 0 1 0 = 2
# 0 0 1 1 = 3
# 0 1 0 0 = 4
# ..........
# 1 1 1 1 = 15
Id = (P5 * 8) + (P4 * 4) + (P3 * 2) + P2
And then check the Id value in the request from the host, and if it matches the local Id value, then respond appropriately.
Murray