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!

Good Find - Reflective IR Obstacle Detector Module UPDATE

3230 views
14 replies
1 rating 2 rating 3 rating 4 rating 5 rating
  • Member since
    January 2009
  • From: Bakersfield, CA 93308
  • 6,526 posts
Posted by RR_Mel on Saturday, December 15, 2018 5:32 PM

I’ve been dinking around with the“IR Infrared Obstacle Avoidance Sensor Module for Arduino” for the last few days and they work very good.  I decided to experiment with a crossing gate controller and built up Geoff Bunza’s controller.  It works great!  I’m really impressed with the SG90 servos for operating the gates.
 
As all of my crossings have Grain of Wheat bulbs (everything I have is older than dirt) I used a Arduino expansion board to make a high current driver for the bulbs.  I went with a single non inverting TD62304 seven channel driver chip using four channels.
 
 
 
I used a pair of the Arduino IR detector modules and a UNO for the controller.  Geoff’s sketch worked first shot.  The only thing I changed is the delay after the gate release.  His delay is 30 seconds and because my layout is small with several crossings I reduced the delay to 15 seconds.
 
His program seems to work better for my layout than the Rail Logic Controllers because of the timing.  I’m going to remove one of my Logic Rail Controllers and Tortoise and install the Arduino and servos and compare the operation between the Arduino and Logic Rail.  It will be rather easy to manipulate the timing in the Arduino to fit my layout.  I really like the SG90 servos.
 
Mel
 
 
My Model Railroad   
 
Bakersfield, California
 
I'm beginning to realize that aging is not for wimps.
 
  • Member since
    February 2002
  • From: Reading, PA
  • 30,002 posts
Posted by rrinker on Friday, December 7, 2018 5:58 PM

 Any decent IR system modulates the transmitter and the receiver uses a bandpass filter to look for that frequency. A steady on source like a fluorescent light may swamp the receiver and prevent it from seeing the pulse from the transmitter, but it also shouldn't flasly trigger (unless you used a modulation frequency that can be generated by a harmonic of 60Hz). 

 I also mentioned that it should be possible to auto-calibrate a system like this, at least on startup, if the receiver uses an analog input, and the threshold is adjusted under effectively a known condition until the receiver can see the transmitter. Then if the beam is blocked, it will detect as such because the receiver is calibrated for the ambient conditons. Probably not really needed for a pulsed IR system since most visible sources won;t have any effect on it.

                                 --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
    December 2015
  • From: Shenandoah Valley
  • 9,094 posts
Posted by BigDaddy on Friday, December 7, 2018 5:18 PM

RR_Mel
I don’t have any plans on doing up an instructional thing, I’m not that knowledgeable enough on the Arduino stuff. It’s like my typing, hunt and peck.

You're way ahead of some of us.  To me the keyboard is Cyrillic.  ЩЩԘ

Henry

COB Potomac & Northern

Shenandoah Valley

  • Member since
    January 2009
  • From: Bakersfield, CA 93308
  • 6,526 posts
Posted by RR_Mel on Friday, December 7, 2018 4:55 PM

Incandescent lighting has no effect on these IR detectors and we haven’t had any direct sunlight in a long time.  The Sun has an almost permanent filter here called SMOG, the last few days has been overcast.  Could be several weeks to several months before we have direct Sunlight.
 
I worked them over for a couple of hours doing everything I could to screw them up and nothing seems to bother them so I would say they are a go for me.  Slick packaging and the price is right.  Simple wiring and no apparent problems using unshielded wire. 
 
I have gone to #28 gauge unshielded flat ribbon cable for all of my Arduino stuff without any problems.  Easy to work with and cheaper than regular stranded wire.  I’ve been buying 10, 16 & 26 conductor ribbon wire for under $20 per 100’ off eBay from US sellers.  It can be split into any number of conductors easily.  It’s grey and a black Sharpie takes care of the labeling.  By using the Arduino type connectors attaching the wires is super simple, plug and play.
 
 
 
 
 
Mel
 
 
My Model Railroad   
 
Bakersfield, California
 
I'm beginning to realize that aging is not for wimps.
 
  • Member since
    July 2009
  • From: lavale, md
  • 4,678 posts
Posted by gregc on Friday, December 7, 2018 10:50 AM

