Skip to main content

Replies sorted oldest to newest

Hi Ken, I just bought Azatrax detector Kit, it came with:

1 Detector, dual, turnout

1 Latching relay DPDT 12vac or dc

1Power supply 12vdc


Looks like it should work great for what I need it for. I also included 2 Dwarf signals O 2-led . all for $91.50 That was with shipping. Came in 2 days!

It comes down to whether working at the component-level is part of the fun of the hobby to you.  The Lionel 153IR or the MTH ITAD run in the $30-40 range.  They work, it's a name brand you can trust, it's plug-and-play, etc, etc.. 


But if you like fiddling with electronics and maybe want to learn a bit about IR techniques and such, then you can cobble together the functionality of a 153IR/ITAD for less than $5.  And by learning about what's going on under-the-hood, you can experiment and then make modifications or variations to the basic circuitry to provide additional functionality not provided by anything you can buy off-the-shelf.  Plus, there are enough people here on OGR that know enough about the nuts-and-volts of these things to make it practical.

Hi Stan,


Yes, as a retired EE, I like to fiddle. But I was not in design and it's been forever since I took a course in transistor electronics.


So, any help would be much appreciated. If someone could provide a basic schematic with component values, I will give it a try. Mostly want to detect train passing to operate gates, signals, etc..


Thanks for any help.


P.S.: I looked at the schematics at some of the sites provided and they have me somewhat started. I just know nothing about what to order for an IR emitter or detector.

Last edited by ken's trains
Originally Posted by ken's trains:
P.S.: I looked at the schematics at some of the sites provided and they have me somewhat started. I just know nothing about what to order for an IR emitter or detector.

Yes.  One downside of DIY projects based on web content is out-dated information especially with electronic components.  In the link mentioned above for example, he says,


"The DigiKey part numbers for suitable phototransistors are 365-1066-ND and PNA1801LS-ND."


Well, the first number is valid and looks fairly priced, but the 2nd part number is obsolete.;keywords=365-1066


I make the "fairly priced" comment because hobbyists often use whatever part they have lying around, and then write it up with no regard to how easy/hard it is to buy that part.  An unsuspecting reader trying to replicate the exact parts list doesn't realize it is an obscure or obsolete part with an unreasonable price.


So if getting started with this IR stuff, I suppose it's not obvious that you probably want to start with an emitter (LED) that has similar packaging.  So on the DigiKey site you would search for "3mm Infrared LED".  Then you want the Infrared color (wavelength) to match the phototransistor so it's definitely not obvious that you want to choose 940nM.  And you might come up with:


If ordering from DigiKey (I recommend them) or anywhere for that matter, obviously gather up a parts list to consolidate shipping.


An intermediate step between component-level DIY assembly and simply buying from Azatrax or whomever is something you don't see written about a lot (yet).  That's using low-cost electronic "modules" from Asian suppliers off eBay.  For example, in a recent thread I suggested one way to cobble together an IR detection system using eBay modules.  See the photo in this thread:


There's an IR module with an emitter and detector already installed for not much money.  I think it's safe to assume they matched the LED and phototransistor type.


And if you're willing to use low-cost Asia eBay sellers and live with waiting a couple weeks for stuff, you can find IR LED/phototransistor pairs attractively priced.  For example, here's 10 pairs for $2.99 (free shipping).


Note that the one nice thing about DigiKey is their parts have datasheet links so you can get detailed technical info. 





The links to DigiKey and your previous posts on the Asian products were great. I've ordered a bunch of the stuff from them (LED/sensor, power supply, volt reg, relay module). I ordered enough to make a lot of mistakes, so I will give it a try when they arrive in the next decade (kinda slow on shipping--must be by boat). This works just fine 'cause I'm currently letting my Homasote sheets air out in the garage. Great stuff, but a little stinky. I have many, many operating accessories (log, coal, culvert, etc.) that I want to put in a yard config. That will take up a lot of time figuring spacing, switch location, etc.


I have been wanting to do this for 30 yrs. Waited for my wife to retire to help with scenery design, but she passed away several years ago. So, put on hold again, and now I'm well into it. I joined a model railroad club several months ago, but they haven't been much help for layout design/electronic things.


Can't thank you enough for the help. And will probably get back to you when electronics arrives.


By the way, just a side non-related question for anyone 'listening'. I am putting the Homasote on top of plywood and then want to put cork roadbed under the track. I bought some straight cork roadbed, put what do all of you buy/use for the curved track.



