Some guidance / advice please

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?

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

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

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.

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.

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.

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.

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

Thanks again.