HC-SR04: duk game da firikwensin ultrasonic

HC-SR04 firikwensin

Wani lokacin ma wajibi ne Auna nisa kuma don haka kuna da na'urori masu auna firikwensin da yawa. Mun riga mun ƙaddamar da labarin don magana akan babban firikwensin nesa na nesa kamar VL52L0X. Wannan firikwensin na nau'ikan ToF ne kuma ya dogara ne akan mizanin ma'auni godiya ga laser dinta. Amma idan daidaito ba shi da mahimmanci a gare ku kuma kuna son wani abu wanda zai ba ku damar auna nisa a farashi mai sauƙi, wataƙila hakan kuna da a hannun ku shine HC-SR04.

A cikin yanayin HC-SR04 firikwensin nesa, nesa ana auna ta duban dan tayi. Tsarin yana kama da hanyar gani ta VL52L0X. Wato, an fitar dashi, akwai billa kuma an karɓa, amma a wannan yanayin maimakon zama laser ko IR, shine duban dan tayi. Idan kuna sha'awar kayan lantarki, robobi ko mai yin mai son, za ku iya amfani da shi don yawancin ayyukan DIY kamar tsarin gano cikas ga mutummutumi, na'urori masu auna sigina, da sauransu.

Menene HC-SR04?

To, a bayyane yake, kamar yadda na riga na yi bayani a cikin sakin layi na baya, HC-SR04 ƙananan firikwensin nesa ne mai nisa bisa tushen duban dan tayi. Tare da shi, yana ba ka damar auna nisan sauƙi da sauri, duk da cewa a ƙa'ida ba kasafai ake yin hakan ba. Mafi sau da yawa, ana amfani dashi azaman transducer don gano matsalolin kuma zai iya guje musu ta wasu hanyoyin da ke haɗe da amsawar firikwensin.

Bayyanar da HC-SR04 ya bambanta sosai kuma yana da sauƙin ganewa. Kari akan haka, sanannen abu ne a cikin kayan farawa na Arduino kuma ya zama dole don yawan ayyukan. Yana da sauƙin ganewa saboda yana da "idanu" guda biyu waɗanda a zahiri sune na'urorin duban dan tayi wanda wannan tsarin ya haɗa. Ofayan su mai ɗaukar hoto ne kuma ɗayan mai karɓar. Yana aiki a madaidaicin 40 Khz, saboda haka ɗan adam ba zai iya ji ba.

Ka'idojin Sensor na Ultrasonic

Ka'idar wacce Ya dogara ne akan kwaikwayon wanda aka yi amfani dashi lokacin da ka jefa dutse a cikin rijiya don auna zurfinsa. Kuna jefa dutsen da lokaci nawa zai ɗauki kafin ya faɗi ƙasa. Sannan kayi lissafin gudu don lokacin da ya wuce kuma zaka samu nisan da dutsen yayi. Amma a wannan yanayin firikwensin kai ne.

Labari mai dangantaka:
ESP8266: tsarin WIFI don Arduino

A cikin HC-SR04, mai ba da wutar zai fitar da sauti na zamani kuma idan suka fado daga abu ko cikas ta hanyar da mai karba zai kama su. Da kewaye zaiyi lissafin da ya dace na cewa amsa kuwwa don sanin nesa. Wannan ma yana iya zama sananne a gare ku idan kun san tsarin da wasu dabbobi kamar dolphins, whales ko jemage suke amfani da shi don gano matsaloli, farauta, da sauransu.

Ta hanyar ƙididdige lokaci tun lokacin da aka aiko bugun jini har sai an karɓi amsa, lokacin kuma sabili da haka za'a iya tantance nisan daidai. Ka tuna cewa [Sarari = lokacin gudu] amma game da HC-SR04, dole ne ka raba wannan adadi ta / 2, tunda an auna lokacin daga lokacin da duban dan tayi ya fito ya yi tafiya ta sararin samaniya har sai ya sami cikas da hanyar dawowa, don haka zai zama kamar rabin wannan ...

Pinout da takaddun bayanai