Sorry to hear about your wife Ken, my condolences.


As far as curved cork, you use the straight stuff, you just curve it.  Also, when you're laying cork, stagger the two sides so the butt seams don't fall together.  You can pin it down in position while you wait for glue to dry.  I just run a bead of white glue along the outside edge, this allows you to reuse the cork if you decide you want to change some of the track.  Once the glue dries, you can remove the pins.

I'm thinking of the Midwest Products cork roadbed, it has tapered sides and is already split in half.  When you get it, you have to just pull the two halves apart, as the tapered cut is inside when shipped.


No "trick" to making the curves, you just lay it on the table and bend it into the proper shape.  It doesn't split.  Having the roadbed in two pieces makes it more flexible.


Here's what it looks like when it's split and the tapered sides are on the outside.


As an added note: IR sensors work fine for train detection and I have a large number of these in my layout. Another form of detection to consider is magnetic. A reed relay under the track or placed along side the track with a small magnet placed on the loco or a car will also work and doesn't have that ambient light issue. I've used this form also and it is virtually flawless.

Hi all. Back from the flu--great way to spend the holidays.


Well I have now received all of the parts from Stan's pictorial schematic referenced in the above post. I connected everything together with the exception of the relay. I tried out the detection circuit to that point monitoring the output of the IR Module and it works. I have not separated the emitter and sensor (to sit across the track from each other) yet, but first a question for Stan. I could drag out my old EE books(and probably still not get it right), but instead could you tell me where to put the capacitor in the relay circuit to provide a time delay for the relay opening. By the way, I did buy the parts from an Asian company, and although some of the deliveries took a while, the prices are great and everything seems to work.


Once I get it all together and working, I will take some pics and provide more detailed info on parts, suppliers, and connections for anyone else interested.


Again, Stan, thank you so much for steering me in the right direction, and for all of your help.





The flash rate is determined by the capacitors and the current rating of the bulbs.  You can change it by changing either parameter.


A 555 would work fine as well, but if you want incandescent bulbs, I'd be thinking of driver transistors for the bulbs.  Lots of examples on the web, here's one:


thanks John , i have a wole book of just 555 timer circuits and there applications.

Boy isn't it amazing how useful the internet is i  finding anything! so whats up for the weekend? Want to come up sometime and see your guys layout!



Thanks for the boards, going to experiment and make my own test rig, i have spare motors and connector harnesses i found to power up the boards weather it be 5 volt board or 3 volt boards!


Originally Posted by ken's trains:
 I could drag out my old EE books(and probably still not get it right), but instead could you tell me where to put the capacitor in the relay circuit to provide a time delay for the relay opening.

Unfortunately there's no simple answer as it depends on which relay module you have.  The basic concept is the capacitor is charged quickly when the trigger signal is present...and then the capacitor slowly discharges holding the relay closed when the trigger signal is absent.  That's nothing new or profound.  What's new is these $1 eBay modules have a transistor driver so the current it takes to drive the relay is, say, 50 times less than if you drive the coil directly.  That means for the same capacitor you can hold the relay that much longer.  Without the transistor you'd see holding capacitors in the thousands or tens of thousands of microfarads to achieve a few seconds of hold time.  These capacitors were bulky and expensive.


So by have a DC power supply available to power the modules, the control signals to activate the relays in these eBay modules are now, say, 1 milliamp or even less rather than the tens of milliamps to directly drive relay coils.  This is techno-babble to the non-enthusiast but that's what's going on.



Originally Posted by ken's trains:
... have you come up with a circuit that will operate the 2-light flashing RR crossing signal.

I've got to believe there are many companies that sell circuits to drive a crossing flasher.  And GRJ gave some links to circuits if you want to build from the component level.  That said, here's one alternative not so much as a recommendation but as a way to approach the problem using these insanely priced eBay module.  A timer module (about $1.50 free shipping) generates a slow speed pulse signal.  The pulse drives a relay module (about $1 free shipping) that has an SPDT style relay.  The relay has 10 Amp contacts so obviously overkill but 1-2-3-done. 


ogr corssing flasher lego style


Images (1)
  • ogr corssing flasher lego style
Videos (1)
ogr crossing flasher lego style



Stan & John you are the best. I will give all of your suggestions and references a thorough review and let you know what approach I will try and the result. Stan, I did buy the Asian relay modules and a pack of various size caps so I can experiment.


Unfortunately today the love of my life (my dog) got very sick and I have spent the day at the vet and the evening caring for her.


Thanks much for all of your help.



Hi Stan,


I have the relay module you had shown in your picture schematic (the one from the Asian comp). Problem is that looking at the schematic that's shown on ebay for that module, I can't figure where to put the cap. I can't determine if it should go on the 'trigger' side or the 'relay closure' side. And the optical isolation has me a lot lost. My 2 concerns are:

 - If I put the cap across the wrong terminals (with no resistance to limit the current--cap is a short at switch closure), I could burn something up

 - Once I know where to put the cap, does it have to be electrolytic (been a long time since I did this stuff and don't remember if discharge direction is critical--isn't that why you use/don't use electrolytics--boy I've forgotten more than I ever learned)





I assume you are referring to the 5V relay module?  I don't have one but the one I linked to in the other thread shows the following schematic.  Unfortunately with many of these low-cost eBay modules some detective work is needed.  For example, can you look at the board and confirm that R4 is indeed the missing part shown in the photo below?  You should be able to visually trace the printed wires which are kind of fuzzy in the photo so I can't tell.


ogr ebay relay module missing resistor

Anyway, the idea is a capacitor in the polarity indicated gets charged by the external triggering source.  For experimentation purposes don't worry about the short-circuit from a pushbutton switch to charge up the capacitor.  As discussed earlier the concept is the capacitor discharges into the ISO1 optoisolator input.  The ISO1 output drives the relay transistor Q1 which provides current gain so that rather than requiring 100 mA (or so) to drive the coil, the control input only needs to provide a milliamp or so of current.  If experimenting you should be able to see LED D1 on bright when the control input is present, then as the control input is removed and the capacitor decays, D1 too will decay in brightness and at some point the relay will release.


The "fun" comes in when you fiddle with the circuit.  To extend the hold time, of course you can always add capacitance but that's the brute force method.  The input is such that you can really apply 12V (DC) if you have that present.  That means the capacitor charges up higher and will take longer to decay...adding hold time for the same capacitance.  Or you can add a resistor (say, 1K) between the capacitor and the module input to slow the discharge while still providing sufficent current to drive ISO1.  Or you can add a 10 cent transistor to increase the impedance that the capacitor sees thereby discharging even more slowly.  Or you can find a soild-state time-delay module on eBay to perform the delay digitally.  And so on.  Again, all this is for the DIY hobbyist who likes to tinker at the component level to keep the gray cells active in retirement .


Oh, and the wiring diagram is incorrect on the eBay listing I looked at.  "VCC" should go to the positive supply.


ogr ebay relay module wiring diagram wrong


But let me second-guess something.  One reason a time-delay is needed in signaling and crossing circuits is to insure the train passes thru the controlled area before the signal switches color or the gates go up.  But as we know, if a train passes an ITAD and simply stop right after, the timer will time out and the signal or crossing gates will change incorrectly after the time delay.  So the solution (in some cases) is to use two ITADs wired "in parallel" and require the train length to be long enough to straddle the two ITADs.  If this is done then no delay is required for the signal/crossing circuit to operate "properly".


So another part of the fun when you fiddle with these IR components is to observe that IR detectors (phototransistors) can be wired in series or parallel to perform basic logic functions such as "AND" and "OR".  For example, if you put two photodetectors in parallel, then if IR energy hits EITHER detector then current flows and the eBay module trips.  OTOH if you put two photodetectors in series, then as long as IR energy hits BOTH detectors then the module trips...but if either detector is blocked then the module releases.  Obviously you'd choose the right "logic" depending on whether you are using a reflective (as most ITADs do) or transmissive (across the track) detection scheme.   The point is this kind of fiddling can eliminate the need for a time-delay in the first place...and/or can save even more money as just adding a few 10 cent IR emitters and detectors can replace multiple ITAD/153IR devices!



Images (2)
  • ogr ebay relay module wiring diagram wrong
  • ogr ebay relay module missing resistor
Originally Posted by ENichter:

I tried to find these on ebay but must be searching wrong? do you have a link or part number to help me find it?

Hmm.  The eBay timer module shown in the photo is one which I had to modify because they manufactured it incorrectly (subject of another thread but it's another story).  You can find timer modules on eBay using search phrases like "NE555 module".  I'm reluctant to post a link because that's what I did for the posted timer module and I felt bad that another forumite ordered it so I modified them for him (amazing since thousands have been sold according to eBay, they don't work as advertised, and they're still for sale from several sellers!).  I don't know what you're doing but obviously look for one that has a timing/frequency range that fits your needs.


The relay modules can be found with search phrases like "arduino relay module".  Again, it depends on what you're doing but these relay modules with 1,2,4,8,16, etc. on one board and you can get the cost/relay down below $1 with the multiple relays.


My intent was to discuss these insanely priced modules on eBay which allow a kind-of Lego style building block assembly of electronic functionality for O-gauge layouts.  If your intent was for crossing flashers, for a bit more money (but still what I call insanely priced) I hooked up the following $8 eBay timer module to implement the same crossing flasher functionality but this takes only one module so less wiring.  I can recommend this one as it was discussed in another thread and some other guys have actually used it too.  It allows amazing digital precision of timing functionality such as have the crossing lights alternate at exactly 0.99 seconds instead of 1.00 seconds (if that's what you want!).;hash=item19f7d39aba



ogr ebay cycle timer module as crossing flasher


Images (1)
  • ogr ebay cycle timer module as crossing flasher
Videos (1)
ogr ebay cycle timer module as crossing flasher



My module appears to be the one shown in your picture, but I could not visually verify the missing resistor due to the 4-pin chip covering the trace from the IN pin. I did however verify that IN goes to the spot you highlighted using my ohmmeter. So does that mean the 1K resistor is not necessary? The trace under the black chip also goes to a pin on the black chip (ID on the chip is FL 817C, F409--would that be the opto-isolator device?). Based on your suggestions, I will try different value caps on IN-Grd and see what happens. And yes I did buy an AC/DC Power Supply (for train application) so I can also play with VCC and the trigger voltage.


Again, can't thank you enough. I will let you know how it goes.



The resistor R4 (1K) is definitely not necessary and actually defeats the purpose of the optoisolator ISO1...but that's another story.  I've come to be suspicious of these eBay listings and you get useless (IMO) replies if you ask many eBay sellers anything technical.


Again, I don't have your particular module in front of me (I ordered one but who knows when it will get here!).  So I hooked up an eBay 12V relay module I have with a similar input circuit (uses the same 817 optoisolator chip).  The video below shows the basic function with a pushbutton providing the input.  The relay instantly turns on/off (watch the red LED on the relay module) following the pushbutton.


Then I put a 100uF capacitor between IN1 and ground.  It creates a delay of a few seconds. Then I put a simple transistor buffer using a 2N3904 NPN transistor and a 10K resistor as shown in the following schematic.  If you're dusting off your EE textbook this is a basic emitter-follower transistor buffer.  Now, the load on the capacitor is so small that a original 100uF capacitor created a a ridiculously long delay (several minutes).  So I used a 10uF capacitor and got a delay of about 30 seconds which is still probably too much for any practical signal/crossing-gate time delay but you get the idea.


The 2N3904 is possibly the most common transistor ever made, produced by the gazillions and available for about 2 cents on eBay.  The point is you don't have to thin your wallet if this kind of tinkering is what makes the hobby fun for you.


ogr relay module with input npn buffer cap

ogr ebay relay module npn buffer



Images (2)
  • ogr relay module with input npn buffer cap
  • ogr ebay relay module npn buffer
Videos (1)
ogr capacitor delay ebay relay module



Thank you, that helps. By the way, I took a course in Transistor electronics in 1963 and didn't do well then---so this may be wasted on me. I understand in principle, but all the EE courses were theory and not of much design/practical use. One example is me pulling out my Basic Electric Circuit Theory book from 1962 wherein I read that the instantaneous response to a switch closure in a DC capacitive circuit is a short circuit followed by a current decay to zero followed by a lot of math. That was my concern with no resistance in the circuit to ground. But on further reading, my book explained the examples to be ideal conditions vs. real world (i.e. no resistance in the circuit).


Oh well, too many years and I never used much of it in my career, That is why your help is sooooo much appreciated. I have a bunch of cap's and will play.


By the way, I cannot play any of your videos. They are in an ".swf" format not recognized by the several players I have nor by my video conversion program????



Add Reply


OGR Publishing, Inc., 1310 Eastside Centre Ct, Suite 6, Mountain Home, AR 72653
800-980-OGRR (6477)

Link copied to your clipboard.