I wrote some software for the ATTiny85 to manage all this. That will be forthcoming soon.
Since I am using an ATTiny85, I couldn't use the Arduino environment to program it, readily. I think there are some ways to configure the environment to do it, but in the end, it was just easier to set up an Eclipse environment with the AVR GCC compiler and program my own PWM (for dimming LEDs) and millisecond counter (i.e. the "delay" function).
Here's the flowchart for the processor:
When no hand is present, the range is the distance between the sensor underneath the cabinet and the top of the counter. This is the "Max" distance
The "Min" distance is some range above '0' (because the sensor can only resolve distances above around 1 cm).
A Hand is "near the cabinet" when the measured range is in the lower 10% of the range between Min and Max.
A Hand is "Removed" when the range is in the top 10% of the range between Min and Max.
When a distance is measured, the Min and Max values are saved to create a range between the bottom of the cabinet to the top of the counter.
I found that due to humidity and temperature changes, the Max range can 'drift' over time. To compensate for this, whenever the State is "Off" and the Ultrasonic sensor is pinging for the presence of a Hand, the Max is decremented so that the Max range can be refreshed. Otherwise, the 10% max range I use to determine the removal of the hand would "disappear below the counter" over time and the user would never be able to escape the Ranging State.