Cov txheej txheem:

Ultrasonic Sensor Tutorial Siv Arduino: 6 Kauj Ruam
Ultrasonic Sensor Tutorial Siv Arduino: 6 Kauj Ruam

Video: Ultrasonic Sensor Tutorial Siv Arduino: 6 Kauj Ruam

Video: Ultrasonic Sensor Tutorial Siv Arduino: 6 Kauj Ruam
Video: Ultrasonic sensor HC-SR04 with Arduino(code explained) Distance Measuring Senosr -Arduino tutorial 9 2024, Kaum ib hlis
Anonim
Ultrasonic Sensor Tutorial Siv Arduino
Ultrasonic Sensor Tutorial Siv Arduino

Cov lus qhia no yog qhia txog qhov nrov Ultrasonic Sensor HC - SR04. Kuv yuav piav qhia nws ua haujlwm li cas, qhia koj qee yam ntawm nws thiab qhia qhov piv txwv ntawm Arduino qhov haujlwm koj tuaj yeem ua raws kom koom ua ke hauv koj cov phiaj xwm. Peb muab cov duab kos qhia yuav ua li cas xaim lub ntsuas hluav taws xob ultrasonic, thiab piv txwv piv txwv los siv nrog Arduino.

Khoom siv

  1. Arduino UNO lossis lwm lub Rooj Tswjhwm Saib Arduino
  2. HC-SR04 Ultrasonic Sensor
  3. Cov qhob cij
  4. Jumper Hlau

Kauj ruam 1: Kev piav qhia

Nqe lus piav qhia
Nqe lus piav qhia

HC-SR04 ultrasonic sensor siv sonar txhawm rau txiav txim siab nrug rau ib yam khoom zoo li puav ua. Nws muaj qhov ua tau zoo uas tsis yog kev sib cuag kom paub ntau nrog qhov tseeb thiab nyeem tau ruaj khov hauv pob uas siv tau yooj yim. Nws los ua tiav nrog ultrasonic transmitter thiab receiver modules.

Kauj ruam 2: Nta

Nta
Nta

Nov yog cov npe ntawm qee qhov HC-SR04 ultrasonic sensor nta thiab cov yam ntxwv:

  • Lub Hwj Chim:+5V DCQuiescent
  • Tam sim no: <2mA
  • Ua haujlwm tam sim no: 15mA
  • Kev Ua Tau Zoo: <15 °
  • Kev ncua deb: 2cm - 400 cm/1 ″ - 13ft
  • Daws teeb meem: 0.3 cm
  • Ntsuas lub kaum ntse ntse: 30 degree
  • Ua kom cov tswv yim mem tes dav: 10uS
  • Loj: 45mm x 20mm x 15mm

Kauj ruam 3: Ua haujlwm

Ua hauj lwm
Ua hauj lwm

Lub ntsuas hluav taws xob ultrasonic siv sonar los txiav txim siab qhov nrug mus rau ib qho khoom. Tus xa tawm (tus lej pin) xa lub teeb liab lub suab nrov ntau. Thaum lub teeb liab pom cov khoom, nws tau pom thiab …… tus xa tawm (tus ncho tus pin) tau txais nws. Lub sijhawm nruab nrab ntawm kev sib kis thiab txais tos ntawm lub teeb liab tso cai rau peb xam qhov deb mus rau ib yam khoom. Qhov no ua tau vim tias peb paub lub suab nrawm hauv huab cua.

Kauj Ruam 4: Sib cuam tshuam Ultrasonic Sensor Nrog Arduino

Qhov ntsuas no nrov heev ntawm Arduino tinkerers. Yog li, ntawm no peb muab piv txwv yuav siv HC-SR04 ultrasonic sensor nrog Arduino li cas. Hauv qhov haujlwm no lub ntsuas hluav taws xob ultrasonic nyeem thiab sau qhov nrug mus rau ib qho khoom hauv kab ntawv saib.

Lub hom phiaj ntawm txoj haujlwm no yog los pab koj nkag siab tias lub ntsuas cua ua haujlwm li cas. Tom qab ntawd, koj yuav tsum muaj peev xwm siv qhov piv txwv no hauv koj tus kheej cov haujlwm.

Kauj ruam 5: Schematics

Schematics
Schematics

Ua raws daim duab qhia chaw kom xaim HC-SR04 ultrasonic sensor mus rau Arduino.

Kauj ruam 6: Code

Tshaj tawm cov cai muab rau Arduino siv Arduino IDE

Kev qhia Ultrasonic Sensor

Pom zoo: