A simple and cost effective sensor approach

Moderator: Moderators

A simple and cost effective sensor approach

Postby sv1iw » 09.11.2016, 20:01

Based on an idea and software from my friend Laszlo Rozsahegyi (viewtopic.php?f=11&t=10120). When I first started to build my layout I was looking, as everyone else I guess, what would have been the best sensors to use for loco detection. Cost was not an issue but I was looking for something simple and effective. After a lot of research and evaluation of the different methods Laszlo suggested that infra red would have been a good solution as sensors and an Arduino MEGA could support 48 of them (an Arduino UNO will support eight) with a sketch he had wrote. I liked the idea and thought it was worth to try. The boards are coming from E-Bay (China, Hong Long etc), they are small, cheap but they have 2x5mm leds on board, not so easy to mount them on c-track lines. E-Bay to the rescue and I got 3 mm leds instead which could easily installed on the track bed. Two holes of 3mm were opened side by side of the central rail and the leds were mounted under the track. Some glue to secure them in place and Dupon cables (used for arduino connections) were used to connect them with the board which was mounted out of sight and under the layout (see photos at the end of the message).

The little board was secured with a 3mm screw under the layout and the output driven from the infra red led board was guided through a plastic channel on the long sides of the layout at the back, where the Mega is mounted. Since the boards have reverse logic you have to tic the reverse check mark when defining the sensor in Rocrail. So far the system works excellent it is stable and utilized with minimal cost and complexity.
A few words of caution. Do not mount the leds too far apart or the detection may not happen in some locos. Also be aware that if mounted too close you may damage the protective plastic of the central post under the track. The little boards have a small blue potentiometer which controls the sensitivity of the infra red led detection, it will stay stable when adjusted correctly once. The MEGA board is defined as CS2 interface and the virtual serial is taken from the USB port. If you need more info feel free to send me a PM or mail to sv1iw[at]raag.org. I will be glad to help if needed and supply the MEGA sketch.

Keep rocking... Manos SV1IW

Last edited by sv1iw on 13.11.2016, 00:41, edited 1 time in total.

Re: A simple and cost effective sensor approach

Postby sv1iw » 10.11.2016, 20:34

Some reference to the arduino object avoidance board and the extra infrared leds needed

The boards: http://www.ebay.com/itm/10-X-Infrared-O ... SwgQ9VrfV6

The 3mm sensors http://www.ebay.com/itm/10pairs-3mm-LED ... SwaNBUeC~H

The output pin from the board connects to the arduino digital pin...

Regards Manos SV1IW

Re: A simple and cost effective sensor approach

Postby sv1iw » 12.09.2017, 13:02

A final word. You can add a 10K resistor from pin 5 of the LM555 to ground (or the LM393 chip as ir boards may have one or the other). This will compress and lower the dead band of voltage detection which unmodified is from 1~3V. The detection of loco is a lot smoother.

Manos Darkadakis

Return to DIY Hardware