Welcome to the forum   
Welcome Guest! To enable all features please Login or Register.

Notification

Icon
Error

2 Pages12>
Share
Options
View
Go to last post in this topic Go to first unread post in this topic
Offline osoraku  
#1 Posted : 22 January 2025 11:46:45(UTC)
osoraku

Portugal   
Joined: 22/01/2025(UTC)
Posts: 48
Location: Setubal, Palmela
Dear All -

Inspired by work by the Locoduino group (this project, in particular), I developed a low-cost WiFi hub based on the Raspberry Pi Pico to route CS2 protocol packets between a controller and a 60116 Gleisbox. (It also has a limited number of feedback channels to detect track occupancy.) I've tested it with Rocrail and JMRI but do not have means to try with other controller software. If anybody has time and/or interest in testing and providing feedback, I'd be grateful.

Project description is here on Github.

Osoraku

Edited by user 30 April 2025 11:57:43(UTC)  | Reason: Tested now with JMRI; mention feedback too.

thanks 5 users liked this useful post by osoraku
Offline patnaik  
#2 Posted : 23 January 2025 15:40:00(UTC)
patnaik

United States   
Joined: 22/08/2020(UTC)
Posts: 39
Location: Maryland, Silver Spring
Originally Posted by: osoraku Go to Quoted Post
Dear All -

Inspired by work by the Locoduino group (this project, in particular), I developed a low-cost WiFi hub based on the Raspberry Pi Pico to route CS2 protocol packets between a controller and a 60116 Gleisbox. I've tested it with Rocrail but do not have means to try with other controller software. If anybody has time and/or interest in testing and providing feedback, I'd be grateful.

Project description is here on Github.

Osoraku


I am quite interested in this. I would be using JMRI instead of Rocrail. JMRI does understand the CS2 Ethernet protocol, so hopefully should work. I will need some handholding as I have never used this hardware (I am familiar with Arduino).

What is the advantage of using the Raspberry Pi Pico vs the ESP32 (which I happen to have on hand) used in the post you linked to?

Let me look into ordering parts.

Gopal
Offline osoraku  
#3 Posted : 23 January 2025 16:40:21(UTC)
osoraku

Portugal   
Joined: 22/01/2025(UTC)
Posts: 48
Location: Setubal, Palmela
Originally Posted by: patnaik Go to Quoted Post


I am quite interested in this. I would be using JMRI instead of Rocrail. JMRI does understand the CS2 Ethernet protocol, so hopefully should work. I will need some handholding as I have never used this hardware (I am familiar with Arduino).

What is the advantage of using the Raspberry Pi Pico vs the ESP32 (which I happen to have on hand) used in the post you linked to?

Let me look into ordering parts.

Gopal


Dear Gopal -

As to Raspberry Pi Pico vs ESP32, it makes no odds (except that the expansion board is for the RPP). The main advantage of this project over the Locoduino one is that you don't have to buy components and build the board yourself - once you get the expansion board, you're good to go: plug in the processor and it has all the necessary connections already built onto it. That reduces the overall cost.

Happy to help when you get the parts.

Osoraku
Offline patnaik  
#4 Posted : 23 January 2025 19:21:46(UTC)
patnaik

United States   
Joined: 22/08/2020(UTC)
Posts: 39
Location: Maryland, Silver Spring
Originally Posted by: osoraku Go to Quoted Post
Originally Posted by: patnaik Go to Quoted Post


I am quite interested in this. I would be using JMRI instead of Rocrail. JMRI does understand the CS2 Ethernet protocol, so hopefully should work. I will need some handholding as I have never used this hardware (I am familiar with Arduino).

What is the advantage of using the Raspberry Pi Pico vs the ESP32 (which I happen to have on hand) used in the post you linked to?

Let me look into ordering parts.

Gopal


Dear Gopal -

As to Raspberry Pi Pico vs ESP32, it makes no odds (except that the expansion board is for the RPP). The main advantage of this project over the Locoduino one is that you don't have to buy components and build the board yourself - once you get the expansion board, you're good to go: plug in the processor and it has all the necessary connections already built onto it. That reduces the overall cost.

Happy to help when you get the parts.

Osoraku


Osoraku,

I can't find the CAN bus shield in the US. I found this, though <https://www.adafruit.com/product/5728> Will it work?

Gopal
Offline xxup  
#5 Posted : 23 January 2025 20:57:25(UTC)
xxup

Australia   
Joined: 15/03/2003(UTC)
Posts: 9,578
Location: Australia
I think that it is this unit -> https://www.joy-it.net/en/products/RB-P-CAN-485

