Jump to content
  • 0
Paddy Mac Namara

Diamond Crossing Protector

Rate this question


This item didn't appear to rouse much interest over on the layout forum (Celbridge), but may be of interest to those who prowl this forum.


Anyway please let me know what you think.


Here is a more detailed description of what’s involved.


In the diagram below of crossing, M is mainline B is branch-line. So what we want to do is allow the mainline have priority over branch-line and of course avoid collisions.

The branch-line is isolated between points x and y. There are sensors S1 and S2 on mainline, when S1 or S2 detects a train power is cut on branch-line.

X Crossing Isolated section.jpg

The next diagram shows how the isolated section can be controlled with on/off switch and then replacing the on/off switch with a relay. Also a diagram with relay pin-outs shown.


What the electronic circuit does is allow the sensor to switch on/off the coil on the relay which in turn turns on/off power to the track

Isolated section.jpg

Below is the detailed circuit diagram.

Circuit Diagram 9V Rev B.jpg

What does it do?


With S1 or S2 = 0 (no train detected) Transistor T1 and T2 are on because current goes to base (b) of transistor and turns “on” the collector-emitter (c-e) circuit thus the relay coil gets 9v. The relay is wired to either side of isolated section on branch-line through the common (CM) and normally open (NO), which is an open circuit, but because the coil on the relay is active the relay switches and the CM-NO circuit closes so we have power to the isolated section.


So this is the normal operating state of the circuit, relay coil active and thus power to isolated section.


Now when a train passes over S1 or S2 (S1, S2 =1) the infrared light from the diode on the left of S1 (the triangle thingy) is reflected back to the right hand side and this activates the transistor circuit in the sensor to “on” so now current is diverted from the base of transistors T1, T2 to ground. This switches off the c-e circuit so no current passes thru the relay coil, which is now in its off state so the CM-NO circuit is now open and no current flows to isolated section.


I have a video of a test track for the circuit over on Celbridge thread on layout forum.



There are some problems with this in practice, the photo-sensor doesn’t work so well on the black undercarriage of our models…so I had to paint them white.

The sensor is only active when it detects something over it, so one needs a long train to ensure that one or both sensors is covered as a train is going thru the crossing.


Also what happens if branch-line loco is already on the crossing as a mainline loco triggers the sensor.Power is cut to branch-line so it stops in the middle of the crossing….crash…bang…oops !!!!!


This is really just the start of trying to design something more comprehensive, it will work fine if the timings of branch and mainline are lagged correctly and you keep an eye on things.


I’m not going to install it on the layout just yet I want to think things thru a bit more.

Am I going to need more sensors on branch-line, could a latching circuit be better.

Would reed switches be better…etc. etc?

Do I go the whole hog and use an Arduino microprocessor…..why didn’t I go DCC in the first place….?????....i know, I know.

Share this post

Link to post
Share on other sites

9 answers to this question

Recommended Posts

  • 0

My first thought, and the same thought occurred when I read the original post under Celbridge, is, what happens if a branch train is already in the isolated section when a mainline train hits S1. As I see it, the branch train stops, straddling the crossing, and gets T-boned by the mainline train.

A safer option would be to have a 'first come, first through' system, where the first train to reach the crossing, regardless of which line it is on, prevents the other train from reaching the crossing until it is clear.

Alternatively, a modification to the isolated section so that if a branch train is already in the isolated section when S1 is activated, the track power stays on until the branch train is clear of the crossing.

Moving the isolated section to be totally on the approach side of the crossing, leaving the crossing live for the branch train to keep going in the event of an approaching main line train, is another option.

Share this post

Link to post
Share on other sites
  • 0

As promised some detail on the circuit used in the most recent video on “Celbridge”

As before my test track is not actually an X crossing but the two parallel tracks simulate what I want to do.

Track 1 is the main-line thru the junction and the reed switches are here. Track 2 is the “suburban” line and is required to wait for the main-line to pass thru the X crossing, this track is isolated either side of the X crossing.


R1 is the reed switch that detects the loco as it approaches the “X crossing”

R2 is the reed switch as it leaves the “X crossing” junction.

The isolated section on track 2 (the one I want to shut down) is connected to the relay thru the common (cm) and normally closed (nc) pins. So the isolated section is live at the beginning of the sequence.

When R1 is activated by magnet on loco it closes and delivers power to coil 1 on the relay, this causes relay to open the cm/nc circuit and so power is cut off to the isolated section on track 2. Because this is a latching relay we only need one pulse to coil 1 and the cm/nc remains open. (it doesn’t matter that R1 opens again once the loco moves away, once “latched” it stays latched).

Coil 2 un-latches the relay. So once the loco passes over R2 it activates coil 2 which unlatches the relay so the cm/nc circuit reverts to it original state and power is returned to isolated section on track 2.

As noted before this is a WIP and a learning curve, I am working on solutions to problems such as what if the loco on the suburban line is in the middle of X crossing as loco on mainline approaches….watch this space.


Share this post

Link to post
Share on other sites
  • 0

Just a bit of detail on the video posted on “Celbridge” thread.

Here is a photo of the track showing the position of the reed switches and a photo of the circuit board. The reed switches are triggered by a magnet underneath the loco.

FCFS circuit board.JPG

FCFS track.JPG

The circuit diagram is shown below, at top of diagram, a schematic of the track with sensors and a diagram of how the pin contacts on the relays work


Relay K1 has power to the track connected thru contacts NC (normally closed) and CM (common). The default for the relay is called the “reset” condition. Thus current flows thru NC-CM. So the Branchline (BL) has power “on”.

If loco on ML triggers reed switch R1 current flows thru coil 1 of relay K1 and “sets” the relay, this will then switch the contacts from NC-CM to NO-CM so BL is now power “off”. (NO is the normally open contact on the relay). When the loco on ML triggers R2 current flows thru coil 2 of relay K1 and “resets” it back to default, so BL has power “on”

Relay K2 operates in the same way and switches power on/off to Mainline (ML).

The circuit operates on a first come first served basis, whichever loco reaches the junction first switches off power to the other loco. At the moment the circuit can only work in one direction, I think I can get it to work “both ways”, but I’m having some difficulty at the moment

When and if, I ever get around to actually wiring this up on the layout, I will be switching power on/off on isolated sections, so I won’t have locos suddenly stopping dead on the tracks far away from the diamond junction.

This project is still evolving and I’m in no major hurry as I have control of the diamond crossing with simple on off buttons. I have two tracks going across the junction, so double the wiring.

I have done some coding with Arduino microcontroller and reed switches with some success, but it’s debatable if using software will simplify things as I still need relays to switch on/off current.

For those of you unfamiliar with Arduino, it is, I suppose a hobby version of a PLC (used in more industrial applications), very cheap about €30 , very popular for student projects and hobbyists

Share this post

Link to post
Share on other sites
  • 0

As promised i eventually got around to doing the above with an Arduino, you still need a single coil non latching relay, but it will work both ways, but it is not without its problems.


sorry about the sound quality on that one, and me mumbling at the end, here's another one.


Share this post

Link to post
Share on other sites
  • 0

As you can see not the most reliable, i think if i change the orientation of the reed switch, lenghtwise it should work better, see photo below of smaller magnet attached to loco


Loco with magnets.jpg

here's the ciruit diagram, very scruffy sorry i normally do them on graph paper...


Reed switch with arduino.pdf

and finally here is code for the arduino, i take no credit for it, i found it after a lot and i mean a lot iof searching, its simple and i like it for that

bool junctionclear;

void setup() {

  pinMode(2, OUTPUT);

  pinMode(9, INPUT);

  pinMode(10, INPUT);

  pinMode(11, INPUT);

  junctionclear = true;

  digitalWrite(2, LOW);


void loop() {

 if (digitalRead(9) == HIGH || digitalRead(11) == HIGH)

  {junctionclear = !junctionclear;}


 if (junctionclear)

  {digitalWrite(2, LOW);}

  else {digitalWrite(2, HIGH);}


Share this post

Link to post
Share on other sites

Join the conversation

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

Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  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...

Important Information

Terms of Use