Trains.com

Subscriber & Member Login

Login, or register today to interact in our online community, comment on articles, receive our newsletter, manage your account online and more!

Inexpensive infrared train detector circuit

32235 views
33 replies
1 rating 2 rating 3 rating 4 rating 5 rating
  • Member since
    July 2006
  • From: Bradford, Ontario
  • 15,797 posts
Inexpensive infrared train detector circuit
Posted by hon30critter on Friday, January 11, 2013 2:08 AM

I posted this recently on another thread about train detection, but I thought it might be good to bring direct attention to it be starting a thread all on its own.

This is a very inexpensive infrared train detector which will work with the layout room lights either on or off. In its basic form it is limited in what it can do. For example, there is no delay mechanism so the detector will turn on and off as each car rolls over it. Adding delay circuitry is beyond my comprehension but perhaps someone with a better knowledge of electronics could contribute that sort of additional information. It is also only capable of powering an LED, but I'm sure a relay could be added.

I must state a couple of qualifications: First, I have only used this circuit in test mode because I don't have a layout to try it on. However, I have built three of the sensors and they all work. They will consistantly detect at about 1 1/2".

Second, I have no clue about where I got this circuit from so I cannot give proper credit to the designer.

Here is the schematic and Digi-Key parts list. I think you can use pretty much any LED you choose:

EDIT August 3, 2013. Two key items in the above diagram have become obsolete: For QSC112-ND, use 160-1030-ND or QSD123-ND. Bob Frey whom designed the circuit recommends the 160-1030-ND but either will work. For QEC113-ND, use 754-1600-ND. All parts numbers are Digi-Key.

Here is one of the test circuits, as well as the test track. The tubes in the test track holes are heat shrink tubing:

There are two sensitive bits to observe. One is that the phototransistor (LED infrared detector) must be shielded with heat shrink tubing so only the very tip of the detector is exposed. Second is that you will need a filtered 12V DC power source. When I tried the detectors on an old train set power pack they did not work reliably.

As I said in the other thread, I am an electronic dunce. The fact that I got three of these circuits to work consistently shocked the heck out of me! If I can do it, anybody can!

Now, if someone could add a delay component and perhaps a relay, we would be off to the races! And in economy class to boot!

Dave

I'm just a dude with a bad back having a lot of fun with model trains, and finally building a layout!

  • Member since
    December 2004
  • From: Pa.
  • 3,361 posts
Posted by DigitalGriffin on Friday, January 11, 2013 9:39 PM

Interesting circuit, but it labels +12V and -12V as the primary feeds. That would imply a balanced power supply.  I think the -12V is supposed to be ground/common to battery.

Don - Specializing in layout DC->DCC conversions

Modeling C&O transition era and steel industries There's Nothing Like Big Steam!

  • Member since
    July 2006
  • From: Bradford, Ontario
  • 15,797 posts
Posted by hon30critter on Friday, January 11, 2013 10:00 PM

Digitalgriffen:

I was using a 12V power supply so all I was trying to show was which way the leads were connected. Like I said, I am no expert in this stuff so I apologize if I have labelled the drawing incorrectly. All I know is that the circuit works and the price is right.

Dave

I'm just a dude with a bad back having a lot of fun with model trains, and finally building a layout!

  • Member since
    September 2003
  • 10,582 posts
Posted by mlehman on Saturday, January 12, 2013 1:11 AM

Dave,

I may have to try one of these. I need just very basic detection, something to tell me -- Am I clear of a point needed to provide room to turn a train on a wye without bumping the train staged on what is effectively the wye's tail track? Looks like I may be able to find parts at Radio Shack. Will post 'em if I have any luck.

Mike Lehman

Urbana, IL

  • Member since
    July 2006
  • From: Bradford, Ontario
  • 15,797 posts
Posted by hon30critter on Saturday, January 12, 2013 2:37 AM

Mike:

I got the parts from Digi-Key but that adds a shipping charge to the cost. For me (in Canada) the Digi-Key shipping charge is a bargain ($8.00 CDN to the door usually the next day - incredible service!). I hope that Radio Shack can supply the parts for you. I don't think there is anything wildly unusual required. As I have said before, you will need a filtered 12V power supply. If you don't have one then you should consider the small investment required as a good use of funds because you will be able to use the power supply to run a bunch of other circuits. The draw from the detector is peanuts.

What I didn't include in the cost for the test circuit was the circuit board, but that is not a necessary component. You can build the whole thing and just use a bit of heat shrink tubing to separate the bits.

Good luck. Thank you for your interest.

Please do let us know if the circuit works for you. All the commercial stuff is way more expensive (granted they also have more features) but I think this is a gem that will suit many people.

Dave

I'm just a dude with a bad back having a lot of fun with model trains, and finally building a layout!

  • Member since
    September 2003
  • 10,582 posts
Posted by mlehman on Saturday, January 12, 2013 7:35 AM

Dave,

By filtered DC, I assume that's the same as a regulated DC source?

BTW, I also wonder about operation at voltages lower than 12 volts, although that something I know I'll need to experiment with. Maybe one of our electronic gurus has a suggestion about that>

Mike Lehman

Urbana, IL

  • Member since
    July 2006
  • From: Pittsburgh, PA
  • 1,796 posts
Posted by JoeinPA on Saturday, January 12, 2013 9:09 AM

mlehman

By filtered DC, I assume that's the same as a regulated DC source?

A regulated supply would be filtered. However, a filtered supply wouldn't have to be a regulated supply. Filtering means that a suitable capacitor has been added after the diode(s) to smooth out the DC. A simple AC transformer-diode bridge-capacitor circuit would be an example of a filtered, non-regulated supply.

Joe

  • Member since
    February 2002
  • From: Reading, PA
  • 30,002 posts
Posted by rrinker on Saturday, January 12, 2013 12:21 PM

 The voltgae would have to be around 12V, give or take a little bit, so regulated may not be needed. To operate on a completely different cupply voltage, like a 9V DC supply, the values of the resistors would need to be changed. I calculated my last transistor circuit more than 25 years ago so off the top of my head I don't know what those values would be. Heck, 9V might even work as-is, but not any lower - testing a lower voltage to see if it works won't damage anything, just don't test OVER 12V. Worst that can happen if the voltage is too low is either it won;t light the LED or it will always stay lighted. Much lower than 9V and definitely that 680 ohm resistor connected to the LED will need to be reduced.

                     --Randy


Modeling the Reading Railroad in the 1950's

 

Visit my web site at www.readingeastpenn.com for construction updates, DCC Info, and more.

  • Member since
    July 2006
  • From: Bradford, Ontario
  • 15,797 posts
Posted by hon30critter on Saturday, January 12, 2013 7:05 PM

Randy and others:

I have actually tested the circuit at about 9.1 volts and it works fine.

Dave

I'm just a dude with a bad back having a lot of fun with model trains, and finally building a layout!

  • Member since
    July 2009
  • From: lavale, md
  • 4,678 posts
Posted by gregc on Sunday, January 13, 2013 5:10 PM

while i'm sure the circuit works as tested, i have to ask if the load driven by the circuit shouldn't be more conventionally on the collector side instead of the emitter side if the darlington pair?

the circuit on the left in the drawing below is what i believe is the circuit as proposed.   I suggest that a more conventional approach would be the circuit on the right.    One issue is the the load voltage, the LED/resistor in the drawing but possibly a relay, affects the voltage across the 220k bias resistor in the photo-transistor path.  I believe the circuit on the right makes the photo-transistor path independent of the load.

however, i can see the need for some hysteresis, to partially latch the circuit on or off, which the proposed circuit may provide, but which i don't understand.

greg

greg - Philadelphia & Reading / Reading

  • Member since
    July 2006
  • From: Bradford, Ontario
  • 15,797 posts
Posted by hon30critter on Sunday, January 13, 2013 10:36 PM

GREGC:

Thanks for your input.

I think I understand what you are suggesting, but let me see if I have it right:

In the original design the position of the red LED/ 680ohm resistor (would this be called the load?) influences the amount of power going through the sensor/transistor part of the circuit. If a different load was applied, i.e. the LED/resistor was replaced by a relay, the sensor/transistor might not work properly.

In your revised circuit, the load (please pardon me if my terminology is not correct) will not affect the sensing function, assuming it is within the limits of the power available and within the transistors's load range.

In other words, different devices could be powered using your circuit - yes? no? For example, could I use this with a latching relay to throw a turnout?

Thanks.

Dave

I'm just a dude with a bad back having a lot of fun with model trains, and finally building a layout!

  • Member since
    February 2002
  • From: Reading, PA
  • 30,002 posts
Posted by rrinker on Monday, January 14, 2013 6:02 AM

 The way Greg redrew it, you could even thoeretically use a different power supply for the load. A latching relay though, well, you'd need something else to turn it off. Any load within the current capacity of that Darlington transistor would be fine though. If the load is inductive, like a relay coil, it should have a regualr diode paralleled across the coil to prevent the inductive kickback when it releases from causing a damaging voltage spike in the transistor.

 You COULD rig a latching relay with a normally closed button to make an auto-stop for a hidden siding - when the sendor is covered, the relay trips and cuts track power. To get the train back out, you press the button to cut the relay power until the train has moved enough that the sensor is no longer blocked. As long as the sensor is far enough away from the bumper so that the coupler doesn;t hit before the carbody blocks the sensor, and you don;t barrel into the siding at warp speed, it should easily stop without crashing.

                        --Randy

 


Modeling the Reading Railroad in the 1950's

 

Visit my web site at www.readingeastpenn.com for construction updates, DCC Info, and more.

  • Member since
    July 2009
  • From: lavale, md
  • 4,678 posts
Posted by gregc on Monday, January 14, 2013 4:02 PM

dave

yes.  i believe you understand the point i was trying to make.   and Randy made some very good points.  But i'd like to make 2 additional points:

1) don't know if you understand how transistors work.  The base-emitter (BE) path, the one with the arrow has characteristics of a diode.  if the voltage across the BE is greater than a diode drop, ~0.7 volts, the transistor begins conducting.   In the Darlington case, there are two diode drops, so the voltage at the base of the darlington, the lead on the left side of the circle, needs to be above ~1.4 volts.  The 220k resistor is pulling that voltage down and the photo-transistor is pulling up when active.

one question is how distinct is the voltage change at the base of the darlington when there is light or no light?  This determines how reliable it switches, and this may be why the load, the LED and resistor, are where they are.  but i don't think so.  It would be nice if the light level needed to be a little higher to turn the circuit on than it needs to be to turn it off (hysterisis).

2) the circuit is active, the darlington is conducting, when the photo-transistor is active, hence when the light path is not broken.  This may not be desired, it may be more convenient to to have something pass current when the light path is broken by the presence of a car.

another approach is to swap the  positions of the photo-transistor and 220k resistor.   This way the photo-transistor actually turns the darlington off instead of on.  This way the the circuit become active when a car is present.

greg

greg - Philadelphia & Reading / Reading

  • Member since
    February 2002
  • From: Reading, PA
  • 30,002 posts
Posted by rrinker on Monday, January 14, 2013 5:12 PM

 Actually a good "how do they work" was in MR back in the early 60's, an article by Linn Wescott, of course. Naturally it was all about Germanium tranistors, but the principle is the same. Or there are tons of web pages, even the Wikipedia article, if you really want to learn a little about this stuff.

 I think that also fairly simple circuit from MR a while ago (correction posted here - as drawn int he magazine it was wrong) is the opposite type - turns on the load when the bean is broken, vs this one that turns off the load when the beam is broken. Or check out Rob Paisley's site, he's got a million of them. Don;t discount some of the ones that on the surface appear more complicated because they use an IC - some of those eng up with 2 or 4 detectors from just one IC - in the long run even cheaper than these simple transistor circuits.

                 --Randy

 


Modeling the Reading Railroad in the 1950's

 

Visit my web site at www.readingeastpenn.com for construction updates, DCC Info, and more.

  • Member since
    October 2006
  • From: Western, MA
  • 8,571 posts
Posted by richg1998 on Monday, January 14, 2013 5:55 PM

Store this link and look around. There may be some ideas that may apply to this project. He has a lot of model railroad projects.

http://home.cogeco.ca/~rpaisley4/CircuitIndex.html#top

Rich

If you ever fall over in public, pick yourself up and say “sorry it’s been a while since I inhabited a body.” And just walk away.

  • Member since
    July 2006
  • From: Bradford, Ontario
  • 15,797 posts
Posted by hon30critter on Monday, January 14, 2013 6:08 PM

Thanks Rich:

I have had Mr. Paisley's link stored for years. Great stuff!

I built some of his circuits for double coil switch machines and they work well with the proper power supply.

Dave

I'm just a dude with a bad back having a lot of fun with model trains, and finally building a layout!

  • Member since
    October 2006
  • From: Western, MA
  • 8,571 posts
Posted by richg1998 on Monday, January 14, 2013 6:15 PM

hon30critter

Thanks Rich:

I have had Mr. Paisley's link stored for years. Great stuff!

I built some of his circuits for double coil switch machines and they work well with the proper power supply.

Dave

Yeah, same here. I love his DCC amp meter for use with a cheap Harbor Freight multimeter. I built two of them and they have paid off. Quite well.

Rich

If you ever fall over in public, pick yourself up and say “sorry it’s been a while since I inhabited a body.” And just walk away.

  • Member since
    February 2002
  • From: Reading, PA
  • 30,002 posts
Posted by rrinker on Monday, January 14, 2013 8:11 PM

 I may build some of those, but get some panel mount meters, cheaper than a RRampmeter. Depends on where I end up before building my 'dream' layout - depending on the room size and track plan it will probably make more sense to distribute boosters around the layout than have long heavy bus runs from some central power panel. Master power panel with meters and stuff would look cool though.

             --Randy

 


Modeling the Reading Railroad in the 1950's

 

Visit my web site at www.readingeastpenn.com for construction updates, DCC Info, and more.

  • Member since
    July 2006
  • From: Bradford, Ontario
  • 15,797 posts
Posted by hon30critter on Saturday, February 2, 2013 1:59 AM

I am bumping this thread in the simple hope that a few fellow model railroaders who have not seen it might be interested.

If the bump is inappropriate, please let me know. Thanks Dave

I'm just a dude with a bad back having a lot of fun with model trains, and finally building a layout!

  • Member since
    August 2006
  • From: Greendale, WI
  • 108 posts
Posted by Robert Frey on Monday, February 4, 2013 7:26 PM

Dave,

I removed this information because ALL my IR circuit links use Obsolete IR Parts. I need to update these links someday with "New" IR parts.

For “New” IR parts visit:

http://cs.trains.com/mrr/f/744/t/219552.aspx

Bob Frey

Website: http://bobfrey.auclair.com

  • Member since
    July 2006
  • From: Bradford, Ontario
  • 15,797 posts
Posted by hon30critter on Monday, February 4, 2013 7:56 PM

Bob:

Thanks very much for your valuable contributions to the thread!

In fact, I have to give you credit for the original circuit that I started the thread with. I couldn't remember where I got it from but as soon as I saw your diagram I recognized it immediately.

EDIT:

I just realized that the original circuit was published in an article by you in MR in October 2009, with some corrections made to the published diagram in a later issue.

I hope that I have not broken any rules by posting your design.

Dave

I'm just a dude with a bad back having a lot of fun with model trains, and finally building a layout!

  • Member since
    August 2006
  • From: Greendale, WI
  • 108 posts
