Cov txheej txheem:

ULTRASONIC SENSOR HC-SR04: 9 Cov Kauj Ruam
ULTRASONIC SENSOR HC-SR04: 9 Cov Kauj Ruam

Video: ULTRASONIC SENSOR HC-SR04: 9 Cov Kauj Ruam

Video: ULTRASONIC SENSOR HC-SR04: 9 Cov Kauj Ruam
Video: HC-SR04 Ultrasonic Distance Sensor and Arduino (Lesson #9) 2024, Kaum ib hlis
Anonim
ULTRASONIC SENSOR HC-SR04
ULTRASONIC SENSOR HC-SR04

Raws li lub npe qhia tias nws siv lub suab tsis zoo ultrasonic los ua haujlwm. Yog lawm, nws siv lub suab nthwv dej ultrasonic los ntsuas qhov kev nkag siab qhov teeb meem deb thiab lwm yam. Nws yog hluav taws xob hluav taws xob lossis cov cuab yeej uas feem ntau siv tam sim no ib hnub los ua haujlwm ntau yam. Cov ntsuas no muaj npe nrov thiab nquag siv rau lub hom phiaj phiaj xwm. Cov ntsuas no tuaj yeem txuas rau ntau lub microcontrollers los ua ib qhov haujlwm.

Niaj hnub no peb pom qhov muag dig, qhov rooj tsis siv neeg, radars uas siv tib yam lossis zoo dua ntawm ultrasonic sensor los ua cov haujlwm no uas kuv tab tom siv yog qhov yooj yim thiab muaj nyob hauv khw.

Kauj ruam 1: Piav qhia

Piav qhia
Piav qhia

Ultrasonic sensor yog lub ntsuas hluav taws xob uas tau tsim tawm ntawm ob lub LM324 ic thiab MAX3232 ic tus xa tawm transducer thiab tau txais kev hloov pauv thiab ntau yam ntxiv.

Sensor muaj plaub tus pin VCC, GND, TRIG, ECHO uas yog siv los xa thiab tau txais cov mem tes taw mus rau MAX3232 ic.

Kev xa tawm thiab tau txais cov hloov pauv xa cov nthwv dej ultrasonic rau ob peb microseconds thiab tau txais kev hloov pauv nkag siab cov nthwv dej no rov qab thiab lub microcontroller suav qhov nrug raws li lub sijhawm siv.

*NCO TSEG:- Qhov ntsuas no tau muab los ntawm ULTRASONIC SOUND WAVES thiab cuam tshuam rau cov xwm txheej sib txawv xws li HUMIDITY, TEMPREATURE thiab lwm yam uas tau tshwm sim los ntawm kev hloov pauv ntawm tus nqi ntawm lub ntsuas.

Qhov ntsuas no muab cov txiaj ntsig ntawm hom mem tes txhais tau tias nws xa lub microcontroller lub sijhawm siv los ntawm cov nthwv dej mus tsoo cov khoom thiab rov qab los. Nws tuaj yeem ntsuas qhov nrug ntawm 4meters nyob ntawm seb lub tsev qiv ntawv siv los xam cov ntaub ntawv. Tab sis nws muaj qhov tsawg kawg nkaus nyob deb ntawm qhov uas tsis muaj ib yam khoom yuav tsum tau plave lossis lub sensor yuav muab qhov tsis xav tau nrug thiab qhov ntawd yog 2cm.

Kauj ruam 2: NTAUB NTAWV THIAB DAIM NTAWV THOV

  • Kev suav cov ntaub ntawv ceev
  • Yooj yim rau siv
  • Pom lub kaum sab xis txog 120 degrees
  • Muab ze ze qhov tseeb
  • Hom mem tes hom ntaub ntawv
  • Tus nqi qis
  • Siv tau hauv qhov rooj thiab qhov muag tsis pom
  • Lub hom phiaj ruaj ntseg
  • Tsev kawm ntawv tej dej num

Kauj Ruam 3: SENSOR SPECIFICATIONS

SENSOR SPECIFICATIONS
SENSOR SPECIFICATIONS
SENSOR SPECIFICATIONS
SENSOR SPECIFICATIONS

Kauj Ruam 4: QHOV TSEEM CEEB

  • Ib qho microcontroller nyiam Arduino Uno rau cov pib tshiab.
  • Ib daim ntawv qhia zaub mov
  • Jumper xov hlau

Kauj Ruam 5: CIRCUIT DIAGRAM

CIRCUIT DIAGRAM
CIRCUIT DIAGRAM

Ua ntej tshaj coj cov kab hluav taws xob mus rau lub khob cij los ntawm microcontroller

VCC/5v+ kab thiab GND - kab.

Tom qab ntawd txuas lub ntsuas hluav taws xob mus rau lub rooj mov ci thiab txuas lub zog rau lub ntsuas hluav taws xob los ntawm cov kab hluav taws xob siv cov xov hluav taws xob.

Tam sim no txuas TRIG PIN ntawm SENSOR rau MICROCONTROLLER DIGITAL (PIN 3) thiab ECHO PIN OF SENSOR rau DIGITAL (PIN 2) NTAWM MICROCONTROLLER.

Kauj Ruam 6: LIBRARY

Kuv tau siv lub tsev qiv ntawv ultrasonic rau kev ntsuas lub hom phiaj uas txuas rau ntawm no

github.com/JRodrigoTech/Ultrasonic-HC-SR04 ULTRASONIC HC-SR04 lub tsev qiv ntawv lossis koj tuaj yeem siv Arduino tus thawj tswj tsev qiv ntawv rub tawm nws

Kauj ruam 7: CODE

// muab cov cai no tso rau hauv lub tswv yim ntawm arduino los ntawm kab no

#suav nrog

Ultrasonic ultrasonic (9, 8); // (Trig PIN, Echo PIN)

void teeb tsa () {

Serial.begin (9600);

}

void lub voj ()

{

Serial.print (ultrasonic. Ranging (CM)); // CM los yog INC

Serial.println ("cm");

ncua (100);

}

Kauj Ruam 8: Ua haujlwm

Raws li txoj cai pib nws pib

tus pin uas lub sensor xa nws cov ntaub ntawv ces tus microcontroller tos rau cov ntaub ntawv kom tau txais sai li sai tau thaum cov ntaub ntawv tau txais

Ultrasonic nthwv dej raug xa hauv mem tes ntawm 10 microseconds thiab tau txais los ntawm tus txais thiab Arduino suav qhov nrug raws li lub sijhawm siv los ntawm nthwv dej rov qab los rau lub sensor.

Kauj ruam 9:

Duab
Duab
Duab
Duab
Duab
Duab

Tam sim no peb tau txais PCB tsim thiab nws yog lub sijhawm los xaj cov PCB.

Txog qhov ntawd, koj tsuas yog yuav tsum mus rau JLCPCB.com, thiab nyem rau ntawm "QUOTE NOW" khawm.

JLCPCB kuj yog tus txhawb nqa txoj haujlwm no. JLCPCB (ShenzhenJLC Electronics Co., Ltd.), yog lub tuam txhab PCB loj tshaj plaws hauv Suav teb thiab cov tuam txhab tsim khoom lag luam tshwj xeeb tshwj xeeb hauv PCB sai sai thiab tsim cov PCB me me. Koj tuaj yeem xaj yam tsawg kawg ntawm 5 PCBs rau tsuas yog $ 2.

Txhawm rau kom tau txais PCB tsim, xa cov ntaub ntawv gerber koj rub tawm hauv cov kauj ruam kawg. Rub cov ntaub ntawv.zip lossis koj tseem tuaj yeem rub thiab poob cov ntaub ntawv gerber.

Tom qab xa cov ntaub ntawv zauv teb, koj yuav pom cov lus ua tiav hauv qab yog tias cov ntawv tau ua tiav tiav. Koj tuaj yeem tshuaj xyuas PCB hauv Gerber tus saib kom paub tseeb tias txhua yam zoo. Koj tuaj yeem saib ob sab saum toj thiab hauv qab ntawm PCB.

Tom qab ua kom ntseeg tau tias peb cov PCB zoo, tam sim no peb tuaj yeem tso qhov kev txiav txim ntawm tus nqi tsim nyog. Koj tuaj yeem xaj 5 PCBs rau tsuas yog $ 2 tab sis yog tias nws yog koj thawj xaj ces koj tuaj yeem tau txais 10 PCBs rau $ 2.

Txhawm rau txiav txim, nyem rau ntawm "SAVE TO CART" khawm.

Kuv cov PCBs tau siv 2 hnub los tsim khoom thiab tuaj txog hauv ib lub lis piam siv DHL qhov kev xaiv xa khoom. PCBs tau ntim tau zoo thiab qhov ua tau zoo tiag tiag.

*NCO NTSOOV:- Yog tias koj xav tau pcb gor txoj haujlwm no tshaj li hu rau kuv lossis sau kuv hauv cov lus.

Pom zoo: