Object detection by photocell

A photocell is a poor substitute for a camera, but it’s a lot cheaper too. So the question for grisbot is whether a photocell is sufficient to detect an object nearby.

Here’s one possible solution. Suppose an object — say, a ping pong ball — is in front of the robot like so:

pong1

The photocell registers a level of light, but has no way of knowing (yet) whether that level is simply ambient light (say, like from a window or lamp) or light reflecting off the ping pong ball.

But the robot has a flashlight mounted, which it now turns on:

pong2

If there was no object in front of the robot, then the light level detected by the photocell would not change. But the flashlight beam reflects off the ping pong ball in this case, which means that the photocell will detect a significant increase in light level.

I tried this out on the test bed with this program in the Arduino:

flashpong

The asterisks in the serial monitor output indicate that the current light level is a value of more than 50 above the previous value, which means that the flashlight beam is being reflected by a nearby object.

Imagine the robot conducting a sweep pattern, flashing a light on and off as it does so, and comparing light levels from one fraction of a second to the next. When it detects a significant difference between on/off measurements in the same direction, it knows that an object is in that direction.

And so, a robot with an ATMega328 brain and photocell eyes just might be able to herd ping pong balls, which would be another fun capability I could add to grisbot.

About engineerzero

Once and future engineer.
This entry was posted in Uncategorized and tagged , , , , . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s