Does your model railway use DC excitation on the tracks, with complex block switching, or does it use AC excitation on the tracks and Digital Command Control (DCC)? Block occupancy detection is almost trivial with DCC, or so I am told. Just need to add conductive axles to the rolling stock, about 40 kΩ per axle.
Differential capacitive sensors, which have been discussed elsewhere in this forum, could probably be applied to capacitive block sensing with some ingenuity. Well, okay, a lot of ingenuity. You would probably want to imbed one plate of the capacitor horizontaly between the rails. The other plate would be part of the car, but I doubt there is enough metal area to form a "good" capacitor when the rolling stock passes over the fixed plate imbedded between the tracks. You did say you did not want to modify the rolling stock or the locomotives, but with capacitance sensing you would probably have to glue a metal plate or thin foil to the bottom of the rolling stock.
An air-spaced capacitor that the stock rolls between is also a possibility, but I think that would detract from the visual appeal of the layout, even if it could somehow be made to work.
If I were into model railroading, I would look seriously at modulated IR LEDs paired with photo-transistors or photo-diodes in a synchronous detection circuit. The modulated emission is used as a "carrier" to allow ambient light effects to be canceled or greatly attenuated while synchronously detecting lR radiation at the modulation frequency. The photo-transistor or photo-diode does have to remain linear for all conditions of ambient illumination, i.e., not saturate, for this scheme to work. A reverse-biased photo-diode junction makes a fair current source that is linear over four or five decades of illumination intensity. If used in thermodynamically coupled pairs, with one shielded from ambient light, their dark current as a function of temperature can be made to virtually cancel. An FET op-amp connected as a transconductance amplifier is used to convert the photo-current to a suitable voltage for further processing.
I wish someone on this forum would look into video processing of an inexpensive CCD camera image to perform tasks such as this. Industry has already stepped up to the plate, using high-resolution cameras to control pick-and-place robots on a automobile assembly line. See attached file. Sensing the presence of a train of cars in a specified field-of-view (a block of track) should be trivial.
Thanks for the advice, hevans1944
The railway uses DC rather than DCC, as we find it allows for a more authentic setup, in the aspects we care about. Additionally, non DCC stock tends to be considerably cheaper.
I think block occupancy is only trivial in DCC for locos. Rolling stock doesn't normally carry a decoder, so wouldn't be visible to the system, but I may be wrong, I've never been seriously interested in DCC
Generally, however, most stock will carry metal wheels, albeit isolated from each other with a plastic bush between one wheel and the axle, to prevent short circuits. I was hoping this would have been enough of a capacitance change to be detected.
I've managed to get myself 3 of these on a sample order :-
http://www.microchip.com/wwwproducts/Devices.aspx?product=CAP1208
I'm going to rig them up to a test track, and a Raspberry Pi (I2C Bus) and see what I can do with a minimum of stock alterations.
Interesting point about the cameras. I wonder if something can be done with a PiCam... i'll have a look into that.
Gryd3 - A product exists for this already, known as IRDoT. These can be expensive in larger numbers. I could create my own version cheaper, but I worry about the sensors being confused by natural light, as we run outdoors, plus, it'll only detect in one place. Thanks for the recommendation, tho!
BlueJets - magnets and hall sensors can only give me an in and out, and require modification to stock that i'd rather not do. IF i can get capacitive detection working, it would be ideal in my setup. Again, thanks for the input.