I found it on amazon.co.uk, but it was A$90 shipped to Australia. Ouch!
Adrian
UserPostedImage
Australia flag by abFlags.com
Offline osoraku  
#6 Posted : 23 January 2025 22:28:03(UTC)
osoraku

Portugal   
Joined: 22/01/2025(UTC)
Posts: 48
Location: Setubal, Palmela
Originally Posted by: patnaik Go to Quoted Post
Originally Posted by: osoraku Go to Quoted Post
Originally Posted by: patnaik Go to Quoted Post


I am quite interested in this. I would be using JMRI instead of Rocrail. JMRI does understand the CS2 Ethernet protocol, so hopefully should work. I will need some handholding as I have never used this hardware (I am familiar with Arduino).

What is the advantage of using the Raspberry Pi Pico vs the ESP32 (which I happen to have on hand) used in the post you linked to?

Let me look into ordering parts.

Gopal


Dear Gopal -

As to Raspberry Pi Pico vs ESP32, it makes no odds (except that the expansion board is for the RPP). The main advantage of this project over the Locoduino one is that you don't have to buy components and build the board yourself - once you get the expansion board, you're good to go: plug in the processor and it has all the necessary connections already built onto it. That reduces the overall cost.

Happy to help when you get the parts.

Osoraku


Osoraku,

I can't find the CAN bus shield in the US. I found this, though <https://www.adafruit.com/product/5728> Will it work?

Gopal


Dear Gopal -

Ooof - I'm pretty sure it could be made to work, but you'd need to have headers (20 pin female sockets on each side of that board) to plug the RPP into it. That rather thwarts the low-cost/easy setup character of the project: there would be a lot of soldering to do to install the headers. Any other options available? (I thought that in the US they had everything electronic, and cheap!)

Osoraku

Offline osoraku  
#7 Posted : 23 January 2025 22:34:27(UTC)
osoraku

Portugal   
Joined: 22/01/2025(UTC)
Posts: 48
Location: Setubal, Palmela
Originally Posted by: xxup Go to Quoted Post
I think that it is this unit -> https://www.joy-it.net/en/products/RB-P-CAN-485

I found it on amazon.co.uk, but it was A$90 shipped to Australia. Ouch!


Dear xxup -

Oh dear. That's the correct board, but why would it cost more in Oz than in Europe? The puzzles of international trade. At that price, it pretty much kills the low-cost nature of the project (unless I'm seriously ignorant of the €-A$ exchange rate).

Osoraku
Offline osoraku  
#8 Posted : 23 January 2025 23:00:09(UTC)
osoraku

Portugal   
Joined: 22/01/2025(UTC)
Posts: 48
Location: Setubal, Palmela
PS - The silkscreen info on my board indicates that it was manufactured in Germany. Hence, an EU supplier might be a good choice. I found a half-dozen non-Amazon EU suppliers on the web. With the caveat that it should work (same CAN chip used, but different pin assignments), in N. America, the Waveshare Pico-CAN-B board seems to be a substitute and costs 17-25 USD. AliExpress also lists some CAN boards with sockets attached for Raspberry Pi Pico like this.

Let me know, and we can collaborate; perhaps I can find a similar board locally.

Osoraku

Edited by user 24 January 2025 18:26:41(UTC)  | Reason: Added other board sources, with caveats

Offline patnaik  
#9 Posted : 25 January 2025 04:36:23(UTC)
patnaik

United States   
Joined: 22/08/2020(UTC)
Posts: 39
Location: Maryland, Silver Spring
Originally Posted by: osoraku Go to Quoted Post
PS - The silkscreen info on my board indicates that it was manufactured in Germany. Hence, an EU supplier might be a good choice. I found a half-dozen non-Amazon EU suppliers on the web. With the caveat that it should work (same CAN chip used, but different pin assignments), in N. America, the Waveshare Pico-CAN-B board seems to be a substitute and costs 17-25 USD. AliExpress also lists some CAN boards with sockets attached for Raspberry Pi Pico like this.

Let me know, and we can collaborate; perhaps I can find a similar board locally.

Osoraku


While looking for CAN boards, I came across this: <https://github.com/KevinOConnor/can2040>. Looks like CAN can be implemented entirely in software on the RPi Pico W which uses the RP2040 microcontroller. Talk about low-cost! Code is in C, not python, but should be possible to interoperate. Probably beyond my capabilities to get it to work though.

Gopal
thanks 2 users liked this useful post by patnaik
Offline osoraku  
#10 Posted : 19 February 2025 19:47:00(UTC)
osoraku

