DIY Home Automation: Motion Sensing Switch

DIY Motion Sensor Switch

I have this habit of never turning off lights in my bathroom when I get out, it stays on for the entire night and in the morning I get an earful from my Mom or my flatmates depending on where I am. After acknowledging that I will never be breaking this habit, I did what was an obvious choice , I built a motion sensor switch. It automatically turns off light in the bathroom if no one is inside and turns on when somebody enters it. Trust me, this was much more useful than I thought it would be. So here is a guide on how to make one if you are like me.

A list of things you need to get started:

  1. PIR Motion Sensor Module x 1 : Banggood | Amazon
  2. 5V Relay Module x 1 : Amazon | Banggood
  3. 5V AC to DC converter x 1 :
  4. Female DuPont Cables : Amazon | Banggood
  5. 18 AWG wire(for AC connections).
  6. A suitable enclosure.

Disclosure: These are affiliate links, I get a small commission for qualifying purchases.

Things you need

Got them? Lets begin the build. Refer to the connection diagram below to wire up the components.

Test Circuit

Test the circuit to see if it detects motion by swiping your hand across the PIR motion sensor. Use the timing and sensitivity dials( left and right respectively in the image below) to set it to the required time and range. Timing dial controls the on time of the sensor for each detection, it can be from 3s to 5min. You can set the sensitivity to adjust the range of detection from 3m to 7m.

Download STL files from here and print them to get your enclosure. Don’t have a 3D printer yet? Don’t worry, a simple plastic box would do.

Install it in your bathroom (or wherever) by referring to the circuit diagram given above.

Done and done! Simple, wasn’t it? Enjoy the surprise on your guest’s face when they enter your bathroom ;p !

Follow this excellent tutorial if you want to learn more about PIR motion sensors.

Thank you for reading, hope you enjoyed it, see you in the next post!

Leave a Reply

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

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

Facebook photo

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

Connecting to %s

%d bloggers like this: