Cov txheej txheem:

Ultrasonics Raws Txoj Haujlwm Txoj Haujlwm: 4 Kauj Ruam (nrog Duab)
Ultrasonics Raws Txoj Haujlwm Txoj Haujlwm: 4 Kauj Ruam (nrog Duab)

Video: Ultrasonics Raws Txoj Haujlwm Txoj Haujlwm: 4 Kauj Ruam (nrog Duab)

Video: Ultrasonics Raws Txoj Haujlwm Txoj Haujlwm: 4 Kauj Ruam (nrog Duab)
Video: Nas Thiab Nab Qa Ntsuab 3D Animation Part 1 2024, Kaum ib hlis
Anonim
Ultrasonics Raws Txoj Haujlwm Txoj Haujlwm
Ultrasonics Raws Txoj Haujlwm Txoj Haujlwm

Txhua qhov hloov pauv ntawm ultrasonic radars Kuv tau pom rau cov khoom siv arduino (Arduino - Radar/Ultrasonic Detector, Arduino Ultrasonic Radar Project) yog cov radars zoo heev tab sis txhua tus ntawm lawv yog "dig muag". Kuv txhais tau tias, lub radar pom qee yam tab sis nws pom dab tsi?

Yog li kuv tshaj tawm kuv tus kheej txhawm rau txhim kho cov txheej txheem uas tuaj yeem tshawb pom ob qho tib si thiab cim lawv. Hauv lwm lo lus txoj haujlwm tso chaw yam tsis siv GPS cov cuab yeej tab sis ntsuas ultrasonic.

Nov yog qhov txiaj ntsig kuv vam tias koj nyiam.

Kauj Ruam 1: Nws Ua Haujlwm Li Cas?

Nws Ua Haujlwm Li Cas?
Nws Ua Haujlwm Li Cas?

Cov txheej txheem teeb tsa tau tsim los ntawm peb lub chaw ntsuas hluav taws xob nrog lub ntsuas hluav taws xob ultrasonic thiab id_node 1, 2 thiab 3 tsim ib lub duab plaub lossis lub xwmfab uas ua rau lub kaum sab xis ntawm 90º thiab qhov twg qhov kev ncua deb ntawm lawv tau paub zoo li qhia hauv daim duab 1.

const float distancebetween1and2 = 60.0;

const float distancebetween2and3 = 75.0;

Cov ntsuas no ntsuas qhov deb thiab lub kaum ntse ntse ntawm lwm yam khoom nrog id_node ntau dua 3 uas tseem muaj lub ntsuas hluav taws xob uas ntsuas lub kaum sab xis ntawm 170 °.

Txhua tus ntawm lawv xa qhov kev ncua deb, lub kaum ntse ntse ntsuas thiab tus id_node mus rau lwm lub chaw nres tsheb tus tswv siv kev sib txuas lus sib txuas wireless los tshuaj xyuas, suav qhov chaw ntawm cov khoom siv kev ntsuas trigonometry thiab txheeb xyuas lawv.

Txhawm rau zam kev cuam tshuam tus tswv chaw nres tsheb sib koom ua ke txhua lub ntsuas hluav taws xob ultrasonic nyob rau hauv txoj kev uas tsuas yog ib lub tshuab ntsuas ultrasonic ntsuas ntawm txhua lub sijhawm

Tom qab ntawd thiab siv kev sib txuas lus txuas tus tswv chaw nres tsheb xa cov ntaub ntawv (lub kaum ntse ntse, nrug, id_object) mus rau kev kos duab los ua cov phiaj xwm.

Kauj Ruam 2: Yuav Ua Li Cas Kho Peb Qhov Chaw Sensor thiab Lub Hom Phiaj

Yuav Kho Li Cas Peb Qhov Chaw Sensor thiab Cov Hom Phiaj
Yuav Kho Li Cas Peb Qhov Chaw Sensor thiab Cov Hom Phiaj
Yuav Kho Li Cas Peb Qhov Chaw Sensor thiab Cov Hom Phiaj
Yuav Kho Li Cas Peb Qhov Chaw Sensor thiab Cov Hom Phiaj

Tsuas yog lub luag haujlwm ntawm txhua lub chaw nres tsheb sensor yog txhawm rau txheeb xyuas cov khoom thiab xa cov npe nyob deb, lub kaum sab xis thiab tus lej cim ntsuas mus rau tus tswv chaw nres tsheb.

Yog li koj yuav tsum hloov kho qhov kev tshawb pom qhov siab tshaj plaws ("siv tau_max_distance") tso cai thiab qhov tsawg kawg ib ("siv tau_min_distance") (centimeters) txhawm rau txhim kho kev txheeb xyuas thiab txwv thaj tsam nrhiav pom:

int siv_max_distance = 80;

int siv_min_distance = 1;

Tus lej cim ntawm cov chaw nres tsheb sensor ("no_node" hauv cov cai hauv qab no) yog 1, 2 thiab 3 thiab tus lej ntawm tus tswv chaw nres tsheb yog 0.

const uint16_t this_node = 01; // Chaw nyob ntawm peb cov node hauv hom ntawv Octal (Node01, Node02, Node03)

const uint16_t other_node = 00; // Chaw nyob ntawm tus tswv node (Node00) hauv hom Octal

Txhua lub chaw nres tsheb sensor cheb thiab lub kaum sab xis ntawm 100º (“max_angle” hauv cov cai hauv qab no)

#define min_angle 0

#define max_angle 100

