Introduction: DIY Security System

In this instructable I will be showing you what I made for my final exam was a DIY security system

(Note: this is a school project it is not completed)

Step 1: Step 1 Making the Cirkit

the circuit I have only has the ultrasonic sensor and the IR receiver hooked up to it I was going to attach the aldreno to a raspberry pie 3 to have it send a photo to any device its wirelessly attached to and add a camera to take the photo when the ultrasonic sencorr is tripped

Step 2: Step 2 Making the Code

the code is not finished but the idea is to make the IR receiver turn on and off the ultrasonic sensor and have a camera take a Pictor and send it to your phone I found this to make it possible but never got around to trying it

( https://www.raspberrypi.org/forums/viewtopic.php?t... )

but here's the code I have right now

#define trigPin 13
#define echoPin 12

#include const int irReceiverPin = 2;

decode_results results;

IRrecv irrecv(irReceiverPin);

int distance; long duration;

void setup() {

Serial.begin (9600);

pinMode(trigPin, OUTPUT);

pinMode(echoPin, INPUT);

Serial.begin(9600); //initialize serial monitor

irrecv.enableIRIn(); //enable ir receiver module

duration = pulseIn(echoPin, HIGH);

distance = (duration/2) / 29.1; }

void loop() {

if (irrecv.decode(&results)) //if the ir receiver module receiver data

{

Serial.print("irCode: "); //print"irCode: "

Serial.print(results.value, HEX); //print the value in hexdecimal

Serial.print(", bits: "); //print" , bits: "

Serial.println(results.bits); //print the bits

irrecv.resume(); // Receive the next value

if(results.value == 0xFFA25D) {

digitalWrite(trigPin, LOW); // Added this line

delayMicroseconds(2); // Added this line

digitalWrite(trigPin, HIGH);

delayMicroseconds(10); // Added this line

digitalWrite(trigPin, LOW);

duration = pulseIn(echoPin, HIGH);

distance = (duration/2) / 29.1;

results.value = 0;

if (distance <= 200){

digitalWrite(trigPin, LOW); // Added this line

delayMicroseconds(2); // Added this line

digitalWrite(trigPin, HIGH);

delayMicroseconds(10); // Added this line

digitalWrite(trigPin, LOW);

duration = pulseIn(echoPin, HIGH);

irrecv.resume();

Serial.print("Distance: ");

Serial.println(distance); } } delay(1000); }

Step 3: Building the Contaner

the container does not really matter as long as the ultrasonic sensor and the IR receiver and the power cord has a place to pop out of so they can work. I just made a box out of some cardboard I had lying around.