Feasibility of reading 72 photoresistors on Uno

Hello all. I'm working on a community art project which will require me to determine where a flying object crosses a plane (looking for x,y coords). I had an idea to use a row of photoresistors along each of the x and y axes, then have corresponding rows of LEDs across from them. Then I would want to read data from the photoresistors to determine which LED beams have been broken, so I can plot the position of the object.

Is it feasible to read data from 72 photoresistors with an Uno?

If so, can I do it quickly enough to detect object moving quickly through the plane?

I guess I would need to use something like shift registers daisy-chained to use that many inputs. I have a bunch of these shift registers. Some people have told me it's doable, and some said I'll need to figure out a different way to go about it. I found this thread that seems like a similar issue, but I'm new to hardware and still pretty unclear on if that would work, so any guidance is much appreciated. Thanks.

Photoresistors are relatively slow to respond. You should probably use phototransistors to get quick response.

A set of nine Parallel to Serial shift registers will allow you to read 72 digital inputs via SPI at about 8 million bits per second. As you read the nine bytes you can check to see if any bits have been set. If none, there is nothing to do but scan again. If any bits have been set you can then look at the nine bytes to get the horizontal and vertical coordinates.

You might need to use lenses to limit the field of view of each sensor.

If the object is too small or too fast you may need pulse stretching on the sensors to allow the object to be reliably detected.

How big is the flying object? How fast is it moving? In other words, how long does it take to pass through the plane?

If you don't know how fast it's moving, some phone cameras have a slow motion feature that should give you a rough idea of the speed.

@mikb55: We’ll probably be using a tennis ball, about 2.8" diameter, the speed will vary, but it’ll be blocking the led beams for about 1\1000th second at its quickest.

@johnwasser: I’ll look into the photo transistors, thanks.

I was thinking of setting each of the photoresistors (or photo transistors) back a couple inches into tubes to cut out peripheral light, might this work in place of lenses?

And if the ball is passing the plane for about .001s would I need the pulse stretching?

Does anyone have a suggestion where to start looking online to figure out how to wire up that many shift registers?

Thanks for the help!

IMO you should start finding out more yourself. Start with a single cell, and find out whether the passing object will provide a logic level signal at all. If not, you have to add an amplifier (another transistor or comparator), that also may do the pulse stretching. Because signal conditioning is required for every single cell, this is the most important (costly...) part of your project, worth some experiments with different approaches (mechanics and circuits).

Hi,

2.8" = 2.8 * 2.54 = 7.112cm in 1/1000sec 7112 cm / sec 71,12 m/s 71.12 *60 *60 = 256032 m/hr 256.032 kph

Nadal, Groth, Roddick, Williams ???????? Air cannon... Mythbusters?????? LDRs will definitely not be fast enough.

You would need to have a flipflop on each Rx. Master RESET them, then scan them. When a ball goes through the plane a flipflop is SET, the scan will see the SET flipflop. Just scan x axis, when you have found a set output then go and find its mate on y axis.

Then master RESET and scan x axis for next ball.

How quick do you need to know when and where the ball crossed the plane?

Tom.... :)

look into shooting chronographs. we know what you want is possible, as we can detect a bullet, albeit through a specific flight path, up to about 7,000 feet per second. and up to 1,800 rounds a minute.

all you need to do if figure out how to narrow your beam, not just put it into a tube for shade.so your beams create a grid of a fashion.

I have always thought that they could do with with a baseball in a stadium because of the fixed location of home plate

Haha, Tom, no unfortunately no tennis pros or cannons. People will be throwing the ball, so max speed would probably be about 80 mph, since the beams would be spaced, the full diameter of the ball might not pass through the beam, so I'm being conservative and estimating the .001s. In most cases it would be more than that.

After a throw I would want a few seconds to reset so the thrower could get ready for the next one, I could take as much time as needed to process and reset.

Thanks Dave, Yeah I wonder how they plot position for MLB pitches, probably comparing multiple camera angles or something. I'll look into shooting chronographs.

People would be throwing against a board, so I could use some sort of pressure sensor in the board I guess. If anyone's heard of some sort of good durable pressure sensing pad I might consider that option. But I was thinking using a plane of beams like this a couple inches off the board might be good because we wouldn't actually hitting the sensing equipment with the balls (less chance of breaking stuff). Also if I can figure out how to do it with beams like this, I could eventually add another sensing frame halfway through the throwing path and track ball movement, which could be pretty cool.

So are you thinking a set of detection lines, vertical or horizontal, spaced close enough that a ball will pass thru at least one line, and a 2nd set in parallel, so the time can be measured between the 2 crossings and its speed determined?

You might consider using the inexpensive laser modules to make light beams. You need to get a photo transistor and experiment to see if it has the reaction time you require.

@CrossRoads, maybe in the future for a phase 2 I'd want to measure speed, but at this point I'm really just concerned with the position of the ball.

So I was thinking 36 pairs of light beams and sensors along the x-axis, and another 36 along the y-axis, creating a grid of beams on the same point on the z-axis. If one or more of the x-axis beams is blocked, check the y-axis to see if any have been blocked as well, if so, plot the x,y position based on the blocked beams.

Ideally the code would be a little more complex than that, because the more beams that are blocked, the more accurately I can estimate the position of the ball. So if possible I'd want to record a series of readings starting when the first beam is blocked, then when all the beams are unblocked again, use the reading with the most blocked beams to plot the ball's position. But to start with, if I can just get one beam on each axis tripped at the same time that's plenty of precision for now.

@zoomkat: Lasers was my original idea, but someone told me I could get away with LEDs instead and it'd be much cheaper. I was skeptical because the light source and the sensors will be about 4' from one another, but he insisted. I guess I'll have to run some tests with both a laser and an LED before I go ahead and buy everything.

You have 36 sensors spread along 48" so they are about 1-1/3" apart. You need to restrict the field of view of the sensors to about 2" at 48". That would be the same view as 0.25" at 6" (divide both sides by 8) so if you put your sensor at the bottom of a 6" hole that is 1/4" in diameter you should get the right field of view. The inside of the hole should be as non-reflective as possible. Putting the LED at the bottom of a similar hole should help avoid interference with adjacent sensors.

@zoomkat: Lasers was my original idea, but someone told me I could get away with LEDs instead and it'd be much cheaper. I was skeptical because the light source and the sensors will be about 4' from one another, but he insisted. I guess I'll have to run some tests with both a laser and an LED before I go ahead and buy everything.

Light scatter from the other LEDs might be a problem. I think the below laser modules are the same as I bought in the past. You get 10 for $3.13 including shipping. You probably can get a small laser pointer for testing. DollarTree has them for $1, and I've seen them in the walmart checkout lane.

http://www.dx.com/p/12mm-5mw-red-laser-diode-modules-black-dc-4-5v-165078#.VjDjrFWFPiw

zoomkat: I think the below laser modules are the same as I bought in the past. You get 10 for $3.13 including shipping.

That seems pretty reasonable, I'll get some of those and test em out, thanks!

johnwasser: You have 36 sensors spread along 48" so they are about 1-1/3" apart. You need to restrict the field of view of the sensors to about 2" at 48". That would be the same view as 0.25" at 6" (divide both sides by 8) so if you put your sensor at the bottom of a 6" hole that is 1/4" in diameter you should get the right field of view. The inside of the hole should be as non-reflective as possible. Putting the LED at the bottom of a similar hole should help avoid interference with adjacent sensors.

Thanks John, I ordered a few test parts, going to do some tests, I'll start with a 6" hole, matte black.

Hey all. Been a while, but I'm back on this project.

I did some experimenting with a single laser diode / phototransistor pair to see if breaking the laser beam would result in usable signal.

I set the phototransistor at the end of a 6" long black tube, and had the laser diode aimed directly at it. I hooked the transistor up to an analog input to get some readings in the Serial Monitor.

Here is the sketch code:

void setup() {
  pinMode(4, OUTPUT);
  Serial.begin(115200);
}

void loop(){
  digitalWrite(4, HIGH);
  Serial.println(analogRead(0));
  if (analogRead(0) < 10){
    Serial.write("BEAM BLOCKED");
  }
}

And this is an example of the Serial Monitor readouts when I broke the beam by flicking a finger through it:

47
48
47
44
34
20
9
BEAM BLOCKED
2
BEAM BLOCKED
1
BEAM BLOCKED
0
BEAM BLOCKED
0
BEAM BLOCKED
0
BEAM BLOCKED
35
44
47
47
47
47
47

When the laser is shining directly on the photo transistor, the analog reading is around 40. It looks like this is not a large enough difference to produce a digital signal, correct? Is there some way I can do signal conditioning with the phototransistor? Do I need a more sensitive phototransistor?

My goal is to be able to read all 72 phototransistors digitally to see if the corresponding laser beams have been blocked in less than 1ms.

Any ideas would be greatly appreciated, thanks!

It’s obvoiusly enough to generate a digital signal. I mean, you are reading the signal by digital means, right?44/255ths may not be enought to generate an interrupt, but hopefully, you can poll all 72 fast enough.

Hi,
How have you got the phototransistors wired, I think they can be biased to give some gain and hopefully better response.

Tom… :slight_smile:

Here's the basic diagram of how I have it wired to test the one pair (the full 72 is going to require a chain of shift registers, I'm told).

https://circuits.io/circuits/2657971-the-unnamed-circuit

I'm currently using analogRead just to test it out. I tried reading the transistor's output through digitalRead, but it was reading 0 the entire time whether or not the laser was hitting the transistor. I assume this is because via analog it's only reading around 40/1023 at its peak. So dropping from 40ish to 0 is read as a 0 either way when using digitalRead.

I'm going to need to just read a 1 or 0 to be able to input the values into shift registers.

Personally, I'd do it arse-about (asuming you're using NPN photo-transistors

+V --- 4K7 --- Collector --- (opto) --- Emitter --- 0V | Base Input pin

Then using pinMode(pin, INPUT_PULLUP), you should get nice snappy [u]DIGITAL[/u] inputs. You could go higher than 4K7, but it's a good starting point, and will give full voltage swing.