more complete version
led off when there is no object
add auto power-down logic