Pages: [1] 2   Go Down
Author Topic: Detecting each of up to 16 different things  (Read 1943 times)
0 Members and 1 Guest are viewing this topic.
London
Offline Offline
Edison Member
*
Karma: 48
Posts: 1486
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I want to detect each of 16 different model railway wagons as they pass over a certain point. I need to know if wagon 1, 2...16 is the one passing over that point. They will arrive in no particular order. They will be travelling at a slow speed.

I have toyed with the idea of a self made barcode stuck to the underside of each wagon to identify it and reading this with an IR LED and detector, but don't know how to detect the start of the read cycle and how to control the timing of reading each bar. Although the speed will be quite slow, it may not be constant.

I don't want to use a standard barcode reader as the red laser light would be noticeable and out of place on a model railway.

Has anyone got any ideas how to do this?
Logged

Global Moderator
Boston area, metrowest
Offline Offline
Brattain Member
*****
Karma: 547
Posts: 27363
Author of "Arduino for Teens". Available for Design & Build services. Now with Unlimited Eagle board sizes!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

RFID tag on each train and a reader at the track?
Logged

Designing & building electrical circuits for over 25 years. Check out the ATMega1284P based Bobuino and other '328P & '1284P creations & offerings at  www.crossroadsfencing.com/BobuinoRev17.
Arduino for Teens available at Amazon.com.

Global Moderator
Dallas
Offline Offline
Shannon Member
*****
Karma: 210
Posts: 13036
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset


Ir LED on each blinking at different rates.
Logged

Dubuque, Iowa, USA
Offline Offline
Faraday Member
**
Karma: 49
Posts: 2544
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I have toyed with the idea of a self made barcode stuck to the underside of each wagon to identify it and reading this with an IR LED and detector, but don't know how to detect the start of the read cycle and how to control the timing of reading each bar. Although the speed will be quite slow, it may not be constant.

Assuming you've rigged up your IR reflectance sensor right (and that's a big assumption), it should trigger low when the white label of the barcode starts as hopefully the barcodes are the only reflective thing passing over the sensor.

Design your barcode with a black line three units wide in the front. Using pulseIn() you can measure the time it takes for the bar to pass over the sensor and now you've got your reference time. The remaining bars in your barcode are then either two or one unit wide and comparing those times to your reference you know if you've got a binary one or zero.
Logged

Global Moderator
Dallas
Offline Offline
Shannon Member
*****
Karma: 210
Posts: 13036
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset


A little mirror with bits of evenly spaced black tape.  Ir beam reflected once = car #1.  Ir beam reflected twice = car #2.

RFID...
http://www.thebox.myzen.co.uk/Hardware/Crazy_People.html

Magnets + Hall effect sensor...
http://www.thebox.myzen.co.uk/Hardware/Dice_Game.html
Logged

Pittsburgh, PA, USA
Offline Offline
Faraday Member
**
Karma: 98
Posts: 4813
I learn a bit every time I visit the forum.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I don't know these guys but it looks like a ready hardware part of the solution:
http://www.phidgets.com/products.php?product_id=1102_0

OTOH, knowing that black and white reflect differently you can try making your own sensor and yes, tape a bar code under each car.

Consider using white stripes (more reflective) for data and black stripes as reference widths. A zero would be a narrow white stripe and a one would be 3x as wide a white strip. The black stripes would all be narrow. You would be reading perhaps 10,000x a second, keep count of how many reads the last black stripe was and if the next white strip is less than 1.5x as many then it's a zero bit but if 2.5x or more then it's a one bit.
Then start your data sector with an attention section of 8 narrow b/w stripes followed by a wide black stripe, the next white stripe begins your data.

The boffo setup would read the same no matter which direction the train is going, attention section at both ends and each car's ID being symmetric. You could get away with 2 number / 4 white stripe codes that would read 0000 0000, 0001 1000, 0010 0100, etc.

I did kind of adapt an idea from Mitsubishi Labs there, but it's kind of adapted from old telegraph Morse code methods that had to be invented because humans don't tap keys with clock-like precision (long story short) so I doubt there will be a patent battle if you go to market.
Besides, I added the bit about using the black stripes for reference, Mitsubishi just used relative numbers of flash reads of data alone to know dit from dah.

The at least twice borrowed idea being that no data is not a data zero. That was used before computers, even the 1880's electro-mechanical type (hole or not being the data). IIRC the words are 'prior art'.  smiley-cool

Cool?
Logged

I find it harder to express logic in English than in Code.
Sometimes an example says more than many times as many words.

London
Offline Offline
Edison Member
*
Karma: 48
Posts: 1486
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

RFID tag on each train and a reader at the track?

An idea that I might consider. Where does one get RFID tags from and can they be programmed?
Logged

London
Offline Offline
Edison Member
*
Karma: 48
Posts: 1486
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset


Ir LED on each blinking at different rates.

That would mean having a power source (battery) on each truck. Trying to take power from the rails for these would be a no-no as the power is PWM and the wagons are too light to make constant contact with the rails.
Logged

London
Offline Offline
Edison Member
*
Karma: 48
Posts: 1486
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset


Assuming you've rigged up your IR reflectance sensor right (and that's a big assumption), it should trigger low when the white label of the barcode starts as hopefully the barcodes are the only reflective thing passing over the sensor.

