IR object sensors

Barry Gordon Mar 18, 2020

  1. Barry Gordon

    Barry Gordon TrainBoard Member

    23
    6
    2
    I am in the process of installing IR object sensors on my railroad. I just started back in this hobby and am a little bit old (80) which gives me a problem with fine motor control. This makes soldering a definite challenge. I am using a small IR collision detection device that runs at 3.3 volts and interfaces with an Arduino. There are several you tube videos on this subject I can add something new. My track (Kato N-scale Unitrack) is already down. The baseboard is 3/4" plywood.

    I have modified the sensors as follows:
    1) De-soldered and removed the existing 5 mm IR receiver and emitter
    2) I added in the place of the IR devices two 2-pin header connectors. *
    3) I bought new IR emitters and receivers in 3 mm size. **
    4) I soldered them to 2-wire header leads that mate with the connectors I placed on the board *

    * The header wires and their board connectors come in a package of 20 for $8.39 from Amazon
    (SING F LTD 2 Pin 2.0mm PH Micro Electrical JST Plug Flame Retardant Cable Socket
    20 Pcs 12cm Battery Connector Plug with Wire Cable

    ** The emitter and receiver are available on eBay and amazon. I bought them from Amazon
    (New 80pcs 3mm 5mm 940nm Receiver/Infrared LED Emitting Diode IR
    20 pieces of each type and size) 3mm size are what I used for N scale.

    To attach the IR devices to the wires I used an interesting little piece of shrink tubing containing a solder ring. It is about 1" long, sized for 24-26 gauge wire. You put the two wires (in this case 1 wire and one component lead) and heat it with a heat gun The solder melts joining the wires and the tubing shrinks making a nice insulated joint. I bought them at Amazon:
    ( 100PCS Solder Seal Wire Connectors by Haisstronica Heat Shrink Solder Connectors
    White 26-24 $13.99)

    I have used the solder shrink tubing quite a bit now. It works so well when I need to join/splice wires. I believe it comes in various sizes for different wire gauges.

    The 3 mm devices fit very nicely in a 1/8 " hole drilled through the track base. I then drilled a larger whole from the other side of the baseboard so I could push the device up and set it even with the track. I drop of clear Gorilla glue holds it very nicely.

    The sensor board I attached to the underside of the baseboard with two sided foam tape. There is a hole for a small screw. The sensor board runs very nicely at 3.3 volts. I use a 25 pin D connector and cable to bring the sensors from the layout to the control panel Arduino mega board.

    Hope this helps someone.
     
    Sumner likes this.
  2. Sumner

    Sumner TrainBoard Member

    1,115
    1,254
    27


    Very cool, thanks for pointing these out and good luck on your project,

    Sumner
     
  3. Barry Gordon

    Barry Gordon TrainBoard Member

    23
    6
    2
    I have run into a few issues with my project. Any help will be greatly appreciated.

    The issues have to do with the JMRI sensor tables. If I put an object close to the sensor reflecting the signal from the transmitter to the receiver, the LED on the FC-51 sensor module goes on as it should. Sometimes however the JMRI Sensor table shows strange things. The sensor I have put the obstacle at switches as it should, but other sensors will change state for no apparent reason.

    The sensor table pull up / pull down entries do not seem to have any effect and I don't understand if I should be using them. I currently have no pull up resistors installed. I am running the sensors at 3.5 volts from a separate PSU (the Arduino ground and the 3.3v PSU ground are tied together) and assume if I install pull up resistors I need to tie the resistor to the same 3.3 PSU as the sensors are tied to and not the Arduino 5 volt supply.

    One of the problems I see is sunlight and fluorescent light, neither of which will be pertinent on the final configuration. Sunlight and/or flourescent light hitting the IR receiver often causes it to trip and register an obstacle.

    What do I ave to do to get the system to properly save changes to the sensor table. I load the configuration file at startup, is there a way to cause the JMRI panel program to reload the configuration file without a restart?
     

Share This Page