# Reed-and Relay circuit control



## limitwheel (Jan 8, 2011)

I stumbled onto an article concerning the use of reed switches, relays and magnets to control trackside accessories. (eg. crossing gates, block signals etc.) You could use insulated rails, infrared beams or weighted devices. I looked into the infra-red detectors and found this to be too expensive. This reed-relay system intrigued me enough to gather the necessary components and set it up with terrific results. 
Here's the question: Is anyone interested in using this system to actuate trackside signals or devices etc?
If so, I can purchase the necessary components in bulk and sell it as a whole complete kit. The kit would consist of 2 relays, 2 reed swithces, 2 magnets and solderless connectors and a set of instructions to wire it up. 
Please let me know what everyone thinks of this idea.


----------



## gunrunnerjohn (Nov 10, 2010)

How exactly is this going to work? If you have to put magnets on each train that you want to activate the signals, I'm not sure that's going to be all that desirable. Also, you need to have some provision for delay after the magnet goes by to make it realistic. Are you thinking of using one to turn on and one to turn off? 

Have you seen this gadget, I picked four of these up for $20/ea in another train forum. If offers programmable delays after the train passes and a sensitivity control. Since it doesn't require anything on the train, it works with anything that comes by.


----------



## limitwheel (Jan 8, 2011)

I just built this reed & relay circuit system and you use 2 reed switches, 1 to turn the circuit on and 1 to turn it off. I glued one magnet under the loco to activate the first reed switch and the same magnet would the trigger second reed switch further down the track to turn the circuit off. 
I origionally wanted to buy the same Lionel infra-red controllers but they were too expensive.


----------



## gunrunnerjohn (Nov 10, 2010)

As long as you don't mind the magnet requirement, that probably works well. I just happened to luck into a guy selling some of these on another forum, so I jumped on them.

One issue I see is you can only run in one direction with that scheme, unless it's bi-directional in it's operation.

Can you post a schematic of how you're wiring them?


----------



## limitwheel (Jan 8, 2011)

gunrunnerjohn,

You're right about the direction. I haven't figured out how to make this work in both directions.


----------



## gunrunnerjohn (Nov 10, 2010)

There's probably a way, but I'm thinking some electronics would be the ticket here. You could use a 555 timer triggered by the reed switch to add a time delay after the train passes, and have that trip the relay.


----------



## plandis (Oct 5, 2011)

limitwheel said:


> I stumbled onto an article concerning the use of reed switches, relays and magnets to control trackside accessories. (eg. crossing gates, block signals etc.) You could use insulated rails, infrared beams or weighted devices. I looked into the infra-red detectors and found this to be too expensive. This reed-relay system intrigued me enough to gather the necessary components and set it up with terrific results.
> Here's the question: Is anyone interested in using this system to actuate trackside signals or devices etc?
> If so, I can purchase the necessary components in bulk and sell it as a whole complete kit. The kit would consist of 2 relays, 2 reed swithces, 2 magnets and solderless connectors and a set of instructions to wire it up.
> Please let me know what everyone thinks of this idea.


I am all ears! Its got to be less expensive then than the IR devices!!!


----------



## plandis (Oct 5, 2011)

limitwheel said:


> gunrunnerjohn,
> 
> You're right about the direction. I haven't figured out how to make this work in both directions.


I have to toy with it a little but if you let track relay 1 be tr1 and track relay two be tr2 and add two more relays, let them be ebr for east bound, wbr for west bound. then tr1+tr2=ebr and tr2+tr1=wbr. you can have two sets of reeds close together on each side of the accessory or track block. Like I said, I'd have to play with it a little with the relay contact arrangement so that tr1 must be energized prior to tr1 for the ebr to energize for example but I think it is doable! Cheap? that would be another story but I do know that mini relays are available through digikey for pennies. Even with the IR devices, there would still need to be some "relay logic" involved to detect direction and I think it wold take a minimum of 4 of them to detect a track block if you wanted to do directional detection.


----------



## gunrunnerjohn (Nov 10, 2010)

Well, this is starting to get to the level where parts cost is approaching the commercial solutions. 

I think you're thinking the IR detectors will cost more than they do. Before I'd start working with that many relays and magnets, etc., I'd consider looking at something like this: Infrared Train Detection


----------



## servoguy (Jul 10, 2010)