Portugal   
Joined: 22/01/2025(UTC)
Posts: 48
Location: Setubal, Palmela
Originally Posted by: xxup Go to Quoted Post
I think that it is this unit -> https://www.joy-it.net/en/products/RB-P-CAN-485

I found it on amazon.co.uk, but it was A$90 shipped to Australia. Ouch!


Dear Adrian -

The code should also work with a Waveshare Pico-CAN-B board, which I found on the web for AU$29. That board is also available in the US for USD 15 (from various sources). So a relatively cheap solution is still possible; I updated the relevant bits of code to suggest how to configure it for use with that board. With the caveat of still untested, however.

Osoraku
thanks 1 user liked this useful post by osoraku
Offline patnaik  
#11 Posted : 25 February 2025 20:26:45(UTC)
patnaik

United States   
Joined: 22/08/2020(UTC)
Posts: 39
Location: Maryland, Silver Spring
I went ahead with the ESP32 based project that you mentioned earlier. Reasons: I know Python even less than I know C++, I had a ESP32 at hand, and because the ESP32 has a CAN controller on board, all I needed was transceiver costing about one dollar. No soldering as I am using a plug in breadboard. Not as neat, but fully functional.

Osoraku, thanks for the inspiration and advice.

Gopal
Offline xxup  
#12 Posted : 26 February 2025 04:18:34(UTC)
xxup

Australia   
Joined: 15/03/2003(UTC)
Posts: 9,578
Location: Australia
Okay.

I have ordered these from Amazon.com.au


https://www.amazon.com.au/dp/B0BVZGPS3G <-- Does not use Australia Post, but is the cheapest.
https://www.amazon.com.au/dp/B0BW34HFBL

They should be here in a week or two. $60 for everything seemed reasonable.

I still need to find a 60116.. Cheap hopefully.

Edited by user 26 February 2025 08:22:09(UTC)  | Reason: Not specified

Adrian
UserPostedImage
Australia flag by abFlags.com
Offline xxup  
#13 Posted : 26 February 2025 04:27:11(UTC)
xxup

Australia   
Joined: 15/03/2003(UTC)
Posts: 9,578
Location: Australia
Originally Posted by: osoraku Go to Quoted Post
.... With the caveat of still untested, however.

Osoraku


Testing is my middle name.. LOL Hopefully, it works.

Adrian
UserPostedImage
Australia flag by abFlags.com
Offline xxup  
#14 Posted : 26 February 2025 08:21:16(UTC)
xxup

Australia   
Joined: 15/03/2003(UTC)
Posts: 9,578
Location: Australia
I had to cancel one of the orders as they can't ship using Australia Post.

Ordered this one instead:
https://www.amazon.com.au/dp/B0BS9SDN4Q

Adrian
UserPostedImage
Australia flag by abFlags.com
Offline osoraku  
#15 Posted : 26 February 2025 16:28:36(UTC)
osoraku

Portugal   
Joined: 22/01/2025(UTC)
Posts: 48
Location: Setubal, Palmela
Originally Posted by: xxup Go to Quoted Post
I had to cancel one of the orders as they can't ship using Australia Post.

Ordered this one instead:
https://www.amazon.com.au/dp/B0BS9SDN4Q



Dear Adrian -

