Kleine Teile mit Arduino zählen

Hallo liebe Arduino Gemeinge,

An meinem Projekt komme ich leider nicht weiter.
kurze Beschreibung:
Es sollen kleine Teile gezählt werden (kleine Zahnräder im Durchmesser von 5mm und eine höhe von
0.2mm).
Ich dachte mir, dass ich diese Aufgabe mit einer Gabelichtschranke lösen kann.
Leider ist es mir nicht gelungen.
Der Arduino zählt nur, wenn die Teile etwas größer sind.
Ich habe es mit einer Gabellichtschranket mit eingebautem Komporator LM393 probiert, es ging etwas besser aber trotzdem nicht stabil. In vielen Fällen zählt der Arduino einfach nicht.
Dann habe ich es mit einem Laser und einem Fotowiederstand BPW34. Die habe ich einfach über Wiederstände am Arduino angeschlossen. Leider hat es auch nicht so richtig geklappt. Der Arduino auch nicht stabil gezählt. Es fehlte etwas.
Jetzt meine Frage:
welchen Typ von Sensoren soll ich verwenden?
Soll ich nocht was dazuschalten z.B. Impedanzwandler, Operationsverstärker...?
Oder soll ich etwas im Sketch ändern?

OLED_Z_HLER.ino (1.07 KB)

Hi.

This is the international forum, where English is the language to use.

So you want to count small objects (being 5 x 0.2 mm cog wheels), using a photo interrupter.
There's a few possible problems with that.

First is of course the size of the objects.
There's also the direction the objects go through the sensor.
Are you able to have all objects pass the sensor in the exact same way ? *)
Are the objects (semi) transparent ?
Do they have holes in them ?

Another, much used way to count any number of objects, is by weighing them.
The objects need to be the same weight for this of course.
You could also opt to use multiple methods of measuring, which would need all methods to come up with the same result.

*)
Suggestion:
Do not just drop the objects through the sensor.
Instead, have the cog wheels roll through a guide, while passing the sensor at the optimum position.
Be careful to prevent the wheels from clogging the guide.

there is a german language forum

MAS3:
Suggestion:
Do not just drop the objects through the sensor.
Instead, have the cog wheels roll through a guide, while passing the sensor at the optimum position.
Be careful to prevent the wheels from clogging the guide.

Thanks for your suggestion with the guide.
Yes,the objects have holes and are not transparent.
To weigh the objects will be very difficult because of different size.
What other measurement methods do you suggest?

You now have 2 threads with the same subject.
So i'll refer to your German thread, which is well on its way and has some great answers already.