RR_Mel
Greg may be right about fluorescent lighting interference.  I cut over to LED lighting in our house a year ago.  I’ll run some tests under fluorescent lighting and post the results here.

shouldn't be a problem with florescent light using infared (IR) detectors.   Sunlight and incandescents lights extend into IR wavelengths which IR detectors are sensitive to.

greg - Philadelphia & Reading / Reading

  • Member since
    January 2009
  • From: Bakersfield, CA 93308
  • 6,526 posts
Posted by RR_Mel on Friday, December 7, 2018 10:49 AM

Greg is correct about fluorescent lighting interference.  The only fluorescent lights I have left is a pair of Sears droplights with an 18 watt bulb (I think they're 18 watts).  It triggers the receiver LED at about 18” but fades quickly to no detection by two feet.  Adding the second light next to the first one doesn’t change things.  I put my Fluke at the comparator input and can’t see any change in the LED output at 3 feet switching the lights on and off.
 
By using a pair of modules pointed at each other the range of break beam is about 36”, I don’t know the power out of the emitter but the module draws 40.4ma at 4.98 volts at idle.  That would be the current of the power on LED, emitter and the LM393 at idle.  Triggered the current is 44.2ma at 4.98 volts.  The 4.2ma increase is the Activate LED and switching of the comparator.  Assuming those numbers are correct the emitter has about 150mw output. 
 
EDIT:
 
I went a bit deeper with my Fluke and found the emitter voltage at 1.26 volts drawing 3.72ma which equals  4.6872 milli watts, not much power there folks.
 
 
Mel
 
 
My Model Railroad   
 
Bakersfield, California
 
I'm beginning to realize that aging is not for wimps.
 
  • Member since
    January 2006
  • From: Northeast OH
  • 2,268 posts
Posted by NeO6874 on Friday, December 7, 2018 10:34 AM

RR_Mel
Their listing doesn’t say anything about shielding them.  It also says it will drive a relay direct but no mention of the output current limitation of the LM393 chip being 20ma max.

 

welcome to (cheap chinese) arduino stuff Smile.  The number of people I've run across who've fried something because they didn't know they needed to check anything other than voltage is somewhat high.

-Dan

Builder of Bowser steam! Railimages Site

  • Member since
    January 2009
  • From: Bakersfield, CA 93308
  • 6,526 posts
Posted by RR_Mel on Friday, December 7, 2018 10:10 AM

gregc

i traded emails with Mel about this.   He said he used 38 kHz optical detectors commonly used on TV remotes which filter for the corresponding frequency from the source and have gain control to adapt to room light conditions.

greg - Philadelphia & Reading / Reading

 

Greg may be right about fluorescent lighting interference.  I cut over to LED lighting in our house a year ago.  I’ll run some tests under fluorescent lighting and post the results here.
 
The IR system I’m currently using uses modulated IR of both 38khz and 56khz.  None are pointed directly at fluorescent light, all are horizontal beam break.  I didn’t go with modulated IRs because of the possible interference from fluorescent light bulbs.  I needed two beams for detection for my dual track mainline and didn’t want to fight problems with two parallel beams with 2” spacing.  Following dual track S curves with beam break optical isn’t an easy thing to accomplish.  If I was to start over I would use the modulated IR beams for long straight track and reflective IR from under the track for curved track.  At 50¢ per module a half dozen in a curve is cheaper than the modulated beams.
 
I complained to the China seller about the range of the modules this morning.  Their listing says 2~30cm range and the best I got out of the ten I received was 5cm.  Their listing doesn’t say anything about shielding them.  It also says it will drive a relay direct but no mention of the output current limitation of the LM393 chip being 20ma max.
 
By the way my modulated IR system has worked flawlessly for two years.  At this point I don’t plan on replacing it.  The reflective IR module is so slick any additions will be using them instead of the higher priced modulated detection.
 

hon30critter

That's neat Mel!

You should write a manual for how to put Arduinos to work on a layout.

Dave

 

 
Dave, I don’t have any plans on doing up an instructional thing, I’m not that knowledgeable enough on the Arduino stuff.  It’s like my typing, hunt and peck.  I do post my projects on my blog with as much information as I can.
 
Mel
 
 
My Model Railroad   
 
Bakersfield, California
 
I'm beginning to realize that aging is not for wimps.
 
  • Member since
    December 2009
  • 54 posts
Posted by Carolina Northern on Friday, December 7, 2018 7:43 AM

Mel,

 

I have twenty of these in my stack of things to do. My illness kicked me again and a lot has been put on hold. Glad to hear that these work as I hoped they would.

While waiting to get back in the layout room, I've had a good time reading your blog and following many of your links - thanks for the deversion.

 

Don

  • Member since
    July 2009
  • From: lavale, md
  • 4,678 posts
Posted by gregc on Friday, December 7, 2018 7:03 AM

i believe these devices will work OK is dark spaces

I had problems when I experimented with optical sensors embedded between the ties.

I built a system using IR opto-transistors and incandescent room lighting which has a broad enough spectrum to cover IR.    This is why refective IR approaches may not work with incandescent or sunlight spaces.

I was given a system, I think from Iowa Scaled Engineering.   I looked at the signals driving the emitters and found that they blank the transmitter periodically.   This way they can determine if the sensor is really detecting the emitter or some back ground light.

I was also told, that best results were to use shrink-wrap tubing to shield the sensor.

i traded emails with Mel about this.   He said he used 38 kHz optical detectors commonly used on TV remotes which filter for the corresponding frequency from the source and have gain control to adapt to room light conditions.

greg - Philadelphia & Reading / Reading

  • Member since
    August 2003
  • From: Collinwood, Ohio, USA
  • 16,367 posts
Posted by gmpullman on Friday, December 7, 2018 12:29 AM

hon30critter
You should write a manual for how to put Arduinos to work on a layout.

X1  Yes

 

Ed

  • Member since
    January 2009
  • From: Bakersfield, CA 93308
  • 6,526 posts
Posted by RR_Mel on Thursday, December 6, 2018 11:58 PM

I pretty much buy all of my electronic stuff off eBay.  Both long time parts houses here in Bakersfield closed several years ago so eBay is about my only source now.  Just put “IR Infrared Obstacle Avoidance Sensor Module for Arduino” in a eBay search and pick which seller your want.
 
I bought 10 from a dealer that had quantities of 1 to 50.  I’m having a blast dinking around with the Arduino stuff.  These work so good and are such a slick package that I’m kicking around replacing the home brew IR stuff on my turntable indexing system.
 
They sure work great for under the track occupancy detection or operating crossing gates.  I removed the LEDs from one of the boards and installed some micro connectors so I could remote the LEDs.  They work very good at over 12” as break beam detection.
 
Slick package and under 50¢
 
 
Mel
 
 
My Model Railroad   
 
Bakersfield, California
 
I'm beginning to realize that aging is not for wimps.
 
  • Member since
    December 2001
  • 1,190 posts
Posted by mvlandsw on Thursday, December 6, 2018 10:47 PM

Where did you find them?

  • Member since
    July 2006
  • From: Bradford, Ontario
  • 15,797 posts
Posted by hon30critter on Thursday, December 6, 2018 10:21 PM

That's neat Mel!

You should write a manual for how to put Arduinos to work on a layout.

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
    January 2009
  • From: Bakersfield, CA 93308
  • 6,526 posts
Good Find - Reflective IR Obstacle Detector Module UPDATE
Posted by RR_Mel on Thursday, December 6, 2018 6:53 PM

I found a pretty good IR under the track detector at a very good price.  It has very good detection at 2” at less than 50¢ each in quantities of ten.  
 
It requires a ⅝” hole under the track, operates at 3.3 to 5 vdc with a switched ground out.
 
It is an “IR Infrared Obstacle Avoidance Sensor Module for Arduino”.  The specs say the detection range is 2 ~ 30cm, the best I got out of ten modules is a little over 5cm but they work great up to 5cm.  I didn't shield the LEDs from each other on the board so with proper isolation between the emitter and detector they might do 30cm.  They are activated by reflection off of the detected object.
 
 
I mounted a couple boards vertically next to a hidden siding and bent the LEDs down to horizontal for spotting my locomotives and they work very good.  I tried two boards on my bench test track through the ties and they worked perfect also.
 
It has an LM393 comparator output rated at 20ma.  There is an onboard LED that draws .34ma so it should be able to switch 15ma easily on the output pin.
 
 
Mel
 
 
My Model Railroad   
 
Bakersfield, California
 
I'm beginning to realize that aging is not for wimps.
 

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!