Cov txheej txheem:

ANALOG ULTRASONIC SENSOR rau DAS TUS MEASURMENT: 3 Kauj Ruam
ANALOG ULTRASONIC SENSOR rau DAS TUS MEASURMENT: 3 Kauj Ruam

Video: ANALOG ULTRASONIC SENSOR rau DAS TUS MEASURMENT: 3 Kauj Ruam

Video: ANALOG ULTRASONIC SENSOR rau DAS TUS MEASURMENT: 3 Kauj Ruam
Video: Как использовать 2 или более лазерных датчиков расстояния VL53L0X 2024, Kaum ib hlis
Anonim
ANALOG ULTRASONIC SENSOR rau kev ntsuas nrug
ANALOG ULTRASONIC SENSOR rau kev ntsuas nrug

Cov lus qhia no yuav cuam tshuam nrog yuav siv lub tshuab ntsuas ultrasonic txuas nrog Arduino li cas thiab ntsuas qhov tseeb kom nrug deb ntawm 20cm txog 720cm.

Kauj Ruam 1: GY-US42V2

GY-US42V2
GY-US42V2
GY-US42V2
GY-US42V2

Kuv siv lub npe nrov GY-US42V2 uas tuaj yeem ua raws li 4 txoj hauv kev:

-pulse tso zis nrog lub tsev qiv ntawv tshwj xeeb rau nruab (SR04.h) tsis raug sim

-I2C kev sib txuas lus nrog lub tsev qiv ntawv tshwj xeeb SoftI2Cmaster.h (tsis kuaj).

-I2C tsis muaj lub tsev qiv ntawv tshwj xeeb nrog daim ntawv qhia tus pin no:

  • VCC to VCC,
  • A5 (atmega328 SCL) rau CR
  • A4 (atmega328 SDA) rau DT
  • GND to CSY

Txuas mus rau atmega328 uas tsis muaj qhov rub tawm tsis kam, tsis yog qhov ntsuas zoo heev.

-Serial RX TX nrog lub tsev qiv ntawv tshwj xeeb SoftwareSerial.h thiab daim ntawv qhia tus pin no:

VCC to CSY

GND to CSY

  • pin D2 to CR
  • pin D3 to DT
  • VCC to PEB

Muaj tseeb dua thiab zoo tshaj qhov kuv xav

Qee qhov kev qhia tshwj xeeb:

GY-US42 yog tus nqi qis, qhov ua tau zoo ntau yam qauv.

Kev siv hluav taws xob 3-5 V, kev siv hluav taws xob me me, qhov loj me, kev teeb tsa yooj yim.

Nws lub hauv paus ntsiab lus ntawm kev ua haujlwm yog qhov kev sojntsuam tso tawm ultrasonic nthwv dej tsis zoo los ntawm cov khoom ntsuas, qhov kev sojntsuam tau txais lub suab rov qab, siv lub sijhawm sib txawv, suav qhov nrug deb. Muaj peb txoj hauv kev los nyeem cov ntaub ntawv module, piv txwv li, ntu UART (qib TTL), IIC, hom mem tes pwm, Cov kis tau tus mob ceev yog 9600bps thiab 115200bps, tuaj yeem teeb tsa tau, muaj kev txuas ntxiv, teeb tsa cov zis hauv ob txoj hauv kev, koj tuaj yeem txuag lub zog teeb tsa.

IIC tuaj yeem hloov kho qhov chaw nyob sab hauv kom yooj yim rau IIC tsheb npav tib lub sijhawm nkag mus rau ntau qhov qauv. Cov mem tes pwm tso tawm yog tib yam li sr04.

Tus qauv tuaj yeem hloov pauv mus rau lwm qhov chaw ua haujlwm thiab txuas ncaj qha rau lub microcontroller.

Thaum lub khoos phis tawj xav tau USB hauv TTL module, kev txuas ncaj qha.

IIC hom tuaj yeem txuas ncaj qha mus rau APM, Pixhawk thiab lwm yam kev tswj dav hlau.

Muab Arduino, 51, STM32 cov txheej txheem kev sib txuas lus ntawm lub microcontroller, tsis muab kev sib txuas thiab sab hauv microcontroller qhov chaw.

Raws li qhov tshwm sim ntawm kev siv lub transceiver ib qho kev sojntsuam ultrasonic tau tsim nyob rau hauv, thaj tsam ntawm qhov muag tsis pom thaj tsam li 20 cm. Tsis pub dhau 20 cm, qhov ntau yog tsis raug.

Voltage: 3-5 V

Built-in MCU xam nrug deb

IIC and serial and pwm

Zaus: 15 Hz (ntau yam)

Tam sim no: 9mA (VCC = 5V)

Kauj Ruam 2: Schematic thiab Cov Ntawv Hauv Hauv Sketch thiab Libs

Schematic thiab Archive Tsis pub dhau Sketch thiab Libs
Schematic thiab Archive Tsis pub dhau Sketch thiab Libs

Kuv tau ua clone board ntawm arduino nrog atmega328 PU non P, Kuv tau txais ntev dhau los. Kuv ntaus 2 daim duab hu ua:

  • RADARI2C rau I2C khiav tsis muaj lub tsev qiv ntawv tshwj xeeb
  • RADARserial nrog SoftwareSerial.h

Koj tseem yuav pom thawj daim duab thiab cov libs muab rau lub ntsuas cua no.

Kauj Ruam 3: Xaus

Hom kev ntsuas no yuav raug siv ua qhov chaw nres tsheb nraub qaum tab sis rau sab nraum zoov siv, cov kab ke no tuaj yeem cuam tshuam los ntawm cua uas cuam tshuam lub suab. Ceev faj.

Ua tsaug rau txhua lub vev xaib xav tau los kho cov lus qhia no.

Zoo siab qhia !!!!

Pom zoo: