Cov txheej txheem:

Raspberry SPy Neeg Hlau: 8 Kauj Ruam (nrog Duab)
Raspberry SPy Neeg Hlau: 8 Kauj Ruam (nrog Duab)

Video: Raspberry SPy Neeg Hlau: 8 Kauj Ruam (nrog Duab)

Video: Raspberry SPy Neeg Hlau: 8 Kauj Ruam (nrog Duab)
Video: TIKTOKERS TAKE ON COACHELLA PT 2 🌴 | Scott Kress #shorts 2024, Hlis ntuj nqeg
Anonim
Image
Image
Raspberry SPy Neeg Hlau
Raspberry SPy Neeg Hlau

Txoj haujlwm no tso cai rau koj tsav tus neeg hlau los ntawm lub vev xaib thiab saib cov kwj tawm. Nws tuaj yeem siv los soj xyuas cov tsiaj, xyuas kom tsis muaj dab tsi hlawv hauv koj lub qhov cub, thiab txawm saib noog! DFRobot muab Raspberry Pi 3 thiab Raspberry Pi lub koob yees duab module.

Kauj Ruam 1: Tus Neeg Hlau Hluav Taws Xob

Neeg Hlau Electronics
Neeg Hlau Electronics

Kuv pib los ntawm kev sib dhos 2WD MiniQ chassis cov khoom siv los ntawm DFRobot. Kuv xaub lub log mus rau lub cev muaj zog, tom qab ntawd muab lawv tso rau hauv cov khoom sib dhos thiab txuas lawv mus rau lub chassis. Thaum kawg, kuv ntxiv cov hlau txhawb nqa. Tam sim no nws yog lub sijhawm los tsim lub rooj tsavxwm tseem ceeb. L293d lub cev muaj zog tsav tsheb tau muab tso rau hauv qhov chaw, nrog rau cov xov hlau khiav mus rau Raspberry Pi's GPIO pins. Tom ntej no, Kuv tau siv lub txuas rau lub roj teeb, vim qhov ntawd yuav muab lub zog tseem ceeb. Tom qab ntxiv lub hwj chim ntxiv, kuv tau teeb tsa tus tswj hwm 5V.

Kauj ruam 2: Teeb tsa Pi

Teeb tsa Pi
Teeb tsa Pi

DFRobot ncav tes rau kuv thiab xa lawv Raspberry Pi 3 thiab Raspberry Pi Lub Koob Yees Duab Module. Yog li tom qab kuv qhib lub thawv kuv tau txais txoj haujlwm los teeb tsa daim npav SD. Ua ntej kuv tau mus rau Raspberry Pi Downloads nplooj ntawv thiab rub tawm qhov tshiab tshaj plaws ntawm Raspbian. Tom qab ntawd kuv rho tawm cov ntawv thiab muab tso rau hauv cov npe yooj yim. Koj tsis tuaj yeem tsuas yog luam/muab cov ntawv.img tso rau hauv SD daim npav, koj yuav tsum "hlawv nws" mus rau daim npav. Koj tuaj yeem rub tawm cov khoom siv hluav taws xob zoo li Etcher.io kom yooj yim hloov OS cov duab. Tom qab cov ntaub ntawv.img nyob ntawm kuv daim npav SD kuv tso nws rau hauv Raspberry Pi thiab muab lub zog rau nws. Tom qab kwv yees li 50 vib nas this kuv tshem lub qaum thiab tshem daim npav SD. Tom ntej no kuv muab daim npav SD rov qab rau hauv kuv lub PC thiab mus rau phau ntawv "khau raj". Kuv tau qhib phau ntawv sau tseg thiab khaws nws ua cov ntaub ntawv tsis muaj npe hu ua "ssh" nrog TSIS txuas ntxiv. Kuj tseem muaj cov ntawv kuv ntxiv hu ua "wpa_supplicant.conf" thiab muab cov ntawv no tso rau hauv:

network = {ssid = psk =}

Tom qab ntawd kuv tau khaws thiab tshem daim npav thiab muab rov qab rau hauv Raspberry Pi 3. Qhov no yuav tsum tam sim no tso cai rau siv SSH thiab txuas rau WiFi.

Kauj Ruam 3: Npaj Lub Koob Yees Duab Npaj

Npaj Lub Koob Yees Duab Npaj
Npaj Lub Koob Yees Duab Npaj

Los ntawm lub neej ntawd, lub koob yees duab tau xiam ntawm Pi, yog li koj yuav tsum qhib lub davhlau ya nyob twg hom sudo raspi-teeb tsa los coj cov ntawv qhia zaub mov. Mus rau "kev xaiv cuam tshuam" thiab tom qab ntawd qhib lub koob yees duab. Tam sim no tsuas yog xaiv "Ua tiav" thiab ntxig cov hlua kab ntawm lub koob yees duab hloov mus rau thaj tsam raug ntawm Pi.

Kauj ruam 4: Txhim Kho Software

Muaj ntau qhov software sib txawv uas tuaj yeem rub tawm cov vis dis aus, xws li vlc thiab tsab ntawv tsa suab, tab sis kuv txiav txim siab siv mjpeg-streamer vim nws qis qis thiab txhim kho yooj yim. Raws li cov lus qhia ntawm lub xaib, ua git clone https://github.com/jacksonliam/mjpg-streamer.git rau hauv daim nplaub tshev, tom qab ntawv ntaus sudo apt-tau nruab cmake libjpeg8-dev txhawm rau teeb tsa cov tsev qiv ntawv xav tau. Hloov koj phau ntawv teev npe rau hauv daim nplaub tshev uas koj rub tawm thiab tom qab ntawd ntaus ua raws los ntawm sudo ua nruab los ua ke software. Thaum kawg nkag mus rau export LD_LIBRARY_PATH =. thiab kom khiav nws hom./mjpg_streamer -o "output_http.so -w./www" -i "input_raspicam.so" Koj tuaj yeem nkag mus rau kwj los ntawm kev mus rau https://: 8080/stream.html txhawm rau saib cov kwj deg.

Kauj ruam 5: Tswj

Maub los
Maub los
Maub los
Maub los

Tom qab ntawd los ib feem ntawm yuav ua li cas tswj hwm Raspberry Pi hla WiFi, vim tias Bluetooth muaj ntau yam tsawg dhau. Kuv txiav txim siab siv Flask server khiav ntawm Raspberry PI thiab ESP8266 ESP12E module xa cov ntaub ntawv rau nws. ESP8266 tsuas yog muaj ib qho lus sib piv, uas txhais tau tias kuv siv tsis tau lub joystick ncaj qha, vim nws siv ob lub tswv yim sib piv. Qhov kev xaiv zoo tshaj plaws yog ADS1115, uas yog I2C cov cuab yeej uas nyeem cov cim sib piv ntawm 16 qhov kev daws teeb meem. Kuv yooj yim txuas SDA rau 4 thiab SCL rau 5, nrog rau VCC thiab GND. Tus joystick X axis txuas rau A0 ntawm ADS1115, thiab Y axis txuas rau A1. TAB SIS, Kuv yuam kev hlawv ADS1115, yog li kuv yuav tsum tau mus rau qhov zoo tshaj tom ntej: khawm! Yog li tam sim no kuv teeb tsa yog ESP8266 Sparkfun Yam Dev Board nrog 3 khawm- rau pem hauv ntej, sab xis, thiab sab laug. Tam sim no thaum twg ib tus raug nias, nws xa cov ntaub ntawv kom tig lub log hauv qhov kev taw qhia ntawd.

Kauj Ruam 6: Txoj Cai rau Neeg Hlau

Txoj Cai rau Neeg Hlau
Txoj Cai rau Neeg Hlau

Kuv tau ua qhov haujlwm yav dhau los uas siv Pi's GPIO PWM lub tsev qiv ntawv los tswj lub cav ntawm json, yog li kuv tsuas yog rov ua lub hom phiaj kom lees txais cov ntaub ntawv ntawm Flask app xwb. Flask yog Python lub tsev qiv ntawv uas tseem ceeb tig koj Pi rau hauv lub vev xaib uas muaj peev xwm xa thiab txais cov ntaub ntawv. Los ntawm kev siv PWM, lub cav tuaj yeem tswj tau nrog qhov tseeb ntau dua piv rau lub tank tsav. Qhov no kuj txhais tau tias tus neeg hlau tuaj yeem txav mus los nrawm dua li qhov ruaj khov. Kuv lub hwj iav app tau teeb tsa los hloov PWM ntawm lub cav thaum nws tau txais cov ntaub ntawv los ntawm GET thov ntawm http los ntawm ESP12e. Nws kuj tseem siv subprocess. Qopen lub tsev qiv ntawv los khiav cov ntawv webstreaming hauv keeb kwm yav dhau. Kuv tau txuas cov cai rau nplooj ntawv qhov project, yog li txhua yam uas tsim nyog yog rub tawm.

Kauj Ruam 7: Tus Tswj Cov Cai

Txoj cai tau yooj yim zoo nkauj, tsuas yog nyeem los ntawm 3 tus pin, khiav lawv los ntawm qee qhov yog cov lus los txiav txim siab lub log taw qhia, thiab thaum kawg xa cov txiaj ntsig mus rau Raspberry Pi. ESP8266 pawg thawj coj ntxiv rau Arduino IDE los nrog HTTPClient lub tsev qiv ntawv, uas saib xyuas lub taub hau thiab xa cov ntaub ntawv. Flask server yuav tsum tau txais cov ntaub ntawv los ntawm POST hu, yog li cov lej pib sib txuas nrog Raspberry Pi webserver, tom qab ntawd ntxiv lub taub hau rau cov ntaub ntawv qhia tias nws yog JSON encoded, thiab thaum kawg nws xa cov ntaub ntawv hauv daim ntawv ntawm JSON yam khoom. Kuv ntxiv 40 ms ncua sijhawm los tiv thaiv Raspberry Pi los ntawm kev ua haujlwm ntau dhau nrog cov ntaub ntawv.

Kauj Ruam 8: Khiav Raspberry SPy

Khiav lub Raspberry SPy
Khiav lub Raspberry SPy
Khiav lub Raspberry SPy
Khiav lub Raspberry SPy

Txhua yam uas xav tau yog ntaus sudo python.py! Koj yuav tsum pom lub koob yees duab teeb, thiab los ntawm kev mus rau lub vev xaib chaw nyob ntawm pi nrog chaw nres nkoj 8080 cov kwj deg yuav tsum pom. Tam sim no koj tuaj yeem siv tus tswj hwm nyob txhua qhov chaw hauv tsev thiab muaj cov khoom noj nyob ib yam.

Pom zoo: