I want to find out if it is possible detect and identify individual rolling stock of an H0 scale model railway using a bar code scanner.
The biggest problem is the short distances there is only 5mm or perhaps even less to the scanner and the actual bar code.
Instead of using a commercial scanner I was thinking to use an IR emitter/receiver such as the sharps IS471F and some self made barcodes with relative large bars. Perhaps even a bar code with a reflective surface. Every first and last bar would get a fixed size to filter out the train's speed.
If I put a plate with a small hole over the IR LED to narrow the IR light. A bit like a baffled sensor. Would it be feasible to detect a barcode at only a few mm distance, provided that the bars are large enough to get a decent reading, or is this method next to impossible?