How hard to make a beam counter?

How hard would it be to make a simple light beam based counter?
I'm thinking laser diode or infrared beam that counts by ONE whenever something interrupts the beam.

A simple LED display and a reset button to reset to zero each push.

How hard would this be?

It would be super simple.

Software side: very simple.
Hardware side: that’s where the challenges are (especially on how to prevent false triggers/missed triggers due to ambient light).

super-duper simple
let's try it out.

count beams = 1

there, done.

of course if you mean number of interupts of the one beam...
that depends on what breaks the beam
across a door way and single stream of people is not hard
across a door as the movie theater lets out, that one break of the beam might be 50 people over 5 minutes.
one lane of a car, say into a parking lot counts a car and trailer as 2
across a roadway might have cars passing so 2 count as 1.

Hi Bittsen,

It would very much depend on the application.

Like wvmarle said the challenges are in the hardware depending on what you are trying to count.

Counting slow moving milk cartons on a conveyor belt under perfect lighting is rather easy, but counting cars on a road both at day and night can be much harder.

Can you tell a bit more about what you are counting, how it is moving and what the conditions are?
And also what your budget and desired accuracy would be (that always helps in finding a good solution).

Regards,
Teunman

Thanks so far.

I would be setting up a basic counter that will count single items as they pass through a channel. Basically a conveyor belt system with product passing by about once every few seconds. Lots of time between product. Product would only be visible, however, for a fraction of a second. Like, 0.01 second.

Bittsen:
Thanks so far.

I would be setting up a basic counter that will count single items as they pass through a channel. Basically a conveyor belt system with product passing by about once every few seconds. Lots of time between product. Product would only be visible, however, for a fraction of a second. Like, 0.01 second.

OK.

Product would only be visible, however, for a fraction of a second. Like, 0.01 second.

It sounds like product is either a very narrow object moving slowly, or a wide object that is moving very quickly.

Or something in between. Am I close?

Various sizes moving quickly. Nothing over 20 inches long though.

Hmm, 20 inches wide, crossing the line in 10 milliseconds.

That would be moving at 51 meters per second, or 183 km/hr, or 115 mph. That is one hell of a conveyor belt!

jremington:
Hmm, 20 inches wide, visible for 10 milliseconds.

That would be moving at 51 meters per second, or 183 km/hr, or 115 mph. That is one hell of a conveyor belt!

Not exactly. The smallest item would be about 3 inches, visible for 10 milliseconds.

The item would be counted during being blown past by a jet of air. The purpose of the counter is to determine how many product made it past that spot.

Yes, pretty much exactly, for a 20 inch wide object.

However, it is no problem for the Arduino to detect a 10 millisecond pulse.

Hi Bittsen,

Okay, so as long as the objects are not translucent and you are absolutely sure they will pass the beam of light it should be relatively simple. Like jremington said, it is no problem for the arduino to detect a 10 ms pulse. So this is what I would do:

  1. look for a light (or laser) and sensor combo (like the ones some stores have to let them know someone enters (and to annoy you mom when you play with them as a kid))
    Preferebly this has either an analog output or something that is easy to interface an arduino with (SPI or some other protocol). Make sure that the sensor is fast enough to sense the object.

  2. Get an arduino compatible LCD and a button.

  3. Read datasheets for everything

  4. Hook up stuff

  5. Write code (which should be simple) that does:
    read sensor
    if sensor gives pulse: add to 1 to counter
    display number of counter on lcd
    if number pressed: set counter to 0

  6. Post photo's of your project here so we can see :slight_smile:

just out of curiosity what is the project for exactly?

Regards,
Teunman

Ambient light is a common problem. Modulated IR (typical 38 kHz) is the general solution.

teunman:
just out of curiosity what is the project for exactly?

Regards,
Teunman

I haven't played with analog inputs but, yeah, it shouldn't be much different than a pushbutton is.
I have only played with a display once. I think maybe I can figure that out. MAYBE.

What is the project for?

I manage a manufacturing department. The entire life of this company they have supplied the workers with X-amount of material and hoped to make count at the end. They've never actually had a bean counter at the end other than whoever puts the product into a box. This works except that some products are multiple components and since they just go into a catch bin, they often end up with too many of one component and too many of another.
If each machine could have a counter at the end point then they can match quantity during production which would reduce waste from product made in overrage.

Bittsen:
I haven’t played with analog inputs but, yeah, it shouldn’t be much different than a pushbutton is.

Reading an analog signal and reading a push button are two VERY different things.

Bittsen:
I manage a manufacturing department. The entire life of this company they have supplied the workers with X-amount of material and hoped to make count at the end. They've never actually had a bean counter at the end other than whoever puts the product into a box. This works except that some products are multiple components and since they just go into a catch bin, they often end up with too many of one component and too many of another.

Sounds like you're counting at the wrong point.

Count at the machine's side: the number of parts it produces (most machines can do just that already), and make sure when you need 100 parts it produces 100 parts (plus compensation for any rejects) instead of produce produce produce oh, time to stop, never mind what's still on the belt.

wvmarle:
Sounds like you're counting at the wrong point.

Count at the machine's side: the number of parts it produces (most machines can do just that already), and make sure when you need 100 parts it produces 100 parts (plus compensation for any rejects) instead of produce produce produce oh, time to stop, never mind what's still on the belt.

That's what I'm trying to accomplish. The counter would be placed at the point on the machine where a "finished" component passes. The machine operator already removes rejects so only the "good" component gets to the count point.

Doesn't the machine offer some form of counting output that you can tap in?

At least it sounds like you get one and only one type of object per sensor, that should make the job of a break beam sensor easier. Many such sensors are commercially available. Some have the transmitter and receiver on either side; others in a single package with a reflector on the opposite side. Normally using modulated IR, to provide good immunity against ambient light (as you're presumably work indoors that should be good enough - you need lots of ambient IR, such as direct sunlight, to mess up such sensors).

The product changes from time to time but at any given "session" the product would be the same for hours on end.

There isn't any device on the machine that can be utilized for counting. It's an old machine. VERY old.