Close

Nightlight Bug

A project log for Ghosty, the Thinking Nightlight

When you go to the bathroom this light (very subtle) comes on--10 seconds after you leave, it turns off. Sleep well, move around safely.

mike-rigsbyMike Rigsby 10/01/2016 at 17:270 Comments

Another night with Ghosty, but he still performed erratically. Sometimes he would turn on when I walked by--sometimes not. If I went slowly, he would always work. What's going on? My suspicions centered around the little green light on the Ping transducer.

What if that light somehow convinces the photocell that it is daytime?

The hardware side of me wanted to pull the Ping out of Ghosty's head and crush the led with a pair of wire snippers! The software side (knowing that it's up against an adrenal filled "do something" junkie) protested.

"You might destroy the Ping and have to wire in a new one. You really don't know if that's the problem--let's at least prove it before you go on your destructive rampage."

Barely succumbing to the logic, I agreed to give it a little thought and one or two tests. In software I ask, "Is it dark? If it's dark, is anyone passing by? If no one is passing by, repeat." The "Is anyone passing by?" question fires up the Ping and lights the little green light. If this is done enough times, the inside of Ghosty's head gets fairly green and the photocell thinks it's daytime.

"So what?" argues my hardware side. The light is off when the "Is it dark?" question is asked. Our photocell friend, however, is what you might call, "a little slow." By placing a .2 second delay before reading the photocell the problem is solved.

At least, it's solved in my test room. Tonight, we'll find out for sure!

Discussions