Cov txheej txheem:

Ntsej Muag Ntseg Ntseg Ntseg Nrog LTE Pi HAT: 4 Cov Kauj Ruam
Ntsej Muag Ntseg Ntseg Ntseg Nrog LTE Pi HAT: 4 Cov Kauj Ruam

Video: Ntsej Muag Ntseg Ntseg Ntseg Nrog LTE Pi HAT: 4 Cov Kauj Ruam

Video: Ntsej Muag Ntseg Ntseg Ntseg Nrog LTE Pi HAT: 4 Cov Kauj Ruam
Video: Qhov muag qhia neeg phem 2024, Hlis ntuj nqeg
Anonim
Ntsej Muag Ntseg Ntseg Ntseg Nrog LTE Pi HAT
Ntsej Muag Ntseg Ntseg Ntseg Nrog LTE Pi HAT

Kev lees paub lub ntsej muag tau dhau los siv ntau thiab ntau dua, peb tuaj yeem siv nws los ua lub ntsuas phoo ntse.

Kauj Ruam 1: Yam Khoom Siv Hauv Txoj Haujlwm no

Cov khoom siv kho vajtse

  • Raspberry Pi 3 Qauv B.
  • Raspberry Pi Lub Koob Yees Duab Module V2
  • Grove - Tshaj Tawm
  • LTE Cat 1 Pi HAT (Europe)
  • 10.1 nti 1200x1980 HDMI IPS LCD Zaub

Software apps thiab cov kev pabcuam online

  • WinSCP
  • Notepad ++ yog

Kauj Ruam 2: Kev Kho Vajtse Txuas

Kho vajtse txuas
Kho vajtse txuas

Hauv txoj haujlwm no, peb npaj yuav thaij duab nrog picamera thiab paub lub ntsej muag hauv lawv, tom qab ntawd tso saib qhov txiaj ntsig tshwm sim hauv lub vijtsam. Yog tias ntsej muag paub, qhib lub qhov rooj, thiab xa leej twg qhib lub qhov rooj mus rau tus lej xov tooj tshwj xeeb ntawm SMS.

Yog li koj yuav tsum txuas lub koob yees duab rau Raspberry Pi lub koob yees duab interface, thiab teeb tsa lub kav hlau txais xov thiab Grove - Txuas mus rau LTE Pi lub kaus mom, tom qab ntawd ntsaws HAT rau koj Pi. Screen tuaj yeem txuas nrog Raspberry Pi ntawm HDMI cable, tsis txhob hnov qab txuas lub zog rau koj lub vijtsam thiab Pi.

Kauj ruam 3: Software Programming

Lub ntsej muag lees paub

Ua tsaug rau Adas Geitgey thiab nws lub ntsej muag Kev lees paub qhov haujlwm, peb tuaj yeem siv lub ntiaj teb yooj yim tshaj plaws lub ntsej muag lees paub lub tsev qiv ntawv ntawm Raspberry Pi. Cov theem hauv qab no yuav qhia koj yuav ua li cas teeb tsa lub ntsej muag paub ntawm Pi.

Kauj Ruam 1. Siv raspi-teeb tsa los teeb tsa lub koob yees duab thiab GPU nco.

sudo raspi-teeb tsa

Xaiv Kev Xaiv Kev Xaiv - Lub Koob Yees Duab kom qhib lub picamera, tom qab ntawd xaiv Advanced Options - Memory Split los teeb tsa GPU nco, nws yuav tsum hloov mus rau 64. Tom qab ua tiav, rov pib dua koj li Raspberry Pi.

Kauj Ruam 2. Nruab cov tsev qiv ntawv uas xav tau.

sudo apt-tau hloov tshiab

sudo apt-get upgrade sudo apt-get install build-essential / cmake / gfortran / git / wget / curl / graphicsmagick / libgraphicsmagick1-dev / libatlas-dev / libavcodec-dev / libavformat-dev / libboost-all-dev / libgtk2. 0-dev / libjpeg-dev / liblapack-dev / libswscale-dev / pkg-config / python3-dev / python3-numpy / python3-picamera / python3-pip / zip sudo apt-tau ntxuav

Kauj Ruam 3. Ua picamerea txhawb nqa array.

sudo pip3 nruab -hloov kho picamera [array]

Kauj Ruam 4. Install dlib and face recognition.

sudo pip3 install dlib

sudo pip3 nruab face_recognition

Kauj Ruam 5. Rub tawm thiab ua piv txwv paub lub ntsej muag

git clone-ib leeg-ceg

cd./face_recognition/examples python3 facerec_on_raspberry_pi.py

CEEB TOOM: Yog tias koj tau txais ImportError: libatlas.so.3: qhib tsis tau cov ntaub ntawv sib qhia: Tsis muaj cov ntaub ntawv lossis cov npe, khiav cov lus txib hauv qab no txhawm rau kho nws.

Relay

Thaum lub ntsej muag lees paub tau npaj tiav, peb tuaj yeem txuas ntxiv cov yam ntxwv ntxiv. Peb txuas Grove - Txuas mus rau LTE Cat 1 Pi HAT, tab sis nws siv cov chaw nres nkoj digital ntau dua li I2C chaw nres nkoj.

Qhov no yog tus pin-tawm rau Raspberry Pi 3B, peb tuaj yeem pom SDA tus pin thiab SCL tus pin nyob hauv pawg thawj coj tus pin 3 thiab tus pin 5.

Duab
Duab

Yog li peb tuaj yeem tswj kev xa tawm los ntawm cov teeb liab digital rau tus pin 5. Khiav hauv qab qhov kev pab cuam nab hab sej ntawm koj li Raspberry Pi, yog tias tsis muaj dab tsi mus tsis raug, koj yuav hnov Ti-Ta los ntawm kev xa tawm.

ntshuam RPi. GPIO ua GPIO

RELAY_PIN = 5 GPIO.setmode (GPIO. BOARD) GPIO.setup (RELAY_PIN, GPIO. OUT) GPIO.output (RELAY_PIN, GPIO. HIGH)

Yog li ntawm no yog lub tswv yim, peb thauj lub ntsej muag uas paub los ntawm daim nplaub tshev, paub lub ntsej muag raug ntes los ntawm picamera, yog tias lub ntsej muag nyob hauv daim nplaub tshev, tswj kev xa mus qhib lub qhov rooj. Peb tuaj yeem ntim lawv rau hauv chav kawm, ntawm no yog load_known_faces () txoj hauv kev thiab qhib () txoj hauv kev, txoj haujlwm tiav tuaj yeem rub tawm hauv qhov kawg ntawm kab lus no.

def load_known_faces (tus kheej):

known_faces = os.listdir (tus kheej._ paub_faces_path) rau paub_faces hauv tus kheej_faces: tus kheej._ paub_faces_name.append (paub_face [0: len (known_face) - len ('. jpg')]) known_face_image = face_recognition.load_image_file (self._ known_aces)) tus kheej._ paub_faces_encoding.append (face_recognition.face_encodings (paub_face_image) [0]) rov len (tus kheej._ paub_faces_encoding) def qhib (tus kheej): yog tus kheej._ matched.count (Muaj tseeb)> 0: GPIO.output (tus kheej._ relay_pin, GPIO. HIGH) luam tawm ('Qhov rooj qhib') time.sleep (5) GPIO.output (tus kheej._ relay_pin, GPIO. LOW) tus kheej._ reset_recognise_params () rov muaj tseeb tus kheej._ retry_count += 1 luam ('Thov sim dua … { } '. format (self._ retry_count)) return False

Xav txog qhov zoo tshaj plaws, peb tuaj yeem qhia cov duab uas tau lees paub, tsev qiv ntawv PIL thiab matplotlib tuaj yeem pab tau, ntawm lawv, matplotlib xav tau kev teeb tsa ntawm tus kheej, khiav cov lus txib no hauv koj li Raspberry Pi lub davhlau ya nyob twg.

sudo pip3 nruab matplotlib

Ntshuam lawv hauv koj cov cai, thiab hloov pauv yog thaiv hauv ((txoj hauv kev) zoo li no:

img = Image.open ('{}/{}. jpg'.format (tus kheej._ paub_faces_path, tus kheej._ paub_faces_name [0]))

plt.imshow (img) plt.ion () GPIO.output (tus kheej._ relay_pin, GPIO. HIGH) luam tawm ('Qhov rooj qhib') plt.pause (3) plt.close () GPIO.output (tus kheej._ relay_pin, GPIO. LOW) tus kheej._ reset_recognise_params () rov muaj tseeb

Tam sim no, yog lub ntsej muag lees paub, daim duab hauv daim nplaub tshev yuav tshwm ntawm qhov screen.

Duab
Duab

SMS

Qee zaum peb xav paub leej twg nyob hauv peb chav, thiab tam sim no muaj chaw rau LTE Cat 1 Pi HAT. Txuas daim npav SIM rau nws, thiab ua raws cov kauj ruam los ntsuas seb nws puas ua haujlwm lossis tsis yog.

Kauj Ruam 1. Pab kom UART0 hauv Raspberry Pi

Siv nano los kho qhov teeb meem.txt hauv /khau raj

sudo nano /boot /config.txt

ntxiv dtoverlay = pi3-disable-bt rau hauv qab ntawm nws, thiab lov tes taw hciuart kev pabcuam

sudo systemctl lov tes taw hciuart

ces rho tawm console = serial0, 115200 hauv cmdline.txt hauv /khau raj

sudo nano /boot /cmdline.txt

Tom qab txhua yam ua tiav, koj yuav tsum rov pib dua koj li Raspberry Pi.

Kauj Ruam 2. Rub qhov piv txwv thiab khiav nws.

Qhib lub davhlau ya nyob twg ntawm koj tus Raspberry Pi, ntaus cov lus txib no rau nws kab ntawm kab.

cd ~ ib

git clone https://github.com/Seeed-Studio/ublox_lara_r2_pi_hat.git cd ublox_lara_r2_pi_hat sudo python setup.py nruab cd kuaj sudo python test01.py

Yog tias koj pom cov txiaj ntsig no hauv koj lub davhlau ya nyob twg, LTE Cat 1 Pi HAT ua haujlwm tau zoo.

40-pin GPIO header kuaj pom

Pab kom CTS0 thiab RTS0 ntawm GPIOs 16 thiab 17 rts cts thaum sawv… module lub npe: LARA-R211 RSSI: 3

Tam sim no peb paub HAT ua haujlwm tau zoo, yuav siv nws li cas xa SMS? Thawj qhov koj yuav tsum paub yog tias Raspberry Pi sib tham nrog HAT ntawm xa AT cov lus txib los ntawm UART. Koj tuaj yeem xa AT cov lus txib rau LTE HAT los ntawm kev ua cov lej no hauv nab hab sej

los ntawm ublox_lara_r2 ntshuam *

u = Ublox_lara_r2 () u.initialize () u.reset_power () # Kaw debug zaws u.debug = Cuav u.sendAT ('')

AT hais kom xa SMS yog raws li hauv qab no

AT+CMGF = 1

AT+CMGS =

yog li ntawm no yog _send_sms () txoj hauv kev:

def _send_sms (tus kheej):

yog tus kheej._ phonenum == Tsis muaj: rov qab yuam kev rau tus account hauv tus kheej._ lees paub_face_names (): yog tus kheej._ ublox.sendAT ('AT+CMGF = 1 / r / n'): luam tawm (tus kheej._ ublox.response) yog nws tus kheej. _ublox.sendAT ('AT+CMGS = "{}" / r / n'.format (self._ phonenum)): print (self._ ublox.response) if self._ ublox.sendAT (' {} nkag mus hauv chav. / x1a'.format (unlocker)): luam tawm (tus kheej._ ublox.response)

CEEB TOOM: LTE Cat 1 Pi HAT lub tsev qiv ntawv sau los ntawm nab nab 2, uas tsis sib xws nrog nab nab 3, yog tias koj xav siv nws nrog lub ntsej muag paub, thov rub nws los ntawm qhov txuas ntawm qhov kawg ntawm kab lus no.

Pom zoo: