April 22, 2011, 11:03 pm - James Farrer
Ever since I got the light meter going I've been thinking about what I could do with it. I want to hook up some servos but I don't have any yet and have needed something to do with them. I had the idea to set up a set of sensors to detect direction of something and then point something at it. Something to the effect of automatic aiming.
So here's what I've done. I set up five photocells each facing out and take the input in. The actual values that come in from each photocell vary so I normalize it between the max and min values for each photocell and map that to a range of 1000. Once I have the normalized data I compare the new value to the last value for each sensor and determine the difference. I set a threshold for the difference to minimize the noise and effectively adjust the sensitivity. Then I compare the difference between each of the sensors and whichever sensor has changed the most indicates the direction.
Since I don't have a servo to actually point in the direction I have set up five LED's with the proper one lighting up based on the direction from the photocells. It's a bit rough but it generally works. The biggest problem with the direction is when shadows cross over it. I think setting up a sort of hood over each photocell should help to keep them more direction based.
Some possibilities for improvement at this point include:
- Hooking it up a little better so it's not just a bunch of wires strung around
- Adjusting the LED's so they are also in the same general orientation as the sensors
- Replacing the LED's with a servo and a set of eyes or something like that to indicate it's following the movement
- Set up the threshold so it auto-adjusts to the amount of light and the deltas, probably using a sliding window to calculate it so a sudden light change would get it's attention but then over time more subtle changes could be detected
- Take into account the data from several of the sensors to determine a more precise direction. For example if there are two sensors that are measuring similar changes, point to a spot in between them
- Add a cannon, catapult, or laser to bring the application to a "useful" point of application on my desk at work...
Or click here for a still image of it.