Advertisement
infrared model train detector schematic

Infrared Model Train Detector

This simple and economical IR model train detector circuit is intended especially for those hobbyists who wish to add a smart sensor to detect trains on their model railway track. As can be seen in the schematic diagram, it comprises of a simple infrared transmitter and receiver wired around the good old PLL Tone Decoder LM567(IC1). It has a working range of around 10 to 50 cm. Output of the detector is galvanically isolated with the help of a standard opto-coupler CNY18-2 (IC2), which can be suitably interfaced to any external circuit for further processing task(s).

Schematic of the Model Train Detector Circuit

infrared model train detector schematic

Working of the circuit is straight forward. When light from Infrared sender (D1) is relected by the wagon of the model train, IC1 through Infrared photo sensor (D2) receives the recovered signal at its input point (pin3). If PLL (IC1) is locked, its output (at pin8) drops low, thus disabling the optocoupler IC2 for the specific time and this process repeats based on the number of wagons.

Infrared componets D1 and D2 should be mounted such that D2 can only pick up reflected light. When a train passes, the infrared light is reflected at certain intervals, which produces a sort of ‘pulse code’ for the train. Using an external circuit connected through IC2, it is possible to distinguish various model trains from each other using the pulse code! The choice of D1 and D2 is not very critical, but they must be band compatible. Operating point of the detector is dependent on refleted light levels and value of the resistor R2 (here 22K) may need to be ‘tuned’ for optimum performance.

IR sensor mounting plan

ir senson mounting plan

17 Comments

Join the conversation!

Error! Please fill all fields.
  • jeffmonoptusnet-com-au

    Hi TravisC.

    The circuit of the IR sensors as shown is a good general purpose sensor. However as I pointed out to TK Hareendran it does have a little problem. The output is noisey. Apart from being annoying, to do what you want the output should be filtered. D3 is also not necessary and C4 should be a 2.2 uF. This narrows down the capture range. Filtering the output will stop the noise and give a nice clean digital output. (On or off) I don’t know the type of flasher circuit you are using but I assume that it will not like noise.

    I hope this helps.

    Cheers – Jeff Monegal

    • jeffmonoptusnet-com-au

      Hi TravisC

      About 12 months ago I published a circuit that has none of the problems mentioned and was designed almost 3 years ago. So far many 1000’s have been built. It was published in the Model Railways in Australia. The same sensor was published in the Silicon Chip electronics magazine.

      If you think you are capable of building this sensor then you can log on to the http://www.siliconchip.com.au and a search for Automatic Points Controller. This project uses 2 of these sensors. Alternatively log onto modelrailwaysinaustralia.com.au ans search for the article on sensors.

      We used to sell the sensors built ready to go but demand has dropped off and we no longer sell them. If you really have no luck then email me and I may be able to supply a circuit.

      Also please note that the circuit published here is certainly credit worthy and I congratulate T K Hareendran for his efforts.

      Cheers – Jeff

    • TravisC

      You statement below about noise and stuff is all a foriegn to me. Way over my head. So I guess I will just forget it until I can find one already made that I know will work.

      Thanks
      TravisC

    • jeffmonoptusnet-com-au

      Hi

      Perhaps I should have been a bit clearer in my statement. The output noise is not a function of the sensor itself. If the input is a clean on/off then so will the output. However when a wagon is passing the sensor the under car bits will make the output noisey. When I say noisey I mean multiple pulses. The 567 responds instantly ( figuratively speaking) so the multiple reflections from various bits of equipment under carriages will make the output follow the multiple reflections. A filter will make the sensor give 1 pulse per carriage.

      I too tested several sensors and found as many as 12 pulses for a long passenger coach. The pulses were all fairly clean but you need 1 pulse per carriage not 1 pulse per reflection. In a system that counts carriages 12 pulses for a single coach is definately bad.

      The output of a 567 is an open collector to ground so the diode does absolutly nothing. In some extreme cases the diode can actually prevent the opto coupler from switching off. The output transistors in some lower quality 567 chips do not pull the output pin all the way to ground. I have seen as high as 1 volt. Add the .7 volt of the diode and you have the situation when some opto couplers may not switch off.

      Believe me when I say you are better off inverting the output using another transistor and switching off the opto this way. This also let’s you then add a bit of capacitance to filter the output.

      I have also just noticed you have used a pull up resistor in the base of t1. Also not necessary as the output at pin5 is a digital square wave.
      I hope all this helps any newcomers who may be reading.

      Cheers – Jeff

    • T.K.Hareendran

      jeffmonoptusnet-com-au : Noted your suggestions.Thanks!

      I’ve re-tested my prototype and observed that the output is “clean” (not very noisy). I still prefer the use of D3 as without it erroneous output switching observed at sometimes.

  • TravisC

    I am looking for an easy detection unit for N scale trains, that will detect a train, then will trigger (a flasher unit)a seperate unit. I don’t quit understand the scematic of this unit. I have made a few circuit boards before but they was already laid out. Thanks

  • Jeff Monegal

    Dear Sir

    A very nice circuit but it does suffer for output noise. When a piece of rolling stock passes the sensor if the reflecting surface is not completely flat such as the various parts that are found underneath a carriage or a bogie, multiple pulses can be reflected back to the receiver. In this situation the output can rapidly toggle as the reflected light source is bounced off the many different surfaces. The circuit needs filtering. If you log onto http://www.siliconchip.com.au and do a search for Auto Point Controller you will find a similar circuit that works much better. I give this information not to condem or ridicule your circuit but simply as a way of helping as many model railway people as possible. I designed this circuit a few years ago and many 1000’s have been built.

    Cheers – Jeff Monegal

  • Sanju

    Can i get an abstract for this…?? I am doing this as a simple project

  • Tariq996

    Hello.
    I’v completed this circuit & it works very well.
    But,…
    I’ve used 4N25 optocoupler instead of CNY18-2 & an LED as visual indicator & i don’t have a model train so i used to pass things like spoon, tin in front of IR sensor

  • Tariq996

    I’ve a IR sensitive transistor which is in a set with IRLED as same as u’ve shown in the image. So, can I replace it as D2 & T2 & is there any need of providing connection to base pin of photo-transistor

    • T.K.Hareendran

      Yes, you can experiment with the module. There is no need to connect the “base” terminal. Leave it free!

  • vivek

    hey friend, i like it but i could not understand circuit diagram so please improve in detail as well as one example image using component please

    • TravisC

      I am like you Vivek, I can not read scematics and would like a more of a digram how you would put these together on a board to make it work.

    • TravisC

      I am like you Vivek, I can not read scematics and you like a more of a digram how you would put these together on a board to make it work.

    • Geoff

      Hi, I assume that the use of the 567 IC is to avoid ambient light issues that affects most IR detection circuits ? Cheers

    • T.K.Hareendran

      The circuit is very simple and straight forward! I think, the documentation is enough even for a novice. In case you need further clarification, Mr. Vivek, refer the datasheet of LM567.

Looking for the latest from TI?