Posted by Robert Frey on Tuesday, February 5, 2013 10:10 PM

Dave:

I removed this information because ALL my IR circuit links use Obsolete IR Parts. I need to update these links someday with "New" IR parts.

For “New” IR parts visit:

http://cs.trains.com/mrr/f/744/t/219552.aspx

Bob Frey

Website: http://bobfrey.auclair.com

  • Member since
    July 2004
  • From: Huntley, IL
  • 250 posts
Posted by kenkal on Friday, February 8, 2013 12:27 AM

hon30critter
They will consistantly detect at about 1 1/2".

I would be very surprised if all it can detect is within that short of a distance.  Have you tried mounting and stagerring along the outside of the track the emitter and receptor so that they would not see the gap between cars? The first car would break the beam and it wouldn't see a space again until a very short car or the end of the train is detected.   Just be sure the they are correctly aligned and you should get more than 1.5" operating area.  Ken                      

        emitter
           O
HHHHHH   HHHHHHHHHHH
 O
receptor
Huntley, IL
  • Member since
    July 2006
  • From: Bradford, Ontario
  • 15,797 posts
Posted by hon30critter on Friday, February 8, 2013 5:10 PM

Ken:

Thank you for pointing out another possible arrangement for the detector system. In fact, it would make more sense to mount the detector as you suggest in areas like hidden staging where the detectors don't need to be hidden.

I was more interested in finding something that could be easily hidden and used to control visible turnouts, hence the between the track setup. The circuit as shown won't do that all by itself. A relay would have to be added to deal with the voltage required for the turnout motor. When I get that far I will post a diagram with the added components. Maybe one of the electronic gurus (which I am definately not) could beat me to it.

I haven't tried them in the across track configuration that you suggest but I know you are right because I did test the detector with the emitter/receptor facing each other several inches apart. The 1 1/2" distance I gave was with the emitter and receptor mounted side by side with heat shrink tubing used to reduce the angle of detection on the receptor. 

Thanks for your input.

Dave

 

I'm just a dude with a bad back having a lot of fun with model trains, and finally building a layout!

  • Member since
    July 2006
  • From: Bradford, Ontario
  • 15,797 posts
Posted by hon30critter on Wednesday, February 13, 2013 9:35 PM

Ken:

I did a rough test of your suggestion about mounting the detection circuit across the track on an angle to the cars.

With 12V supplied the detector worked with up to about nine inches between the emitter and receptor. However, there was a lot of interference from the light in my workshop. The receptor had to be shielded for about two inches from its tip towards the emitter, and the lights on my workbench had to be turned off, leaving only the 60 watt pot lights in the ceiling. That is not nearly enough light for daytime operations.

I then tested the detector at 9.2V. The detection distance was only reduced by about one inch, but the amount of interference was reduced fairly significantly. The receptor still required additional shielding.

I don't recall having a problem with interference from room light when I tested the detector mounted between the rails using reflected IF instead of direct. I will test that again and let you know what I find.

My conclusion is that the circuit may be too simple for use across the track where it is exposed to normal ambient light. Also, it would likely only be good for single track applications unless the components were mounted very close to the track.

It still looks like a cost effective method for detection in hidden (shaded) staging.

Dave

I'm just a dude with a bad back having a lot of fun with model trains, and finally building a layout!

  • Member since
    July 2006
  • From: Bradford, Ontario
  • 15,797 posts
Posted by hon30critter on Wednesday, February 13, 2013 11:23 PM

