Cov txheej txheem:

Qhov kawg Headless RPi Zero Teeb rau Pib: 8 Kauj Ruam
Qhov kawg Headless RPi Zero Teeb rau Pib: 8 Kauj Ruam

Video: Qhov kawg Headless RPi Zero Teeb rau Pib: 8 Kauj Ruam

Video: Qhov kawg Headless RPi Zero Teeb rau Pib: 8 Kauj Ruam
Video: QHIA QHOV TSEEB - KUB VAJ LOOG TSUA NEW MUSIC VIDEO 2022 2024, Hlis ntuj nqeg
Anonim
Qhov kawg Headless RPi Zero Teeb rau Cov Pib
Qhov kawg Headless RPi Zero Teeb rau Cov Pib

Hauv Cov Lus Qhia no, peb yuav tshuaj xyuas kuv lub hauv paus teeb tsa rau txhua qhov haujlwm Raspberry Pi Zero. Peb yuav ua nws txhua qhov los ntawm lub tshuab Windows, tsis muaj keyboard ntxiv lossis saib xyuas xav tau! Thaum peb ua tiav, nws yuav nyob hauv is taws nem, sib qhia cov ntaub ntawv hla lub network, ua haujlwm li USB tus ntiv tes xoo tsav thiab ntau ntxiv. Muaj YouTube cov vis dis aus (YUAV TSHUAJ!

hlub Raspberry Pi Zeros thiab kuv xav tias lawv muaj txiaj ntsig zoo, tab sis nws siv sijhawm ua haujlwm ntau kom lawv npaj tau los ua ke rau hauv cov phiaj xwm. Kuv lub hom phiaj ntawm no yog taug kev koj los ntawm txhua qhov teeb tsa kom yooj yim li sai tau, thiab tom qab ntawd kuv yuav qhia koj yuav ua li cas thim koj li kev cai tshiab Raspbian OS SD Card yog li koj tuaj yeem rov pom daim npav nco tshiab hauv 15 feeb thiab tsis muaj taug kev los ntawm cov txheej txheem no dua.

Hmoov tsis zoo, qhov sau no tau tsim tshwj xeeb rau cov neeg siv Windows. Nws yeej yuav muaj txiaj ntsig zoo rau txhua tus neeg, tab sis kuv tsis ua cov txheej txheem no ntawm Linux lossis Mac OS, yog li kuv tsis tuaj yeem pab nrog cov txheej txheem tseeb ntawm cov tshuab ntawd. Kuv paub tseeb tias koj tseem tuaj yeem ua raws, txawm li cas los xij. Tsis muaj qhov ntau uas tshwj xeeb rau Windows ntawm no thiab txhua qhov nws tuaj yeem ua tiav ntawm lwm qhov kev ua haujlwm nrog kev pab me ntsis los ntawm Google.

Qhov no feem ntau txhais tau tias yuav siv rau ntawm Raspberry Pi Zero, txawm hais tias nws txhua yam yuav ua haujlwm ntawm Zero W tsuas yog zoo. Qhov uas tau hais, tsis muaj USB OTG kev ua haujlwm yuav ua haujlwm ntawm ib qho ntawm lwm tus Qauv (A, B, thiab lwm yam) raws li cov qauv nkaus xwb uas txhawb nqa nws yog Xoom thiab Xoom W.

Kauj ruam 1: Rub tawm thiab Nruab

Rub tawm thiab Nruab
Rub tawm thiab Nruab
Rub tawm thiab Nruab
Rub tawm thiab Nruab
Rub tawm thiab Nruab
Rub tawm thiab Nruab

Thawj qhov peb yuav tsum tau ua yog rub tawm thiab teeb tsa ib pawg software.

Peb yuav xav tau Balena Etcher rau sau cov duab disk rau SD daim npav uas tuaj yeem rub tawm los ntawm no.

Hais txog cov duab disk, cia peb lob Raspbian Lite los ntawm NO. Thaum lub sijhawm sau ntawv, Kuv siv Rasbian Buster Lite.

Kuv nyiam mus lob daim SD Memory Card Formatter app los ntawm no. Qhov no yog siv los ua daim npav SD ua ntej kuv ua rau lawv. Nov yog hom kev ua haujlwm, tej zaum nws tsis tsim nyog nyob rau feem ntau, tab sis kuv tau nyeem tias nws tuaj yeem cawm koj qee qhov kev tu siab nrog rau daim npav SD tshiab yog li vim li cas ho tsis.

Tom qab ntawd rub tawm Putty los ntawm NO. Koj yuav tsum xav tau Putty yog tias koj tab tom mess nrog Raspberry Pis, tshwj xeeb tshaj yog tias lawv 'tsis muaj taub hau'.

Qhov no yuav zoo li tsis txaus ntseeg, tab sis tom ntej no peb yuav tau txais Bonjour Luam Ntawv Kev Pabcuam los ntawm Apple los ntawm HERE. Qhov no cia peb xa mus rau peb Raspberry Pi (thiab lwm yam khoom siv) los ntawm lub npe yog li peb tsis tas yuav txheeb xyuas seb nws IP Chaw Nyob yog dab tsi txhawm rau txuas rau nws. Tej zaum koj twb tau teeb tsa qhov no ntawm koj lub tshuab, nws tsim nyog kuaj ua ntej.

Thaum kawg, tuav Win32 Disk Imager los ntawm NO. Peb yuav siv qhov no kawg los ua daim duab ntawm peb daim npav SD tiav. Tom qab ntawd, peb tuaj yeem luam nws rov qab mus rau SD daim npav nrog Balena Etcher txhua lub sijhawm peb cuam tshuam qee yam lossis pib ua haujlwm tshiab.

Zoo, tam sim no teeb tsa txhua yam, qhov no yuav tsum ncaj nraim mus. Thaum koj ua tiav, rov pib Windows thiab qhib koj daim npav micro SD rau hauv koj lub computer thiab txuas ntxiv.

Kauj ruam 2: teeb tsa daim npav SD

Kev teeb tsa SD daim npav
Kev teeb tsa SD daim npav
Kev teeb tsa SD daim npav
Kev teeb tsa SD daim npav
Kev teeb tsa SD daim npav
Kev teeb tsa SD daim npav
Kev teeb tsa SD daim npav
Kev teeb tsa SD daim npav

Tam sim no cia siv txhua qhov software tshiab los teeb tsa daim npav SD. Tab sis ua ntej peb ua qhov ntawd, thov nco ntsoov tias nws yog lub tswv yim zoo los pib nrog daim npav 8 lossis 16 daim npav rau qhov no. Peb tab tom yuav thim peb cov txheej txheem rau rov siv dua tom qab thiab yog tias koj pib nrog daim npav loj loj, koj tsis tuaj yeem sau nws mus rau daim npav me dua. Txawm li cas los xij, koj tuaj yeem sau daim npav me me mus rau qhov loj dua thiab tom qab ntawd nthuav Linux cov ntaub ntawv kaw lus los ua kom tiav. Yog li pib me me yuav ua rau muaj txiaj ntsig ntau dua tom qab.

Yog li ua ntej, khiav SD daim npav nco daim ntawv thov app, xaiv koj daim npav SD, xaiv "hom ntawv nrawm" thiab ntaus rau hauv daim ntawv lo ntim. Nyem "Format" thiab muab sijhawm rau nws los npaj daim npav. Yog tias koj daim npav nco muaj ntau qhov faib rau nws, xaiv ib qho ntawm lawv yuav ua haujlwm zoo xwb; nws yuav format txhua daim npav tsis hais txog.

Tom qab ntawd, uncompress Raspbian Lite daim duab duab nrog txhua yam koj nyiam (Kuv siv Winrar).

Khiav Balena Etcher thiab xaiv Raspbian Lite.img cov ntaub ntawv koj tsuas yog tsis nyem. Xaiv koj daim npav SD thiab muab sijhawm rau nws los sau cov duab rau koj daim npav thiab txheeb xyuas nws.

Thaum ua tiav lawm, tej zaum koj yuav xav tau tshem tawm thiab rov ntxig daim npav SD kom tau Windows los nqa cov faib tshiab. Thaum koj pom tus tsav sau tias "khau raj" tshwm hauv "Lub PC no", qhib nws. Yog tias koj tau txais lus ceeb toom txog lwm qhov muab faib ua tsis tau nyeem, tsuas yog tsis quav ntsej nws; nws yog Linux faib uas Windows tsis tuaj yeem nyeem ib txwm.

Khiav ib daim ntawv thov uas koj nyiam nrog los tsim cov ntawv sau. Notepad zoo rau qhov no, Microsoft VS Code yog qhov zoo dua.

Ua ntej, ntxiv cov ntaub ntawv khoob mus rau "khau raj" tsav lub npe "ssh" tsis muaj daim ntawv txuas ntxiv: tawm nws tas kiag li. Qhov no yuav ua kom Raspbian pib SSH server ntawm khau raj, uas peb yuav txuas rau tom qab nrog Putty. Koj yuav tsum tau qhia cov ntaub ntawv txuas ntxiv hauv File Explorer kom ntseeg tau tias koj cov ntaub ntawv muaj npe raws nraim "ssh" thiab tsis yog qee yam xws li "ssh.txt". Nov yog qhov piv txwv ntawm yuav ua li cas qhia cov ntaub ntawv txuas ntxiv hauv Windows 10.

Tom ntej no, cia hloov "config.txt". Peb yuav dhia mus rau hauv qab ntawm cov ntawv thiab ntxiv:

dtoverlay = dwc2

Qhov no yuav pab kom USB OTG ua haujlwm peb xav tau rau kev khiav Ethernet thiab Cov Khoom Siv Loj Tshaj ntawm USB.

Tom qab ntawv, qhib "cmdline.txt". Peb yuav tsum tau ceev faj heev ntawm no: txhua lo lus txib mus rau thawj kab thiab xav tau qhov chaw nruab nrab ntawm nws thiab lwm cov lus txib nyob ib puag ncig nws. Kuv kuj ntxiv qhov chaw nyob ntawm qhov kawg ntawm thawj kab kom muaj kev nyab xeeb, thiab ua kom ntseeg tau tias muaj kab thib ob khoob hauv cov ntawv. Scroll mus rau qhov kawg ntawm kab ntawv thawj thiab ntxiv:

modules-thauj khoom = dwc2, g_ether

Yog lawm, teeb tsa daim npav SD tiav! Pop daim npav micro SD ntawd rau hauv koj li Raspberry Pi thiab ntsaws Raspberry Pi rau hauv koj lub computer ntawm USB. Nco ntsoov tias koj ntsaws koj lub xov tooj USB rau hauv nruab nrab qhov chaw nres nkoj USB; qhov chaw nres nkoj sab nraud tsuas yog txuas rau lub zog.

Kauj Ruam 3: RPI teeb tsa PART 1

RPI teeb tsa PART 1
RPI teeb tsa PART 1
RPI teeb tsa PART 1
RPI teeb tsa PART 1
RPI teeb tsa PART 1
RPI teeb tsa PART 1

Thaum Raspbian khau looj plab hlaub, nws yuav pab kom USB OTG ua haujlwm ntawm tag nrho USB chaw nres nkoj. Tom qab ntawd, nws yuav pib qhov kev pabcuam uas zoo li yog USB Ethernet adapter rau Windows thiab thaum kawg, nws yuav pib SSH server uas peb tuaj yeem txuas rau Ethernet los ntawm sab hauv ntawm Windows. Nov yog tus yuam sij kom tsis xav tau keyboard lossis saib.

Hauv Windows, qhib "Device Manager" los ntawm txhaj rau lub tshuab raj pib thiab ntaus "Device Manager". Thaum qhov ntawd tiav, koj yuav tuaj yeem pom txhua yam khoom siv tau pom los ntawm Windows. Yog tias koj saib xyuas koj tus thawj tswj hwm lub cuab yeej, koj yuav pom lub network hloov pauv tshiab tshwm tuaj hu ua "USB Ethernet/RNDIS Gadget" uas yog li cas koj thiaj paub tias koj npaj tau los txuas. Piv txwv tias koj tau teeb tsa Bonjour ua ntej, koj tuaj yeem txuas rau Raspberry Pi los ntawm lub npe; yog tias tsis yog, koj yuav xav tau qee yam xws li NMAP txhawm rau tshuaj xyuas koj lub network rau nws.

Qhib Putty uas yuav raug teeb tsa rau SSH los ntawm lub neej ntawd. Hauv lub thawv tswv, ntaus "raspberrypi.local" thiab ntaus nkag. Yog tias txhua yam tau ua tiav raug, koj yuav zaum tau txais kev nyab xeeb ceeb toom popup ceeb toom koj txog SSH tus yuam sij los ntawm Raspberry Pi. Qhov ntawd zoo, tsuas yog nyem yog mus txuas ntxiv thiab koj yuav tau txais tus ID nkag mus sai los ntawm Raspberry Pi.

Yog tias koj tsis tuaj yeem txuas, tos kom txog thaum lub teeb ntawm Raspberry Pi nres ntsais muag (nws tsuas yog ntsuab ntsuab) thiab tshem nws. Txheeb xyuas tias koj siv lub hauv paus feem ntau USB chaw nres nkoj, xyuas kom koj tau rov ua haujlwm Windows txij li txhim kho Apple Bonjour thiab ntsaws USB rov qab rau hauv. Qee zaum, yam tsis ua haujlwm thawj zaug.

Lub neej siv tus lej nkag mus rau Raspberry Pi yog:

pi pib

Thiab tus password yuav yog:

raspberry

Thaum koj tau nkag mus rau hauv koj tus Pi, thawj qhov peb yuav tsum tau ua yog rov tsim kho peb cov cuab yeej USB los txhawb Ethernet thiab Cov Khoom Loj es tsis yog Ethernet uas peb muaj tam sim no. Ua li ntawd los ntawm kev ntaus ntawv:

sudo nano /thiab /modules

Qhov no yuav qhib cov ntawv hauv Nano cov ntawv kho nrog cov cai tswj hwm. Thaum qhib, nqes mus rau hauv qab ntawm cov ntawv thiab ntaus lossis muab tshuaj txhuam:

dwc2 ua

(Nco tseg: yog tias koj theej cov ntawv no, koj tuaj yeem muab nws tso rau hauv Putty los ntawm txoj nyem rau ntawm lub davhlau ya nyob twg.) Tom qab ntawd, tuav tus Tswj qhov tseem ceeb thiab ntaus X kom tawm. Nws yuav nug yog tias koj paub tseeb tias koj xav txuag, xaiv yog. Tom qab ntawd, nws yuav nug koj kom paub meej lub npe cov ntaub ntawv, tsuas yog ntaus nkag.

Ua ntej peb mus ntxiv, cia peb tham txog USB Mass Storage (ntiv tes xoo) ua haujlwm peb tab tom teeb tsa. Nws muaj txiaj ntsig zoo rau kev luam cov ntawv lossis cov ntawv sau yooj yim rau siv ntawm Pi, lossis rau koj cov ntawv sau ntawm Pi los sau cov ntaub ntawv zoo li cav uas tuaj yeem khaws tau yooj yim los ntawm Windows. Txawm li cas los xij, muaj qee qhov kev ceeb toom rau qhov no. Koj tsis tuaj yeem sau rau qhov muab faib los ntawm Raspberry Pi thiab Windows tib lub sijhawm, yog li koj yuav tsum txiav txim siab ua ntej tias sab twg koj xav kom tuaj yeem sau rau nws. Tsis tas li, yog tias koj ua nws sau rau ntawm Windows, koj yuav tau txais lus ceeb toom txog tsav yuav tsum tau kho qee zaum. Qhov no yog qhov tsis txaus ntseeg me me thiab nws yeej tsis xav tau kev kho tshwj tsis yog tias koj tshem lub Raspberry Pi thaum nws sau cov ntaub ntawv, yog li nws tsis yog qhov loj.

Nrog txhua yam uas tau hais, cia peb tsim cov ntawv ntim rau peb cov ntaub ntawv faib USB Mass Storage. Kuv tab tom teeb tsa nws rau 2 gigabytes lossis 2048 megabytes ntawm no. Koj tuaj yeem khaws chaw ntau dua lossis tsawg dua yog tias koj xav tau. Nkag mus:

sudo dd bs = 1M yog =/dev/xoom ntawm =/piusb.bin suav = 2048

Tom ntej no, peb yuav muab lub thawv ntawd los ua rog rog 32 MSDOS. Nkag mus:

sudo mkdosfs /piusb.bin -F 32 -I

Tam sim no, ua cov npe los siv ua koj cov lus taw qhia rau qhov muab faib no nrog:

sudo mkdir /mnt /usb_share

Thiab peb yuav tau ntxiv qhov nkag mus rau fstab rau qhov muab faib tshiab nrog:

sudo nano /thiab /fstab

Luam qhov no mus rau qhov kawg ntawm cov ntaub ntawv fstab:

/piusb.bin /mnt /usb_share vfat cov neeg siv, umask = 000 0 2

Thaum qhov no ua tiav, cia peb nce txhua qhov faib tshiab thiab xyuas kom peb tsis muaj qhov yuam kev. Yog tias koj ua, thov rov qab saib koj cov kauj ruam ntawm no thiab xyuas kom koj tsis tau plam dab tsi.

sudo mount -a

OK, yuav luag ua tiav teeb tsa USB cov cuab yeej. Tam sim no, cia mus rau hauv "rc.local" thiab ntxiv qee kab kom rov qhib tau peb cov cuab yeej USB thiab rov hais dua qhov muab faib no tom qab txhua khau raj nrog:

sudo nano /etc/rc.local

Luam cov hauv qab no ua ntej kab ntawv uas hais tias "tawm 0" yog li nws tseem yog kab kawg ntawm cov ntawv:

/bin/pw 5/sbin/modprobe g_multi file =/piusb.bin stall = 0 tshem tau = 1sudo mount -o ro /piusb.bin/mnt/usb_share

NCO TSEG: Cov kab ntawv saum toj no yuav ua rau nws thiaj li Windows tuaj yeem sau rau tus ntiv tes xoo thiab Linux tsuas tuaj yeem nyeem los ntawm nws. Yog tias koj xav kom qhov no yog lwm txoj hauv kev, siv qhov no:

/bin/pw 5/sbin/modprobe g_multi file =/piusb.bin stall = 0 tshem tau = 1 ro = 1sudo mount -o /piusb.bin/mnt/usb_share

Muaj ob peb yam kom pom txog qhov peb tau muab tso rau ntawm no. Kuv tsaug zog 5 vib nas this; koj tuaj yeem txo qhov ntawd kom zoo li 1 thib ob yog tias koj nyiam. Tom qab ntawd, yog tias koj qhov pib tau tawg nrog lwm cov kev pabcuam thiab tsav tsheb, koj yuav xav nce qhov no. Kuv tsuas yog tso nws ntawm 5 kom nyab xeeb.

Kab thib ob yog pib ua Multi-Function Composite USB Gadget. Hauv ib pliag, peb yuav tshem tawm peb cov teeb tsa yav dhau los "g_ether" Gadget raws li qhov no suav nrog Ethernet, Serial thiab Mass Storage tag nrho hauv ib qho. Kab thib peb suav rov qab faib cov rog 32 ntawm Raspberry Pi. Nco ntsoov, koj tuaj yeem rov qab los tom qab thiab hloov pauv sab twg tsuas yog nyeem rau cov haujlwm sib txawv lossis yog tias koj hloov siab.

Tam sim no peb tau ua tiav qhov ntawd, cia peb rov qab mus rau "cmdline.txt" thiab tshem "g_ether" los ntawm qhov kawg nrog:

sudo nano /boot /cmdline.txt

Scroll mus rau qhov kawg ntawm thawj kab thiab tshem "g_ether", tom qab ntawd txuag.

Yog lawm, siv sijhawm me ntsis los txhawm rau koj tus kheej tom qab; koj tuaj deb heev lawm. Tam sim no, cia rov pib dua Raspberry Pi thiab npaj nws kom rov siv dua hauv Windows.

sudo rov pib dua

Kauj Ruam 4: RPI Teeb Ntu 2

RPI Teeb Ntu 2
RPI Teeb Ntu 2
RPI Teeb Ntu 2
RPI Teeb Ntu 2
RPI Teeb Ntu 2
RPI Teeb Ntu 2
RPI Teeb Ntu 2
RPI Teeb Ntu 2

Muaj ntau qhov tsis txaus ntseeg rau siv Multi-Function Composite USB gadget ua haujlwm ntawm Raspberry Pi. Kuv tsis tau pom txoj hauv kev kom nyob ib puag ncig feem ntau ntawm cov no, tab sis lawv tsis muaj teeb meem loj thaum koj tau siv rau lawv.

Thawj zaug: thaum Raspberry Pi tab tom pib, thaum txuas nrog ua USB OTG ntaus ntawv, koj yuav tau txais lus ceeb toom hauv Windows tias nws yog lub cuab yeej tsis paub; cia li tsis quav ntsej qhov ntawd. Peb tau ntxiv qhov "g_multi" module pib rau "rc.local" txhawm rau kho qhov teeb meem no tab sis nws siv sijhawm li ob peb vib nas this rau qhov ntawd kom ncaws tawm.

Qhov txawv thib ob: Qee zaum, thaum tus ntiv tes xoo tshwm, Windows yuav yws tias muaj qee yam tsis raug nrog nws thiab nws yuav tsum tau tshuaj xyuas kom raug. Qhov laj thawj rau qhov no nyuaj, tab sis tshwj tsis yog tias koj tsis tau txuas lub Raspberry Pi thaum sau ntawv rau SD daim npav, tsis muaj dab tsi tsis raug nrog nws; nws tsuas yog qhov txawv nrog txoj kev Linux mounts nws. Koj tuaj yeem kho nws yog tias koj nyiam, lossis tsuas yog tsis quav ntsej nws.

OK, yog li tam sim no koj muaj tus ntiv tes xoo tuav los ntawm Raspberry Pi. Yog tias koj tau sau nws los ntawm Windows tam sim no yog lub sijhawm zoo los tsim cov ntawv sau ntawm nws lub npe "test.txt" nrog qee cov ntawv hauv nws, Tom qab ntawd, peb mam li nyeem nws rov qab los ntawm Linux.

Qhov kev sib tw thib peb no koj tsuas yog yuav tsum tau kho ib zaug ntawm ib lub tshuab koj siv nws, yog li txawm hais tias nws yuav zoo li tsis txaus siab, koj yuav zaum tsuas yog ua nws ib zaug.

Nqa mus rau "Tus Thawj Tswj Ntaus Ntawv" zoo li ua ntej thiab hauv qab "lwm yam khoom siv" koj yuav tsum pom lub cuab yeej nrog ceeb toom ntawm nws lub npe "RNDIS". Kuv tsis paub tseeb vim li cas "g_ether" ua haujlwm tau zoo xwb, tab sis qhov no tsis yog; nws yog ib qho yooj yim kho, ho. Txoj nyem rau ntawm nws thiab xaiv "Hloov tus tsav tsheb". Tom qab ntawv "Xauj kuv lub computer" thiab "Cia kuv xaiv". Xaiv "Qhia tag nrho cov cuab yeej" thiab muab nws qee lub sijhawm los thauj tag nrho cov kev xaiv. Thaum thauj khoom: nqes mus rau "Cov Chaw Tsim Khoom" thiab xaiv "Microsoft" (tsis yog "Microsoft Corporation", tsuas yog "Microsoft"). Nyob rau ntawm "Qauv" cov npe: nqes mus rau "Cov Chaw Taws Teeb NDIS sib xws" thiab xaiv nws, tom qab ntawv nyem "Tom ntej" hauv qab txoj cai. Koj yuav tau txais lus ceeb toom, tsuas yog nyem "Yog" thiab kaw qhov kev sib tham thaum qhov kev teeb tsa tiav.

Yog tias txhua yam mus tau zoo, tam sim no koj yuav muaj "Chaw Taws Teeb NDIS sib xws" hauv "Network Adapters". Tam sim no peb tuaj yeem tham nrog Raspberry Pi dua.

Tom ntej no, cia ua kom ntseeg tau tias nws muaj peev xwm ncav cuag internet los ntawm peb lub tshuab Windows qhov internet txuas. Txhawm rau ua qhov ntawd, nyem lub pob "Pib" thiab ntaus "Network Status" thiab xaiv nws. Thaum qhov ntawd tshwm tuaj: nqes me ntsis thiab xaiv "Hloov Chaw Teeb". Koj yuav tsum pom koj li Raspberry Pi NDIS ntaus ntawv nyob ntawm no nrog lub npe zoo li "Ethernet 5" thiab tseem yog lub network adapter koj siv txuas Windows rau hauv internet nrog; Qhov no feem ntau yuav mus rau npe qee yam xws li "Wifi". Txoj cai nyem rau ntawm ib qho uas txuas koj rau hauv internet thiab xaiv "Khoom". Tom qab ntawd, nyem rau "Sib Koom" tab ntawm lub qhov rais uas tshwm tuaj. Tam sim no khij lub npov uas hais tias "Tso cai rau lwm tus neeg siv network txuas los ntawm lub khoos phis tawj no txuas internet" thiab xaiv lub network adapter lub npe ntawm Raspberry Pi NDIS ntaus ntawv peb nyuam qhuav saib (qee yam xws li "Ethernet 5".)

Thaum qhov no ua tiav, peb tuaj yeem tshawb xyuas Raspberry Pi rau kev sib txuas hauv is taws nem los ntawm kev rov txuas nrog Putty zoo li ua ntej. Thawj qhov kuv txheeb xyuas thaum nrhiav kev sib txuas hauv is taws nem ntawm Pi yog pinging 8.8.8.8 uas yog Google npe sau npe server. Koj tuaj yeem ua qhov no los ntawm kev ntaus ntawv:

pib 8.8.8.8

Koj yuav zoo li tsis muaj kev sib txuas, nyob rau hauv rooj plaub twg tsuas yog rov pib dua koj Pi nrog:

sudo rov pib dua

Thaum nws rov pib dua, nws yuav nqa Ethernet adapter rov qab thiab Windows yuav tsum pib qhov nkag hauv internet txuas rau nws tau txais txij tam sim no mus. Koj yuav tsum paub tias nws tau khau raj los ntawm tos USB drive kom rov qab los. Tam sim no, cia peb txuas nrog Putty dua thiab rov ntsuas rau kev sib txuas hauv is taws nem:

pib 8.8.8.8

Lub sijhawm no, nws yuav tsum ua haujlwm zoo xwb, yog li tam sim no cia saib seb peb puas tuaj yeem ping www.google.com:

ping

Ok, zoo meej. Yog li peb Raspberry Pi tau txuas nrog rau hauv is taws nem! Ua haujlwm zoo!

Yog tias koj muaj teeb meem ntawm qhov no, koj kuj tseem yuav tsum tshem lub cuab yeej los ntawm "Tus Thawj Tswj Ntaus Ntawv" (nyem rau nws thiab xaiv "Uninstall Device" thiab rov pib dua Windows). Tom qab ntawd pib cov kauj ruam no dua. Ua ntej mus rau qhov ntawd, Kuv yuav rov nyeem txhua yam thiab paub tseeb tias koj tsis nco dab tsi.

Kauj Ruam 5: RPI Teeb Ntu 3

RPI Teeb Ntu 3
RPI Teeb Ntu 3
RPI Teeb Ntu 3
RPI Teeb Ntu 3
RPI Teeb Ntu 3
RPI Teeb Ntu 3

Tam sim no peb muaj Pi online, peb tuaj yeem pib txhim kho yam thiab teeb tsa qhov seem. Ua ntej txhim kho ib yam dab tsi, txawm li cas los xij, peb yuav tsum hloov kho peb cov pob APT nrog:

sudo apt-tau hloov tshiab

Tom ntej no, cia ua lub tsev tu me ntsis ua ntej mus ntxiv los ntawm kev khiav:

sudo raspi-teeb tsa

Thaum qhov ntawd tiav, xaiv "Hloov Tus Neeg Siv Tus Kheej". Tom qab ntawd cia peb kho tus tswv tsev lub npe rau Raspberry Pi no yog lwm yam uas tsis yog lub neej ntawd. Xaiv "Network Options" thiab tom qab ntawd "Hostname". Kuv tau hu kuv lub npe "devpi" tab sis koj tuaj yeem mus nrog qhov suites koj; tsuas yog nco ntsoov peb yuav ua daim duab SD daim npav no tom qab yog li koj yuav tsis xav ua kom dhau qhov tshwj xeeb rau ib qhov haujlwm tseem tsis tau raws li koj vam tias yuav rov siv cov teeb tsa no tom qab. Thaum ua tiav, rov qab mus thiab xaiv "Ua tiav", uas tej zaum yuav rov pib dua koj li Raspberry Pi.

Thaum tus ntiv tes xoo rov qab los dua, cia peb rov txuas nrog Putty. Nco ntsoov tias koj li Raspberry Pi tam sim no muaj npe txawv, yog li koj tsis tuaj yeem siv "raspberrypi.local" txuas ntxiv. Tam sim no, koj yuav tsum tau siv lub npe hostname koj nyuam qhuav nkag mus. Koj tseem yuav tau txais qhov ceeb toom SSH tshiab vim tias tus tswv lub npe txawv, uas yog qhov zoo. Koj tus ID nkag mus tseem yuav yog "pi" tab sis koj tus password tam sim no yuav txawv ib yam thiab.

Tam sim no, cia nruab Samba cov ntaub ntawv sib qhia yog li koj tuaj yeem hloov kho cov ntaub ntawv hauv Linux los ntawm sab hauv Windows. Ua ntej, peb yuav nruab "avahi-daemon":

sudo apt-tau nruab avahi-daemon

Tom qab ntawd:

sudo hloov tshiab-rc.d avahi-daemon defaults

Cov kauj ruam tom ntej no zoo li tso cai Apple Tham hla chaw nres nkoj 548. Ua siab ncaj, Kuv tsis paub tseeb tias vim li cas qhov no thiaj li tsim nyog, tab sis kuv tsis tuaj yeem tau txais Samba cov ntaub ntawv sib qhia los ua haujlwm yam tsis muaj nws, yog li ntawm no peb yog. Peb tab tom tsim cov ntaub ntawv pabcuam tshiab nrog:

sudo nano /etc/avahi/services/afpd.service

Thiab muab ib co XML tso rau hauv:

%h _afpovertcp._tcp 548

Tom qab ntawd ntaus tswj x kom txuag. Tam sim no rov pib dua "avahi-daemon" thiab peb yuav tsum muaj zeroconf pabcuam nrhiav pom teeb tsa.

sudo /etc/init.d/avahi-daemon rov pib dua

Thaum kawg, cia peb nruab Samba cov ntaub ntawv sib qhia kev pabcuam. Thaum koj tau txais lub vijtsam xiav thov kom pab txhawb WINS, Kuv ib txwm hais tias tsis yog.

sudo apt-tau nruab samba samba-common-bin

Cia peb hloov lub neej ntawd Samba cov ntaub ntawv sib qhia lo lus zais:

sudo smbpasswd -a pib

Thaum ua tiav lawm, peb yuav xav hloov kho lub neej ntawd Samba teeb tsa nrog:

sudo nano /etc/samba/smb.conf

Muaj ntau yam koj tuaj yeem teeb tsa hauv no, tab sis kuv tsuas yog poob rau hauv qab ntawm cov ntawv thiab muab tshuaj txhuam kuv qhov chaw sib koom ua ke:

pawg ua haujlwm = WORKGROUP

yeej kev txhawb nqa = yog [qhov chaw] tawm tswv yim = HOME path =/home/pi/browseable = Yes writeable = Yes only guest = no create mask = 0777 directory mask = 0777 public = yes read only = no force user = root force group = root

Qhov no yuav qhia "/home/pi" nrog rau kev nyeem/sau nkag tau. Xav tias dawb los kho qhov no tam sim no, tab sis kuv siv qhov no los kho cov ntawv sau los ntawm Windows, yog li kuv nyiam tso nws qhib dav. Nias Tswj + X kom txuag thiab rov pib dua Raspberry Pi txhawm rau ncaws txhua qhov ntawd rau hauv iav:

sudo rov pib dua

Kauj Ruam 6: RPI Teeb Ntu 4

RPI Teeb Ntu 4
RPI Teeb Ntu 4
RPI Teeb Ntu 4
RPI Teeb Ntu 4

Raws li ib txwm muaj, thaum USB tus ntiv tes xoo tsav rov qab los rau hauv Windows, peb tau npaj mus txuas ntxiv. Lub sijhawm no, cia peb sim nkag mus rau Linux cov ntaub ntawv kaw lus hla peb qhov tshiab Samba qhia tawm. Hauv Windows, koj tuaj yeem ua qhov no los ntawm kev qhib File Explorer lossis ib qho browser browser thiab mus rau txoj hauv kev "\ YOUR_HOST_NAME" (hloov nrog koj lub npe tiag tiag.) Nws yuav nug koj txog cov ntawv pov thawj, uas yog koj li qub Pi siv "pi" "thiab xijpeem koj tus password tshiab yog. Nco ntsoov koj qhia nws kom nco qab koj daim ntawv pov thawj yog li koj tsis tas yuav nkag mus rau cov ntaub ntawv no.

Yog tias txhua yam ua haujlwm tau zoo, koj yuav pom qee cov ntawv sib koom. Ob qho ntawm cov ntsiab lus no mus rau tib lub npe "tsev/pi". Qhib ib qho ntawm lawv thiab tsim lwm cov ntawv sau npe "test.txt" zoo li peb tau ua ntawm USB tus ntiv tes xoo tsav ua ntej.

Tam sim no uas peb muaj ob qho ntawv xeem hauv qhov chaw, cia peb nyeem lawv los ntawm Raspberry Pi. Rov txuas rau SSH thiab ntaus cov hauv qab no kom pom dab tsi hauv koj cov neeg siv phau ntawv qhia tsev:

ls ua

Koj yuav pom cov ntawv xeem cov ntawv peb nyuam qhuav tsim. Koj tuaj yeem lees paub tias los ntawm kev teev nws cov ntsiab lus nrog miv hais kom ua:

miv text.txt

Yog tias peb teev cov ntsiab lus ntawm "/mnt/usb_share", peb tuaj yeem pom cov ntawv sau peb tau ua ntawm USB tsav hauv Windows ib yam nkaus:

ls /mnt /usb_share

Thiab yog tias peb miv tias, peb tuaj yeem pom nws cov ntsiab lus:

miv /mnt/usb_share/test.txt

Zoo kawg! Koj tau ua tiav teeb tsa Raspberry Pi!

Kauj ruam 7: Thaub qab Disk Duab

Thaub qab Disk Duab
Thaub qab Disk Duab
Thaub qab Disk Duab
Thaub qab Disk Duab

Zoo, koj tau ua tiav teeb tsa lub hauv paus rau cov haujlwm tshiab! Ua haujlwm zoo! Qhov no tau yog txoj kev taug, tab sis ua ntej peb dhau mus heev nrog kev teeb tsa no, peb yuav tsum tau thim rov qab yog li peb tuaj yeem rov qab tau yooj yim rov qab mus rau qhov no lossis luam qhov teeb tsa no rau cov haujlwm tshiab yav tom ntej. Txhawm rau ua qhov ntawd, cia peb kaw Raspberry Pi thiab muab daim npav SD rov qab rau hauv lub tshuab Windows:

sudo kaw -h tam sim no

Thaum SD daim npav tuaj txog hauv Windows, khiav Win32 Disk Imager. Hauv qhov ntawd, peb yuav nkag mus rau txoj hauv kev thiab lub npe npe rau peb cov duab thaub qab. Nco ntsoov tias koj muab nws cov ntaub ntawv txuas ntxiv ntawm ".img".

Tom qab ntawd, nco ntsoov tias koj tau xaiv txoj cai tsav. Qhov no yuav tsum yog khau raj tsav los ntawm koj daim npav SD.

Tom qab ntawd, nyem "Nyeem tsuas yog faib cov faib" kom ua kom cov txheej txheem no tiav. Thaum kawg, nyem "Nyeem" thiab cia nws ua nws qhov.

Thaum qhov ntawd ua tiav, peb tuaj yeem pom tias nws tau tsim cov duab disk uas yuav luag txhua qhov loj ntawm daim npav SD tag nrho! Peb tuaj yeem ua qhov MUCH me me los ntawm kev nrawm nws vim tias feem ntau ntawm cov ntaub ntawv ntawd tsis muaj dab tsi. Kuv siv Winrar, tab sis koj tuaj yeem siv txhua yam koj xav tau, tsuas yog ua kom ntseeg tau tias koj xaiv qib siab ntawm kev nyem. Tam sim no koj tuaj yeem pom cov duab khaws tseg yog qhov ntau me dua.

Yog li ntawd, tam sim no koj muaj Raspberry Pi txuas nrog internet thiab koj lub tshuab Windows dhau USB. Tsis xav tau lwm yam khoom siv kho vajtse. Koj tuaj yeem txuas rau nws hla SSH, sau tus lej ntawm nws los ntawm qhov koj nyiam tshaj lij hauv Windows, khaws cov ntaub ntawv ncaj qha rau Linux cov ntaub ntawv kaw lus lossis hla lawv ntawm USB tus ntiv tes xoo tsav hauv Windows. Nov yog qhov yooj yim tiag tiag uas muaj peev xwm hla nws cov ntaub ntawv los ntawm lwm lub khoos phis tawj uas koj yuav tsis tuaj yeem txhim kho kev sib tham. Koj tseem tuaj yeem sau cov ntawv uas yuav saib xyuas cov ntaub ntawv tshiab thiab khiav lawv sai li sai tau thaum lawv tshwm ntawm tus ntiv tes xoo!

Kuv zoo siab koj ua nws los ntawm tag nrho cov lus qhia no! Kuv vam tias txhua yam ua haujlwm tau zoo thawj zaug sim thiab qhov no cawm koj ntau lub sijhawm. Yog tias koj muaj teeb meem, kuv yuav ua qhov zoo tshaj plaws los pab hauv cov lus, thiab yog tias koj muaj kev hloov pauv koj yuav ua rau kuv teeb tsa, Kuv xav hnov koj cov kev xav thiab cov lus qhia.

Kauj Ruam 8: Cov Lus Qhia Ntxiv

Rov qab mus rau cov disk loj dua

Yog tias koj tab tom kho daim duab no mus rau SD daim npav tshiab uas loj dua tom qab ntawd daim duab duab, koj yuav xav nthuav Linux cov ntaub ntawv system los sau daim npav tshiab. Qhov no tuaj yeem ua tiav los ntawm kev khiav "raspi-config":

sudo raspi-teeb tsa

Tom qab ntawv xaiv "Advanced Options". Tom qab ntawd, "Nthuav Cov Ntaub Ntawv". Thaum qhov no ua tiav, koj lub Linux system yuav siv tag nrho SD daim npav, txawm tias koj pib nrog daim duab me me ntau dua.

Pom cov ntawv sau tshiab ntawm tus ntiv tes xoo tsav los ntawm Windows hauv Linux

Koj yuav tsum tau un-mount thiab rov mount no fat32 tsav hauv Linux kom tau txais cov ntaub ntawv tshiab los tshwm. Qhov no tsis tseem ceeb heev ua thiab tuaj yeem ua tiav nrog:

sudo umount /mnt /usb_share

Tom qab ntawd:

sudo mount -o ro /piusb.bin /mnt /usb_share

Thiab tam sim no koj yuav tsum pom koj cov ntaub ntawv tshiab hauv Linux:

ls /mnt /usb_share

Saib rau cov ntawv sau nab nab tshiab ntawm tus ntiv tes xoo thiab khiav lawv cia

Lub plhaub tsab ntawv tuaj yeem ua rau saib cov ntaub ntawv tshiab tau txais thiab ua qee yam nrog lawv thaum lawv tshwm sim. Nws zoo li kev ua haujlwm hnyav kom ua haujlwm tas li yog li kuv sim tsis txhob khiav nws nrawm heev, tab sis Raspberry Pi tsis zoo li lub siab ntau dhau.

Ua ntej, tsim lub plhaub tsab ntawv:

nano refreshPythonScript.sh

Muab tshuaj txhuam rau hauv tsab ntawv hauv qab no thiab kho kom saj:

#!/bin/sh

remoteFile = "/mnt/usb_share/Main.py" tempFile = "/home/pi/tempMain.py" localFile = "/home/pi/Main.py" # delect local file and replace it with an empty file rm $ localFile kov $ localFile thaum muaj tseeb ua # unmount thiab rov qab usb_share kom rov ua cov ntaub ntawv ntawm nws sudo umount /mnt /usb_share sudo mount -o ro /piusb.bin /mnt /usb_share # theej Main.py tawm ntawm usb qhia rau sib piv sudo / cp -r $ remoteFile $ tempFile yog cmp -s "$ tempFile" "$ localFile"; tom qab ntawd ncha "lawv phim" lwm qhov ncha "lawv sib txawv" # tua cov nab hab sej yog tias nws twb tau khiav sudo killall python3 # luam cov ntaub ntawv temp hla cov ntaub ntawv hauv zos sudo / cp -r $ tempFile $ localFile # khiav cov ntaub ntawv hauv zos sudo python3 $ localFile fi # tos me ntsis ua ntej rov kuaj dua 10 ua tiav

Txuag nrog Tswj + X thiab hloov qhov kev tso cai ntawm tsab ntawv yog li nws tuaj yeem ua tiav:

chmod +x refreshPythonScript.sh

Thiab tam sim no koj tuaj yeem khiav nws txhua lub sijhawm los ntawm kev ntaus ntawv:

./refreshPythonScript.sh

Qhov no tuaj yeem ua tiav tau thaum Raspberry Pi pib, uas hloov nws mus rau hauv qhov nthuav me me Python ntaus ntawv!

Pom zoo: