I’ve designed and put into the public domain, a complete detection system that does NOT require any modification to any rolling stock or locomotives, and is independent of track power.
As such, it will work on DC or DCC or for that matter ANY form of power used for a model train. It’s designed to be cheap and simple, yet reliable.
The system is Arduino based, and includes basic, simple signaling as part of detection, but if that’s used is up to you. It supplies a simple logic level signal to indicate that a block is occupied.
The design was initially introduced on the TrainBoard forum, and I’m trying to get more exposure so more people will try it. There are videos and complete documentation that includes the code for the Arduino, schematics and single-sided PCB layouts so you can make the boards at home. There is also some technical details of how it works.
The estimated costs per block is between $9 and $16 depending on how fancy you get in the build process. The outputs are on 0.100 centers, so many types of connectors can be used, from simply soldering wires to the pads (not recommended) to simple pin headers, to screw terminals. The wiring to external devices is whatever you have around, and I use the wire from CAT5 computer cables.
Besides the Arduino modules, the only external components are resistors for the indicator LEDs, the IR sensor modules and the IR source LED and its current limiting resistor. Simplicity by design!
http://www.trainboard.com/highball/index.php?threads/different-way-to-do-detection.91951/
The video production isn’t very good, and if you watch all 10, the final system implementation is worth it. Again, all the code and schematics and board layout is done, and the discussion should help you understrand