Ok - Its Dave again (hope you're not getting bored!)

I tested the detector again with it mounted between the rails so the IF reflects off of the bottom of the cars. The receptor was shielded with heat shrink tubing so that the tip of the receptor was about 5/16" below the bottoms of the ties and the heat shrink extended up to the bottom of the ties. I used a 1/16" drill bit inserted into the open end of the heat shrink touching the receptor tip to control the shrinkage.

Under normal lighting on my work bench the detector worked fine. My 'normal' lighting consists of two desk lamps with 23 watt compact florescent bulbs, a third desk lamp with a 50 watt halogen bulb and four 60 watt incandescent pot lights in the ceiling over the workbench.

I then held the detector within five inches of one of the compact florescents and there was no interference. Next I held the detector within five inches of the 50 watt halogen and the detector light did come on indicating interference. There is a lot of light at five inches from a halogen bulb, certainly more than would be on the surface of a layout.

I also experimented with different lengths of shielding in front of the receptor. At 3/4" nothing worked. At 1/8" there was a lot of interference. 5/16" seemed to work the best.

Obviously everyones' layout lighting will be different so you will have to play with the shielding to get the best performance.

Dave

I'm just a dude with a bad back having a lot of fun with model trains, and finally building a layout!

  • Member since
    July 2013
  • 9 posts
Posted by dadstruck on Saturday, July 27, 2013 11:51 PM

Hi Dave

I have tried constructing the circuit the way it is in the diagram. I purchased my parts from Digikey, the photo receiver and infared that are listing on the sheet are no longer available. They shipped a cross referenced units. I have the shrink wrap on the photo cell 2" long. My problem is that the led stayed on all the time until I turned out all the light in the room.  When I moved the infared diode to the end of the shrink tubing on the photo receiver the led will not come on. Any suggestions.  I have a basic knowledge of electronics from years back.

I like the circuit and how it should work is ideal for where I need it.

Phil 

  • Member since
    July 2003
  • From: Sierra Vista, Arizona
  • 13,757 posts
Posted by cacole on Sunday, July 28, 2013 8:09 AM

dadstruck

I purchased my parts from Digikey, the photo receiver and infared that are listing on the sheet are no longer available. They shipped a cross referenced units. I have the shrink wrap on the photo cell 2" long. My problem is that the led stayed on all the time until I turned out all the light in the room.

Phil 

Possible problems --
1.  Digikey sent you a photocell that will detect not only infrared but also visible light.  That would explain why your room lighting had an effect on it.
2.  This is a very basic, reflective infrared emitter/detector pair.  The emitter and detector should be mounted at a slight angle to each other so the reflected light will fall onto the detector instead of being reflected straight back to the emitter.
3.  Circuits of this type usually require that the detected object be very smooth and highly reflective material in order to properly reflect the IR beam onto the detector.
4.  You may have the Darlington pair wired backwards.  Double check the polarity of your IR emitter and the Darlington pair.
  • Member since
    July 2009
  • From: lavale, md
  • 4,678 posts
Posted by gregc on Sunday, July 28, 2013 3:43 PM

i believe these symptoms could be explained by the transistor receiver being too sensitive and/or the LED emitter not bright (how would you tell) enough.

the transistor/receiver can be made less sensitive to room lighting by reducing the resistor value in series with the photo transistor.  A pot may make things easily adjustable.

the LED intensity can be increased by reducing the resistor value in series with it.   There should be a spec for the LED max current.   pick the resistor that give that value for the applied voltage.

somewhere, there is a good combination.   shadowing the photo-transistor can also help

greg - Philadelphia & Reading / Reading

  • Member since
    July 2006
  • From: Bradford, Ontario
  • 15,797 posts
Posted by hon30critter on Sunday, July 28, 2013 8:17 PM

cacole and gregc:

Thanks for responding. You know way more about this stuff than I do.

I did test the circuit on an actual piece of track with rolling stock and it seemed to work fine.

Phil:

You might want to contact Robert Frey who is the original designer of the circuit. If you scroll up the thread you will see a couple of posts by him. I am disappointed to hear that the specific components are discontinued. That makes things harder.

Dave

I'm just a dude with a bad back having a lot of fun with model trains, and finally building a layout!

Subscriber & Member Login

Login, or register today to interact in our online community, comment on articles, receive our newsletter, manage your account online and more!

Users Online

There are no community member online

Search the Community

ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT
Model Railroader Newsletter See all
Sign up for our FREE e-newsletter and get model railroad news in your inbox!