Take a look at the Parallax website, they have some tutorials that you can download. One of them gives an example of using the Basic Stamp freqout command to drive an infrared emitter, and then collecting the signal if it is reflected back by an object in close proximity. The neat thing about their approach is that they demonstrate that by changing the modulated frequency you can determine a relative distance to the object. So, no one in the room, no reflection, someone approaches the toilet, wait, they leave, then gosub flush. I would suggest that you also monitor the temperature of the water feed line into the toilet. If unused, the water temperature will be close to room temperature. If you sense a drop in temperature while the infrared sensor senses someone close, or shortly thereafter, then that person flushed, (your fresh water should be colder,) and you don't waste any water flushing a second time.
I'm sure that the infra-red information is in the 'Toddler' robot section of the Parallax site, and I think it appears in a few other places. You'll have to experiment to find the maximum range. Radio-Shack now carries some Parallax sensors, they have a passive infra-red motion sensor, I believe that it's only seven or eight dollars. Might be worth a look.
Good luck!
Jerry.





Bookmarks