Model Railway control. Displaying point positions using 74HC165 & 74HC595

So let me start by saying i only started with the Arduino just after Christmas so i,m a complete newbie with this, but i have been progressing on my goal of using Arduino for a Model Railway layout control device.
I have stumbled on the idea i have that i want to use 74HC165 input shift register to collect button inputs for point changes on a layout, then it will send data to a 74HC595 output shift register to switch the leds on a display panel to show the points have changed.

Points are changed using a servo instead of the usual point motor (they are cheaper and quieter).

I want, if it is possible to do it like this, because it will make the set up modular so in future i can add registers for bigger layouts when needed..

Taking things step by step i first want to get a grip of the input side of things (hopefully i will know then how to do the output side from learning this side).

So the question is , is this possible to do ?

Many thanks for any advice..

Yes it is possible. But if you are controlling the points with a computer you know what they are set to so there is no need to read anything back.

Sorry i,m not using a computer with the layout.

My idea is to use the arduino as the guts of the control panel switching servos and Leds from button inputs..

I want to cut down the amount of wiring that ends up in a layout control panel (our club layout boards are a nightmare to work on and there is 3 of them !!)

So i am hoping that if i can show them this way of controlling the points they may consider a rewire..

Ok, so using the code from the playground i think i have got the input side worked out on the 165..

I will hopefully do some more tomorrow to check it is working as i want it too..

Next step will be to run the Leds through a 595 and get them working as i want.
(green and red Leds to switch over on each push..)

Then i can add back in the servos...

How many Inputs and outputs do you need? What about an $18 Arduino Mega with 54 I/O built-in?

Yes i thought about the Mega and for smaller layouts it would be enough to do the job.

But i want to make something that is modular expandable so it can meet the needs of even the largest layouts should the need arise..

I am thinking of something similar and my idea is to use a separate Arduino for each railway board - that way none of them will have too many turnouts or signals to control. A Mega or Micro will make it easy to send and receive control messages between the boards using Serial1 and just 2 wires plus power and GND.

I am planning to use a PC screen instead of physical switches to eliminate as much wiring as possible. It will also be responsible for the inter-locking logic.

If you want to use switches you could use a Mega to collect the switch data and send messages to other boards. It could also handle the interlocking. That way the control Mega could be in a control box with just three wires going to the rest of the layout Rx, Tx and GND.

My goal is to have as little wiring and as few extra components as possible. You don't need to spend long with wire and a soldering iron before the cost of an extra Micro looks very attractive.

Just my 3 cents.

...R

Cheers Robin,

It was an option i was looking at too, but for exhibition layouts taking a computer along with everything else isn't our best option (especially if the computer isn't available for a show), I am hoping to use this on a club layout we are currently rebuilding.

My hope is to use the shift registers inside the control panel to keep it tidy (as they will be on the back of the display so only the connecting wires to the arduino will be coming down and use I2C servo boards on each of the layout boards giving me 16 outputs per board for just a 5 wire connection (that's the plan anyway).

And by hopefully making it modular, it should be expandable for bigger layouts easily (we have a larger club layout which really could do with a rewire as the person who made the control system is no longer there and it is a nightmare to chase faults on).

Tahlon:
And by hopefully making it modular, it should be expandable for bigger layouts easily (we have a larger club layout which really could do with a rewire as the person who made the control system is no longer there and it is a nightmare to chase faults on).

That’s what I am thinking of as well.

Like I said earlier even if you don’t want to use a PC the use of several Arduinos could reduce the inter-board and controller-to-layout wiring to a minimum.

However (because I like programming) bringing a couple of cheap laptops to an exhibition (one for a backup) is not a big deal. But I know lots of model-railway folk don’t like PCs.

…R

Tahlon:
Sorry i,m not using a computer with the layout.

OK let me say it another way. You are using a servo to change the points. You control that using an I2C servo board so something gives that board the command to open or close the points. That something is an Arduino I suppose, so your code "knows" the state of the points, so there is no need to read them.

Grumpy_Mike:
so your code "knows" the state of the points, so there is no need to read them.

That makes me wonder if the problem is feedback for the operator.

Maybe using toggle or slide switches rather than button switches would provide operator feedback without the additional complexity of LEDs.

...R

If it was just my layout then maybe displaying the points position on a display wouldn't be a problem. But this is a club layout and across the members their knowledge, capability, etc varies so by having a visual reference on the display board of the points position means it is easy for expert and novice alike to operate the layout with a degree of ease..

And lets be fair who wouldn't like some leds on their display board ? :slight_smile:

Tahlon:
And lets be fair who wouldn't like some leds on their display board ? :slight_smile:

ME :slight_smile: My display board will be my laptop screen.
(By the way this is just intended as a humourous contribution)

More seriously I showed my idea for a PC based system to the club members who are only too familiar with the existing wiring and nobody was opposed to it in principle. I think the general feeling was that it would make the control system more intuitive - especially for less experienced operators. However there are no plans to implement it or scrap the existing wired/relay system just yet.

...R
PS The guys who like LEDs should be made to wire them up.

I think a majority of our members would struggle to find porn with a laptop already connected to the internet, let alone run a layout with one !! :slight_smile:

But i can see where you are coming from and my own layout may well be laptop controlled or atleast over-seeing (tablet maybe) whats going on, especially as it will be over 3 levels.

Tahlon:
I think a majority of our members would struggle to find porn with a laptop already connected to the internet, let alone run a layout with one !! :slight_smile:

All they need see is a track diagram with turnouts (and signals) that they click with a mouse to change. If it appears on a tablet they just need to touch them. This is the sort of thing I have in mind. In this diagram the coloured buttons are to select which DC controller that section of track is connected to. Clicking on a turnout will change it.

track.jpg

…R

That looks good Robin..

Well i have managed with plenty of head scratching and searching to get a set up running.
Using 4 buttons
5 servos
8 Led's - 4 green & 4 red

It is a start and now i know it is possible i can work on the clubs layout version with 11 buttons ( so next lesson is daisy chaining the 165 & 595 and then getting the information collected and sent correctly..

Hi Tahlon

I am new to Arduino also and I clearly have a problem with programming, would you be able to share your Sketch code with us?

I have only been able to use a press button that runs the servo and alternates one of two LED to get the points position!

Regards

Darren