Cov txheej txheem:
Video: Kev Pom Kev Nyob Nrog Raspberry Pi thiab HC-SR04: 3 Cov Kauj Ruam
2024 Tus sau: John Day | [email protected]. Kawg hloov kho: 2024-01-30 09:26
HC-SR04 Ultrasonic Distance Sensor siv cov tsis sib cuag ultrasound sonar los ntsuas qhov nrug mus rau ib qho khoom. Nws muaj ob lub transmitters, tus txais thiab tus tswj Circuit Court. Cov neeg xa xov xa tawm lub suab nrov ultrasonic ntau, uas thaws tawm ib qho khoom nyob ze, thiab tus txais tau mloog rau txhua qhov rov qab ncha. Qhov ncha ntawd tau ua tiav los ntawm kev tswj hwm lub zog txhawm rau xam lub sijhawm sib txawv ntawm lub teeb liab uas tau xa thiab tau txais. Lub sijhawm no tuaj yeem siv tom qab, nrog rau qee qhov kev ua lej ntse, los xam qhov nrug nruab nrab ntawm lub ntsuas cua thiab qhov khoom xav tau!
Khoom siv
Koj yuav xav tau dab tsi:
- Raspberry Pi 2/3/4
- Micro SD Card thauj khoom nrog Raspbian
- 5.1V USB Fais fab mov
- HC-SR04 (pom tseeb)
- Cov qhob cij
- 4 Txiv neej rau Poj Niam Cables
- Saib xyuas thiab keyboard rau Raspberry Pi
Kauj Ruam 1: Teeb Raspberry Pi
- Ntxig daim npav SD uas koj tau teeb tsa nrog Raspbian (ntawm NOOBS) rau hauv daim npav microSD ntawm sab hauv qab ntawm koj li Raspberry Pi.
- Nrhiav tus USB txuas kawg ntawm koj cov keyboard's cable, thiab txuas cov keyboard rau USB chaw nres nkoj ntawm Raspberry Pi (nws tsis muaj teeb meem qhov chaw nres nkoj twg koj siv).
-
Nco ntsoov tias koj lub vijtsam raug ntsaws rau hauv lub qhov (socket) phab ntsa thiab hloov mus. Saib ntawm HDMI chaw nres nkoj (s) ntawm Raspberry Pi - ceeb toom tias lawv muaj lub tiaj tiaj nyob saum. Siv kab txuas txuas lub vijtsam mus rau Raspberry Pi's HDMI chaw nres nkoj - siv tus adapter yog tias tsim nyog.
- Txuas lub USB fais fab mov rau hauv lub qhov (socket) thiab txuas nws mus rau koj lub Raspberry Pi lub zog nres nkoj.
- Koj Raspberry Pi yuav pib khau raj tom qab ntawd koj yuav npaj mus.
Kauj ruam 2: Teeb Kho Vajtse
Kev teeb tsa lub ntsuas nrug deb ntawm ultrasonic yog yooj yim yooj yim, tsis muaj lwm qhov nyuaj xav tau, tsuas yog lub ntsuas cua, 4 kab thiab Raspberry Pi. Nws tsuas muaj plaub tus pin:
- VCC rau Pin 2 (5V)
- TRIG rau Pin 12 (GPIO 18)
- ECHO rau tus Pin 18 (GPIO 24)
- GND to Pin 6 (GND)
Kauj ruam 3: Python Script
Ua ntej tshaj plaws peb yuav tsum muaj lub tsev qiv ntawv sej gpiozero teeb tsa thiab siv peb yuav tsim tsab ntawv tshiab
sudo nano nrug_sensor.py
nrog cov hauv qab no:
# Tau txais cov tsev qiv ntawv uas peb xav tau
los ntawm gpiozero ntshuam DistanceSensor los ntawm lub sijhawm ntshuam pw tsaug zog # Pib ua haujlwm ultrasonic sensor sensor = DistanceSensor (ua rau = 18, ncha = 24) thaum Tseeb: # Tos 2 vib nas this pw (2) # Tau txais qhov nrug deb li deb li cas = sensor.distance # Tab sis peb xav tau nws hauv centimeters nrug = sensor.distance * 100 # Peb yuav tau txais tus lej zauv loj yog li peb yuav muab nws faib rau 2 qhov chaw nrug = puag ncig (sensor.distance, 2) # Luam tawm cov ntaub ntawv mus rau lub vijtsam luam tawm ("nrug: {} cm ".format (sensor.distance))
Pom zoo:
Qhov muag tsis pom kev Nrog ESP8266, Google Tsev thiab Openhab Kev Sib Koom thiab Kev Tswj Xyuas Web: 5 Cov Kauj Ruam (nrog Duab)
Qhov muag tsis pom kev Nrog ESP8266, Google Tsev thiab Openhab Kev Sib Koom thiab Kev Tswj Xyuas Web: Hauv Cov Lus Qhia no kuv qhia koj li cas kuv ntxiv kev siv tshuab rau kuv qhov muag tsis pom. Kuv xav kom muaj peev xwm ntxiv thiab tshem tawm qhov kev siv tshuab nws, yog li txhua qhov kev teeb tsa yog clip ntawm.Qhov tseem ceeb yog: Stepper motor Stepper tsav tswj bij ESP-01 Iav thiab teeb tsa
IoT: Pom Kev Pom Kev Pom Cov Ntaub Ntawv Siv Node-RED: 7 Cov Kauj Ruam
IoT: Pom Kev Pom Teeb Pom Kev Pom Cov Ntaub Ntawv Siv Node-RED: Hauv cov lus qhia no, koj yuav kawm paub yuav tsim lub internet txuas nrog lub ntsej muag li cas! Kuv yuav siv lub teeb pom kev ib puag ncig (TI OPT3001) rau qhov ua piv txwv no, tab sis ib qho ntsuas ntawm koj xaiv (ntsuas kub, av noo, lub hwj chim ntsuas hluav taws xob, thiab lwm yam) yuav ua haujlwm. Tus nqi sensor
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
Pom Qhov Pom Pom Pom Pom Lub Koob Yees Duab (TfCD): 15 Kauj Ruam (nrog Duab)
Pom Qhov Pom Pom Pom Pom Lub Koob Yees Duab (TfCD): Cov kev pabcuam paub uas tuaj yeem paub txog kev xav, ntsej muag ntawm tib neeg lossis cov khoom yooj yim tam sim no tseem nyob rau theem pib ntawm kev txhim kho, tab sis nrog kev kawm tshuab, thev naus laus zis no tau nce zuj zus. Peb tuaj yeem cia siab tias yuav pom ntau ntxiv ntawm cov khawv koob no hauv
Lub Teeb Pom Kev Pom Kev Pom Zoo/ Handheld Photograpy Teeb: 7 Cov Kauj Ruam (nrog Duab)
Intimate Video Light/ Handheld Photograpy Light: Kuv paub koj xav li cas. Los ntawm "intimate," Kuv txhais tau tias teeb pom kev nyob ze rau qhov xwm txheej teeb pom kev nyuaj-tsis tas yuav rau "xwm txheej zoo." (Txawm li cas los xij, nws tuaj yeem siv rau qhov ntawd ib yam nkaus …) Raws li New York City tus kws yees duab-lossis