Introduction: Possessed Screen for Halloween Using PIR Sensor and Arduino!!

Picture of Possessed Screen for Halloween Using PIR Sensor and Arduino!!

It's Halloween!!! Time to decorate your house as creepiest as possible!!! Besides the traditional costume, there is technology for you to be creative!!!. This tutorial will show you how to build a possessed screen to surprise your friends passing by.

AtmosFX has some very cool jump-scare video that are only $7.99 each. It is perfect to decorate you possessed house at Halloween.

The components that you will need are:

  1. - Arduino (UNO, Nano, Mega,...) in this tutortial, I use Arduino Nano
  2. - Connecting cable.
  3. - PIR Sensor
  4. - Some female to female wire
  5. - A laptop
  6. - A mean to display (TV screen, Projector,...)

Now, let's do some programming!!

Step 1: Set Up Your PIR Sensor and Arduino:

Picture of Set Up Your PIR Sensor and Arduino:

Now let's begin with the wiring.

The PIR sensor has 3 pins. From left to right:

- VCC: connect to 5V pin of the Arduino - OUT: the pin to collect data, connect to 12 pin of the Arduino. - GND: connect to GND pin of the Arduino.

Connect the cable from your Arduino to your laptop.

Step 2: Upload the Code to Your Arduino:

Picture of Upload the Code to Your Arduino:

With your Arduino connected to your laptop, now open Arduino IDE. It can be install here.

Copy this code to your .Arduino IDE:

void setup() {<br>  Serial.begin(9600);                                       //Begin the Serial communication with your computer
}
void loop() {
  if(digitalRead(12) == HIGH){                         //To check if the PIR sensor detects your friends
    Serial.println(1);                                          //Send 1 to your laptop, mean there are some person passing by
  }
  else Serial.println(0);                                   // If there aren't anyone, send 0
  delay(60000);                                              // Some free time after sending data to avoid continually playing the video
}

Now click "Upload" to transfer your code to the arduino.

Step 3: Set Up Your Python Program!

Picture of Set Up Your Python Program!

In this tutorial, I use python 3.5.2 32 bit.

There a library you need to install to use the code.

Open your Command Prompt and type:

pip install pyserial

and press Enter. Wait for the library to be downloaded.

Now open Python IDLE.

import serial, time<br>
#TWO CLASSES BELOW IS TO DISPLAY VIDEO
class Video(object):
    def __init__(self,path):
        self.path = path
    def play(self):
        from os import startfile
        startfile(self.path)
class Movie_MP4(Video):
    type = "MP4"
#THE MAIN CODE:
count = 0
arduino = serial.Serial('COM5', 9600, timeout=.1)	       #SET UP YOUR CONNECTION TO THE ARDUINO.
time.sleep(1) #give the connection a second to settle	       #YOU SHOULD REPLACE "COM5" WITH YOUR COM 
movie = Movie_MP4(r"C:\Users\admin\Desktop\scare\scare.mp4")   #YOU SHOULD WRITE YOUR OWN DIRECTORY TO THE VIDEO HERE
while True:
        data = arduino.readline()		#READ DATA FROM ARDUINO
        print(data)
        if (data == b'1\r\n'):			
                movie.play()			

Copy and paste the code above, or download mine.

My Arduino is connected at COM5.

At the python window, press F5 to run the script.

Step 4: Display Your Spooky Video!!

Now the last step is to connect your laptop into a TV screen, a projector or whatever mean of display you have. I don't have one right now so I'll use my laptop screen instead.

When a friends passing by, the PIR will detect that there are people. It will trigger the arduino to send data to the python script, that will open the Video.

It's all done now and it's time to have some fun with your friends.

Happy Halloween!!

Comments

Swansong (author)2017-11-02

I love these effects! I'm hoping to set some up in the windows next year. :)

fast_as_cheetah (author)Swansong2017-11-02

Thank you ^^ I'm glad that you like my tutorial <3

About This Instructable

352views

7favorites

License:

Bio: I love coding and electronics!!
More by fast_as_cheetah:Possessed Screen for Halloween Using PIR Sensor and Arduino!!
Add instructable to: