First off, I haven’t been able to get my project to work. The sonar distance sensor isn’t working as I expected, and the servomotor I’m using isn’t powerful enough to reliably throw around some popsicle sticks and cardboard. Regardless, my project was to work as follows. A user is presented with a cardboard cutout of a hand. If she were to pass her hand in front of it, the cardboard hand would rotate forward to give her a high five. Ultimately, this is pretty simple; just a servomotor and a sonar distance sensor. The way I have this setup is such that the sonar sensor is embedded in the cardboard hand. I think (and I could be wrong) that the sonar sensor readings are getting thrown off by the jittering of the servomotor. Even when it’s not being activated, the servo buzzes at a high frequency, which I think messes up the readings from the sonar sensor. Perhaps this was a good opportunity to use an infrared sensor. The end of my post has a few pictures of current (failed) setup.
I think I could make this work by taking some of the following steps. Instead of using a servo motor, I could get my act together and use a step motor with an external power supply. I think that this would prove to be the most difficult solution from a hardware and software perspective, but I think that it would probably result in the best end product. Alternatively, I could slap in a bigger servomotor such that the machine would reliable rotate the hand forward.