Introduction: Portable Motion Sensor Module
I guess that you guys have seen a lot of tutorials about integrating PIR sensor to a lamp and make it able to turn on/off automatically.
My tutorial is not much different from those. But I have my own improvisation. I will make this project in a more "portable" way.
The main idea here is to build a separated module with three main components: a PIR sensor, a relay module, an adapter.
With this module, just plugin a lamp or a fan into it, then plug this module in a electric socket, after that, your household application is turned into an automatic application! Quite simple.
As the most interesting feature of this module, you can take it anywhere, instantly turn any traditional lamp or fan into a automatic one.
Let's do this.
Step 1: Gathering the Parts
To complete this project, you will need 3 main components:
- PIR sensor
- 5 volt Relay Module
- 5 volt Adapter (from 220 volt to 5 volt or 120 volt to 5 volt, it depends on the electricity of your town)
In addition, some jumpers should be prepared.
To add portability to our project. You should buy some 5mm Foamex sheets. I choose Foamex because it is durable and easy to cut with a knife.
Step 2: Wiring
In this step, you will connect 3 main components to each other.
First, considering the adapter. It converts from 220 volt AC to 5 volt DC. You should notice that it has 2 pairs of wires. In my case:
- The red-black pair is output. So I will connect this pair to relay module and the sensor.
- The yellow-yellow pair is input. So I have to connect it to the power socket.
The red wire will be connected to Vss+ and Vcc in the relay module. Our PIR sensor also need energy, so the red wire will be pluged into Vcc pin.
The black wire will be connected to GND and Vss- in the relay module and GND in the PIR sensor.
Second, the OUT pin in the PIR sensor should be wired with EN1 in the relay module.
Third, you've known that, in the relay module, NC, NO, and COM are three ports that can be connected to our household application. For detail about these ports, please see the references at the end of this tutorials.
In my project, I want to make it portable, so I have prepared 2 socket. Household socket in local stores only has two ports.
I will connect the COM port to a port in the first socket, NC port to another port the second socket. And these socket must share a common line. I mean that two socket must be connected to each other via a common port.
Step 3: Testing
Now, just 2 more step and out module will be ready.
I will test my module like this picture.
I'd like to use a multimeter to ensure that the output voltage is correct so it won't damage anything.
Step 4: Finishing
After testing our module. Now, we will put it into a Foamex case. I build a case with the following measurement: 16x7x7 cm.
I use hot glue to stick the sockets and other component to the case.
I am extremely clumsy so the wires look terrible.....
Step 5: Configuring
You should notice that our PIR sensor has two knob. As you can see on the picture, The left one is distance adjustment and the right one is delay adjustment. Increment is clockwise. Decrement is counter-clockwise