Introduction: PIR Motion Sensor Box

Project Objective:

Turn on a house appliance with infrared motion!

Project Materials:

  • 18 gauge wire connecting high voltage to the relay - $1.00

Approximate Total Price: $20

Source Code:


Step 1: Prototyping on Solderless Breadboard

Once you have all the material and the source code downloaded, you can refer to the Fritzing circuit schematic above in order to build your circuit on the breadboard.

Step 2: Relay and Wiring


It might be a good idea to research how relays work. Most relays have a diagram either on the top or the bottom. They comprise of a coil and a magnetic switch. This will allow us to control a high voltage appliances with our Arduino's 5 volts.


Using the 18 gauge wire, connect the to coil pins on the relay to the terminal block. 18 gauge wire is rated up to approximately 30 amps which mean the appliance that we will eventually plug into the motion box will be limited to 30 amps. But do not worry, most lights draw a very low amperage and it should be labeled with the amperage that it draws. The chart above suggests that our 18 gauge wire can handle approximately 30 amps.

Step 3: Testing Low Voltage

This step was not entirely necessary, but I felt that it was a good idea to debug the circuit with a 9 volts battery instead of the dangerous 120 volts or line voltage. This is running the Blink program to demonstrate that we can control a high voltage with the Arduino Micro’s 5 volt supply. That clicking sound you here is the sound of the mechanical switch firing in the relay.

Step 4: High Voltage and Precautions

Before we work with 120 volts, it is important to do some research and take great precaution as HIGH VOLTAGE WILL KILL YOU, so be carefully. Make sure you wires are not live when you are working with them.

Tips for working with high voltage:

  • If you do find yourself working with live wires during this project, which is not a good idea, be especially aware of the black wire because it carries all the power.
  • I would recommend keeping your non-dominant hand in your pocket while you work. This will ensure that during a worst case scenario the current does not travel through your heart and kill you.

Furthermore, if you are not familiar with line voltage connection, follow the diagram above.

Step 5: Connecting High Voltage Wires

Now if your circuit is setup properly, you can splice your power line and connect it to the relay’s power terminal connection just like you did with 9 volts in step 3.

Step 6: Final Result

By triggering the motion box’s PIR sensor and activating the relay you can turn on a light, iHome speaker system, alarm, or whatever your heart desires, so long as it does not over draw the amperage.

Home Automation

Participated in the
Home Automation