Carl's Railway Automation

Post all your model railway electronic problems, solutions and discoverys here.
carlmeek
Posts: 5
Joined: Thu Apr 13, 2017 12:15 am

Carl's Railway Automation

Postby carlmeek » Thu Apr 13, 2017 4:19 pm

I'm a software developer creating a control system from scratch to power an ambitious huge OO layout in a converted barn. I've been working on it a couple of months and I've achieved 11 locos running at once while I sit back with my arms folded. Each train plans a route, sets points and reports it's location, interacting with the other trains and obeying blocks and locks. It's pretty damn reliable with only a very occasional fault - and its getting better each time i run it. I've still got a long way to go, but results so far are pleasing! Trains are all DCC/Sound and sounds are automatically played (for example doors closing, guards whistle, and horns into tunnels).

I've just started writing a blog about this, it makes sense to share what i've learned so far. Please take a look, and i'd love to hear some feedback. I'll be adding more and more content as things progress.

http://trainautomation.blogspot.co.uk/

User avatar
TimberSurf
Posts: 2085
Joined: Wed Jan 08, 2014 5:47 pm
Location: N.Wales
Contact:

Re: Carl's Railway Automation

Postby TimberSurf » Thu Apr 13, 2017 7:24 pm

Hi and welcome to the forum!
You should have joined earlier as we have some Arduino geeks on here already! (not that I am one)
I am a systems Engineer who does this sort of control for a living on Industrial PLC's. So train automation is very close to my heart and I plan something similar for the future. There are proprietary systems out there, but largely based around DCC itself, the Arduino "field" devices is an interesting twist :D . I am not overly sure what benefit it brings? If we ignore your .net PC program (that is unarguable, as it is bespoke to the routing function), I would like to investigate the "field" side of your design (can you tell I am a Hardware design engineer and not software?).
My design will be around simple block control, hardwired, obviously you want that function to be in the software, so need to connect the "field" inputs and outputs (I/O) back to the PC. I appreciate that trains can be controlled via DCC++ (did you know DCC standards include a raft of input configurations?). From what I have read on your website (correct me if I am wrong), you control (4) points via Wifi. You get sensor data back via Arduino what? Comms? RS232/USB? I only know the rudiments about Arduino, but with (bit shift?) they should be capable of hundreds of inputs, so your 10's of 10's doesn't add up? What is the nominal distance between sensors? I appreciate distance is a problem and so you need many to keep the sensor wires short (or reasonable)
Image
Lumsdonia <--- Hit link to go to my website for full story and wiring advice!

carlmeek
Posts: 5
Joined: Thu Apr 13, 2017 12:15 am

Re: Carl's Railway Automation

Postby carlmeek » Thu Apr 13, 2017 8:28 pm

I aimed to keep things clean and modular, and chose to use DCC for trains only. For points i'm sure it works but it is (a) expensive and (b) doesn't give feedback of positive movement. So I chose to use arduinos and connect them directly.

I'm using ESPDUINOs with built in WIFI - these form the main grid of communication, so it's TCP socket communication between the .NET hub and these ESPDUINO devices. Each of those does 4 sets of points AND provides a TTL Serial link which can connect to an Arduino MEGA to provide 53 sensors.

Obviously I could use bitshift and extend it further and further, but there's been no need so far.

How many sensors? Well my track is probably about 80 metres in total and it has 53 sensors. They are strategically placed, and the software sorts the rest. I literally just drill a hole, bang in a sensor, measure it's location and tell the software. I'll still be needing a few more as there are a few unprotected zones where a train could overrun it's mark.

Eventually of course these blocks will have nice LED signals powered by the Arduinos too... but for now they are just blocks with no visible signalling.

carlmeek
Posts: 5
Joined: Thu Apr 13, 2017 12:15 am

Re: Carl's Railway Automation

Postby carlmeek » Thu Apr 13, 2017 9:24 pm

I've just posted a set of videos onto the blog. They are here:

Introduction to the Layout
https://www.youtube.com/watch?v=oPyC6DAEZmM

Sensor Wiring
https://www.youtube.com/watch?v=6jNW5EGlILk

The Moving Map
https://www.youtube.com/watch?v=ZhaMlnkyOqg

The Software Back End
https://www.youtube.com/watch?v=jHSALX4wE9M

Automating ONE Train
https://www.youtube.com/watch?v=f2UZ3Ba9v3M

Automating ELEVEN Trains
https://www.youtube.com/watch?v=-B82k-PuTgw

I would run more trains- but i need to build more track first!!

User avatar
TimberSurf
Posts: 2085
Joined: Wed Jan 08, 2014 5:47 pm
Location: N.Wales
Contact:

Re: Carl's Railway Automation

Postby TimberSurf » Fri Apr 14, 2017 11:32 am

Lets just get a few thinks straight, first I would just like to say you have done a fantastic job! Full automation is not everyone's cup of tea, but to have made it from scratch, is quite an achievement!
Second, we are all envious of the amount of space you have! :cry:

I don't think you have mentioned in your investigations, the use of reed relays? They have proven very effect on hundreds of layouts in the past for sensing. Although "hall effect" is a more modern technical availability, I don't actually see an advantage in them.

It also strikes me (just as an observation, that you select trains by name, thus I guess the software remembers were it last was, so effectively, you have to "tell" the program the name of the train and it then remembers were it is by "tracking" its movements. This means you could confuse the program, by removing/swapping trains etc.
Idea, how long is the pulse you get from the magnet? perhaps you could have 5, the first is a trigger then a combination of four are allocated as bits to give you 16 addresses?

What does the program do if a train doesn't turn up (derails) were it has been commanded to go?
Did I see 182mph? They do seem to be running at a hell of a pace!
Image
Lumsdonia <--- Hit link to go to my website for full story and wiring advice!

carlmeek
Posts: 5
Joined: Thu Apr 13, 2017 12:15 am

Re: Carl's Railway Automation

Postby carlmeek » Fri Apr 14, 2017 11:49 am

Reed relays are great but Hall effect switches beat them hands down. They are cheaper, more reliable and smaller. These days there are no reasons to use reed over Hall effect. I'm sure reed switches can be almost as good, and for existing installations not worth replacing them, but for a new install it's hall every time.

The pulses from the Hall effect sensor vary, I haven't measured them, I only note the change from 1 to 0. The pulse will vary with a number of factors: speed, size of magnet, power of magnet.

You can indeed confuse the software by starting up with things in the wrong position. Whilst I could spend time trying to get ID numbers into the sensors, I don't really see much value in doing this. It would only work when moving, and would not tell you direction of movement. I think more useful would be to deploy RFID to identify the parked trains in platforms. I've got all the gear for RFID reading but it is expensive and doesn't work with trains traveling faster than a snails pace.

If a train doesn't arrive where it is expecting it counts it as a "skipped sensor". It allows one, but two will shut the train down, and sound it's horn, and the operator then needs to cross check its location and restart the mission.

The Hornby HST does indeed do 180+ scale miles per hour, and it's great for proving the track is working well.

I have one annoying regular derailment, the three axel bogie at the front of the class 47 keeps skipping a point that isn't quite level. This causes a short, and the software then shuts down gracefully until you fix it. One button pressed and everything then continues.

It's a very large track for a single power district, but it's working well. Shorts at points are the most common reason for full shutdown.

ianjeffery
Posts: 48
Joined: Tue Jun 14, 2016 10:03 am

Re: Carl's Railway Automation

Postby ianjeffery » Fri May 19, 2017 3:25 pm

Hi Carl,

I'm really interested in this, but i cant find any links to the software you wrote. is it on github or something simular ?

carlmeek
Posts: 5
Joined: Thu Apr 13, 2017 12:15 am

Re: Carl's Railway Automation

Postby carlmeek » Fri May 19, 2017 3:27 pm

No, i have not released the software to the public domain.

User avatar
TimberSurf
Posts: 2085
Joined: Wed Jan 08, 2014 5:47 pm
Location: N.Wales
Contact:

Re: Carl's Railway Automation

Postby TimberSurf » Tue Mar 13, 2018 10:17 pm

TimberSurf wrote:......we have some Arduino geeks on here already! (not that I am one)


Just updating my statement, I am not a geek, but I am beginning to be one (mini geek)
I have written a few sketches! lol

Traffic lights and servo driven car lifts are well under way!
Image
Lumsdonia <--- Hit link to go to my website for full story and wiring advice!


Return to “Electronics”

Who is online

Users browsing this forum: No registered users and 1 guest