Feasibility - sensing person standing and linking to light with gradual on & off


I would be very grateful for any advice on the feasibility of using arduino for a project I'm working on. :slight_smile:


A glass window with concealed lighting that a person can approach.

What I would like to do:

When someone approaches the window, stands in-front of it, and looks through it for a set period of time the concealed lighting gradually turns on. The lighting either stays on for a set period of time and gradually fades off, or stays on for as long as a person is stood in-front of the window.

I've been looking through the forums and online as to how this can be achieved but haven't found anything yet. I'm new to arduino, but very keen to learn, so any pointers in the right direction would be much appreciated.

Thank you in advance,


It is difficult to put arduino and eyes in the same postal or project code. So you want the light to only fade in when the person has stood in front of your window and looked into it. If someone backs in front of the window, stands for a moment with his back towards the window, you want no reaction? That requires facial recognition. Look into raspberry pi and openCV applications. You can have a raspberry pi camera pointed at the windows from the inside to recognize eyes. I'm not familiar with how the code works though. You might be able to tell the person's eyes and approximate distance to your camera.

Google openCV face or eye detection recognition etc. Plenty of tutorials.

I don't think he's looking for something that fancy - if he just wants it to react to something approaching it, maybe ultrasonic ranging sensors (HC-SR04 et al)? Or PIR? or both?

That's probably your best bet. I saw a project like this recently - it was done with an Espruino, but here's the thread where he talks about it: Distance - Color RGBLED + Distance sensor HC-SR04 (having strange results) | Espruino

Many thanks for your replies.

luidr - In answer to your question, I would like there to be a reaction whether a person is facing forward or backwards. I'm just interested in the distance and time spent in-front of the window. Sorry if this wasn't clear.

DrAzzy - Thank you for the suggestions and link.

It looks like an ultrasonic range sensor combined with a timer would be a good starting point. When the range sensor is triggered the timer could also be triggered, at the end of time time period the range is checked again and if its still within range the lighting fades in?

Thanks again the pointers.

Sounds like a good plan. Just have to mount the sonic ranger so that it doesn’t look too intruding.

Here’s some of the more expensive sensors I’ve used:

The HC-SR04 sensors are cheap but hard to hide (if that’s your concern too).

Thank you for your help!