Prototype contactless bathroom power switches with Arduino and Sainsmart relays

Reblog From: http://www.grantgibson.co.uk/blog/2013/05/arduino-sainsmart-relay/

A couple of months ago a friend showed me his plans for a new bathroom in his house.  The plans included a number of electrical items – fans, lights, etc – all of which required switches.

The problem is that – in the UK at least – there are tight regulations around electrical switches in the bathroom.  Two standard solutions are to either have all switches outside the bathroom door, or have ceiling-mounted switches inside controlled by pull cords.

Neither solution was ideal – having to leave the bathroom to change the lights isn’t great, and the number of different electrical items made pull cords impractical (they’d need at least four cords in the corner of the room and it’s unlikely any guest would be able to work out what did what.

I proposed a solution using infra-red proximity sensors mounted underneath a sealed glass shelf.   I then got to work on a prototype which is shown in the video below.

The system uses four IR proximity sensors (approx £5 each) linked to an Arduino Uno.  The Arduino is hooked up to a Sainsmart 4-way mechanical relay capable of switching mains voltage at up to 10 amps.  Also linked to the Arduino are four RGB LEDs.  We’re using the blue and red inputs on each LED to indicate the on/off state of each relay.

Controlling the switches is pretty straightforward.  The proximity sensors project a fairly narrow beam directly above, allowing them to be mounted fairly close together without problems.  They also have an analogue distance adjustment, controlled by a screw on the underside, which determines how high above themselves they can ‘see’.  To switch the relay on or off you simply pass your hand 0-15 centimetres above the relevant IR sensor.

I’ve written an Arduino sketch that does some basic checks and ‘de-bounces’ rapid flickering hand movements so the relays aren’t triggered on then off again say by two fingers that are slightly apart.

Here’s a basic breadboard schematic of the setup (click for full size):

Relay breadboard

The Arduino sketch is available on GitHub: https://github.com/grantgibson/ir-switch/

Important disclaimer: I have no electrical qualifications.  I don’t even know if this system meets wiring regulations for bathrooms (or any room for that matter).  It’s just a prototype I built for my own amusement.  If you try to follow my method you assume all responsibility for anything that goes wrong or right.  Remember – mains voltage can kill.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: