Notifications
Clear all

[Solved] Hello from Northumberland, UK

42 Posts
6 Users
23 Likes
1,969 Views
(@swarlandrb)
Member
Joined: 2 years ago
Posts: 11
Topic starter  

Hello everybody,

I teach an after-school code club at our village Primary school using Scratch initially then on to the Raspberry pi using Python.  Just started using the RP Pico for control of certain functions on our model railway club layout. I will need advice on how to pass a parameter from one Pico to another in the near future, so looking forward to your help and assistance.

Cheers, Roger

 


   
Quote
(@yurkshirelad)
Member
Joined: 3 years ago
Posts: 493
 

Welcome! I grew up down the road, outside middlesbrough. You're in a beautiful part of the country.

This sounds like an interesting project, and I love the fact you're teaching at the school! I'm sure people here can help you out.


   
SwarlandRB reacted
ReplyQuote
ron bentley
(@ronbentley1)
Member
Joined: 2 years ago
Posts: 385
 

Hi SwarlandRB

Welcome, lots of helpful members here, so ask away!

Ron B

Ron Bentley
Creativity is an input to innovation and change is the output from innovation. Braden Kelley
A computer is a machine for constructing mappings from input to output. Michael Kirby
Through great input you get great output. RZA
Gauss is great but Euler rocks!!


   
SwarlandRB reacted
ReplyQuote
Ron
 Ron
(@zander)
Father of a miniature Wookie
Joined: 3 years ago
Posts: 7064
 

@swarlandrb Welcome, to the forum.

First computer 1959. Retired from my own computer company 2004.
Hardware - Expert in 1401, and 360, fairly knowledge in PC plus numerous MPU's and MCU's
Major Languages - Machine language, 360 Macro Assembler, Intel Assembler, PL/I and PL1, Pascal, Basic, C plus numerous job control and scripting languages.


   
SwarlandRB reacted
ReplyQuote
byron
(@byron)
No Title
Joined: 5 years ago
Posts: 1122
 

@swarlandrb

Are you going to code you rpi pico in C++ or micropython?  Either will work fine and micropython would be a good compliment to the python you run on your Rpi.  Passing a parameter from one pico to another (or even pico to rpi can be done in multiple ways and much will depend on how close the boards are situated or if you are using an additional wifi board to use with the pico.   I often complement a rpi pico with the likes of an ESP8266 to wifi enable it (usually a cheapo Wemos ESP8266 mini).  

I hope your railway runs on time 😋 

 


   
ReplyQuote
(@swarlandrb)
Member
Joined: 2 years ago
Posts: 11
Topic starter  

@byron I have completed one railway project in micropython and would want to move onto the next railway project using micropython too.  The club uses a system called CBUS, designed by a group called MERG in the UK, it uses a bus system to transport event messages throughout the layout; however, it doesn't create routes from a start signal and a destination signal.  Our main station throat has a complex of crossings and routes that would be easier to control using start and destination buttons, but even by using a switch matrix, we wouldn't have sufficient GP outputs left 9n one Pico to create switched inputs to the CBUS system.  Therefore, I would like to have a second Pico a few inches away from the first Pico, connected probably using the serial facility, so that number 1 Pico can send a message to number 2 with a numerical code of 2 digits that would then trigger an output from Pico 2 into the CBUS input board and create the appropriate CBUS event and associated turnout switching to create the desired route.  I have already made test programs for most of the elements, but I need the easiest way for Pico 1 to talk to Pico 2.  I would probably want Pico 2 to acknowledge the Pico 1 message. 


   
ReplyQuote
byron
(@byron)
No Title
Joined: 5 years ago
Posts: 1122
 
Posted by: @swarlandrb

but I need the easiest way for Pico 1 to talk to Pico 2.  I would probably want Pico 2 to acknowledge the Pico 1 message. 

A simple serial UART comms twix the pico's would do the trick I think.  Its passed my bedtime right now so I will give it some more thought tomorrow.    


   
Inst-Tech and SwarlandRB reacted
ReplyQuote
(@swarlandrb)
Member
Joined: 2 years ago
Posts: 11
Topic starter  

@byron many thanks, past mine too.


   
ReplyQuote
byron
(@byron)
No Title
Joined: 5 years ago
Posts: 1122
 

@swarlandrb

Not yet focused in on your requirements, but SWMBO has allowed me a tea break from preparing the earth so she can plant her first early potatoes. 😎 .  You indicate you wish to pass a 2 digit code, as I was wondering how many different codes you might be passing and what sort of thing triggers the second pico to send this code. Also how many of each pico's pins are free and what other things are attached to them?

 


   
SwarlandRB reacted
ReplyQuote
byron
(@byron)
No Title
Joined: 5 years ago
Posts: 1122
 

And whilst I was sipping my tea I browsed for info about the MERG CBUS.  I see its a CAN bus system.  I wonder if the pico CAN bus as in the link below is of any relevance to your project.

https://www.cnx-software.com/2021/05/26/canpico-open-source-board-adds-can-bus-to-raspberry-pi-pico/


   
SwarlandRB reacted
ReplyQuote
(@swarlandrb)
Member
Joined: 2 years ago
Posts: 11
Topic starter  

@byron 

I have looked at the Pico CAN bus add-on board, but I don't really know enough about the system to know if I can create an event straight onto the CBUS. 

My thoughts for the program are that the operator would select the route start and end by pressing a button switch in both locations followed by an activation button; the switches will be wired into a 5x4 switch matrix and detected in Pico 1, the start and end button values would be identified from the matrix and added to a buffer.  Once 'activated', the buffer contents will lookup a value in a python dictionary, the new value will equate to a GPIO pin number and this will be transmitted to Pico 2 to activate the appropriate output, which will be sent to a MERG CBUS switch add on board. This board creates the appropriate CBUS event to switch to the route required.

There will be 9 input lines from the switch matrix, plus a couple of others on Pico 1, 15 or so routes outbound on Pico  2, so not too many spare pins, but hopefully enough to activate a UART function on each Pico.  I don't know enough about serial-to-serial connections to be able to tell how it would actually have to work, but basically I want Pico 2 to listen out and Pico 1 to send the 2-digit number, Pico 2, after checking the received number is between 1 and 20 say, will acknowledge receipt back to Pico 1, who if acknowledgement hasn't been received within a specified period, would resend the message.

I have tested the matrix input and the python dictionary lookup and they both work well; the Pico 2 output program will be straightforward, just the bit in the middle I need now.


   
ReplyQuote
byron
(@byron)
No Title
Joined: 5 years ago
Posts: 1122
 

@swarlandrb

To quote from the micropython rpi pico docs 

There are two UARTs, UART0 and UART1. UART0 can be mapped to GPIO 0/1, 12/13 and 16/17, and UART1 to GPIO 4/5 and 8/9.

I think you will only need to use one of the UARTs on each board, and it wont matter which one, so are any of these pins available on each pico?  And I should say you only need one of the pins pairs for each board

This post was modified 2 years ago by byron

   
ReplyQuote
(@swarlandrb)
Member
Joined: 2 years ago
Posts: 11
Topic starter  

@byron

Yes, I can arrange for a pair to be available on each board.


   
ReplyQuote
byron
(@byron)
No Title
Joined: 5 years ago
Posts: 1122
 

@swarlandrb

I should also ask how you are powering you pico's, is it from the usb connection or via the VSYS pin


   
ReplyQuote
(@swarlandrb)
Member
Joined: 2 years ago
Posts: 11
Topic starter  

@byron 

I had intended from the usb connection via a twin 3.1amp plug.


   
ReplyQuote
Page 1 / 3