Creating photogate with 12 led diodes

Hello! A .net developer here.
Im trying to make a photogate detector for seeds (small objects 2mm-5mm) with multiple pairs of IRs
I've read this topic on this forum and I thought maybe you can give me an advise.

I found this article on the net from 1998, and I was thinking to bring it back to life, of course with some more modern hardware.

So, my question is, how many IR diodes I can hookup to some PCB for start arduino uno (later on I will see if I gonna migrate to esp32, stm32..). Is possible to "listen" beam break on each beam simultaneously?

Some idea is to monitor those beams which will be in zic-zac schedule on some 3d printed plastic.
Here is the image from the document above:

I think this is the crucial part from the document:

The 24 digital channels were organized into three digital
input ports as PA, PB, and PC. The assembly subroutine
polled the three ports and compared two consecutive
readings from each port. A change in the reading meant a
status change for the digital input, which indicated a seed
either had entered the field of view of a photo-transistor or
had just left the field of view of a photo-transistor. For the
former case, a new seed was detected and the readings
from all three ports and the three counters were stored in
RAM. This cycle repeated until the requested total number
of seeds had been detected.
The main program retrieved all the readings from RAM
and then processed the data. Readings from digital ports
PA, PB, and PC had to be analyzed to assign seed locations
to specific photo-transistors in preparation for determining
the front-to-back location of each seed as it passed through
the sensor. The size of the pelleted sugarbeet seed, and the
size and spacing of the photo-transistors indicated that a
single sugarbeet seed could not block more than two
adjacent photo-transistors at a time. Therefore, two
adjacent blocked light beams were counted as one seed,
and the seed location was consistently assigned to the
photo-transistor closer to the front of the planter. Three
adjacent blocked light beams were counted as two seeds,
with the seed locations assigned to the photo-transistors on
each end of the line formed by the three photo-transistors.
The maximum seed spacing error from this technique was
equal to the spacing between adjacent photo-transistors.
With the staggered arrangement of the photo-transistors,
the maximum spacing error was ±0.3 cm.

Thanks!

I don't think that IR is the right choice. As known from remote controls IR is reflected by many surfaces and may not be stopped reliably.

For the interface I'd suggest port extenders for 8 or 16 items. This reduces the number of wires towards the controller, less chances for interchanged wires and easier replacement in case of a fault.

If you use a port expander this has a pin change function that will generate an output normally called an interrupt pin that alerts your code to read the ports and see what pins have changed.

However you can only truly do things simultaneously if you have a processor core for each thing you want to look at. But anything over three cores is uncommon in the micro controller world.

So basically each core needs to be dedicated to one pair of IR diodes, right?
Maybe I can group them into larger group (first 4 pairs, second 4 pairs, and third 4 pairs) => totally 12 pairs for example.
Because I want to detect simultaneously seeds if there's any.
Also could you propose which port expender should I use? Is it ok MCP23017?

No what part of "not simultaneously" are you having trouble with?

Now if you were to relax that criteria then you might be able to do something fast enough so it looks like it is monitoring them simultaneously but it won't be.

We get a lot of people wanting to do many things simultaneously but when it comes down to it they really don't mean it.

The only thing that could monitoring them simultaneously, and say produce a count for each pair would be an FPGA and a controller could monitor that and accumulate counts. But FPGA is major league stuff and could take you a few years to master providing you are 100% with your normal C programming.

At the other side of the technical spectrum, you could have the IR pairs simply incrementing a counter chip, and then you read that chip's output with your embedded processor.

The MCP23017 can do that. It can detect and signal changes on up to 16 lines immediately. But it won't tell which signal has changed, that's up to your code.

It's roughly the same feature as PCINT on an Arduino. Each PCINT can signal if any of the input pins of one port have changed. Again you have to figure out yourself which pin(s) have changed.

I'm not proud of that thread, but I left it up. Glad someone found a use for it.

Just wanted to say that. I don't have any input for you.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.