If it gets very complex, it might be easier to use a PLC or PC to control all the accessories. Using wired logic can get very complex after a while.
BB


----------



## gunrunnerjohn (Nov 10, 2010)

Well, there's probably only a handful of folks on the forum that could program that.  I'm actually thinking of a PC with some Parallel I/O boards for control of a bunch of stuff, it would be pretty simple to bang out in C.


----------



## plandis (Oct 5, 2011)

servoguy said:


> If it gets very complex, it might be easier to use a PLC or PC to control all the accessories. Using wired logic can get very complex after a while.
> BB


yep. PLCs are right up my alley! lots of Boolean stuff you can do there. for a large automated prototypical layout, the cost for low end PLC would be competitive given the unlimited controls you would have.


----------



## plandis (Oct 5, 2011)

gunrunnerjohn said:


> Well, this is starting to get to the level where parts cost is approaching the commercial solutions.
> 
> I think you're thinking the IR detectors will cost more than they do. Before I'd start working with that many relays and magnets, etc., I'd consider looking at something like this: Infrared Train Detection


Thanks gunny- that looks like a pretty decent detector. have you used any of those?


----------



## plandis (Oct 5, 2011)

gunrunnerjohn said:


> Well, there's probably only a handful of folks on the forum that could program that.  I'm actually thinking of a PC with some Parallel I/O boards for control of a bunch of stuff, it would be pretty simple to bang out in C.


thats right- you worked for big blue didn't you? you probably lived in a C world! anyway, I wish I knew more about that. I often thought a PC based control system for train layout would work very good given the relative cost per I/O. If you had to buy someone's application to crunch the logic, the cost goes way up. at least for me because I don't have he first clue about C. Now if the industrial controllers were not so expensive, I know my way around those OK. anyway back to earth!!


----------



## servoguy (Jul 10, 2010)

There has to be a PLC that is only a few hundred dollars. If you consider the difficulty of relay logic, the PLC should be the best solution. Or, if you are competent in Visual Basic or C, a PC would be an obvious choice. Then all you have to know is how to design a state machine.
BB


----------



## gunrunnerjohn (Nov 10, 2010)

plandis said:


> Thanks gunny- that looks like a pretty decent detector. have you used any of those?


I haven't used it, but there's no reason to believe it won't work. For that price, you could get one and do some testing.  My first IR detectors are the Lionel ones I got because they were a good deal.


----------



## gunrunnerjohn (Nov 10, 2010)

plandis said:


> thats right- you worked for big blue didn't you? you probably lived in a C world! anyway, I wish I knew more about that. I often thought a PC based control system for train layout would work very good given the relative cost per I/O. If you had to buy someone's application to crunch the logic, the cost goes way up. at least for me because I don't have he first clue about C. Now if the industrial controllers were not so expensive, I know my way around those OK. anyway back to earth!!


When I worked for IBM, my primary programming language was assembler for the 360. I also was the Phila support person for Cobol and PL/1. I didn't learn C until years later, but I've been using that for around 30 years! 

As far as the controllers, I'd be looking for some in places like eBay, you could probably score some used ones pretty cheaply.


----------



## plandis (Oct 5, 2011)

servoguy said:


> There has to be a PLC that is only a few hundred dollars. If you consider the difficulty of relay logic, the PLC should be the best solution. Or, if you are competent in Visual Basic or C, a PC would be an obvious choice. Then all you have to know is how to design a state machine.
> BB


we've got some old series one and some early 90-30 fanuc at work we have taken out of service due to system upgrade. I'd love to get my hands on some of those. good little controllers and I cut my teeth on logicmaster!


----------



## gunrunnerjohn (Nov 10, 2010)

See, you're already on the trail of some.


----------



## plandis (Oct 5, 2011)

gunrunnerjohn said:


> See, you're already on the trail of some.



so many trains, dreams, ideas... so little time!!!


----------



## tr1 (Mar 9, 2013)

*digital detection*

:dunno:Is anyone familar with a system called "jmri" I beleive the software is free,however:you will need a small hardrive for the operating system (Java Model Railroad interface) computer controled and I think Atlas may be involved somehow somewhere.
tr1


----------



## gunrunnerjohn (Nov 10, 2010)

Are you talking about JMRI?


----------



## plandis (Oct 5, 2011)

now that stuff looks like one could get lost in!!! FUN!!


----------

