Cov txheej txheem:

Raspberry Pi GPIO Los Ntawm Xov Tooj: 4 Kauj Ruam (nrog Duab)
Raspberry Pi GPIO Los Ntawm Xov Tooj: 4 Kauj Ruam (nrog Duab)

Video: Raspberry Pi GPIO Los Ntawm Xov Tooj: 4 Kauj Ruam (nrog Duab)

Video: Raspberry Pi GPIO Los Ntawm Xov Tooj: 4 Kauj Ruam (nrog Duab)
Video: BTT - Manta M8P - Loading OctoPrint on Marlin firmware configuration (Part 2) 2024, Kaum ib hlis
Anonim
Image
Image
Raspberry Pi GPIO Los Ntawm Xov Tooj
Raspberry Pi GPIO Los Ntawm Xov Tooj
Raspberry Pi GPIO Los Ntawm Xov Tooj
Raspberry Pi GPIO Los Ntawm Xov Tooj

Tswj Raspberry GPIO los ntawm Daim Ntawv Thov Xov Tooj. Los ntawm qhov no, koj tuaj yeem ua koj tus kheej lub teeb taws teeb hloov 220V lossis FAN, thiab lwm yam.

Qhov yuav khoom:

1. Raspberry Pi https://amzn.to/2VJIOBy2. Pawg mov ci

Kauj Ruam 1: Ua Local Web Server

Ua Local Web Server
Ua Local Web Server
Ua Local Web Server
Ua Local Web Server

1.1. Nruab WiringPI

WiringPI yog siv los tswj GPIO. Ntawm Raspberry, qhib cov lus txib rau nruab WiringPI:

$ sudo apt-tau nruab git-core

$ sudo apt-tau hloov tshiab

$ sudo apt-tau hloov tshiab

$ git clone git: //git.drogon.net/wiringPi

$ cd wiringPi

$ git rub keeb kwm

$ cd wiringPi

$./buildChecking tom qab teeb tsa WiringPI

$ gpio hom 0 tawm

-> Yog tias tsis muaj dab tsi tshwj xeeb tshwm sim, txhua yam zoo.

Qauv hais kom ua, sau thiab nyeem tus pin 1

$ gpio sau 10

$ gpio nyeem 1

1.2. Nruab web server:

Txhawm rau nruab lub vev xaib server, ntaus hais kom ua $ sudo apt-tau nruab apache2 php5 libapache2-mod-php5

Yog tias txhua yam ua tau zoo, lub vev xaib hauv zos yuav tshwm thaum koj ntaus ntawv chaw nyob rau Web Browser 192.168.1.71/index.html

1.3. Ua PHP nplooj ntawv rau interface GPIO

Tam sim no peb muaj WiringPI los tswj GPIO los ntawm kev hais kom ua, peb muaj web server. Yog li, txhawm rau Siv Web server tswj GPIO, peb xav tau nplooj PHP los tswj GPIO los ntawm WiringPI

Hauv Raspberry:

$ cd/var/www/html

$ gedit io.php

Tom qab ntawd muab tshuaj txhuam tus lej raws li hauv qhov txuas no

Nco tseg, tus lej no kuv ua rau GPIO7, GPIO8, GPIO9

Kauj Ruam 2: Ua Yooj Yim Circuit

Ua Yooj Yim Circuit
Ua Yooj Yim Circuit
Ua Yooj Yim Circuit
Ua Yooj Yim Circuit

Siv lub rooj mov ci, qee qhov xov hlau, tiv thaiv 220Ohm txuas GPIO7, 8, 9 rau LEDs

Kauj Ruam 3: Tswj GPIO Los Ntawm Lub Vev Xaib

Nov yog peb mus, qhib Web browser, muab qhov chaw nyob no

Tom qab ntawd, GPIO7 yuav tawm, mus rau nws, chaw nyob dhau los

Kauj Ruam 4: Tswj GPIO Los Ntawm Xov Tooj Apps (Android)

Tswj GPIO Los Ntawm Xov Tooj Apps (Android)
Tswj GPIO Los Ntawm Xov Tooj Apps (Android)
Tswj GPIO Los Ntawm Xov Tooj Apps (Android)
Tswj GPIO Los Ntawm Xov Tooj Apps (Android)

Muaj Android App tuaj yeem siv xa php hais kom ua. Lub App tuaj yeem pom hauv Google Ua Si los ntawm lo lus tseem ceeb "Data2Server" lossis los ntawm qhov txuas no

Hauv App no, koj yuav teeb tsa chaw nyob php, hais kom GPIO ON thiab OFF. Kuj tseem nkag tus IP chaw rau Ping los ntawm Xov Tooj mus rau Rasp txhawm rau txheeb xyuas kev sib txuas.

Qhov ntawd yog nws! Tam sim no GPIO tuaj yeem tswj tau los ntawm koj lub Xov Tooj! Los ntawm qhov no, koj tuaj yeem siv nws los tswj Lub Teeb 220V lossis txhua yam uas koj nyiam!

Pom zoo: