I’m creating CCTV system called DAVID and I need help with coding. CODE 1.I have two Raspberry Pi 4 that I need them to be connect/communicate using ethernet Cable -Please provide step by step process...

1 answer below »
I need help coding-- attach is the instruction of the code i need


I’m creating CCTV system called DAVID and I need help with coding. CODE 1.I have two Raspberry Pi 4 that I need them to be connect/communicate using ethernet Cable -Please provide step by step process on how do this? 2.I want python code to run on raspberry Pi for motion detector and camera. -I need the camera to record video for 30 second, once the motion detector is activated - I want the resolution for the camera to be at 1080pi 3 I need a python code for RFID . 4. Code for single Relay board 5. another Python code for an email to be sent to the user for the 30 second video(the video is from camera and motion detector) notification the user. 6.All these codes 2-5 should be single code and also please provide instruction once I download ur code how will I run the code using raspberry pi.
Answered 2 days AfterApr 21, 2021

Answer To: I’m creating CCTV system called DAVID and I need help with coding. CODE 1.I have two Raspberry Pi 4...

Sandeep Kumar answered on Apr 23 2021
150 Votes
cctv_adam.docx
CCTV SYSTEM
1. Connecting two Raspberry Pi using Ethernet Cable
In order to connect the two raspberry Pi’s 1 and 2 is to configure each Pi to
have a unique static IP within the same network by editing the /etc/network/interfaces. You need to connect them using an ethernet cable
on PI 1
auto eth0
iface eth0 inet static
address 192.168.1.5
netmask 255.255.255.0
gateway 192.168.1.6
on PI 2
auto eth0
iface eth0 inet static
address 192.168.1.6
netmask 255.255.255.0
gateway 192.168.1.5
This will allow each Pi to see the other but not any other device on the subnet which allows the network to be secure and flexible
Part 2-5 provided in the python code
As for how to connect them, just connect the individual modules to the GPIO pins in the raspberry pis and enter the GPIO slots in the python code, the comments are there to assist you.
cctv.py
import gpiozero
from gpiozero import MotionSensor
from picamera import PiCamera
from datetime import datetime
from email.mime.multipart import MIMEMultipart
from email.mime.base import MIMEBase
from email.mime.text import MIMEText
import email.encoders
import smtplib
import os
import email
import sys
import time
camera = PiCamera()
pir = MotionSensor(4)
camera.rotation = 180 # delete or adjust to 90, 180, or 270 accordingly
h264_video = ".h264"
mp4_video = ".mp4"
while True:
# record h264 video then save as mp4
pir.wait_for_motion()
video_name = datetime.now().strftime("%m-%d-%Y_%H.%M.%S")
camera.start_recording(video_name + h264_video)
pir.wait_for_no_motion()
...
SOLUTION.PDF

Answer To This Question Is Available To Download

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here