Quantcast
Viewing all articles
Browse latest Browse all 4856

Automation, sensing and robotics • Re: Switches with serial number (or address)?

It could be fairly easy to daisy chain some Picos using their UARTs. Tx from one Pico goes to Rx of next and Tx of last Pico goes to the Pi. No need for sending in the other direction if it's just reporting switch state changes.

Each Pico could easily handle 20 switches, maybe 25. On switch state change the Pico could send the message "00nnOn" or "00nnOff" where nn is the switch number. For the daisy chain it would listen to UART and add one to the "00" prefix so those messages would be "01nnOn" or "01nnOff". The next Pico would change that to "02nnOn" and so on. Eventually the Pi would receive a message with the first two digits identifying the Pico and the next two the switch number. Only three wires needed between each unit - Ground, 5V and data.
I don't think I understand this correctly.
I read you description as each Pico will modify a status message from an upstream Pico before sending it downstream towards the RPi.
That would end in the RPi interpreting all status messages received as coming from the nearest Pico to the RPi.
So first Pico (let's call it 01) detects a change on sensor 4 and sends 0104On. This becomes 0204On, 0304On etc. until it reaches the RPi, which interprets that sensor 4 on Pico xx (the last Pico just before the RPi) has switched on.
That's not going to work - or have I misunderstood something?

I would suggest configuring each Pico with an ID.
A Pico will just forward any received message downstream.
If a Pico detects a change it will create a new status message with the configured ID and send it downstream.
That way the RPi will receive all status messages unchanged.

OP: If there are available GPIO's then you could add a dip switch to set the ID on each Pico.

Statistics: Posted by deepo — Mon Nov 18, 2024 10:15 am



Viewing all articles
Browse latest Browse all 4856

Trending Articles