Cov txheej txheem:

Raspberry Pi Kuaj Lub Koob Yees Duab Nrog Email Ceeb Toom: 3 Cov Kauj Ruam
Raspberry Pi Kuaj Lub Koob Yees Duab Nrog Email Ceeb Toom: 3 Cov Kauj Ruam

Video: Raspberry Pi Kuaj Lub Koob Yees Duab Nrog Email Ceeb Toom: 3 Cov Kauj Ruam

Video: Raspberry Pi Kuaj Lub Koob Yees Duab Nrog Email Ceeb Toom: 3 Cov Kauj Ruam
Video: Saib Mis paub Poj niam (hluas nkauj) tus yam ntxwv lub siab 2024, Kaum ib hlis
Anonim
Raspberry Pi Kuaj Lub Koob Yees Duab Nrog Email Ceeb Toom
Raspberry Pi Kuaj Lub Koob Yees Duab Nrog Email Ceeb Toom

Kev nyab xeeb yog kev txhawj xeeb loj niaj hnub no thiab muaj ntau yam thev naus laus zis niaj hnub no los ua kom koj qhov chaw nyab xeeb thiab saib xyuas. Cov koob yees duab CCTV muaj txiaj ntsig zoo los ua kom pom qhov muag ntawm koj lub tsev lossis chaw ua haujlwm. Txawm hais tias tus nqi ntawm cov hom koob yees duab no tau raug txo qis txij li lawv pib tab sis tseem yog IP lub koob yees duab, uas muaj peev xwm xa thiab tau txais hnub tim dhau lub network, yog kim heev. Hauv Cov Lus Qhia no peb tau ua lub koob yees duab me me uas yuav xa email ceeb toom, yog lub koob yees duab pom tias muaj kev txav mus los ntawm lub koob yees duab

Kauj Ruam 1: Sau cov Cheebtsam

Sau cov Cheebtsam
Sau cov Cheebtsam

1. Raspberry Pi lub koob yees duab / webcam

2. Raspberry Pi 3

3. Motion sensor

Kauj ruam 2: Programming Koj Raspberry Pi

nab hab sej yuav yog qhov kev xaiv zoo rau Program raspberry Pi, yog li peb puas tau …

chaws:

los ntawm picamera ntshuam PiCamera los ntawm lub sijhawm ntshuam pw

ntshuam smtplib

lub sij hawm ntshuam

los ntawm datetime ntshuam datetime

los ntawm email.mime.image ntshuam MIMEImage

los ntawm email.mime.multipart ntshuam MIMEMultipart

ntshuam RPi. GPIO ua lub sijhawm GPIO ntshuam

toaddr = '[email protected]' # tau txais email id

kuv = '[email protected]' # xa email id

Kawm = 'ceeb toom kev nyab xeeb'

GPIO.setmode (GPIO. BCM)

P = PiCamera ()

P.resolution = (320, 240)

P.start_preview ()

GPIO.setup (23, GPIO. IN)

thaum Muaj Tseeb: yog GPIO.input (23):

print ("Tsab ntawv tsa suab …") #lub sijhawm ua kom sov lub koob yees duab

sijhawm.sleep (2)

P.capture ('txav.jpg')

sijhawm.sleep (10)

subject = 'Kev nyab xeeb kev ceeb toom !!'

msg = MIMEMultipart ()

msg ['Subject'] = ntsiab lus

msg ['Los ntawm'] = kuv

msg ['To'] = toaddr

fp = qhib ('txav.jpg', 'rb')

img = MIMEImage (fp.read ())

fp.close ()

msg.attach (img)

neeg rau zaub mov = smtplib. SMTP ('smtp.gmail.com', 587)

server.starttls ()

server.login (user = '[email protected]', password = 'xxxxxxxxx') #tus lej email thiab tus lej zais ntawm cov xa ntawv

server.sendmail (kuv, toaddr, msg.as_string ())

server.quit ()

P.stop_preview ()

Kauj Ruam 3: Khiav Python Code thiab Troubleshooting

Khiav Python Code thiab Troubleshooting
Khiav Python Code thiab Troubleshooting
Khiav Python Code thiab Troubleshooting
Khiav Python Code thiab Troubleshooting

txuas PIR sensor pins rau

1. PIR vcc rau rpi-2 (Pin Lub Cev)

2.. PIR gnd to rpi-6 (Pin Pin)

3. PIR tawm mus rau rpi-16 (Tus Pin Lub Cev)

(Lub cev pins suav yuav pib los ntawm 1-40 saib daim duab)

Yog xav paub ntxiv thov saib cov duab

theej cov cai rau ntawm rpi-desktop

ces qhib davhlau ya nyob twg

  • cd Duab Desktop/
  • sudo nab hab sej codce1.py

qhov ntawd yog nws

daws teeb meem

1. Yog koj pom muaj qhov yuam kev nkag thaum ua haujlwm nab hab se thov rub cov cai los ntawm daim ntawv txuas ntxiv code1.py

2. Yog koj pom lub vijtsam dub / grey hloov chaw tso video hauv Pi

ntaus cov lus txib hauv qab no hauv davhlau ya nyob twg

sudo modprobe bcm2835-v4l2

3. Ua kom koj tau ntxiv cov ntawv pov thawj gmail kom raug, tom qab ntawd khiav cov nab npawb nab npawb

Pom zoo: