I am trying to come up with my first "real" arduino project and I'd like to create an automatic motion based light switch for our hallway.
My plan is to prototype everything using the arduino and a motion sensor and then figure out how to replace one of our wall light switches with a smaller version.
I don't care about detecting at long distances as the hallway isn't very wide. I would like the angle of the motion sensor to be narrow (if it is too wide we'll constantly be triggering the sensor). It should work well under different ambient lighting conditions.
I am considering this guy as the sensor since I don't need any distance information:
When the sensor alerts me that the beam has been broken I'll switch on the light for a specific period of time.
I'd to still like to allow for manual on/off control (via the light switch).
I don't need tons of details (I'd like to figure it out on my own) but if there are any glaring issues a newb should know about I'd appreciate it if you'd share them with me.
I've read that information which is why I am choosing not to use that sensor. Unless I am mistaken, you cannot modify the angle of detection of that sensor, so for my project I don't believe it is appropriate. I guess I could make parts of the dome opaque (or block it in some other way) but I think the sensor I listed in my original post is a better fit.
Are you aware that you can buy motion-activated domestic light switches?
Nothing wrong with making your own if you fancy it as a project, just be aware that what you're proposing already exists and works reliably and safely.
Yes, I know that they exist (I am well aware Google).
All I am asking is... are there are any gotchas I should be aware of (things that might trip up a new arduino user)? Perhaps I am not asking correctly?
I've been a software engineer for 20 years (iPhone team at Apple and Visual Studio team at Microsoft, et. al.) but I am new to arduino/electronics. So I figured I'd ask here instead of electrocuting myself, burning down my house, etc.
The big gotcha is that anything involving interfacing Arduino to mains voltages introduces potentially fatal dangers which need to be fully understood and addressed in the design. The first rule of thumb is don't try to DIY it - buy a professionally designed and built isolating switch and don't try to put high and low voltage equipment in the same enclosure.
Thank you Peter. I'm thinking of grabbing one at HomeDepot (just saw one for $13) and then taking it apart to see how it was done. I already have all the sensing stuff working using another sensor but integrating it into a "real" device that is connected to the house voltage is a little sobering (as I'm sure it should be).
Have you thought about using pressure pads rather than a motion detector as that eliminates issues about beam widths.
You probably also want to monitor ambient light or include a clock as there is no point putting the lights on in broad daylight.
Build everything on the bench and fully test it before installing it for real.
The hallway in question has no natural light (which is why this motion switch would be so handy - you always have to turn on/off the light).
I figured I could power the arduino using the normal AC adapter I have. I'd remove the physical light switch from the wall entirely and use some other type of (safe, prebuilt) switch to control power to the light. Does anyone know of a pre-built 120V AC switch that can be controlled electronically with the arduino?