instructables Security Camera by maartenbrysbaert The SeCam is a security camera that allows you to: - Livestream - Rotate your camera 180 degrees - Capture and record - View captured photos and recorded videos - Turn on an alarm and led when there is motion detected (in this version the motion sensor is replaced by an button because the motion sensor was broken) Security Camera: Page 1
Step 1: Necessities and Materials Necessities: 1. Raspberry Pi B 3 2. SD Card 3. Raspberry Pi camera V2 NoIR 4. Led Light 5. Active buzzer 6. Servo Motor 7. 2 resistors 220 Ohm 8. PIR motion sensor 9. Ethernet cable 10. Wood 11. Toothpick 12. Fine iron wire Materials: 1. Screwdriver 2. Tape 3. Solder 4. Arduino jumper cables 5. Glue Security Camera: Page 2
1 1 1. raspberry pi b3 1. SD Card 32 Gb 1 1 1. blue led 1. Piezzo active buzzer 5V 1 1 1. servo motor 1. resistor 220 Ohm Security Camera: Page 3
1 1. Pir Motion sensor 2 1 1 1. wood 1. fine iron wire 2. toothpick Security Camera: Page 4
1 1. jumper cables (male and female) Download (https://cdn.instructables.com/orig/fbm/ew49/j44fhkqu/fbmew49j44fhkqu.pdf) http://www.instructable (https://cdn.instructables.com/orig/fbm/ew49/j44fhkqu/fbmew49j44fhkqu.pdf) Step 2: Set Up Raspberry Pi 1. Download the image on the SD card: https://www.raspberrypi.org/documentation/installa... 2. Connect with SSH (with putty) username: pi, password: root. 3. Enable PiCam in the raspi-config menu with command 'sudo raspi-config'. Security Camera: Page 5
Step 3: Set Up MySql on Raspberry Pi 1. Download MySql (see picture) 2. Make user (see picture, remember password and username) 3. Copy DDL code below and execute this to create the database. create table account ( ID int auto_increment primary key, username varchar(45) null, first_name varchar(45) null, last_name varchar(45) null, email varchar(45) null, password varchar(45) null ) ; create table media ( ID int auto_increment primary key, type tinyint null, name varchar(45) default 'naamloos' null, date datetime null, triggered tinyint null ) ; create table settings ( ID int auto_increment primary key, securitymode tinyint null, pan int null, alarm tinyint null, led tinyint null, email tinyint null ) ; 4. insert data use securitycam; insert into account(id, username, first_name, last_name, email, password) VALUES (1, 'admin', 'admin', 'admin', 'admin@admin.be', 'admin'); insert into settings(id, securitymode, pan, alarm, led, email) VALUES (1, 1, 0, 1, 1, 0); Step 4: Set Up Pistreaming install libav-tools with this command: sudo apt-get install libav-tools git python3-picamera python3-ws4py Security Camera: Page 6
Step 5: Download Code From Github Download the following github code on your raspberry pi. https://github.com/maartenbrysbaert/project_v2 Step 6: Custumize Code to Your Choices. Change username and password on top of "DbClass" to the username and password you chose in step 3. Step 7: Run Script by Startup Raspberry Pi Connect again to your raspberry pi with SSH and open '.bashrc' with this command: "sudo nano /home/pi/.bashrc" Then go to the bottom of the file and add "sudo python /path/project_v2/project_v2.py &". Replace 'path' with your own path. Step 8: Attach Picam to Servomotor Use toothsticks and iron wire to attach the camera to the servomotor. Try to make the same as shown on the picture. Security Camera: Page 7
Step 9: Build Housing 1. Create bottom: Saw some MDF wood with following measures: 16cm x 8cm x 2cm 2. Create top: Saw another piece of MDF wood: 16cm x 8cm x 0.5cm and saw some slots for the servo motor, picam cable, led and PIR motion sensor cables. (see pictures) 3. create walls: Saw 1 piece MDF wood: 8cm x 4cm x 2cm Saw 1 piece MDF wood: 5.5cm x 4cm x 2cm 4. attach raspberry pi on bottom: Measure where the 2 screws should be inserted, and draw the points on the wood. Then put the screws in using a screwdriver. (see picture) Security Camera: Page 8
Security Camera: Page 9
Security Camera: Page 10
Step 10: Solder Everything Solder all components so they have a female output that can easily be connected to the GPIO pins of the raspberry pi. Be sure to sold an resistor of 220 ohm between the led and ground. Then isolate with tape. Security Camera: Page 11
Step 11: Attach Jumpers to Raspberry Pi Build circuit using the pictures. Be sure that the raspberry pi is turned off while doing this! 1. Plug in the picam into the raspberry pi. (see picture) 2. Attach soldered components to raspberry pi pins. (see picture) - The red cable of servomotor into 5V, brown into GND and orange cabel into pin 19. - "+" from buzzer into pin 13, "-" into GND - "+" from led into pin 26, "-" into GND - VCC from motion sensor into 5V, GND into GND and OUT into pin 21. use this link to get to know which pins are GND, 5V or GPIO pins. https://www.raspberrypi.org/documentation/usage/gp... Security Camera: Page 12
Step 12: Finish of Housing 1. Drill some holes in top of the housing for the led and motion sensor. Put them through the holes. 2. Put the servomotor through the provided slot and fix it with a screw. 3. Glue the wooden walls. 4. You can continue building as much as you want, you can make the top detachable etc. Security Camera: Page 13
Security Camera: Page 14
Step 13: Final Steps Setup wifi on the raspberry: command: sudo nano /etc/wpa_supplicant/wpa_supplicant.conf then add: network={ ssid="network name" psk="password" key_mgmt=wpa-psk reboot the pi Find out which ip address the raspberry pi received (with command: 'ifconfig'). Wait 1-2 minutes. Surf to: 'ipaddress:5000'. You will first have to login with: username: admin, password: admin. Then you wil see the livestream and options! } Security Camera: Page 15