I've not rigged anything yet, just trying to sort out the feasability smiley-red
Hopefully, the barcodes will be the most reflective thing passing over it. I could paint the remainder of the underside of the wagons matt black.
Thanks for your reply. I'll certainly consider it.

Logged

London
Offline Offline
Edison Member
*
Karma: 48
Posts: 1486
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset


A little mirror with bits of evenly spaced black tape. 

Thanks for your suggestion, but have you ever tried sticking 16 strips of tape, evenly spaced, to a little mirror?
A laser printer will give me quite reflective white and black evenly spaced lines.
But that's not the problem. The problem is: when do you start counting?
Logged

London
Offline Offline
Edison Member
*
Karma: 48
Posts: 1486
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I don't know these guys but it looks like a ready hardware part of the solution:
http://www.phidgets.com/products.php?product_id=1102_0

OTOH, knowing that black and white reflect differently you can try making your own sensor and yes, tape a bar code under each car.

Consider using white stripes (more reflective) for data and black stripes as reference widths. A zero would be a narrow white stripe and a one would be 3x as wide a white strip. The black stripes would all be narrow. You would be reading perhaps 10,000x a second, keep count of how many reads the last black stripe was and if the next white strip is less than 1.5x as many then it's a zero bit but if 2.5x or more then it's a one bit.
Then start your data sector with an attention section of 8 narrow b/w stripes followed by a wide black stripe, the next white stripe begins your data.

The boffo setup would read the same no matter which direction the train is going, attention section at both ends and each car's ID being symmetric. You could get away with 2 number / 4 white stripe codes that would read 0000 0000, 0001 1000, 0010 0100, etc.

I was thinking of making my own detector by mounting the IR LED and IR detector in 5mm ID brass tubes with the tops of the tubes level with the track bed and the LED and detector some way down the tubes (think optical rangefinder). That way, I can make the detector more sensitive and focused on a narrow area.

I wouldn't use tape to stick the B&W labels, as tape is reflective. Better to use glue of some sort.

I was thinking of some sort of lead-in (attention strip as you call it) but didn't know how to implement it.

And yes, I was thinking of making the labels symetrical, given enough space. Remembering that the old British 4 wheel wagons were much shorter than the US bogie types.

Thanks for your reply. It's given me food for thought and an avenue to explore.
Logged

Global Moderator
Boston area, metrowest
Offline Offline
Brattain Member
*****
Karma: 547
Posts: 27363
Author of "Arduino for Teens". Available for Design & Build services. Now with Unlimited Eagle board sizes!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Adafruit has a bunch of RFID tags and several readers.
The tags are programmable. Each also have a 4-byte unique ID that is not changeable.

"These chips can be written to & store up to 1 KB of data in writable EEPROM divided into banks, and can handle over 100,000 re-writes. You can use our PN532 NFC/RFID breakout board or Adafruit NFC/RFID Shield for Arduino to read and write data to the EEPROM inside the tag. There is also a permanent 4-byte ID burned into the chip that you can use to identify one tag from another - the ID number cannot be changed."

http://www.adafruit.com/category/55
Logged

Designing & building electrical circuits for over 25 years. Check out the ATMega1284P based Bobuino and other '328P & '1284P creations & offerings at  www.crossroadsfencing.com/BobuinoRev17.
Arduino for Teens available at Amazon.com.

London
Offline Offline
Edison Member
*
Karma: 48
Posts: 1486
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Adafruit has a bunch of RFID tags and several readers.
The tags are programmable. Each also have a 4-byte unique ID that is not changeable.
http://www.adafruit.com/category/55

Thanks for that. It seems like a bit of an overkill for identifying just 16 different things.
Logged

Global Moderator
Boston area, metrowest
Offline Offline
Brattain Member
*****
Karma: 547
Posts: 27363
Author of "Arduino for Teens". Available for Design & Build services. Now with Unlimited Eagle board sizes!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Well, you said you didn't want obvious red barcode scanning light.
You wanted non-powered/passive ID for each car.
You were worried about identifying the start/end of barcodes/optical things on cars.

Adafruit is not the only source for tag readers.
If something else comes to mind I'll put it up here.
Logged

Designing & building electrical circuits for over 25 years. Check out the ATMega1284P based Bobuino and other '328P & '1284P creations & offerings at  www.crossroadsfencing.com/BobuinoRev17.
Arduino for Teens available at Amazon.com.

Pittsburgh, PA, USA
Offline Offline
Faraday Member
**
Karma: 98
Posts: 4813
I learn a bit every time I visit the forum.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I was thinking of making my own detector by mounting the IR LED and IR detector in 5mm ID brass tubes with the tops of the tubes level with the track bed and the LED and detector some way down the tubes (think optical rangefinder). That way, I can make the detector more sensitive and focused on a narrow area.

Only the detector needs a tube if that. Put it behind an aperture. In the mid-80's at a Trenton Fest I saw some guys who made a scanner out on a dot-matrix printer. They mounted the light sensor in a pointed pen barrel and got recognizable images. The IR is just for illumination.

Depending on train speed you may be talking 1" long strips. You might try printing flat black stripes on silver reflective material and see if they have that on sticky-back sheets.

I've had Office Max laser-print sheets with strips of gradient and blocks with apertures on overhead projection sheets for maybe 50 cents. IR on one side, aperture and detector on the other I got analog of the strip position for a home made linear pot.
 
Logged

I find it harder to express logic in English than in Code.
Sometimes an example says more than many times as many words.

Pages: [1] 2   Go Up
Jump to: