Pages: [1]   Go Down
Author Topic: Some guidance / advice please  (Read 448 times)
0 Members and 1 Guest are viewing this topic.
United kingdom
Offline Offline
Full Member
***
Karma: 1
Posts: 198
just think how much free time you would have if everything worked first time!!
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I've hooked up a Photo Reflector ( Photo Reflector SY-CR102 ) to my Arduino Uno 3.  Its connected to analogue 0.  Using a white card with some black stripes on it, I have held the card over the Photo Reflector and moved it back and forth.  I can see that the analogue reading is changing rapidly from anything between 1023 down to 100 counts.

Question is how to I translate this into something useful I can use to read a kind of barcode from?
Logged

Kind Regards,
Sy

USA
Offline Offline
Full Member
***
Karma: 0
Posts: 238
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

You need a way to measure the movement of the sensor relative to the card.
Logged

United kingdom
Offline Offline
Full Member
***
Karma: 1
Posts: 198
just think how much free time you would have if everything worked first time!!
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

In the application, the sensor will be fixed and the card will be moving rapidly over the sensor.
Logged

Kind Regards,
Sy

Gosport, UK
Offline Offline
Faraday Member
**
Karma: 21
Posts: 3113
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

You need to be able to work out the widths of the black lines, so you need to know how fast the card is moving.
Logged

United kingdom
Offline Offline
Full Member
***
Karma: 1
Posts: 198
just think how much free time you would have if everything worked first time!!
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Not sure how to determine that.  The card/sticker will be attached to the underside of a slot car.  As the car moves over the sensor at any speed, I need to be able to read and decode the code....at least that's the aim.
Logged

Kind Regards,
Sy

Gosport, UK
Offline Offline
Faraday Member
**
Karma: 21
Posts: 3113
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

You might be able to use two sensors, and have a timing track of evenly spaced marks, to give an indication of speed or position.
Logged

Seattle, WA USA
Offline Offline
Brattain Member
*****
Karma: 652
Posts: 50869
Seattle, WA USA
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
Not sure how to determine that.
Then what you need to do is record when each HIGH to LOW and LOW to HIGH transition occurs. The time between the first and last transition defines the overall bar code length. Then, you can use the intermediate times to decide how wide a bar was. There are a fixed number of bars possible if the encoded number was 10101010101...01010. Knowing how many bars are possible defines the width of a bar (time-wise). Then, you can use the actual width to figure out how many 0s or 1s were read.
Logged

United kingdom
Offline Offline
Full Member
***
Karma: 1
Posts: 198
just think how much free time you would have if everything worked first time!!
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Thank you, I will have a go at implementing something soon...off on holiday Saturday, back in a week, will try it out and report back.

Thanks again.
Logged

Kind Regards,
Sy

Pages: [1]   Go Up
Jump to: