Introduction: Motion Sensing Outlet

About: Maker from USA. Follow me to stay up to date on my projects and possible kickstarters! Business email: constructed@mail.com

Hi!

Today i'll be teaching you how to make a motion sensing outlet!

As always I have a video documenting the project in step 2

Its perfect for Halloween, just simply plugin your favorite decoration, and whenever the sensor detects motion, the decoration will spring to life!

Best of all the the project uses a mediatek linkit one! This board is amazing and so simple to use! It really is one of the most powerful boards I have ever used.

I made this project after my first idea fell apart... I had a plan to build a POV RGB LED wand, however it did not turn out well. Oh well, maybe next time.

*One more thing, we are working with a lethal amount of electricity. Please know what you are doing*

Also this proect is only suitable for wall outlets rated 120v. for higher voltages (220+) you will need a stronger relay

Step 1: Watch the Video!

Step 2: What You Need

To build this, You will need

  1. A recycled box mine even came with a powercord!
  2. LinkIt One
  3. A relay module
  4. PIR motion sensor
  5. Spare wall outlet

http://goo.gl/DDgePJ (If you dont have a linkit)

http://goo.gl/hC1sv9 (Cheaper price)

http://goo.gl/238eVJ (cheaper price)

For most of the parts I got them at www.gearbest.com

Gearbest is so friendly and the FASTEST shipping time.

They have cheap prices and are my #1 site whenever I need parts for a project.

Please check them out and tell them I sent you.

Step 3: Cut the Box

Using a wall outlet face plate, trace the outline of the wall outlet onto the box

Dont forget to mark a spot for the PIR motion sensor as well

Next drill out the parts you wont need and file it down so they fit tight.

Step 4: Test the Circuit

Before you put the whole project in the enclosure, make sure to test that it works first

Hook up

(LIO) (RLY)

+5v VCC

GND GND

D7 IN1

Next look up "simple relay code" I used this guide here

https://www.instructables.com/id/interface-relay-wi...

test that they work!

Step 5: Put Circuit Together

Now assemble the cicuit

Remember 120v can be lethal. Unplug the power, Be smart.

Im not resposible for your actions, dont get hurt

Wire up the power to the outlet, but take the HOT line, cut it and feed it into t

Step 6: Final Touches

Now put the circuit back together, wrap in electrical tape to avoid shorts and upload the code

here is the code:

/*******************************************************************************/
/*macro definitions of PIR motion sensor pin and LED pin*/ #define PIR_MOTION_SENSOR 8//Use pin 8 to receive the signal from the module #define LED 7//the Grove - LED is connected to D4 of Arduino

void setup() { pinsInit(); }

void loop() { if(isPeopleDetected())//if it detects the moving people? turnOnLED();

else turnOffLED(); } void pinsInit() { pinMode(PIR_MOTION_SENSOR, INPUT); pinMode(LED,OUTPUT); } void turnOnLED() { digitalWrite(LED,HIGH); } void turnOffLED() { digitalWrite(LED,LOW); } /***************************************************************/ /*Function: Detect whether anyone moves in it's detecting range*/ /*Return:-boolean, ture is someone detected.*/ boolean isPeopleDetected() { int sensorValue = digitalRead(PIR_MOTION_SENSOR); if(sensorValue == HIGH)//if the sensor value is HIGH? { return true;//yes,return ture } else { return false;//no,return false } }

Step 7: Youre Done!

Youre done!

Whenever the motion detector detects motion, the relay will spring and the outlet will come to life!

Plug in halloween decorations for the best effects!

Please vote and comment for this instructable in the contests! Thank you!

Also dont forget to check the Mediatek linkit one page before you go!

https://www.instructables.com/id/mediatek-linkit-on...

And remember if you need any parts...

www.gearbest.com

Bye!