That looks ok - it is the Waveshare board. Hopefully it has headers to plug the RPP into (I didn't see them in the photo).

No Gleisbox?!

Osoraku
Offline xxup  
#16 Posted : 26 February 2025 21:14:41(UTC)
xxup

Australia   
Joined: 15/03/2003(UTC)
Posts: 9,578
Location: Australia
No layout either, but I do have the two new locos that I bought since I moved house (Flying Scotsman and the Swiss Churchill Railcar), and I have seen some bits of track lying in one of the other boxes. There will be enough for a good test.

I can get the track box from my local dealer in a few days - it is in stock there. Smile
Adrian
UserPostedImage
Australia flag by abFlags.com
Offline patnaik  
#17 Posted : 26 February 2025 22:34:13(UTC)
patnaik

United States   
Joined: 22/08/2020(UTC)
Posts: 39
Location: Maryland, Silver Spring
There is a start set which includes the MS2 controller, track box, power supply and an oval of track. Seemed to be a good buy.
Offline xxup  
#18 Posted : 27 February 2025 03:33:05(UTC)
xxup

Australia   
Joined: 15/03/2003(UTC)
Posts: 9,578
Location: Australia
I guess that is the question. Does it have to be a 60116 or will any version of the MS2 trackbox work?
Adrian
UserPostedImage
Australia flag by abFlags.com
Offline osoraku  
#19 Posted : 27 February 2025 09:18:22(UTC)
osoraku

Portugal   
Joined: 22/01/2025(UTC)
Posts: 48
Location: Setubal, Palmela
Originally Posted by: xxup Go to Quoted Post
I guess that is the question. Does it have to be a 60116 or will any version of the MS2 trackbox work?


Dear Adrian -

Any Gleisbox that would connect an MS2/CS2/CS3 controller to the track should work. According to this forum link, the 60112, 60113, 60114 and 60116 Gleisboxes work. (They have different max current loads for running HO and 1 gauge locos, but all use the CAN protocol.)

Osoraku
thanks 2 users liked this useful post by osoraku
Offline patnaik  
#20 Posted : 27 February 2025 13:11:18(UTC)
patnaik

United States   
Joined: 22/08/2020(UTC)
Posts: 39
Location: Maryland, Silver Spring
I found having the MS2 controller hooked up was useful in testing communication. Of course, it is not strictly necessary as a locomotive on the track will do the trick.

Gopal
thanks 1 user liked this useful post by patnaik
Offline xxup  
#21 Posted : 04 March 2025 04:45:19(UTC)
xxup

Australia   
Joined: 15/03/2003(UTC)
Posts: 9,578
Location: Australia
Pico Pi W has arrived.

UserPostedImage

The Waveboard has left China - Maybe next week for that bit. Smile
Adrian
UserPostedImage
Australia flag by abFlags.com
thanks 3 users liked this useful post by xxup
Offline xxup  
#22 Posted : 11 March 2025 04:08:31(UTC)
xxup

Australia   
Joined: 15/03/2003(UTC)
Posts: 9,578
Location: Australia
Item number two is here:

UserPostedImage

The waveboard.

I have loaded rocrail onto a linux laptop. I just need the MS2 box, which (hopefully) will be here next week. We had a cyclone and that has messed up (delayed) many things - even for those of us who were not in it's direct path.
Adrian
UserPostedImage
Australia flag by abFlags.com
thanks 2 users liked this useful post by xxup
Offline osoraku  
#23 Posted : 11 March 2025 10:29:37(UTC)
osoraku

Portugal   
Joined: 22/01/2025(UTC)
Posts: 48
Location: Setubal, Palmela
Originally Posted by: xxup Go to Quoted Post
... I just need the MS2 box, which (hopefully) will be here next week. We had a cyclone and that has messed up (delayed) many things - even for those of us who were not in it's direct path.


Dear Adrian -

Great - You don't need an MS2 if you have a Gleisbox, though.

I updated the use instructions with what I think will work with the Waveshare CAN board. You can test the basic functionality of the RPP-CAN interface and the Wifi connection to Rocrail without a Gleisbox using the CAN loopback interface.

Osoraku

Offline xxup  
#24 Posted : 11 March 2025 20:48:23(UTC)
xxup

Australia   
Joined: 15/03/2003(UTC)
Posts: 9,578
Location: Australia
I have ordered a Marklin 29000 set, which has the MS2, the box and enough track for testing. My m-track is in storage until I build the shed - hopefully, later this year. When the shed is built and the layout is ready, I will toss the plastic rubbish out the window.

I have also ordered a 10 pin mini din plug as I am a bit nervous about sticking small wires into tiny plug socket pins when there is an 18v pin between the earth and CAN High connection. Crying

I am keen to find a case for the unit - any thoughts?

Anyway, I will start the preliminary testing in a couple of days - I just need to do more reading about rocorail and these pico things. I have lots of old PI's model 2 and 3 mainly, but this is the first pico.
Adrian
UserPostedImage
Australia flag by abFlags.com
Offline osoraku  
#25 Posted : 11 March 2025 21:31:52(UTC)
osoraku

Portugal   
Joined: 22/01/2025(UTC)
Posts: 48
Location: Setubal, Palmela
Originally Posted by: xxup Go to Quoted Post
...

I am keen to find a case for the unit - any thoughts?



Dear Adrian -

The Waveshare board has the same dimensions as the RPP itself, and I think they mate with the USB connector on the RPP and the CAN terminals on the same end. So you need a box to get the wires out at the end. A quick look at offerings on the web turns up the Adafruit Pico W PiCowBell IoT case that seems to have space for your Waveshare board mated to the RPP ... but caveat emptor. Anything that is NOT a metal Faraday cage for your WiFi receiver should serve.

Osoraku
Offline kiwiAlan  
#26 Posted : 12 March 2025 12:28:28(UTC)
kiwiAlan

United Kingdom   
Joined: 23/07/2014(UTC)
Posts: 8,455
Location: ENGLAND, Didcot
Originally Posted by: xxup Go to Quoted Post

I have also ordered a 10 pin mini din plug as I am a bit nervous about sticking small wires into tiny plug socket pins when there is an 18v pin between the earth and CAN High connection. Crying


The best way to get one of these connectors is to get a spare ms2 cable, that way the connector comes pre-wired. The other end has a JST connector on it, but you could cut that off if you want to connect direct into your hardware.

For a box, I would look at using a Hammond enclosure, available from RS or Farnell in a range of sizes and colours, I have used the 1555 box before, which would be about the correct size for your boards.

Offline xxup  
#27 Posted : 12 March 2025 21:21:31(UTC)
xxup

Australia   
Joined: 15/03/2003(UTC)
Posts: 9,578
Location: Australia
Originally Posted by: osoraku Go to Quoted Post


The Waveshare board has the same dimensions as the RPP itself, and I think they mate with the USB connector on the RPP and the CAN terminals on the same end. So you need a box to get the wires out at the end. A quick look at offerings on the web turns up the Adafruit Pico W PiCowBell IoT case that seems to have space for your Waveshare board mated to the RPP ... but caveat emptor. Anything that is NOT a metal Faraday cage for your WiFi receiver should serve.

Osoraku


That box looks perfect, but it looks like I need a 3D printer to make one. Sadly, it does not look like anyone sells the case.

I will explore this as a long term option as I don't have a 3D printer and I am unlikely to buy one in the near future.

The entire assembly measures 52mm x 25mm x 25mm.

I guess I will use a cardboard box in the short term, while I mull over the business case for a 3D printer that FD will find believable. Laugh
Adrian
UserPostedImage
Australia flag by abFlags.com
Offline xxup  
#28 Posted : 12 March 2025 21:28:11(UTC)
xxup

Australia   
Joined: 15/03/2003(UTC)
Posts: 9,578
Location: Australia
Originally Posted by: kiwiAlan Go to Quoted Post
Originally Posted by: xxup Go to Quoted Post

I have also ordered a 10 pin mini din plug as I am a bit nervous about sticking small wires into tiny plug socket pins when there is an 18v pin between the earth and CAN High connection. Crying


The best way to get one of these connectors is to get a spare ms2 cable, that way the connector comes pre-wired. The other end has a JST connector on it, but you could cut that off if you want to connect direct into your hardware.

For a box, I would look at using a Hammond enclosure, available from RS or Farnell in a range of sizes and colours, I have used the 1555 box before, which would be about the correct size for your boards.



I ended up buying this cable on Amazon -> https://www.amazon.com.au/dp/B0C6X

In case the link dies one day, I will add the detail here:
Traovien Mini-DIN 10-Pin Male to Female Audio Cable for TV Receiver Monitor Projector Audio and Video Receiver etc (Mini 10Pin Male to Female 3.3Ft)

UserPostedImage

The Hammond cases look good - there is a 65mm x 65mm that would do the job. I can get these from Element 14, but I need to buy other stuff to make the shipping worthwhile. I guess my cardboard box will have to do until I prove that this concept works for me.

Edited by user 13 March 2025 09:06:17(UTC)  | Reason: Not specified

Adrian
UserPostedImage
Australia flag by abFlags.com
thanks 1 user liked this useful post by xxup
Offline osoraku  
#29 Posted : 12 March 2025 22:43:23(UTC)
osoraku

Portugal   
Joined: 22/01/2025(UTC)
Posts: 48
Location: Setubal, Palmela
Originally Posted by: xxup Go to Quoted Post


... I guess my cardboard box will have to do until I prove that this concept works for me.


An empty bog roll & duct tape might serve temporarily; dimensions are about right!

Osoraku

thanks 1 user liked this useful post by osoraku
Offline xxup  
#30 Posted : 13 March 2025 23:38:53(UTC)
xxup

Australia   
Joined: 15/03/2003(UTC)
Posts: 9,578
Location: Australia
Out of bog rolls at the moment - there is a national toilet paper shortage in Australia. It seems that the Australian response to any disaster (flood, COVID, drought, election and earthquake) is to buy as much toilet paper as you can carry. Never mind food or water, but we must have the toilet paper! The latest disaster was the cyclone that attempted to cross the coast at Queensland - shops were emptied through Queensland - Why? Because the logistical geniuses that run the two major grocery chains in Australia thought it was a brilliant idea to warehouse everything in Melbourne and then use trucks that can't cross flooded roads (the toilet paper might get wet) to ship the stuff up the one highway in Queensland.

So will a rolled up banana leaf make a good substitute?
Adrian
UserPostedImage
Australia flag by abFlags.com
thanks 3 users liked this useful post by xxup
Offline xxup  
#31 Posted : 13 March 2025 23:40:49(UTC)
xxup

Australia   
Joined: 15/03/2003(UTC)
Posts: 9,578
Location: Australia
On a slightly more serious note.

UserPostedImage

Arrived today. I have started working on the Pico Pi, while I await the last piece, which is the 10pin mini DIN cable. Maybe next week.

Adrian
UserPostedImage
Australia flag by abFlags.com
thanks 2 users liked this useful post by xxup
Offline PJMärklin  
#32 Posted : 14 March 2025 03:53:26(UTC)
PJMärklin

Australia   
Joined: 04/12/2013(UTC)
Posts: 2,258
Location: Hobart, Australia
Originally Posted by: xxup Go to Quoted Post
... It seems that the Australian response to any disaster (flood, COVID, drought, election and earthquake) is to buy as much toilet paper as you can carry. ...


Not just in Australia either BigGrin

I recall during the COVID pandemic one HO scenery/figure manufacturer produced a scene of figures fighting over toilet rolls in a supermarket OhMyGod
thanks 2 users liked this useful post by PJMärklin
Offline xxup  
#33 Posted : 14 March 2025 10:10:09(UTC)
xxup

Australia   
Joined: 15/03/2003(UTC)
Posts: 9,578
Location: Australia
Initial test results, when running can_test_intr.py with the waveboard.

I changed the following variables:
INT_PIN = 21
SPI_CS = 5
SPI_SCK = 6
SPI_MOSI = 7
SPI_MISO = 4

Is the following output correct?:

Initialized successfully, polling mode.
CAN status reg: 00 (***should be 40 [loopback mode]; ignoring***)

1 send normal------------------
CAN id: 0x123 (8 bytes): 12 34 56 78 9a bc de f0
1 send EFF---------------------
CAN id: 0x12345678 (EFF) (8 bytes): 12 34 56 78 9a bc de f0

2 send normal------------------
CAN id: 0x123 (8 bytes): 12 34 56 78 9a bc de f0
2 send EFF---------------------
CAN id: 0x12345678 (EFF) (8 bytes): 12 34 56 78 9a bc de f0

3 send normal------------------
CAN id: 0x123 (8 bytes): 12 34 56 78 9a bc de f0
3 send EFF---------------------
CAN id: 0x12345678 (EFF) (8 bytes): 12 34 56 78 9a bc de f0
---------------------------------


The LED flashes on the Pico Pi with each line.
Adrian
UserPostedImage
Australia flag by abFlags.com
thanks 1 user liked this useful post by xxup
Offline osoraku  
#34 Posted : 14 March 2025 10:17:07(UTC)
osoraku

Portugal   
Joined: 22/01/2025(UTC)
Posts: 48
Location: Setubal, Palmela
Originally Posted by: xxup Go to Quoted Post
Initial test results, when running can_test_intr.py with the waveboard.

Is this correct:

...


Dear Adrian -

Yes, that proves that the Waveshare board works with the RPP. You should test out interrupt mode too, because the train controller program uses it.

Osoraku

thanks 1 user liked this useful post by osoraku
Offline xxup  
#35 Posted : 14 March 2025 10:18:49(UTC)
xxup

Australia   
Joined: 15/03/2003(UTC)
Posts: 9,578
Location: Australia
How do I test the interrupt mode?

UserPostedImage
The Test Lab - Ubuntu 24.04.02 LTS running on old Macbook Air.
Adrian
UserPostedImage
Australia flag by abFlags.com
thanks 1 user liked this useful post by xxup
Offline osoraku  
#36 Posted : 14 March 2025 10:21:52(UTC)
osoraku

Portugal   
Joined: 22/01/2025(UTC)
Posts: 48
Location: Setubal, Palmela
Dear Adrian -

Edit the program and change POLL = False at the top. Download it again to the RPP and run it like before. You should see slightly different output that says it is running in interrupt mode.

Osoraku
thanks 1 user liked this useful post by osoraku
Offline xxup  
#37 Posted : 14 March 2025 10:29:38(UTC)
xxup

Australia   
Joined: 15/03/2003(UTC)
Posts: 9,578
Location: Australia
Latest result:

Initialized successfully, interrupt mode.
CAN status reg: 00 (***should be 40 [loopback mode]; ignoring***)
Interrupt mask is a3

1 send normal------------------
CAN id: 0x123 (1 bytes): 12
1 send EFF---------------------
CAN id: 0x12345678 (EFF) (1 bytes): 12

2 send normal------------------
CAN id: 0x123 (2 bytes): 12 34
2 send EFF---------------------
CAN id: 0x12345678 (EFF) (2 bytes): 12 34

3 send normal------------------
CAN id: 0x123 (3 bytes): 12 34 56
3 send EFF---------------------
CAN id: 0x12345678 (EFF) (3 bytes): 12 34 56

4 send normal------------------
CAN id: 0x123 (4 bytes): 12 34 56 78
4 send EFF---------------------
CAN id: 0x12345678 (EFF) (4 bytes): 12 34 56 78

5 send normal------------------
CAN id: 0x123 (5 bytes): 12 34 56 78 9a
5 send EFF---------------------
CAN id: 0x12345678 (EFF) (5 bytes): 12 34 56 78 9a

6 send normal------------------
CAN id: 0x123 (6 bytes): 12 34 56 78 9a bc
6 send EFF---------------------
CAN id: 0x12345678 (EFF) (6 bytes): 12 34 56 78 9a bc
---------------------------------


Is this -> CAN status reg: 00 (***should be 40 [loopback mode]; ignoring***) a problem?
Adrian
UserPostedImage
Australia flag by abFlags.com
Offline osoraku  
#38 Posted : 14 March 2025 10:35:25(UTC)
osoraku

Portugal   
Joined: 22/01/2025(UTC)
Posts: 48
Location: Setubal, Palmela
Originally Posted by: xxup Go to Quoted Post
Latest result:

...


Dear Adrian -

Fantastic. The board is fully functional - once you get it connected to the Gleisbox there will be no (hardware) problems using it.

Speedy arrival hopes for your DIN-10 plug.

Osoraku

PS - the message will not cause trouble with the controller program.
thanks 1 user liked this useful post by osoraku
Offline xxup  
#39 Posted : 14 March 2025 10:37:02(UTC)
xxup

Australia   
Joined: 15/03/2003(UTC)
Posts: 9,578
Location: Australia
Thank you for checking this for me. One more question:

Is this -> CAN status reg: 00 (***should be 40 [loopback mode]; ignoring***) a problem?
Adrian
UserPostedImage
Australia flag by abFlags.com
Offline osoraku  
#40 Posted : 14 March 2025 10:39:44(UTC)
osoraku

Portugal   
Joined: 22/01/2025(UTC)
Posts: 48
Location: Setubal, Palmela
Originally Posted by: xxup Go to Quoted Post
Thank you for checking this for me. One more question:

Is this -> CAN status reg: 00 (***should be 40 [loopback mode]; ignoring***) a problem?


Dear Adrian -

Not a problem with the controller program. (Rather, a bug in the coder.)

Osoraku

Edited by user 23 March 2025 11:23:26(UTC)  | Reason: It is a bug, not a feature...

thanks 1 user liked this useful post by osoraku
Offline bobyAndCo  
#41 Posted : 20 March 2025 21:11:09(UTC)
bobyAndCo

France   
Joined: 20/02/2024(UTC)
Posts: 20
Location: France - Bretagne
Hello everyone,

Are you still interested in RP PI Pico boards with CAN.

I've made one with an MCP2515 and can supply the Gerbers and components, but I'll have to dig through my archives.

Nice project.

Kind regards

https://forum.3rails.fr/...passerelle-can-tcp/28552
thanks 1 user liked this useful post by bobyAndCo
Offline osoraku  
#42 Posted : 21 March 2025 00:04:58(UTC)
osoraku

Portugal   
Joined: 22/01/2025(UTC)
Posts: 48
Location: Setubal, Palmela
Dear Christophe -

I'll study your S88 Raspberry Pi pico design - looks very cost effective for 16 feedback channels.

And thanks for the original inspiration.

Osoraku
Offline xxup  
#43 Posted : 21 March 2025 05:02:10(UTC)
xxup

Australia   
Joined: 15/03/2003(UTC)
Posts: 9,578
Location: Australia
Oh Yes! I love that s88 design. I was just going to use my LDT HSI-S88-USB to inform Rocrail (and hopefully WinDigiPet), but this looks awesome and I would love to test this too.


My test track with a siding comprising two turnouts is already here - so I was hoping to test a solution where each train stops at a "station" for a random time, and the second loco is only "released" after the first loco has moved ahead into a vacant block. This is easy to do in WinDigiPet, and I assume that Rocrail will have the same capability. I also plan to add in the signals - I assume that the pico CAN will manage this.

I am STILL waiting for the 10-pin mini-DIN cable - it is stuck at Brisbane Airport somewhere. Mad
Adrian
UserPostedImage
Australia flag by abFlags.com
Offline kiwiAlan  
#44 Posted : 21 March 2025 13:25:32(UTC)
kiwiAlan

United Kingdom   
Joined: 23/07/2014(UTC)
Posts: 8,455
Location: ENGLAND, Didcot
Originally Posted by: xxup Go to Quoted Post

I am STILL waiting for the 10-pin mini-DIN cable - it is stuck at Brisbane Airport somewhere. Mad


Well, at least they haven't had a substation fire that has taken out the whole airport ...
https://www.bbc.co.uk/news/live/cly24zvvwxlt

thanks 2 users liked this useful post by kiwiAlan
Offline PJMärklin  
#45 Posted : 23 March 2025 07:28:20(UTC)
PJMärklin

Australia   
Joined: 04/12/2013(UTC)
Posts: 2,258
Location: Hobart, Australia
Originally Posted by: PJMärklin Go to Quoted Post
Originally Posted by: xxup Go to Quoted Post
... It seems that the Australian response to any disaster (flood, COVID, drought, election and earthquake) is to buy as much toilet paper as you can carry. ...


Not just in Australia either BigGrin

I recall during the COVID pandemic one HO scenery/figure manufacturer produced a scene of figures fighting over toilet rolls in a supermarket OhMyGod



It was this unit :


UserPostedImage
thanks 2 users liked this useful post by PJMärklin
Offline marklinist5999  
#46 Posted : 23 March 2025 12:59:33(UTC)
marklinist5999

United States   
Joined: 10/02/2021(UTC)
Posts: 3,865
Location: Michigan, Troy
Not certain if we even have enough to wipe it all out, up, or down anymore.
Offline xxup  
#47 Posted : 27 March 2025 07:48:56(UTC)
xxup

Australia   
Joined: 15/03/2003(UTC)
Posts: 9,578
Location: Australia
The cable finally arrived, but FD has a number of social events planned for me. So, I might not be able to finish the testing until next week.

UserPostedImage

When I finish this project, I will have a good look at the s88 project.
Adrian
UserPostedImage
Australia flag by abFlags.com
thanks 3 users liked this useful post by xxup
Offline xxup  
#48 Posted : 31 March 2025 06:10:08(UTC)
xxup

Australia   
Joined: 15/03/2003(UTC)
Posts: 9,578
Location: Australia
I have some time this afternoon to progress this one.

UserPostedImage

I have cut the cable to find that all 10 pins are wired and there is even a copper wire to the outer shield. I have documented the wire colours in case someone else buys the same cable from Amazon for this project.
Adrian
UserPostedImage
Australia flag by abFlags.com
thanks 2 users liked this useful post by xxup
Offline xxup  
#49 Posted : 31 March 2025 06:53:47(UTC)
xxup

Australia   
Joined: 15/03/2003(UTC)
Posts: 9,578
Location: Australia
Now we connect to the WaveShare board. It is very hard for these old eyes to see the tiny writing, but the WaveShare website has this picture posted.

UserPostedImage

Looking at the Green Screw block, we see H (CAN HIGH), L (CAN Low) and G (Ground).

The next picture shows the three wires connected to the Waveshare board. Green is to G (Ground) Brown is to L (CAN Low) and Orange is to H (CAN High)

UserPostedImage

Some more testing and then we will plug into the track box and check for any smoke. Crying

Adrian
UserPostedImage
Australia flag by abFlags.com
thanks 2 users liked this useful post by xxup
Offline xxup  
#50 Posted : 02 April 2025 12:53:22(UTC)
xxup

Australia   
Joined: 15/03/2003(UTC)
Posts: 9,578
Location: Australia
Okay - I need some help here.

I am trying to find the two utilities that I need to download.

marklin.py

and

threadsafe.py.

I went to this link -> https://github.com/peterhinch/micropython-async to find threadsafe.py, but I can only find:
threadsafe_event.py and threadsafe_queue.py in the V3 folder.

Where do I find marklin.py?
Adrian
UserPostedImage
Australia flag by abFlags.com
Users browsing this topic
Guest
2 Pages12>
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.

| Powered by YAF.NET | YAF.NET © 2003-2025, Yet Another Forum.NET
This page was generated in 1.352 seconds.