Cov txheej txheem:
Video: Ultrasonic Sensor txhawm rau txhawm rau Hloov Txoj Haujlwm ntawm Cov Hom Phiaj: 3 Kauj Ruam
2024 Tus sau: John Day | [email protected]. Kawg hloov kho: 2024-01-30 09:25
Nws yog ib qho tseem ceeb kom muaj koj cov khoom muaj txiaj ntsig muaj kev nyab xeeb, nws yuav tsis muaj zog yog tias koj ua tib zoo saib xyuas koj lub tsev fuabtais tas hnub. Siv lub koob yees duab raspberry pi koj tuaj yeem siv lub snaps ntawm lub sijhawm. Phau ntawv qhia no yuav pab koj tua cov vis dis aus lossis thaij duab thaum qhov kev hloov pauv tau nkag siab hauv thaj tsam ciam teb.
Kho vajtse:
- Raspberry Pi 2/3/4
- Ultrasonic sensor
- Pi lub koob yees duab
- Cov neeg dhia
Kauj ruam 1: Kev sib txuas
- TXI to RPI4B 17
- VCC to RPI4B 5V
- GND to RPI4B GND
- Ncha mus rau 470-ohm resistor rau txuas-1
- GND rau 1K ohm resistor rau txuas-1
- txuas-1 rau RPI4B 4
Cov txheej txheem hluav taws xob tau tsim los siv circuito.io, nws muaj txhua qhov nrov tshaj plaws microcontrollers, sensors, thiab lwm yam thiab lub platform yooj yim siv rau cov pib tshiab.
Kauj ruam 2: Upload Code
Ua ntej koj khiav tsab ntawv, tsim cov ntawv tais ceev tseg los ntawm cov lus txib hauv qab no qhib lub davhlau ya nyob twg thiab tom qab ntawd hloov cov ntawv sau.
pi@raaspberrypi: mkdir media
pi@raaspberrypi: nano measure.py
Txoj cai siv lub koob yees duab thiab tsev qiv ntawv GPIO. Hla-kos GPIO_TRIGGER & GPIO_ECHO pins tau txuas nrog kom raug rau 17th & 4th pins ntawm Raspberry Pi sab nraud.
Luam thiab paste cov cai hauv qab no lossis ntaus rau hauv cov ntaub ntawv nab thiab sau nws li 'measure.py'
#Librariesimport RPi. GPIO li GPIO ntshuam lub sijhawm ntshuam os los ntawm picamera ntshuam PiCamera # Lub koob yees duab hom lub koob yees duab = PiCamera () camera.rotation = 180 # Qhia kab ntawv no yog cov duab zoo kawg nkaus #GPIO Hom GPIO.setmode (GPIO. BCM) GPIO.setwarnings (Cuav) #set GPIO Pins GPIO_TRIGGER = 17 GPIO_ECHO = 4 #set GPIO kev taw qhia (IN / OUT) GPIO.setup (GPIO_TRIGGER, GPIO. OUT) GPIO.setup (GPIO_ECHO, GPIO. IN) def nrug (): # teeb Trigger rau HIGH GPIO.output (GPIO_TRIGGER, True) # teeb tsa tom qab 0.01ms rau LOW time.sleep (0.00001) GPIO.output (GPIO_TRIGGER, False) StartTime = time.time () StopTime = time.time () # txuag Pib Sijhawm thaum GPIO.input (GPIO_ECHO) == 0: PibTime = sijhawm.time () # txuag lub sijhawm tuaj txog thaum GPIO.input (GPIO_ECHO) == 1: StopTime = time.time () # lub sijhawm sib txawv ntawm pib thiab tuaj txog TimeElapsed = StopTime - StartTime # sib npaug nrog lub suab sonic (34300 cm / s) # thiab faib ua 2, vim tias muaj thiab nrug nrug = (TimeElapsed * 34300) / 2 rov qab nrug yog _name_ == '_main_': camera.start_preview (alpha = 200) sim: thaum Tseeb: deb = nrug () luam tawm ("Ntsuas nrug = %.1f cm" % deb) yog qhov deb <= 20: # hloov tus nqi no raws li koj teeb tsa tam sim no = sijhawm.ctime (). hloov ("", "-") camera.capture ("media/image % s.jpg" % tam sim no) luam tawm ("Duab khaws tseg ntawm media/image- % s.jpg" % tam sim no) # lub koob yees duab.start_recording ("media/video- % s.h264" % tam sim no) # Tsis pom zoo qhov no txhawm rau thaij video # luam tawm ("Video tau khaws tseg ntawm media/duab- % s.jpg" % tam sim no) # tsaug zog (5) # Tsis pom zoo qhov no siv sijhawm yees duab 5 vib nas this.sleep (3) camera.stop_preview () # camera.stop_recording () # Tsis pom zoo qhov no txhawm rau thaij video # Rov pib dua los ntawm nias CTRL + C tshwj tsis yog KeyboardInterrupt: luam tawm ("Kev ntsuas ntsuas nres los ntawm Tus Neeg Siv") GPIO.cleanup ()
Kauj ruam 3: Khiav Code
Tam sim no khiav tsab ntawv li
pi@raspberrypi: nab hab sej ntsuas.py
Qhov kev ncua deb yog ntsuas rau txhua 3 vib nas this (koj tuaj yeem hloov tus nqi hauv tsab ntawv) thiab tau luam tawm rau ntawm lub vijtsam yog tias muaj cov khoom pom nyob hauv 20 centimeters, lub koob yees duab pi yuav yees duab thiab khaws cia hauv cov ntawv xov xwm.
Xwb, koj tuaj yeem tua cov vis dis aus los ntawm kev tsis txaus siab lossis tshem tawm cov hashtags (#) los ntawm kab ntawv kab lus uas tau hais raws li cov lus pom. Koj tseem tuaj yeem txuas cov vis dis aus ntev los ntawm kev yooj yim nce/txo tus nqi hauv "time.sleep (5)".
Zoo siab Circuiting!
Pom zoo:
Siv Kev Cia Siab Lub Hauv Paus txuas ntxiv txhawm rau Nrhiav Lub Tuam Tsev Tsis Ua Haujlwm Txoj Cai Ua Haujlwm Hauv Koj Tsev Neeg Tsob Ntoo ntawm Kev Tshawb Nrhiav Tsev Neeg: 11 Kauj Ruam
Siv Kev Cia Siab Lub Hauv Paus Txuas Ntxiv kom Nrhiav Lub Tuam Tsev Tsis Ua Haujlwm Ua Haujlwm Hauv Koj Tsev Neeg Tsob Ntoo ntawm Kev Tshawb Nrhiav Tsev Neeg: Lub hom phiaj ntawm cov lus qhia no yog los qhia seb yuav tshawb nrhiav koj tsev neeg tsob ntoo li cas hauv Tsev Neeg Nrhiav rau cov poj koob yawm txwv nrog kev ua haujlwm hauv lub tuam tsev tsis tiav siv Kev Cia Siab lub hauv siab txuas ntxiv. Siv Kev Cia Siab Lub Hauv Paus tuaj yeem ua rau koj qhov kev tshawb nrhiav tsis tiav
Lub Hom Phiaj Taw Qhia: Tsim Lub Hom Phiaj Kawm/Qhia Txoj Kev/Cov Txheej Txheem Siv Cov Duab Puncher: 5 Kauj Ruam
Lub Hom Phiaj Taw Qhia: Tsim Lub Hom Phiaj Kawm/Qhia Txoj Kev/Cov Qauv Siv Cov Duab Puncher: Kawm/qhia txoj hauv kev rau cov tub ntxhais kawm tshiab rau kev tsom mus rau lub hom phiaj. Nov yog txoj hauv kev tso cai rau lawv kom pom kev thiab pom cov txheej txheem ntawm kev tsim cov khoom los ntawm cov chav kawm. EkTools 2-nti loj punch; cov duab zoo tshaj plaws. 2. Daim ntawv los yog c
Lub Hom Phiaj Nrhiav Lub Koob Yees Duab Slider Nrog Kev Sib Hloov. 3D Luam & Ua Rau ntawm RoboClaw DC Lub Cev Muaj Zog Tswj & Arduino: 5 Kauj Ruam (nrog Duab)
Lub Hom Phiaj Nrhiav Lub Koob Yees Duab Slider Nrog Kev Sib Hloov. 3D Luam & Ua Rau ntawm RoboClaw DC Tsav Tus Tswj & Arduino: Txoj haujlwm no tau yog ib qhov kuv nyiam tshaj plaws txij li thaum kuv tau koom ua ke kuv qhov kev txaus siab ntawm kev ua yeeb yaj kiab nrog DIY. Kuv ib txwm saib thiab xav ua raws cov yeeb yaj kiab uas tau ua hauv cov yeeb yaj kiab uas lub koob yees duab txav mus hla lub vijtsam thaum tab tom taug qab mus
Lub Hom Phiaj Taw Qhia: Tsim Lub Hom Phiaj Kawm/Qhia Txuj Ci/Txuj Ci Siv Txiab: 5 Kauj Ruam
Lub Hom Phiaj Taw Qhia: Tsim Lub Hom Phiaj Kawm/Qhia Txoj Kev/Txuj Ci Siv Txiab: Kawm/qhia txoj hauv kev rau cov tub ntxhais kawm tshiab rau lub hom phiaj ua haujlwm. Nov yog ib txoj hauv kev tso cai rau lawv kom pom kev thiab pom cov txheej txheem ntawm kev tsim cov khoom los ntawm cov chav kawm.Parts: 1. Txiab (yam twg yuav ua). 2. Daim ntawv lossis daim npav. 3. Marker… nyeem ntxiv
Muab AR Cov Hom Phiaj ntawm GPS Ua Haujlwm hauv Kev Ncaj Ncees: 8 Kauj Ruam (nrog Duab)
Tso AR Cov Hom Phiaj ntawm GPS Kev Sib Koom hauv Kev Muaj Peev Xwm Muaj Tseeb: Cov lus qhia no yuav dhau mus ua mobile app rau tso AR khoom ntawm GPS ua haujlwm nrog ARkit thiab ARCore siv Unity3D. Kuv yuav taug kev koj los ntawm kev teeb tsa ib qhov haujlwm uas kuv tau siv Mapbox uas tso cai rau peb los cim cov lus ntawm G tshwj xeeb