Jump to content
NX:

Track Detection, Signals and Interlocking

Recommended Posts

NX:

This is an actual train/track detection system instead of a timer for signals.

Using hall sensors and arduino, an idea for track detection. Below a pic of the testing unit or prototype:

02.thumb.jpg.9858e69c50265f45e88acab98a63cbf6.jpg

 

Magnets are placed under each end of the train and hall sensors are placed under the track (both ends of the track section.

It is not necessary to make holes or damage the track.

03.thumb.jpg.c264dfef364fd9740d12989be8decfb0.jpg

04.thumb.jpg.4b6b8ee3b5b76e5cf796e19b7b61cb86.jpg

 

Sensors connected to arduino 

05.thumb.jpg.4d627a6a28563adb5fcf3b58d30f689d.jpg

 

For a track section with hall sensors at each end of the track section and a train with magnets at each end of of it.

The logic is as below. So an counter is used in the arduino to "know" that the train is IN the track section.

 

S1  S2  Counter Track Status   Comment

0      0          0           empty         no train in track section

1      0          1           occupied   first half of train entered to track section

2      0          2           occupied   whole train is in the track section

2     -1          1           occupied   first half of train is leaving the track section

2     -2          0            empty       whole train left the track section

01.thumb.jpg.79907d1ca10f26502579af5c416230e9.jpg

 

And the serial monitor shows the status of the counter after the train passed the track section

 

1

2

1

as described before

06.thumb.jpg.358497e96ea6110ddd8191d480dfa88b.jpg

 

Success!

 

As a counter is being used, the train can stay as long as I want in the track section and the track detection will not time up.

This idea is based or inspired in the use of Axle Counters for track detection in real train lines.

This project can be modified to control outputs (i.e. signals and others). It can be used in several sections of consecutive tracks. Also, it can be adapted to be bi-directional.

 

Cheers,

 

  • Like 5

Share this post


Link to post
Madsing

Excellent. A perfect application for an Arduino!

  • Like 1

Share this post


Link to post
katoftw

I dont understand any of it. Love to see a video of it working though.

  • Like 1

Share this post


Link to post
Yavaris Forge

I'd love to see a video as well. Very nice program. How many track sections can you control with a single arduino?

  • Like 1

Share this post


Link to post
NX:
17 hours ago, Madsing said:

Excellent. A perfect application for an Arduino!

 

17 hours ago, katoftw said:

I dont understand any of it. Love to see a video of it working though.

 

16 hours ago, Yavaris Forge said:

I'd love to see a video as well. Very nice program. How many track sections can you control with a single arduino?

 

Thanks.

 

This is a work in a progress, the signals are not connected.

A video would show how the counter (i.e. a logic counter inside of the arduino), on the pc screen, goes from 1 to 2 then to 1 while the train is passing the track. Something that is not really exciting to see at the moment but I could make a video anyway.

 

How many tracks? A good question.

 

·         For one track: 2 input pins are required, to connect 2 sensors at each end.

·         For a signal: other projects control signals directly from the arduino, so 3 output pins are required. However, I want to use only one output pin per signal.

·         For points or set of points (in the future): I am also aiming to use only one pin.

 

If more pins are required... a pin extender could be used...

 

PCF8574 GPIO Extender

image.png.55cbfec9eb549c38c9aca7c6839fd1a1.png

 

This is a port extender which can provide up to 64 pins. That is, you connect 8 of these modules to 8 pins of your Arduino.

 

Now… if you want to get serious…

 

You could use the TCA9548A I2C Multiplexer Module (this is a multiplexer).

image.png.5f1161a081fe4a8294883c1282614076.png

 

So you could connect 8 x GPIO Extenders to 1 multiplexer module (TCA9548A I2C). Then replicate the latter up to 8 times. That is: 8 multiplexers with 64 GPIO extenders….

 

8 (multiplexers) x 64 (GPIO extenders) = 512 pins (input or output)

 

I think 512 pins would be enough for almost any project.

 

Note: Btw, I tested these modules. That is, I successfully controlled 1 LED with 1 switch… this was made by connecting 1 LED to 1 GPIO extender which was connected to 1 multiplexer which was also connected to 1 arduino.

image.png.1c22613f60b73e2f601d4e113acd9b82.pngimage.png.9b13d7d5ff042acfe675a77e4386f545.png

 

Some interesting things of this system are:

 

·         The track detection does not time out. Even if the train stops and “sits” between two tracks for long time, the system will still recognise that the train is occupying those two tracks until it moves.

·         It is unlikely to fail (unless you unplug the arduino). I have been testing it quite a lot and always “counts” correctly

·         You can have a track section as long as you want. That’s correct… as long as you want… Actually, this is a characteristic of the Axle Counters (the real devices) which are also used in “dark territory” of train lines instead of “token/staff systems”

·         No major modification to trains, only the installation magnets at each of the train.

·         No damage (making holes) to tracks

·         Quite simple and cheap to implement (for few tracks and signals)

 

For DCC, I know that people usually uses “current” detection which requires physically creating track blocks or sections (i.e. using insulators) and other circuitry. I think this project/idea (not completed yet) could bring a simple solution for DC users (well… also DCC users)

 

Power Up!

 

p.s. picture of magnets

image.png.9865527d80a398c429990a49c1748e3c.png

 

  • Like 2

Share this post


Link to post
disturbman

Very interesting. Thanks.

What kind of magnets are you using? Neodyms?

  • Like 1

Share this post


Link to post
NX:
22 hours ago, disturbman said:

Very interesting. Thanks.

What kind of magnets are you using? Neodyms?

 

Yes, Neodyms are the magnets.

 

On other topic, I was thinking how most of people (including myself) work/ed with IR sensors to achieve some sort of train detection.

a1.thumb.jpg.b0af8d6f59c8f21335b972b458f9d731.jpg

b1.thumb.jpg.7faca8a3fce10492e9e2d85350ab6ce8.jpg

 

Above, some pictures of old projects. IR sensors are helpful but have some challenges.

Still you can make interesting stuff like the video below.

 

 

This is old project which only uses IR sensor and relays (no arduino, no PC) to achieve locking of points, actually the right term will be "approach locking" of points.

This circuit replicates, or tries to, the real interlocking function.

 

In other words,  the circuit does:

  • Locks the points once the train occupies the track section of the points
  • Releases the points once the train passes that track of the set of points 
  • Release the points if the train stops (for 8 seconds) on the track before the track of the points, this is done to ensure the has stopped or the driver is under control of the train.

In the real world, this is obviously use to prevent the operations of points once a train occupies that track section as the later could generate a derailment.

Even tough in N Scale, the same principle can be used to prevent operating points while a train is passing over points.

So we will not have derailments and/or short circuits.

 

Cheers,

 

Edited by NX:
youtube link
  • Like 1

Share this post


Link to post
NX:

A half-cooked test...

Video shows that signals and track detection do not time up!

 

b.thumb.jpg.2605a9a5e6a63e1646e8e06af1f22dcb.jpg

Edited by NX:
youtube link
  • Like 4

Share this post


Link to post

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...