Model Railway

Hello
What i am looking to try and do is make a route setting system..
So it be press one button to another button and it though a point via I guess a relay as points are 16volts

so it could be button 1 to button 5
throw points 1, and 5.
Display route clear.

I was thinking on a LCD display

Also if the route not avaiable I want to display Route Blocked or No route.

Hope this makes sense If you would like a diagram I shall draw one

Hope this makes sense

No. You lost me at "So it be press one button to another button".

Hope this makes sense If you would like a diagram I shall draw one

Truthfully, no.
Try writing an algorithm
DO THIS
IF THIS , DO THAT
etc...etc..etc..

I got the part about display this or that but that is just a minor detail.

thejmr:
Hello
What i am looking to try and do is make a route setting system..
So it be press one button to another button and it though a point via I guess a relay as points are 16volts

so it could be button 1 to button 5
throw points 1, and 5.
Display route clear.

I was thinking on a LCD display

Leave that until you have it working.

Also if the route not avaiable I want to display Route Blocked or No route.
Hope this makes sense If you would like a diagram I shall draw one

How do you tell if a route is in use? I'm sure you don't want to change the points under a train, so you'll need something to tell you when the train has left the section. Once you have that sorted out, route setting is just a table (array) of all the possible routes. E.g. for 1 to 5, point 1 reversed, point 2 reversed, point 3 reversed, point 4 normal, point 5 normal.
As you don't know what state the intermediate points are in, you have to change them all.

I wrote short Arduino program to illustrate signal interlocking on RMWeb

I agree with @raschemmel that you need to write down exactly what is to happen line by line.
When you have that done you will suddenly discover that you are nearly half-way to having a working program.

If you are new to Arduino this Thread about Planning and Implementing a Program may be useful.

...R

thank you for all your responses i can us an detectors for the route occupied and yes it will be a IF or Else script.

button 1 to 5
IF dectors 4 9 7 = 0
Then throw points 5 and 7.
Display Route set

Else
display route interlock

.

Im guessing it will look something like that i am not quite ready to start this project yet but i would like to beable to do a trail on just 2 buttons set up on a breadboard.

 button 1 to 5

Is this puedo code for a FOR LOOP ? (check buttons 1 through 5 ?)

Im not expert but im guessing it will I will draw up a diagram and table or routes and that might make it clearer

thejmr:
Im not expert but im guessing it will I will draw up a diagram and table or routes and that might make it clearer

Yes please.

I think that what @raschemmel was wondering is why you would press more than 1 switch at a time - i.e. 1 to 5 rather than 1 or 5

...R

attached is a very quick diagram not of my layout but it will get the idea across I think

so you wanted to go from button 1 to button 3

you press button 1 and then button 2

The program would check to see if yellow track was free.

If Yes

the program would switch the point the route goes though in this case point 1

and then display "route Set"

If No

Display "Route Blocked"

I hope this now makes a little bit more sense

thejmr:
so you wanted to go from button 1 to button 3

you press button 1 and then button 2

The program would check to see if yellow track was free.

I'm not sure it is clearer.
For a start button 2 is on the black line whereas button 3 is on the yellow line. Why would you press button 2 ?

In any case I don't understand why it is necessary to press button 1 - won't button 2 or 3 (on their own) be sufficient to say which track you want to use?

I suspect you need to take a rather "larger" view of route setting. Based on your diagram there seem to a few route options

incoming from the right and stopping on yellow or black (2)
incoming from the left and stopping on yellow or black (2)
running through non-stop on yellow or black (2) (direction doesn't matter for a run-through)

If you want all these options I think you need a selector system that can cope with them. My inclination would be a button for each option - or a simplified keypad.

...R

you need the 1st button to say where you want the route to Start and the second button where you wanna go.

im sorry im not very good at explaining

thejmr:
you need the 1st button to say where you want the route to Start and the second button where you wanna go.

I sort of figured that is what you had in mind but, as I said, I think a broader concept is needed and would probably be easier to implement.

Have I correctly listed the 6 route options?

And how will the train get to point 1 - will there be other route options prior to that?

If you want to keep it very simple maybe you could program it so that a press of button 1 or 4 means "train is here" and a press of button 2 or 3 means "wants to go there"

...R

Robin2:

thejmr:
you need the 1st button to say where you want the route to Start and the second button where you wanna go.

If you want to keep it very simple maybe you could program it so that a press of button 1 or 4 means "train is here" and a press of button 2 or 3 means "wants to go there"

Isn't that exactly what he asked for, in different words?
"train is here" == Start of route and "wants to go there" == End of route. A button press for each end of each possible route. Much easier than having to remember a route number for each of several possible routes. Let the program sort that out. Once the route is clear and set, the direction of travel is irrelevant, except for signalling.

raschemmel:

 button 1 to 5

Is this puedo code for a FOR LOOP ? (check buttons 1 through 5 ?)

No. It means set a route from the position of button 1 on the track diagram to the position of button 5 on the track diagram.
Much easier than remembering the route number of, perhaps, 239 different possible routes.
That's the way it's done in full size modern electronic signal boxes.

Henry_Best:
No. It means set a route from the position of button 1 on the track diagram to the position of button 5 on the track diagram.
Much easier than remembering the route number of, perhaps, 239 different possible routes.
That's the way it's done in full size modern electronic signal boxes.

You are probably right, but it would have been useful for the OP to explain that and save us all some work.

I wasn't proposing that one would have to remember the correct number out of 239 - perish the thought. There would need to be some visual means of selecting a route. Maybe that is just by pressing all the buttons along the route. However the program will need to know all 239 legitimate route options so it can determine that the button sequence is valid before it can do anything else.

...R

i think we are on the same track the last reply I going to be expermenting at the end of the month with this to ee ifd i can start it off then add to the code

thejmr:
I think we are on the same track

Oh the humanity! :astonished:

Robin2:

Henry_Best:
No. It means set a route from the position of button 1 on the track diagram to the position of button 5 on the track diagram.
Much easier than remembering the route number of, perhaps, 239 different possible routes.
That's the way it's done in full size modern electronic signal boxes.

You are probably right, but it would have been useful for the OP to explain that and save us all some work.

I wasn't proposing that one would have to remember the correct number out of 239 - perish the thought. There would need to be some visual means of selecting a route. Maybe that is just by pressing all the buttons along the route. However the program will need to know all 239 legitimate route options so it can determine that the button sequence is valid before it can do anything else.

...R

Agreed.

Wouldn't it have made more sense to call them START button and DESTINATION-5 button ?

or
Destination-1 button and Destination-5 button