!!

Not Registered?

Welcome!  Please register to view all of the new posts and forum boards - some of which are hidden to guests.  After registering and gaining 10 posts you will be able to sell and buy items on our N'porium.

If you have any problems registering, then please check your spam filter before emailing us.  Hotmail users seem to find their emails in the Junk folder.


Thanks for reading,
The NGF Staff.

Author Topic: IR sensors for train detection and colour light signals  (Read 237 times)

0 Members and 1 Guest are viewing this topic.

Offline daveylad

  • Trade Count: (0)
  • Newbie
  • **
  • Posts: 4
  • Country: gb
    • Awards
IR sensors for train detection and colour light signals
« on: January 30, 2019, 08:14:22 AM »
Please forgive me if this question has been asked before but I am new to this topic.  I am considering using an Arduino and IR sensors to control 3 aspect signals and need a little information.  The first question I have is about the IR sensors themselves.  How big are the actual sensors?  The reason I ask is that I have already laid my track and Fitting the sensors may be a bit tricky.  The second question is the type of Arduino I need.  I was looking at the Arduino Uno and wondered if that would do the job.  I know my questions are a little vague but any info from anyone would be very much appreciated.  Also any links (If that is allowed) to manufactures that people have dealt with for similar projects.

Thank you

Daveylad

Offline ntpntpntp

  • Trade Count: (0)
  • Full Member
  • ***
  • Posts: 2696
  • Country: gb
    • Awards
Re: IR sensors for train detection and colour light signals
« Reply #1 on: January 30, 2019, 09:14:18 AM »
I've not played with arduino based projects like yours, but I do use Heathcote Electronics' IR-DOT detectors and these use 3mm LED-sized transmitter and receiver, so a "pair of eyes" sits in the middle between the rails and between a pair of sleepers. 

https://www.heathcote-electronics.co.uk/

They're quite unobtrusive actually.  Here's a cruel zoom-in!




Nick.   2016 celebrating the 20th anniversary of "Königshafen" exhibition layout!

Offline rhysapthomas

  • Trade Count: (0)
  • Full Member
  • ***
  • Posts: 339
  • Country: gb
    • Awards
Re: IR sensors for train detection and colour light signals
« Reply #2 on: January 30, 2019, 09:20:20 AM »
Hi

Good luck with the project

Your choice of Arduino will depend on how many inputs and outputs you require.  Each sensor will need one output and one analogue input and each signal one ouput per colour light.  The LEDS can be directly driven via a resistor from the arduino.  The Uno is  good choice if space is tight the Nano is smaller with the same number of I/O pins

For the sensors have alook at the TCRT5000 very cheap and i have used lots of these.  They use 3mm LEDS/Sensor and the heads will just fit between the sleepers but the body will need a larger hole below the board which might be difficult for you cut. 

If this unit is too big there are plenty of matched ir/sensor pairs available from the likes of rapid electronics.  You would need to experiment with them notably to prevent interference usually some sleving around the IR LED is enough

Have a look on the MERG site www.merg.org.uk.  There is some useful info there though you need to be a member to access everthing

I have attached a basic circuit diagram but i am not sure it has worked

Offline rhysapthomas

  • Trade Count: (0)
  • Full Member
  • ***
  • Posts: 339
  • Country: gb
    • Awards
Re: IR sensors for train detection and colour light signals
« Reply #3 on: January 30, 2019, 09:25:16 AM »
Yes the diagram is there.  I see there is a post about IRdot which work well but you can use the arduino to do all the hard work and only pay for the sensor.  The picture show very well how to install them.  The LED and sensor are enclosed in brass tubes to help reduce interference.  You will need to program the arduino carefully to avoid lighting interference

Offline daveylad

  • Trade Count: (0)
  • Newbie
  • **
  • Posts: 4
  • Country: gb
    • Awards
Re: IR sensors for train detection and colour light signals
« Reply #4 on: January 30, 2019, 09:56:45 AM »
Thank you to you both for the replies.  To ntpntpntp thank you for the picture - very neat work.  Looking at the sensor they should fit very neatly in as long as I'm careful with my drilling!  Also thank you to rhysapthomas for the info and the wiring diagram.  I think i may take the plunge with the TCRT5000 especially as they are 'cheap as chips'.

regards

Daveylad

Offline njee20

  • Trade Count: (+4)
  • Full Member
  • ***
  • N Gauge Society Number: 22598
  • Posts: 4507
  • Country: gb
    • Awards
Re: IR sensors for train detection and colour light signals
« Reply #5 on: January 30, 2019, 10:20:57 AM »
I use a Mega clone (because they're really cheap, and well... MORE PINS), I use similar sensors to the TCRT5000, but with subtly different LEDs, these:



I've also got one of the Heathcote modules, which have little 'tubes' on the LEDs meaning smaller baseboard holes. I've tried the same using heatshrink on the Arduino ones (because otherwise you need big holes in the board), but have never managed to get reliable detection that way.

Once you get it working you can either write a sketch direct on the Arduino obviously, or you can be a bit more clever with something like JMRI where you can employ more advanced logic with interlocking, point control etc etc. The Arduino interfaces very nicely with JMRI using the C/MRI library.

Offline PostModN66

  • Trade Count: (+2)
  • Full Member
  • ***
  • N Gauge Society Number: 17980
  • Posts: 1971
  • Country: gb
  • Gender: Male
    • YouTube
    • Awards
Re: IR sensors for train detection and colour light signals
« Reply #6 on: January 30, 2019, 12:04:05 PM »
I use the Heatcote modules, but with IR components not between sleepers but from the side or slightly above the train, hidden in tunnels.  This works fine apart from if the coach roofs are too shiny!   A bit of light weathering sorts this out.

Cheers Jon  :)
“We must conduct research and then accept the results. If they don't stand up to experimentation, Buddha's own words must be rejected.” ― Dalai Lama XIV

My Postmodern Image Layouts

Lofthole http://www.ngaugeforum.co.uk/SMFN/index.php?topic=14792.msg147178#msg147178

Deansmoor http://www.ngaugeforum.co.uk/SMFN/index.php?topic=14741.msg146381#msg146381

Offline NinOz

  • Trade Count: (0)
  • Full Member
  • ***
  • N Gauge Society Number: Ex3504
  • Posts: 706
  • Country: au
  • Gender: Male
    • Awards
Re: IR sensors for train detection and colour light signals
« Reply #7 on: January 30, 2019, 12:13:57 PM »
Have you considered ambient light detection?
To be called pompous and arrogant - hell of a come down.
I tried so hard to be snobbish and haughty.

Offline njee20

  • Trade Count: (+4)
  • Full Member
  • ***
  • N Gauge Society Number: 22598
  • Posts: 4507
  • Country: gb
    • Awards
Re: IR sensors for train detection and colour light signals
« Reply #8 on: January 30, 2019, 01:13:45 PM »
I did try using photoresistors but found them very unreliable (significantly worse than IR). They're an analog output, and you've not got many analog pins on an Arduino. I did order some sensors exactly like the IR one I posted above with photoresistors, but they never came (must chase AliExpress!). I'm not honestly sure if they had inbuilt logic to make them a digital input. I assume so.

I'm using IR in my fiddle yard but with a big hole, need to experiment further for a better solution on the scenic side. Or just use a DR4088 for proper block detection and do it properly!

Offline daveylad

  • Trade Count: (0)
  • Newbie
  • **
  • Posts: 4
  • Country: gb
    • Awards
Re: IR sensors for train detection and colour light signals
« Reply #9 on: January 30, 2019, 08:40:42 PM »
Have you considered ambient light detection?

Thought about it but in the wrong type of light I hear they can be unreliable.  A bit right the wrong type of leaves I suppose  ;)

Offline littlegs

  • Trade Count: (0)
  • Full Member
  • ***
  • N Gauge Society Number: 24229
  • 2mm Association Number: 4053
  • Posts: 40
  • Country: gb
  • Gender: Male
    • Awards
Re: IR sensors for train detection and colour light signals
« Reply #10 on: January 30, 2019, 09:00:06 PM »
Hi guys
A while ago I had to cobble up some IR sender/Receivers for my layout where there was no space directly under the track bed due to some mechanical fixtures fitted under the track, so I looked at across track detection as an option. Then someone on the MERG forum (of which I am a member) suggested using a SHARP GP2S60 Surface mount sender/receiver which was only about 3mm square.
I carefully soldered 4 VERY THIN decoder wires to the solder pads on each corner of the unit and found that it fitted between two sleepers of my code 80 track from the side. The excess wires were then fed through the baseboard away from the obstructions and connected to the control module (a MERG dual Hector) underneath. Concealed by ballast etc all you can see is a small black square between the rails.
Detection is pretty good and these are used to trigger other events in the system
I don’t know if they are compatible with an Arduino. But they might be worth a try.
Regards Chris

Offline NinOz

  • Trade Count: (0)
  • Full Member
  • ***
  • N Gauge Society Number: Ex3504
  • Posts: 706
  • Country: au
  • Gender: Male
    • Awards
Re: IR sensors for train detection and colour light signals
« Reply #11 on: January 31, 2019, 12:02:23 AM »
Thought about it but in the wrong type of light I hear they can be unreliable.
Yeah, not good if you have variable light conditions.  Have used them for over 30 years to fire point motors for auto-route selection and found them quite reliable but my applications are always under room lighting.  Of course you need a simple circuit to adjust sensitivity and give a digital output (from memory using a Schmidt trigger, built 25 years ago).
Have made several of Bunza's auto-compensating units but haven't tried them on the layout.  Work very well on the bench though. :thumbsup:
To be called pompous and arrogant - hell of a come down.
I tried so hard to be snobbish and haughty.

 

Please Support Us!
March Goal: £55.00
Due Date: Mar 31
Total Receipts: £65.00
Above Goal: £10.00
Site Currency: GBP
118% 
March Donations


Advertise Here