Cov txheej txheem:

Arduino Tswb Nrog Ultrasonic Sensor: 5 Kauj Ruam (nrog Duab)
Arduino Tswb Nrog Ultrasonic Sensor: 5 Kauj Ruam (nrog Duab)

Video: Arduino Tswb Nrog Ultrasonic Sensor: 5 Kauj Ruam (nrog Duab)

Video: Arduino Tswb Nrog Ultrasonic Sensor: 5 Kauj Ruam (nrog Duab)
Video: Sensor ultrasonic menggunakan arduino uno 2024, Kaum ib hlis
Anonim
Arduino Tswb Nrog Ultrasonic Sensor
Arduino Tswb Nrog Ultrasonic Sensor

Cov lus qhia no yog hais txog yuav ua li cas thiaj yooj yim thiab pheej yig lub tswb nrov ntawm koj tus kheej.

Yog tias koj muaj lus nug lossis teeb meem koj tuaj yeem tiv tauj kuv ntawm kuv tus email: [email protected]

Nov kuj yog video ntawm qhov haujlwm no:

www.youtube.com/embed/A_Px-gb8hYY

Yog li cia pib.

Kauj ruam 1: Saib Video

Koj tseem tuaj yeem pom hauv video tias txoj haujlwm no ua haujlwm li cas.

www.youtube.com/watch?v=A_Px-gb8hYY

Kauj ruam 2: Cov ntaub ntawv

Khoom siv
Khoom siv

Txhua yam ntaub ntawv koj xav tau rau txoj haujlwm no koj tau txais ntawm UTSource.

Sponsor Link: UTSource.netReviews

Nws yog lub vev xaib ntseeg tau rau kev xaj cov khoom siv hluav taws xob nrog pheej yig

tus nqi thiab zoo heev

-Arduino Mega lossis Uno

-Ultrasonic sensor HC-SR04

-2 laub khawm

-Arduino relay modul

-3 LEDs (ntsuab, liab, xiav) Yog tias koj xav tau koj tuaj yeem xaiv lwm yam xim

-some resistors (10k ohm)

-zoo

-jumper xov hlau

-daim ntawv qhia

Kauj Ruam 3: Txuas Ultrasonic Module

Txog qhov haujlwm no kuv tau siv ultrasonic module HC-SR04 vim tias nws pheej yig thiab nws yooj yim los ua haujlwm nrog. Kuv yuav hauv internet rau 3 $.

Yog li ntawm qhov ntsuas no koj muaj 4 tus pin.

1.pin Vcc - tus pin no txuas nrog 5V+.

2. pin. Trig - koj yuav tsum txhais tus pin no hauv koj qhov program.

3.pin Echo -this tus pin zoo ib yam li Trig koj kuj yuav tsum tau txhais nws.

4.pin GND - tus pin no txuas nrog hauv av.

Yuav ua li cas txhais tus pin

Hauv qhov no koj yuav tsum txhais cov pins rau Trig thiab Echo. I tau txhais cov lej digital 7 rau trigPin thiab tus lej digital 8 rau echoPin.

Yog tias koj xav tau koj tuaj yeem xaiv lwm tus lej digital ntawm 2 txog 53.. (tshwj tsis yog 0 thiab 1)

Koj yuav tsum sau cov cai no ua ntej tsis muaj teeb tsa (). (Saib cov kauj ruam Code)

#define trigPin 7

#define echoPin 8

Kauj ruam 4: Kev thaiv kab

Thaiv
Thaiv
Thaiv
Thaiv
Thaiv
Thaiv

Thaum koj tab tom txuas lub khawm koj yuav tsum txuas tus tiv thaiv (Kuv siv 10k ohm resistors) nruab nrab ntawm GND thiab thawb lub pob kom txhawm rau ua kom muaj txiaj ntsig 0 ntawm lub khawm.

Pushbutton (ON) txuas nrog tus lej digital 10

Pushbutton (OFF) txuas nrog tus lej digital 6

Buzzer txuas nrog tus lej digital 3

Liab LED txuas nrog tus lej digital 4

Xiav LED txuas nrog tus lej lej 5

Ntsuab LED txuas nrog digita tus pin 11

Kev xa xov txuas nrog tus lej digital 11

Hlau rau buzzer yog thawj zaug txuas nrog rau kev xa xov module thiab tom qab ntawd los ntawm relay mus rau buzzer. Kuv siv NC sib cuag ntawm kev xa xov

Kauj ruam 5: Code

Nov yog chaws rau tswb.

Tsuas yog rub nws, ntsaws rau hauv Arduino thiab xa cov lej.

Pom zoo: