-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsecurity.py
More file actions
25 lines (20 loc) · 846 Bytes
/
security.py
File metadata and controls
25 lines (20 loc) · 846 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
from picamera import PiCamera
from time import sleep
from datetime import datetime
from gpiozero import MotionSensor
camera = PiCamera()
pir = MotionSensor(4)
while True:
filename = "{0:%Y}-{0:%m}-{0:%d}".format(now)
pir.wait_for_motion()
# Code stops here until motion is detected by the motion sensor^
camera.start_recording(filename)
pir.wait_for_no_motion()
camera.stop_recording()
# Then playback the video with the terminal icon on pi editor interface and enter 'omxplayer {filename}'
# To disable the led so there is no indication that the camera is on:
# in terminal: sudo nano /boot/config.txt
# add to end of file: disable_camera_led=1
# ctrl+o then ctrl+x to save and close
# in terminal: sudo reboot
# Future plans: upload files automatically to dropbox in the event that the pi is physically compromised