Notifications
Clear all

Controlling Minature Railway points and Signals at the station area.


Portersmith
(@portersmith)
New Member
Joined: 1 month ago
Posts: 3
Topic starter  

Hi all,

To clarify, I'm referring to the miniature trains that you ride on, not the HO, N, OO scale trains.

I'm working on a project for my miniature railway club around the station area. The project involves local boxes at each end of the station yard where drivers can select their route on the touch screen when there is no Station Master in position. When there is one, the local boxes become the servent units, and the Station Master has their control box, which controls the whole layout.

The distance between the boxes is 10 - 15 meters (sorry, I can't translate this to Yards (and it is outdoors)), and I've looked at Wifi 1st. After having problems downloading the 1st stage scripts, I started doing a Wireless system using the nRF24L01 with an antenna.

My problem is that I don't know how to program the local boxes to work out if they have complete control of the points and signals or have to give or take control movements to the station master box, also, how the Station Master box can communicate to both local boxes simultaneously as well.

Any help or tips will be great full, please.

David.


Quote
robotBuilder
(@robotbuilder)
Noble Member
Joined: 2 years ago
Posts: 1004
 

@portersmith

So have you searched for any solution yet?

https://howtomechatronics.com/tutorials/arduino/how-to-build-an-arduino-wireless-network-with-multiple-nrf24l01-modules/
https://www.instructables.com/NRF24L01-Multiceiver-Network/

I have just ordered two nRF24L01 to play with,  perhaps I should have ordered three to play with networking.

 


ReplyQuote
DaveE
(@davee)
Estimable Member
Joined: 7 months ago
Posts: 162
 

Hi @portersmith,

re: My problem is that I don't know how to program the local boxes to work out if they have complete control of the points and signals or have to give or take control movements to the station master box, also, how the Station Master box can communicate to both local boxes simultaneously as well.

The logistics and practical aspects of getting wireless comms to work will no doubt provide many hours of puzzling, and hopefully @robotbuilder (and others?) will be able to provide some assistance, but I have requoted your question because I think it is a separate issue.

I interpret your question as imagining a time in the future, when you have a complete set of boxes, each has the ability to transmit and receive messages to/from each of the others, but the boxes have not been 'taught' what to say in the messages or how to interpret a message into any actions.

I confess to never having built such a railway system, so others may provide a more experienced view, but the following are my first thoughts on how to start ....

I suggest that you start by imagining each box is a person, who, as in an unautomated commercial transport railway system, is given the specific role and responsibility of that box. Assume each person  can speak (send messages) and listen (receive messages) to any of the others, can 'receive' any incoming 'data' information (e.g. state of a set of points) that is received by the respective box, and take any actions (e.g. change the state of a set of points) that the respective box can do. (Of course, each person can only receive the information specifically provided to them ... and take actions that are under their direct control.)

Furthermore, imagine these people can only do what they have been instructed to do, because they have never done the job before. Hence, they must be provided with a comprehensive set of instructions as what to do. e.g. write a 'job description' for say the station master, with a list of situations, how to recognise that situation, and what to do when each situation arises. The 'recognition' and 'what to do' are likely to involve both receiving information (e.g 'train approaching station') and sending messages ('Change signal x to stop'). Repeat this process for all of the different boxes so that you have a complete picture.

Now, start to analyse this description, looking for characteristics you will need to provide. For example, does the station master receive information from all of the boxes, or do only some have relevant information? Does the station master send information/commands to all boxes? For each message, is it just for one receiver, or are some messages 'broadcast' to a group of receivers?

If you can complete this visualisation, you should have an answer to the first half of your question. Namely, what should the boxes be programmed to achieve, and what communications are needed? The second part, which I clearly cannot address at this stage, involves translating these requirements into lines of code, utilising message passing, and so on. However, the clearer you can define the requirements, the easier it will be to convert into a working system.

Building a complete system is likely to require a piecemeal approach ... identify a small part of the required functionality, then implement and test it.  For example, you might decide that under certain conditions, the station master needs to command a signal box to change the state of the signal at the exit from the station, to allow the train to leave. Achieving just this 'single action' requires the station master to send an appropriate message, the signal box to receive and recognize the message, and the signal box to change the signal state.

Having a good overall requirement wll greatly aid identifying such small steps. Furthermore, it is easier to spot where the same code can be deployed in different times and places, so that you only need to write and debug it once.

Of course, most 'complex' systems, and my interpretation is this project is likely to be 'complex', start with the initial set of requirements, which are then 'implemented' to form a 'trial' system. The 'trial' system is then tested, and usually found to have some issues, which result in the requirements being amended, and so on, in an iterative loop until the desired result is achieved. 

Good luck with your project ... I hope you enjoy the challenge!

Dave

 


ReplyQuote
Portersmith
(@portersmith)
New Member
Joined: 1 month ago
Posts: 3
Topic starter  

@davee Thank you for the advice.


ReplyQuote