Wondering if anyone has found a reliable way to detect individual cars passing a fixed location on a layout (so I can count them with an Arduino as an example)? I've tinkered for quite some time with a variety of IR devices, some home-brewed and some MR products such as Azatrax. Continually run into problems with the variety of shapes to detect as well as colors (IR doesn't get along accurately with black for instance) as well as geometry challenges (cross track, reflective, between the rails, etc.) "Occupancy detection" is not what I'm looking for. Perhaps someone that is also a robotics hobbyist has some guidance what with all of the type of sensors available nowdays that I am totally unfamiliar with. Thanks, Geoff
Have you tried RFID tags like the prototype uses?
Modeling BNSF and Milwaukee Road in SW Wisconsin
someone described a block occupany approach that counted wheels. An IR emitter and detector were mounted just above the rails.
this approach might work for you if you made some assumptions above wheels per car or the time between wheel detections.
have you tried a emitter mounted between the rails with an detecter on a pole just off the track that won't be blocked by a coupler?
greg - Philadelphia & Reading / Reading
If you are using an IR detector that "bounces" light off the cars, then the color matters. If you use an IR detector "gate" then that's not a problem. You put the IR emitter on one side of the tracks/car and the IR receiver on the other. The physical object blocks the IR beam.
You probably won't be able to use commercial circuits because most of them are designed for occupancy, so the detection is "on" for a few seconds, rather than just when the beam is blocked.
Dave H. Painted side goes up. My website : wnbranch.com
several years back i had a car counting system that used dark on ldr that turned a transistor on that was wired to a relay type counter. worken ok as long as the train was going slow , was going to try upgrade it to a electronic counter , but that got lost in the other projects that were more important.
Thanks, jr, for your reply. Had considered RFID a couple of years ago and it got a bit pricy and complex. A quick look around today shows a lot of additional variety in micro-chips, and readers as well, which could be worth another look. Main drawback is applying chips throughout my roster and needed benchwork mods for mounting readers. Also concerned about proximity of other chips in cars on adjacent tracks being read. Doesn't appear to be an ap for near field reads.
Thanks, too, Mel for your update on the FC-51 based IR detection with Arduino. Looks like tricky geometry as well. Trying to avoid cross-track methods in visible scenery areas to have to hide. Like your under track reflective mode for car under surfaces. Concern would be tricky sensitivity to sense cars overhead but ignore the coupler as it goes by. How could I get somethingto "see" just the trip pins? Maybe paint the tips silver or grey (somewhat prototypical) and look for color capable detector?
Great stuff, Mel. Thanks. Perhaps there is still an opportunty to use IR. I'll sure experiment with one of these. Did you have to bend the emitter / receiver toward each other at all or do they both point straight up? I see the beam width is 35 degrees. Also, why couldn't I run the output lead right over to an adjacent Digitrax DS64 input for detection since the output goes low and skip the Arduino?
Depends on how fast the DS64 reacts - there will be only a very short time between cars that the IR sensor will be clear. That's also goign to generate a lot of Loconet messages, possibly causing bus issues - like when using repeated on/off packets to make a signal indication flash. It's fine if you are monitoring a spot to see if a car is set out there, but for counting - I would keep that off the Loconet. We had to run a second Loconet just for signals ont he club layout, because of all the flashing aspects (guy who runs the signal department on a local regional set it all up, following current NORAC rules) and with old Loconet signal boards, the hardware was mostly dumb and did little more than listen for Loconet messages in a given address range, so to make a signal indication flash, JMRI literally had to send on-off-on-off continuously until the signal went dark or changed to a different aspect. 4 or 5 places of this happening caused noticeable delays in throttle response, so the signal system was split out to a dedicated Loconet. Modern interfaces has built in flashing aspects, so you just tell the board "flashing yellow over red" and the board does it, without a constant stream of Loconet commands.
--Randy
Modeling the Reading Railroad in the 1950's
Visit my web site at www.readingeastpenn.com for construction updates, DCC Info, and more.
Well, still no joy. I picked up an FC-51 and set it up breadboard style using the track on my workbench and have, so far, not found it to be any more effective than the Azatraz and home brew detectors I'm using now. Using the under-track mounting arrangement Mel describes I found it to be extremely sensitive to positioning and sensitivity adjustment to detect just rolling stock vs. a coupler passing by. Same trouble with box cars - lots or beam scatter bouncing off of car ends causes false indications. No sooner than I get it adjusted to work in that situation then I run a hopper car by and it fails because of all of the under car geometric shapes reflect the IR beam everywhere except back at the reciever. Next, after more adjustments to compensate for that, I run a totally black tank car by and it never senses it at all. I'm sure the FC-51 holds promise for some applications but the precise mounting required for my needs in difficult to reach layout areas doesn't seem practical at the moment. Surely there is a better solution. The brewery up the road sure doesn't have a problem counting bottles of product streaming past the capper at thousands per hour.
Thanks again Mel for your additional input. Out of town for a couple of days but I'll get back to experimenting with more geometry next week. You indicated in your 02/09 reply that the FC-51 was aimed straight up so I'll try the angled approach. Still troubled about how to handle lack of reflectiveness of all black cars and locomotive underbodys. Appreciate more details for across the track sensing but tough to do in desert scenery. Else I need to add taller cactus. LOL Also, the FC-51 uses 5mm LEDs while the ones I use now are 1.5mm and much easier to camouflage.
have you tried an IR emitter/detector above/across the rails just above coupler height to detect the gap between cars, as well as the coupler assuming it's with the gaps?
i read that putting heat shrink tubing around detectors to minimize their aperature is sometimes required.
I'm the guy referenced here.....the detector consists of 2 tssp4038 IR detectors that work at 38KHZ, and an IR source driven at that frequency.
The way it works is that an Arduino NANO monitors the sensors and can tell the direction of the movement across the sensors, and knows if the count increases or decreases for any block. Obviously, both adjacent blocks need to be informed of the transition, and an individual count is maintained.
The system can detect anything going past the sensors, with the smallest size being detected based on the placement of the detectors, closer equals smaller detection. The detectors were initially at the side of the track, and because of the size if the detection surface, it actually counted trucks as they passed.
My current system uses Fiber Optic cable to link the detectors to the track, and the detectors are mounted close to and just above the railhead. It works flawlessly.
Like ALL my work for model railroad use, it's all open source/DIY. I'm setting up a web site to sell the bare PCBs if anyone wants them. The complete system including HW & SW is included, but most won't want to get their own PCBs made, so that's the reason for the web site.
The system requires soldering, and I'm considering offering pre-soldered PCBs. Every part that can be socketed is socketed, allowing easy installation and troubleshooting/parts replacement.
I'm not in this to make any money, but I certainly don't want to lose money, so prices will be LOW. Hopefully, I'll get this all done in the next few months.
I put some video of my prototypes on YouTube. Please ignore the quality of the video. Enjoy" https://www.youtube.com/channel/UCGxniu22N3COHRWq_gfEpsw
I forgot to mention that there are NO modifications required for any cars to be detected, which was the primary goal for this design.
Barcodes, inexpensive & proven technology. For smallest size use 2D Data Matrix (looks like a messed up checkboard) which has automatic error correction for damaged images. Free download fonts online for Excel, etc, and simply enter the car number. Place barcode on car bottom and "keyboard wedge" type scanner underneath layout.
Actually Data Matrix is overkill for a simple 4-5 digit number so might as well enter other data like price, type of car, etc. You get 3000 characters.
Terry
I explored barcodes some time ago and generally found the technology somewhat overkill, as you mention. The other drawbacks were the bulkiness of the scanners and their cost. No such thing as a small, hobby sized scanner and the investment for a half dozen or so was prohibitive for the application.
As for gregc's post above - indeed, I presently use heat shrink tubing over my emitters and recievers to not only focus the beam but help shield from unwanted reflection. Nevertheless, as accurately as I can get the basic detection operation to work I can not conquer the reflectivity problem off of many closely coupled cars, particularly a string of box cars. Reflections off of the car ends is really frustrating. Sure - I experimented with long shank couplers, and that did the trick for the most part, but going through my roster and modifying all of the offending rolling stock wasn't what I had planned on.
Meanwhile, I am convinced that a practical (small, cost effective and easily implemented) and reliable sensing mechanism that will detect a specific and precise mark, such as a spot of specific color paint, on the underside of a loco or cars would solve the two major problem here: spurious reflections off of the variety of shapes, sizes and proximity of the objects being detected AND the low IR reflectance at all from dark (black) surfaces. That's the prize.
-Geoff
Interesting Mel. I'll give that a shot. I have sheets of those type stickers, although colored, from other projects. I'll get some white ones to try. Previously I had turned the sensitivity down but still kept running into erratic behavior from other highly reflective colors that would come into view of the FC-51 and as always the beam scattering problem. Thanks.