Raws li qhov saum toj no tsuas yog ua haujlwm ntawm ib yam khoom yog txhawm rau txheeb xyuas cov khoom thiab xa cov npe nyob deb, cov ces kaum thiab cov khoom id ntsuas mus rau tus tswv chaw nres tsheb. Tus lej ntawm ib qho khoom ("no_node" hauv cov cai hauv qab no) yuav tsum muaj ntau dua 3.

Txhua yam khoom sweeps thiab lub kaum sab xis ntawm 170º thiab zoo li saum toj no, nws tuaj yeem hloov kho qhov siab tshaj plaws thiab yam tsawg kawg nkaus kom pom deb li cas.

const uint16_t this_node = 04; // Chaw nyob ntawm peb cov node hauv hom ntawv Octal (Node04, Node05,…)

const uint16_t other_node = 00; // Chaw nyob ntawm tus tswv node (Node00) hauv Octal format int valid_max_distance = 80; int siv_min_distance = 1; #define min_angle 0 #define max_angle 170

Kauj Ruam 3: Yuav Kho Li Cas Qhov Chaw Nres Tsheb

Yuav Kho Li Cas Qhov Chaw Nres Tsheb
Yuav Kho Li Cas Qhov Chaw Nres Tsheb
Yuav Kho Li Cas Qhov Chaw Nres Tsheb
Yuav Kho Li Cas Qhov Chaw Nres Tsheb
Yuav Kho Li Cas Qhov Chaw Nres Tsheb
Yuav Kho Li Cas Qhov Chaw Nres Tsheb

Lub luag haujlwm ntawm tus tswv chaw nres tsheb yog kom tau txais kev xa tawm ntawm cov chaw nres tsheb sensor thiab cov khoom thiab xa cov txiaj ntsig uas siv cov chaw nres nkoj txuas mus rau kev kos duab ua haujlwm los npaj lawv. Ntxiv mus synchronizes tag nrho cov khoom thiab peb lub chaw nres tsheb sensor nyob rau hauv txoj kev uas tsuas yog ib qho ntawm lawv tau ntsuas txhua lub sijhawm kom zam kev cuam tshuam.

Thawj zaug koj yuav tsum hloov kho qhov deb (centimeters) ntawm sensor 1 thiab 2 thiab qhov nrug nruab nrab ntawm 2 thiab 3.

const float distancebetween1and2 = 60.0;

const float distancebetween2and3 = 70.0;

Daim duab kos xam qhov chaw ntawm cov khoom raws li hauv qab no:

  • Rau txhua qhov kev xa tawm ntawm cov khoom (id_node ntau dua 3) saib kom zoo ib yam nyob deb ntawm txhua qhov kev xa tawm ntawm lub ntsuas hluav taws xob ultrasonic (id_node 1, 2 lossis 3).
  • Tag nrho cov ntsiab lus no teev cov npe ntawm "cov neeg sib tw" (nrug, kaum sab xis, id_node) los ua txoj haujlwm ntawm ib qho khoom ("txheej txheem_pointobject_with_pointssensor" hauv daim duab).
  • Rau txhua "tus neeg sib tw" ntawm daim ntawv teev npe dhau los, ua haujlwm "tus neeg sib tw_selected_between_sensor2and3" suav los ntawm qhov pom ntawm lub ntsuas ultrasonic 2 thiab 3 uas ntawm lawv ua raws li cov lej hauv qab no (saib cov duab 2 thiab 3)

float distancefroms2 = sin (radians (lub kaum sab xis)) * nrug;

ntab distancefroms3 = cos (radians (angle_candidate)) * nrug_candidate; // Trigonometry condition 1 abs (distancefroms2 + distancefroms3 - distancebetween2and3) <= ntab (max_diference_distance)

Raws li tau hais los saum no, rau txhua tus "tus neeg sib tw" ntawm cov npe dhau los, ua haujlwm "tus neeg sib tw_selected_between_sensor1and2" suav los ntawm qhov pom ntawm lub ntsuas ultrasonic 1 thiab 2 uas ntawm lawv ua raws li kev ntsuas hauv qab no (saib daim duab 2 thiab 3)

float distancefroms1 = sin (radians (kaum sab xis)) * nrug; ntab nrug froms2 = cos (radians (angle_candidate)) * nrug_candidate; // Trigonometry condition 2 abs (distancefroms1 + distancefroms2 - distancebetween1and2) <= ntab (max_diference_distance)

Tsuas yog cov neeg sib tw (nrug, lub kaum sab xis, id_node) uas haum rau cov xwm txheej trigonometry 1 thiab 2 tau txheeb xyuas cov khoom pom los ntawm lub chaw nres tsheb sensor 1, 2 thiab 3

Tom qab ntawd cov txiaj ntsig tau xa los ntawm tus tswv chaw nres tsheb mus rau cov txheej txheem kos duab los npaj lawv.

Kauj Ruam 4: Cov Npe Khoom

Image
Image

Cov npe khoom siv xav tau rau ib lub chaw nres tsheb sensor lossis ib qho khoom yog cov hauv qab no:

  • Nano pawg thawj coj saib
  • Ultrasonic sensor
  • Micro servo tsav
  • NRF24L01 wireless module
  • NRF24L01 adapter

thiab daim ntawv teev cov khoom siv rau tus tswv chaw nres tsheb yog cov hauv qab no:

  • Nano pawg thawj coj saib
  • NRF24L01 wireless module
  • NRF24L01 adapter

Pom zoo: