Photoresistors for slot cars

Folks,
I've made a lap counter for a 1:32 slot car track. The lap is counted as the car passes over a photoresistor that is illuminated from above. As the car's shadow passes over it, the lap is counted.

My prototype works on the bench, but once on the track, I've found that the race speeds of the cars are so fast, the lap isn't being counted. I have tinkered with the sensitivities and used Serial.print on the mapped voltages. It seems that there is nearly no change when the resistors are in shadow for only an instant.

POSSIBLE ISSUES:
Could this be a logic problem? That is my code is too bulky and not Analog reading the resistors frequently enough.

Is it a hardware problem? Have I just bumped up against the speed limit of my photoresistors?

Is it a knowledge problem? I'm new. I've used analog.read to get the voltage then the map() function to get trigger values to count the lap.

Many thanks folks.
G

LDRs are known to be slow. You need 50-100 ms of darkness (or even longer) for it to reliably work.

Use a phototransistor instead. Those things are much faster. TEMT6000 is a common, cheap one. Or photodiodes as used in light gates.

Thank you!

Relative speeds are something like:

CdS photoresistor: 100000µs (can vary enormously between devices though)
Si phototransistor: 5µs,
Si photodiode: 0.1µs,

And there are specialized high speed photodiodes for communications that are way faster still.

Also an analog reading is much, much slower than a digital reading.

aarg:
Also an analog reading is much, much slower than a digital reading.

But quite fast enough unless the cars are going supersonic. 115µs at 200mph is 1cm of movement.

Hi,
Can you post your code please.
How are you reading and how often the LDR pin?

Tom... :slight_smile:

I have made a slot car lap counter, using an IR LED and an IR sensitive phototransistor - this works nicely, actually cut into the track from below so the guide rail cuts the beam - means a bit of modification to the track but it doesn't need a gantry overhead, so far has proven very reliable.

this is fed in via a digital pin (not even using interrupts, just reading on each cycle and checking for changes as I needed more sensors than I had interrupt pins) driving on an interrupt for two lanes from an Uno or Nano would work very nicely though.

sensor hardware is an IR LED & resistor, plus the IR phototransistor and a 10k resistor, its fast enough for guide blade detection (go 1k and its fast enough for scalextric digital car decoding)

thread at Lap Counter/Timer project | SlotForum covers the hardware and software side, overkill for just lap counting but its so easy to add in lap timing I thought why not?