bar code reader

Status
Not open for further replies.

chazchas

New Member
Hi my name is Charles,I'm new to the forum, and have project that needs to be able to read a bar code and output it to drive a relay. it has to be able drive different relays dependent on the bar code. i have a model railway and I am building a gravity shunting yard, i need it to read the wagons as they pass over the reader and determine which siding to put it in. its just an idea that will allow to build pacific train loads i.e all coal or fuel trains

**broken link removed**


its in the doing that's the fun
 
We're not really allowed to link our own sites in.... After a few posts we can put them in our signatures...

However saying that... I don't think that this infringes the rules too much... Welcome to the site.

What is your idea's.... Most here will start with micro controllers.... Bar code readers primarily output serial data to be read with some processor or other!!

Have you an electronic background??

P.S. I moved your post to the main idea's forum..
 
An alternate to using barcodes, have a think about using RFID. The upside is that the readers are much cheaper than barcode readers.
 
Hi. Sorry about putting my site in, i thought it would give an idea of my problem, i have basic electronics knowledge. RFID is good but has the same problem. i need to be able to get a computer interface to decode the signals to drive the relays, i am not up on these reader systems. and it probably cant be done, but i am not one for giving up
there has to be some way of doing this, ideas are welcome.
 
I've been involved on something similar with slot cars, it is an involved subject, and to fit a reader in a carriage or loco would require significant mods.
You'd probably either have to use something commercial which would require barcodes similar to you'd find on shop bought supplies or write your own code for a microcontroller, which I'm guessing you dont have much experience of as your asking this question in the first place.
One thing I contemplated before barcodes was coded magnets, you can get magnetic switches that respond to an arrangement of magnets n-s poles, theres only a few valid codes I think 16, but this system can be done from memory without any electronics, response time is slow but then a model railway layout isnt particularly fast.
 
Hi Thanks for your reply's, I will elaborate, my way of thinking is install a reader under the track. the wagons will have bar codes on the underneath and be read as they go over the reader, this will talk to the computer which in turn will decode the signal and change the points to the appropriate siding, this has to be fast as the time between wagons is about 2 seconds.
at the moment i am using LDRs in each siding, as the wagon passes over it breaks the light and changes the points to the next siding, but this is random, i want to be able to sort same wagon train. I have never heard of the magnet switch, I shell certainly be looking at it. i don't need many combinations.
 
Something to consider as a possible might be using a bar code reader wand (or any other sensor like RFID) to read a car as it passes over. The data is sent to a computer for the decision making process. Maybe just a small tiny type computer like a Rasberry Pi and finally the small computer outputs to a DO (Digital Out) device like one of these. The DO device controls the track switching. A chunk of code would need to be written. I wonder if a combination like that would work? The linked to DO is 24 channel but you can pretty much have whatever you want as to channels. I am not sure if the Rasberry Pi will work? I know we have members using them and experimenting with them. Anyway, this is a generic suggestion.

Ron
 
I take it you are going to interface it to a PC! Are you going to have a program on the PC to decode and then send the signals back some how?

The is another way.... I'm sure you have heard of the DCC controllers??? Each train has a unique address and can be controlled individually!

A bar code scanner won't be cheap... especially a flat module ( I take it, it needs to be kinda flat!)

And there is also "Touch" switches... very much like RFID..
 
You can probably roll your own barcode reader sensor using an LED and photodiode, in a similar configuration to this **broken link removed**
To transfer the information from the sensor to the PC, you could put in an AC amplifier followed by a schmitt trigger and then an oscillator feeding the RXD line of a serial port (or USB-serial converter). The oscillator could be set up for ASK, FSK or "duty-cycle keying" to allow the sensor output state to be easily decoded by the PC.

Another option (for up to 2 barcode scanners) is to simply connect the phototransistor output to the PC microphone input on the soundcard.

The use of an IR LED will stop the emitter being visible and therefore a nuisance; alternately you could automatically control the brightness of the LED such that it would be off, except when a wagon is over the detector.
 
Several years ago, maybe 7 or 8 I reluctantly got sucked into a project at work that involved identifying and bringing up calibration procedures on a laptop for supported TMDE (Test Measurement and Diagnostic Equipment). The idea was the technician would scan a bar code label and the laptop would bring up the assigned calibration and other information stored on a database.

I used Avery Design Pro Software to create the labels for the TMDE. It was free and worked with the Avery Labels. I am not a programmer and as edged closer to my retirement had no desire to be a programmer. I had some experience using VB (Microsoft Visual Basic) so I wrote my crude code in VB. I am sure any experienced programmer could have done much better. I went to the IS Department and borrowed a bar code scanner. Heck, they were scanning all sorts of bar codes and such so the scanner was easy. I used a USB ported scanner. I looked at some wands and pens but the problem was the pens and wand designs needed to contact the bar code as they were swiped across it. The obvious downside of the scanner was the size but for me that wasn't a problem.

Really matters not what sensor is used be it a bar code reader or RFID or anything else out there. You choose the sensor or in this case reader based on the application. Whatever works. Actually I like the RFID approach for a project like this.

I wrote my code in VB and when an instrument was scanned the laptop would search the database and bring up the required procedure. Once you have the data from the device being scanned you can do whatever you want with it. Use it to manipulate a DO device like I mentioned earlier or whatever. I know those devices are very easy to write code for and manufacturers provide hundreds of code samples to build on. So it all starts with the reader be it bar code or RFID.

Ron
 
How many combinations do you want.

I endorse the approach of doughy83.

If I were building this I would:
have an IR LED & photodiode sensor under the track or two if I wanted it to be direction specific. A sensor like the one dougy83 recommended.
Each wagon would have X number of reflective strips. such as these: http://solutions.3m.co.uk/wps/portal/3M/en_GB/PPE_SafetySolutions_EU/Safety/Products/HighVisibility/
This would input into an Arduino which will count the amount of pulses received over an amount of time from first pulse received. The amount of time would depend on the slowest time for a wagon to pass over the sensor.
The arduino can output serial data to a PC, or USB or it can just control the points for you.

This can easily be done even by a novice for a relatively low cost.
 
Hi Charles,
I am about to embark on a similar model railway loco/wagon identification system and was considering using bar code readers in the track bed.
Having searched here, and finding your post's, I just wondered how far you got?, what your final solution was., was it a total success (or partial) or did it not work at all etc. ?
Cheers
Roy
 
Barcodes ,and there a several formats usually require all of the code visible as a snapshot , or laser scanned, early readers did scan as a pen would do ( speed of reading was not a factor ) with a light and a single sensor these optical pens relied on a start bar , several (4) preamble clock bars , then the code bars ( several ) and a stop bar with crc and or parity checks this relied on the width of the bars to encode the code, the synced clock determining the width therefor the number (hex) I presume your wagon speed will vary so this approach could be the way to go as only a single IR sensor led and source required. Printing a label may be problem also sensor reacting to ambient light. needs some R&D
 
Last edited:
Thanks for your quick reply Granddad,
My primary concern is not so much the ambient light, but the accuracy of the reader, due to the physical restrictions of various (00 gauge) loco's and short wagons, the maximum length for any bar code is 40 mm, and width of 5 mm, but the transmitter / receiver pair has to be at ( or below) the level of the track sleepers to prevent obstruction of the running.
This poses the problem Is there will be variable distances on the various loco's and wagons / coaches to the barcode strip, anything upto around 15 mm ....
Hence a 'wand' type scanner would be no good as this has to be 'in contact' with the barcode to achieve the correct reflective and scanning distances etc, and ensure the reading of single lines / spaces to obtain changing signal states.
To get the scanning accuracy, reliability, and flexibility of a cost effective 'module' to do this I feel is probably going to be the main hurdle / challenge to overcome.
A 'snapshot' type scanner (as used in supermarkets) just would not be cost effective enough. 'We' are possibly looking to install these on a large 'club' layout and have had a ' guesstimate' that we need between 50 and 100 of these depending on how far we take the automation etc.
I will have to experiment with various idea's etc. but I would appreciate any suggestions / solutions from anybody.
As you say R & D time (lots of it I think) is going to be required.
 
If your using a pc then you can get barcode scanners like they use in shops, maybe modded a little it could fit under the track, and then have standard barcode labels on the wagons, the pc can control points using a parallel port or a usb/relay interface, all of which is cheap, you can get new ones cheaply nowadays with a short range.

Otherwise you'll have to either build a barcode reader from scratch, or hack one and communicate with it using a microcontroller.

Heres an idea, presumably your using a microcontroller, well how about having 2 lengths of reflective tape under the wagon corresponding to 2 photosensors under the track, one of the 2 strips of reflective tape would then generate a clock pulse (chequer pattern) to compensate for the speed of the train, and then the length of the pulse from the other reflective strip would tell you which wagon it was.
Or more efficiently have one strip as the clock pulse and the other as binary data, you'd just need to make sure the clock pulse reflective area was a little less than the data to prevent read errors.
 
Last edited:
Distance will be a problem, size not so much device pictured is apx 8x13 mm overall IR pair is only 2.7 3.3. a lens in a tube could overcome distance and ambient light . a 40mm tag should be ample for codes .
Pololu IRS01A
**broken link removed**
 
Thanks grandad,
I am going to experiment with a similar device, Osram SFH7741, that I already have, and try a square plastic tube (or something similar) to reduce the spread of reflection from the barcode, I have seen a barcode layout somewhere similar to the Barcode39 format but reduced and slightly modified to enable direction, identification and speed (even increasing or decreasing along the barcode length) to be derived.
It will take a little while to carry out these experiments, but will post my results along the way.

Misterbenn, please excuse my ignorance, but I'm not sure what NFC is, please explain !
 
Just had a look at the link for the device from CoolComponents, this has an optimal range of only 3 mm, with a maximum of 6 mm, and operates in an analogue mode, the Osram SFH7741 operates in absolute digital mode and has a sensing range of 30 mm, which is likely to be more suited to this type of use .... but only time and testing will tell.
 
Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…