Kun riga kun san cewa don ganin cikakkun bayanan samfurin da kuka samo, mafi kyawun abu shine nemo bayanan bayanan kankare na masana'anta Misali, ga wata Takardar bayanan Sparkfun, amma akwai wasu da yawa da yawa a cikin PDF. Koyaya, anan akwai mahimman bayanai na fasaha na HC-SR04:

  • Pinout: 4 fil don iko (Vcc), mai kunnawa (Trigger), mai karɓa (Echo) da ƙasa (GND). Mai kunnawa yana nuna lokacin da ya kamata a kunna firikwensin (lokacin da aka ƙaddamar da duban dan tayi), kuma ta haka ne zai yiwu a san lokacin da mai karba ya karɓi siginar.
  • Abincin: 5 V
  • Mitar tayi: 40 Khz, kunnen mutum zai iya ji daga 20Hz zuwa 20Khz kawai. Duk abin da ke ƙasa da 20Hz (infrasound) da sama da 20Khz (duban dan tayi) ba za a iya gane su ba.
  • Amfani (a tsaye): <2mA
  • Amfani da aikiSaukewa: 15MA
  • Tasiri kusurwa: <15º, gwargwadon kusurwar abubuwan da kuke iya samun sakamako mafi kyau ko mafi munin.
  • An auna nisa: daga 2cm zuwa 400cm, kodayake daga 250 cm ƙudurin ba zai yi kyau sosai ba.
  • Matsakaicin matsakaici: Bambancin 0.3 cm tsakanin ainihin nisan da ma'aunin, don haka duk da cewa ba a ɗauke shi da cikakken gaskiya kamar laser, ma'aunin ya zama karɓaɓɓe ga yawancin aikace-aikace.
  • Farashin: daga kimanin € 0,65

Haɗuwa tare da Arduino

HC-SR04 tare da Arduino

para haɗa shi da Arduino ba zai iya zama sauƙi ba. Yakamata kawai ku kasance masu kula da haɗa GND zuwa daidai fitowar Arduino ɗinku wanda aka yiwa alama kamar haka, Vcc tare da wadatar Arduino 5v da sauran maƙallan biyu na HC-SR04 tare da abubuwan shigarwa / abubuwan da aka zaɓa don aikinku. Kuna iya ganin cewa yana da sauƙi a cikin makircin Fritzing na sama ...

Yakamata kawai a kula da kai, cewa damisa dole ne ya karɓi bugun wutan lantarki aƙalla microseconds 10 don ya kunna sosai. A baya dole ne ku tabbatar cewa yana cikin ƙimar LOW.

Amma ga lambar don Arduino IDE, ba lallai bane kuyi amfani da kowane ɗakin karatu ko wani abu makamancin haka tare da sauran abubuwan haɗin. Kawai sanya dabara don lissafin tazara da wani abu kaɗan ... Tabbas, idan kuna son aikin ku yayi wani abu dangane da auna ma'aunin HC-SR04, dole ne ku ƙara lambar da kuke buƙata. Misali, maimakon kawai nuna ma'aunai a kan na'ura mai kwakwalwa, zaka iya sa servomotors su matsa zuwa wani bangare zuwa wani nesa don kaucewa cikas, ko kuma mota ta tsaya, za'a kunna ƙararrawa lokacin da ta gano kusanci, da dai sauransu. .

 Informationarin bayani game da shirye-shirye: Littafin Arduino (Free PDF)

Misali, zaka iya ganin wannan lambar asali don amfani azaman tushe:

//Define las constantes para los pines donde hayas conectado el pin Echo y Trigger
const int EchoPin = 8;
const int TriggerPin = 9;
 
void setup() {
   Serial.begin(9600);
   pinMode(TriggerPin, OUTPUT);
   pinMode(EchoPin, INPUT);
}

//Aquí la muestra de las mediciones
void loop() {
   int cm = ping(TriggerPin, EchoPin);
   Serial.print("Distancia medida: ");
   Serial.println(cm);
   delay(1000);
}

//Cálculo para la distancia
int ping(int TriggerPin, int EchoPin) {
   long duration, distanceCm;
   
   digitalWrite(TriggerPin, LOW);  //para generar un pulso limpio ponemos a LOW 4us
   delayMicroseconds(4);
   digitalWrite(TriggerPin, HIGH);  //generamos Trigger (disparo) de 10us
   delayMicroseconds(10);
   digitalWrite(TriggerPin, LOW);
   
   duration = pulseIn(EchoPin, HIGH);  //medimos el tiempo entre pulsos, en microsegundos
   
   distanceCm = duration * 10 / 292/ 2;   //convertimos a distancia, en cm
   return distanceCm;
}

 


Abubuwan da ke cikin labarin suna bin ka'idodinmu na ka'idojin edita. Don yin rahoton kuskure danna a nan.

Sharhi, bar naka

Bar tsokaci

Your email address ba za a buga. Bukata filayen suna alama da *

*

*

  1. Mai alhakin bayanan: Miguel Ángel Gatón
  2. Dalilin bayanan: Gudanar da SPAM, gudanar da sharhi.
  3. Halacci: Yarda da yarda
  4. Sadarwar bayanan: Ba za a sanar da wasu bayanan ga wasu kamfanoni ba sai ta hanyar wajibcin doka.
  5. Ajiye bayanai: Bayanin yanar gizo wanda Occentus Networks (EU) suka dauki nauyi
  6. Hakkoki: A kowane lokaci zaka iyakance, dawo da share bayanan ka.

  1.   Jose m

    Na sami bayanin yana da amfani sosai kuma mai sauki.