Cov txheej txheem:
- Khoom siv
- Kauj ruam 1: Teeb Rasbian
- Kauj ruam 2: Lob tus Code thiab teeb tsa nws
- Kauj Ruam 3: Kev Sib Txuas Arduino
- Kauj Ruam 4: Txuas Txuas Hloov-nws
- Kauj ruam 5: Khiav Txoj Cai
- Kauj Ruam 6: (XAV TAU) Lub Tsev Nyob
Video: Hloov-nws, Tsis Siv Neeg Outlet Nrog Lub Sijhawm Tam Sim No Kev Ntsuas: 6 Cov Kauj Ruam
2024 Tus sau: John Day | [email protected]. Kawg hloov kho: 2024-01-30 09:25
Kuv yeej nyiam automatisation, lub peev xwm los tswj thaum qee yam yuav tsum tshwm sim. Nov yog qhov ua rau kuv los nrog lub tswv yim no: tus kheej ua, qhov hluav taws xob tsis siv neeg. Nws tuaj yeem siv los npaj thaum teeb yuav tsum tau qhib, thaum lub xov tooj xav tau them lossis thaum lub vijtsam xav tau lub zog. Ntxiv rau txhua qhov no, koj muaj peev xwm pom tias tam sim no ntws los ntawm qhov hluav taws xob ntau npaum li cas.
Cov cheebtsam xav tau rau txoj haujlwm no yog:
Khoom siv
Ua ntej peb yuav pib cov no yog yam uas koj yuav tsum tau tsim los ua Hloov-IT lub thawv zoo li kuv. Cov khoom siv no yuav raug nqi ib puag ncig 50 txog 100 euros nyob ntawm koj cheeb tsam thiab tus nqi tam sim no.
Kho vajtse
Electronics
- Raspberry pib 4
- 16gb (lossis ntau dua) Micro SD-Card
- Arduino Ib
- 5V-3.3V Qib hloov pauv
- 5V relay module
- ACS712 20A - tus qauv tam sim no
- 1838 IR-Txais 37.9 kHz module
- IR chaw taws teeb (Kuv siv Elegoo ib qho)
- nquag cathode RGB
- 3 * 330Ω resistors
- laub khawm
- RFID-RC522
- LCD 1602A-1
- Niko phab ntsa qhov (socket)
- 10K Ω potmeter
- 230 rau 5V - 7A fais fab tuag
Cov kab
- USB-B rau USB-A cable
- USB-C fais fab cable
- Ethernet cable
Ntau yam
- Txiv neej-Poj Niam Jumperwires
- Txiv neej-Txiv neej Jumperwires
- Cov kab laug sab
- Shrinking lub cev
Cov ntaub ntawv Specefic qhov chaw (YOOJ YIM)
- 50 * ceev thiab siab tawv
- cov ntaub ntawv hlau 40x40x5 cm nrog lub hau
- daim kab xev ob tog
- 6 * 1cm siab spacers
- coj-tuav
- Velcro daim kab xev
- cov kab lus qhia
Software
- balenaEtcher:
- PuTTy
- rasbian
- Visual Studio Code
- Arduino IDE Cov
Kauj ruam 1: Teeb Rasbian
Ua ntej tshaj plaws peb yuav nyem Rasbian mus rau SD-Card. Peb yuav ua qhov ntawd siv balenaEtcher.
- Qhib balenaEtcher
- Xaiv Rasbian Duab
- Xaiv koj daim npav SD
- Nias Flash tos ob peb feeb kom txog thaum nws flashed
Ntxiv APIPA hauv phau ntawv teev npe khau raj: Peb yuav siv APIPA chaw nyob rau lub program thiab teeb tsa kev teeb tsa ntawm RPI. Ua li no:
- Nkag mus rau phau ntawv teev npe ntawm SD-Card
- Qhib "cmdline.txt"
- Ntxiv "169.254.10.1" tom kawg ntawm daim ntawv thiab khaws nws
- Ntxiv cov ntaub ntawv hu ua "ssh" rau cov npe khau raj (Tsis txhob muab qhov no NTAWV NTXIV)
- Tom qab koj ua tiav qhov no koj tuaj yeem tshem daim npav SD ntawm koj lub PC.
Nkag mus rau RPI siv PuTTy
Tam sim no peb tuaj yeem ntsaws daim npav SD rau hauv peb lub RPI, txuas RPI rau koj lub PC siv lub ethernet cable.
Txhawm rau txuas rau RPI peb yuav siv PuTTy nrog peb APIPA-chaw nyob.
- Qhib PuTTy
- Sau rau hauv peb qhov APIPA-chaw nyob raws li lub npe host (169.254.10.1)
- Nco ntsoov tias qhov chaw nres nkoj yog 22 thiab SSH raug xaiv
- Tam sim no koj tuaj yeem qhib qhov kev sib txuas
- Lub npe siv lub neej ntawd yog: pi
- Nrog tus password tsis raug: raspberry
raspi-config nqis
Qhib raspi-teeb tsa siv:
sudo raspi-teeb tsa
- Hloov tus neeg siv tus password
- Hauv cov kev xaiv hauv zos xaiv koj lub sijhawm sijhawm
- Teeb WiFi siv kev xaiv network tom qab ntawd xaiv Wi-Fi qhov twg koj yuav tsum sau koj li SSID thiab Password.
Nruab Python 3
Hauv qhov haujlwm no peb tab tom siv Python, yog li peb yuav teeb tsa lub hauv paus rau Python3 insteat ntawm Python2, siv cov lus txib hauv qab no
hloov kho-lwm txoj hauv kev-nruab/usr/bin/sej python /usr/bin/python2.7 1
hloov kho-lwm txoj kev-nruab/usr/bin/nab nab sej/usr/bin/python3 2
Nab hab sej pob
Peb yuav xav tau ob peb pob khoom kom tau txhua yam ua haujlwm tau zoo, feem ntau yog Flask pob thiab ib qho los txuas nrog peb Cov DataBase. Peb tuaj yeem teeb tsa cov pob khoom siv cov lus txib hauv qab no:
pip nruab Flask
pip nruab Flask_cors pip nruab Flask_socketio pip nruab Python-mysql-connecton
Database
Tom ntej no peb yuav txhim kho peb li kev tswj hwm database (MariaDB) peb yuav ua li ntawd siv:
sudo apt nruab mariadb-server
Ntaus “Y” thiab Nkag mus ntxiv. Tom qab ob peb feeb, txheej txheem teeb tsa ua tiav thiab MariaDB yuav luag npaj txhij siv.
Txhawm rau teeb tsa lub database tus password siv lo lus txib:
sudo mysql_secure_installation
Tom qab ntawd nyem Enter, txij li tam sim no tus password tsis muaj dab tsi. Tom qab ntawv nyem "Y" txhawm rau teeb tus password, tam sim no koj tuaj yeem sau txhua tus password uas koj xav tau, nco ntsoov nco nws vim tias peb xav tau nws txhawm rau txhawm rau txhim kho kev sib txuas ntawm sab nraub qaum thiab pem hauv ntej.
Tam sim no, nyem "Y" 3 zaug rau: tshem tawm cov neeg siv tsis qhia npe, txwv tsis pub nkag mus hauv paus deb thiab tshem tawm cov ntawv xeem. Thaum kawg, nyem "Y" dua kom rov muaj txoj cai tshwj xeeb.
Tam sim no MariaDB thiab txhua qhov xav tau pob tau ua tiav tiav.
Kauj ruam 2: Lob tus Code thiab teeb tsa nws
Tam sim no peb muaj tag nrho cov pob khoom teeb tsa peb tuaj yeem rub tus lej.
Cov cai muaj nyob ntawm Github yog li koj tuaj yeem clone nws siv:
git clone
Qhov no yog lub ntsej muag
git clone
Qhov no yog cov backend
Txhim kho Database nws tus kheej
Txhawm rau teeb tsa lub chaw khaws ntaub ntawv, mus rau.sql cov ntaub ntawv uas nyob hauv daim nplaub tshev backend siv cov lus txib hauv qab no (nco ntsoov teeb nws rau koj tus kheej txoj hauv kev.
mysql ua
tsim database hloov pauv tawm mysql -u hauv paus -p hloov pauv <Koj_Path_to_Backend_Repo/switchit.sql
Txhim kho Apache
Tam sim no peb muaj tag nrho cov cai thiab cov ntaub ntawv teeb tsa peb tuaj yeem nruab Apache, thiab khiav peb cov backend ntawm nws. Peb yuav ua li ntawd siv:
apt -tau nruab apache2 -y
Tom qab ntawd hloov cov ntaub ntawv hauv/var/ww/html nrog cov uas nyob hauv daim nplaub tshev los ntawm cov ntawv tais ceev tseg.
Yog tias txhua yam ua tau zoo koj yuav tsum tuaj yeem txuas rau koj lub vev xaib siv APIPA chaw nyob: 169.254.10.1 hauv koj tus browser.
Kauj Ruam 3: Kev Sib Txuas Arduino
Txhawm rau nyeem peb lub ntsuas tam sim no thiab peb lub cim RFID peb tab tom siv arduino, kom ua li ntawd siv cov lej arduino uas tau hais hauv qab no. Tshaj tawm nws siv USB-A rau USB-B cable thiab arduino IDE software. Thaum rub tawm, ntu arduino ua tiav.
Tam sim no peb yuav tsum pom cov npe khoom siv ntawm PI. Txhawm rau ua kom ntseeg tau tias hauv /boot/config.txt "enable_uart = 1" tau teeb tsa raug. Tsis tas li nco ntsoov tias "console = serial0, 115200" raug tshem tawm ntawm cmdline.txt.
Tom qab ntawd txheeb xyuas cov chaw nres nkoj siv
ls -l /dev
Tom qab ntawd ib qho ntawm cov npe yuav tsum yog Arduino. Sau lub npe no ntawm arduinocom ua haujlwm hauv app.py
ser = serial. Serial ('/dev/ttyS0', 9600)
Tsuas yog ua li ntawd yog tias kev sib txuas lus txuas tsis ua haujlwm.
Kauj Ruam 4: Txuas Txuas Hloov-nws
Kev tiv thaiv txhua yam yog qhov yooj yim heev txawm hais tias koj yuav tsum ua raws li cov hauv qab no:
- Ceev faj nrog lub qhov hluav taws xob ntawm phab ntsa, 230 volts tuaj yeem ua rau tuag taus.
- Nco ntsoov siv qib hloov pauv rau kev sib txuas lus ntawm RPI thiab Arduino.
- Ua ntej yuav siv lub RGB, xyuas kom koj siv tus pin liab thiab ntsuab. Kuaj qhov no ua ntej!
- Kuaj yog tias tsis muaj dab tsi luv-circuited ua ntej powering lub Circuit Court.
Kauj ruam 5: Khiav Txoj Cai
Tam sim no txhua yam tau txuas nrog kom raug peb tuaj yeem ua haujlwm peb qhov program.
Txhawm rau kom nws ua haujlwm tau pib thaum pib tsim cov ntaub ntawv siv:
sudo nano myscript.service
Tom qab ntawv muab tshuaj txhuam (nco ntsoov siv koj tus kheej app.py cov npe:
[Chav] Nqe lus piav qhia = Hloov pauv Tom qab = network.target [Service] ExecStart =/usr/bin/python3 -u app.py WorkingDirectory = // hloov mus rau app.py directory // StandardOutput = inherit StandardError = inherit Restart = ib txwm siv = pi [Nruab] WantedBy = multi-user.target
Tom qab ntawd nias "ctrl + X" thiab luam nws rau/etc/systemd/system.
Tom qab ntawv cov lus txib ua kom nws ua haujlwm tau zoo:
sudo systemctl pab kom myscript.service
Koj tuaj yeem nrhiav cov ntaub ntawv ntau ntxiv txog qhov no ntawm RaspBerry Pi site.
Reboot thiab ua tiav
Tam sim no reboot koj PI siv:
sudo reboot -h tam sim no
Nov yog qhov koj ua Switch-it!
Ua tsaug rau kev ua raws, vam tias qhov no yuav pab tau. Yog tias koj muaj lus qhia lossis tswv yim, tsis txhob ua siab deb tawm lus.
Kauj Ruam 6: (XAV TAU) Lub Tsev Nyob
Koj tuaj yeem tsim lub tsev nyob rau koj tus kheej nyiam. Kuv siv cov ntaub ntawv hlau uas yog 40x40x5 cm nrog lub hau. Txij li thaum kuv siv cov hlau kuv yuav tsum tau laum qhov thiab siv cov kis kom tau txhua yam tawm ntawm cov phaj hauv av. Kuv tau xaiv los siv lub hauv paus uas 5V, 3.3V thiab gnd muaj. Txhua qhov kev sib txuas hluav taws xob tau txuas nrog ib daim ntawm Shrinking Tube nyob rau saum nws. Txhawm rau ua txoj kev tswj hwm cable kuv siv cov ntaub qhwv nrog cov hlua khawm.
Pom zoo:
Lub kaus mom tsis yog lub kaus mom - Cov kaus mom rau cov neeg uas tsis tau hnav lub kaus mom tiag tiag, tab sis xav tau lub kaus mom kev paub: 8 Kauj Ruam
Lub kaus mom tsis yog lub kaus mom rau cov tib neeg uas tsis tau hnav lub kaus mom tiag tiag, tab sis xav tau lub kaus mom kev paub: Kuv ib txwm xav tias kuv tuaj yeem yog tus neeg lub kaus mom, tab sis tsis tau pom dua lub kaus mom uas ua haujlwm rau kuv. Qhov no "Hat Not Hat," lossis fascinator raws li nws tau hu ua yog txheej txheej sab saum toj rau kuv cov teeb meem lub kaus mom uas kuv tuaj yeem koom nrog Kentucky Derby, vacu
Teeb DS3231 RTC (Lub Sijhawm Sijhawm) Kom raug, Ceev thiab Tsis Siv Neeg Siv Java (+-1s): 3 Kauj Ruam
Teeb DS3231 RTC (Lub Sijhawm Sijhawm) Kom raug, Ceev thiab Ceev Ceev Siv Java (+-1s): Cov lus qhia no yuav qhia koj yuav teev sijhawm li cas hauv DS3231 Lub Sijhawm Tiag Siv Arduino thiab daim ntawv thov Java me me uas siv qhov txuas txuas ntawm Arduino.Qhov laj thawj yooj yim ntawm txoj haujlwm no: 1. Arduino xa cov ntawv thov ua ntu zus
Tsis Siv Neeg Kev Hla Hla Kev Siv Hluav Taws Xob Siv Arduino Raws Kev Nkag Nkag Platform: 9 Cov Kauj Ruam
Tsis Siv Neeg Kev Hla Hla Kev Siv Hluav Taws Xob Siv Arduino Raws Kev Nkag Siab Platform: Christmas tsuas yog ib lub lim tiam xwb! Txhua leej txhua tus tibneeg hu tauj coob nrog kev ua koob tsheej thiab tau txais khoom plig, uas, los ntawm txoj kev, tau txais txhua qhov nyuaj dua kom tau nrog qhov tsis muaj peev xwm nyob ib puag ncig peb. Yuav ua li cas mus los ntawm khoom plig qub thiab ntxiv qhov kov ntawm DIY rau
Yuav Ntsuas Li Cas Ntsuas Kev Siv Lub Hwj Chim ntawm Kev Sib Txuas Lus Wireless hauv Era ntawm Kev Siv Hluav Taws Xob?: 6 Cov Kauj Ruam
Yuav Ua Li Cas Ntsuas Kom Tau Txais Kev Siv Lub Hwj Huam ntawm Kev Sib Txuas Lus Wireless hauv Era ntawm Kev Siv Hluav Taws Xob? Feem ntau IoT nodes yuav tsum tau siv lub roj teeb. Tsuas yog los ntawm kev ntsuas ntsuas lub zog siv ntawm lub wireless wireless peb tuaj yeem kwv yees kwv yees ntau npaum li cas roj teeb kuv
Arduino Neeg Hlau Nrog Kev Nyob, Kev Qhia thiab Qib Kev Sib Hloov (Sab Hnub Poob, Sab Hnub Poob, Sab Qaum Teb, Sab Qab Teb) Tswj los ntawm Lub Suab Siv Bluetooth Module thiab Kev Siv Tus Neeg Siv Hluav Taws Xob: 6 Kauj Ruam
Arduino Neeg Hlau Nrog Kev Nyob, Kev Qhia thiab Qib Kev Sib Hloov (Sab Hnub Poob, Sab Hnub Poob, Sab Qaum Teb, Sab Qab Teb) Tswj los ntawm Lub Suab Siv Bluetooth Module thiab Kev Siv Tus Neeg Siv Hluav Taws Xob: Cov lus qhia no piav qhia yuav ua li cas thiaj tsim tau Arduino Robot uas tuaj yeem txav mus raws qhov xav tau (Forward, Backward) , Sab laug, Txoj Cai, Sab Hnub Poob, Sab Hnub Poob, Sab Qaum Teb, Sab Qab Teb) xav tau Kev nrug deb hauv Centimeters siv lub suab hais kom ua. Neeg hlau kuj tseem tuaj yeem txav tau tus kheej