Train Detection

AlanL

AlanL

Registered
1 Mar 2016
45
5
Northampton
I've received a bundle of components including some miniature 24 volt relays and have been trying a test on the bench. However seeing John's post above using an optoisolator, the relays may not be required.
Yesterday I cut a gap in my test track and filled in the gap with a small piece of rail glued in position -
Test Track View _2_.JPG


The length of wire was soldered before gluing and as I had glued it slightly higher than the track, I filed and smoothed it so that it was perfectly level with the rail top.

Test track _ Caboose 2.JPG

I then soldered wires to the relay coil contacts and as it was on the bench, decided to try it with a single diode. The relay didn't work, just made a faint buzzing. Perhaps I should have used a lower voltage coil on half-wave? I then soldered a capacitor across the coil, 10uf and with that the relay operated and released instantly. I soldered an LED and battery on the relay contacts to confirm the operation. Earlier in this thread, relay chatter was mentioned so I wondered if a higher value capacitor might delay the relay operation. I tried a 100uf and a 470uf capacitor, they both operated instantly. What did alter was the holding time of the relay. 100uf was about 1/2 second and the 470uf was about 2 seconds.
Relay and Cap 10.JPG


With the test circuit connected to the rail, I pushed the caboose along the test track and the relay operated each time the metal wheels crossed the insert.
I tried a loco afterwards and again the relay worked faultlessly.
The idea works but I would have connected the relay contacts to a 555 timer circuit. However, after John's post above maybe an optoisolator would be better?

Alan
 
AlanL

AlanL

Registered
1 Mar 2016
45
5
Northampton
Alan, can we assume DCC? Makes it simpler, but need to know.
Yes I forgot to mention that it is DCC but I thought that it could also be used with DC albeit with component variations or a bridge rectifier in reverse. Thanks for your input by the way.

Alan
 
J

John S

Registered
5 Nov 2017
452
170
The Moon
Moved
 
Last edited:
PhilP

PhilP

G Scale, 7/8th's, Electronics
5 Jun 2013
24,702
944
Tamworth, Staffs.
The timer unit will switch the relay (orange bit on the right) which has changeover contacts, so yes, this will switch from red to green after the timer period.

Why not use a 'buck' converter, in place of the resistor? - Set it for 5V (which you need for most of the circuitry) and then use a resistor to set the current through the LED's in the opto-isolator?
 
PhilP

PhilP

G Scale, 7/8th's, Electronics
5 Jun 2013
24,702
944
Tamworth, Staffs.
Having realised I commented before being right up to date on this..

Alan, put a diode across the coil of the relay, please. It will not matter with the circuit 'as is' at the moment, but any electronics will not like it.
 
J

John S

Registered
5 Nov 2017
452
170
The Moon
Moved
 
Last edited:
AlanL

AlanL

Registered
1 Mar 2016
45
5
Northampton
Phil, thanks for the tip to place a diode across the coil. I had forgotten about back emf from a de-energising coil.

So in John's circuit, the orange box is a relay, I can now see the outputs labelled and understand it better. However, I only want to switch an LED with the 555 chip. It is capable of 200ma more than enough for an LED so I'm not sure that I need a separate relay when the 555 chip will work.
(Searching for timers lead me to the 555 chip and their explanation of use gave switching LED's as an example.)

I am now getting a picture of how to achieve my working signals. I want them to be powered and controlled locally.
Basic idea is as follows plus the diodes, resistors and capacitors. And wiring connections.

Power supply is track through bridge rectifier and voltage regulator.
Trigger is the sensor track through a diode to a miniature relay or optoisolator. The relay applies 0 volt to the 555 timer.
Timer is the 555 chip, input as above. Circuitry for adjustable delay.
Output is directly to the signal LED's, normally low (green) when triggered output high (red).
Hope that makes sense.

Alan
 
AlanL

AlanL

Registered
1 Mar 2016
45
5
Northampton
John thanks for stirring the grey cells and explaining your circuit, I was puzzled about the use of the 555. I'm trying to keep it simple and compact so that the circuit could be hidden near to or under a signal. Still it will be interesting to see your circuit.

Alan
 
J

John S

Registered
5 Nov 2017
452
170
The Moon
Moved
 
Last edited:
GAP

GAP

G Scale Trains, HO Trains
14 Jun 2011
2,522
72
Bundaberg Queensland, Australia
I have been looking at this site a lot ( a very knowledgeable and approachable person) and plan to give the detectors in the "sensors" section a go.


Bit of tinkering with electronics is on my horizon in retirement.
Road crossing flashing lights and boom gates signals and train detection displayed on an old tablet screen all part of the pipe dream.
I have a raspberry pi and a selection of PICAXE microcontrollers to play with at the moment.
I find tinkering a great way to learn or relearn stuff.
 
PhilP

PhilP

G Scale, 7/8th's, Electronics
5 Jun 2013
24,702
944
Tamworth, Staffs.
The beauty of Dave Bodnar's site, is there are video's of his presentations.. These give another insight into some of the projects and concepts..
 
J

John S

Registered
5 Nov 2017
452
170
The Moon
Moved
 
Last edited:
AlanL

AlanL

Registered
1 Mar 2016
45
5
Northampton
John that circuit looks nice and simple. Correct me if I am wrong but is it track power on the left to a bridge rectifier. Then the DC goes to the optoisolator and then to the output on the right? Resistor selects voltage/current to the optoisolator? Would this work the 555 trigger pin 2 to 0 volt?
In your video, you seem to have a foot of track that detects the loco. So does the circuit detect the current drawn by the loco? For my idea the loco would stop on that section because I'm not powering it, the voltage in the loco passes voltage to the dead section.

Alan
 
AlanL

AlanL

Registered
1 Mar 2016
45
5
Northampton
I have been looking at this site a lot ( a very knowledgeable and approachable person) and plan to give the detectors in the "sensors" section a go.
 
Last edited:
AlanL

AlanL

Registered
1 Mar 2016
45
5
Northampton
Lots of info and ideas on that site, I've spent a lot of time reading all of his articles. With the sensors, there are mechanical switches, reed switches, hall effect sensors, and iR sensors. For me, they all had disadvantages and that is why started looking at an alternative method and asked if anyone has tried the 'dead rail' method.

Alan
 
PhilP

PhilP

G Scale, 7/8th's, Electronics
5 Jun 2013
24,702
944
Tamworth, Staffs.
Greg,
'Sloppy' use of language..

'Dead rail' is used when discussing motive-power, here in the UK, but can be used when discussing running live-steam as well:
"You need 'dead-rail' as many live-steam loco'c do not have insulated (isolated) wheels.."

But yes, dead rail is also used when referring to battery power. - But still the inference of 'no power on the rails' Which is what our OP is referring to. ie. a short section of isolated rail, used to detect the passage of stock' in some way.
 
AlanL

AlanL

Registered
1 Mar 2016
45
5
Northampton
Sorry if I've used a misleading term but the insert into the rail is not powered so I described it as dead. When the loco passes over the 'dead' insert the loco applies track voltage through it's chassis to the 'dead' insert momentarily as each wheel and pick-ups pass over. The 'dead' insert then makes a circuit through a relay coil and returns to the opposite track voltage. I'm using a miniature relay and it works every time but I am looking at using an opto-isolator instead of the relay. The relay/opto-isolator then triggers a 555 timer circuit to control signals. The 555 timer circuit ignores any further triggers in a train until it times up and resets to normal low output.

Alan