Isihluzi sokupasa esisezantsi: yonke into ekufuneka uyazi malunga nale setyhula

isekethe yokupasa yokucoca esezantsi

Iikhoyili kunye neeop amps zikuvumela ukuba wenze iisekethe ezinomdla kakhulu, ezinje ngodumo izihluzi zamaza. Ezi zihluzo zinobuninzi bezicelo kumzi mveliso we-elektroniki. Njengokuba kunjalo kwifilitha yokupasa esezantsi, icebo lokucoca ipasile ephezulu, njl. Banomdla ngokukodwa kwizicelo ezithile zesandi, ukukwazi ukucoca imisindo, okanye ngaphezulu okanye izandi ezingathandekiyo ngokwexesha labo. Ke ngoko ziluncedo kakhulu.

Ukuba ufuna ukwazi ngakumbi malunga lokucoca ulwelo low, kunye nezinye izihluzi, kunye nendlela abanokukunceda ngayo kwiiprojekthi zakho ngeArduino okanye nge-DIY, ndiyakukhuthaza ukuba uqhubeke nokufunda ...

Iifilitha zombane

Njengoko igama layo libonisa, icebo lokucoca ulwelo sisiphaluka esenziwe luthotho lweekhoyili kunye nee-capacitors, kunye nezinye izinto zokukhulisa ukusebenza, ukulungiselela ukuvumela kuphela iinxalenye ezithile zedlula rhoqo. Oko kukuthi, kuyo yonke into ebonakalayo ebonakalayo, baya kucoca indawo enye okanye ezingaphezulu ukubathintela ukuba bangadluli.

Ukuba ejemplo Sithetha ngombala ovakalayo ngumntu, ophuma kwi-20 Hz ukuya kwi-20 Khz, ngeefilitha onokuzisusa ezona ziphantsi, okanye ezona ziphezulu, ukuze uvumele kuphela izandi ezingaphantsi okanye ezingaphantsi kwezandi ukuba zidlule. Yinto esetyenziswa ziinkqubo ezininzi zokurekhoda okanye ukuvelisa kwakhona, ezinje ngeemakrofoni, izithethi, njl.

Iindidi

Ngokutsho kwe uhlobo lokucoca ulwelo, okanye, kunoko, kuxhomekeke kubungakanani ababhlokileyo okanye enye abayivumelayo, kukho iintlobo ezahlukeneyo zeesekethe ezi:

  • Icebo lokucoca ulwelo elisezantsi: Babizwa njalo kuba zizicoci ezivumela amaza asezantsi agqithe kwaye acinezele okanye anciphise ukuphumelela kwamaza aphezulu. Ziqukethe iikhoyili enye okanye ezingaphezulu (kuthotho lokuhambisa umbane kunye nomthwalo), kunye nenye okanye ezimbini ii-shunt capacitors ngombane kunye nomthwalo. Khumbula ukuba umthwalo uyaqondwa njengesixhobo esiqhagamshelwe kwisihluzi kwaye esiqokelela imveliso yecebo lokucoca ... Ngaphakathi kwezi zihluzo kukho izinto ezahlukeneyo, ezinjenge-L, T kunye π.
  • Icebo lokucoca ulwelo okupasaIsihluzi sokupasa esiphakamileyo sichasene nokupasa okuphantsi, kule meko, into eza kuyicoca okanye ukunciphisa umda kukudlula kwamaxesha asezantsi, ukuvumela amaza aphakamileyo ukuba apase. Kule nto izinto ze-elektroniki eziyilwayo zityaliwe. Oko kukuthi, apha i-capacitors iya kuba ngothotho ngombane kunye nomthwalo, ngelixa iikhoyili ziya kuvalwa. Kukho ii-subtypes ezifanayo njengoko kunjalo kwiifilitha zokupasa eziphantsi.
  • Ibhanti lokucoca ulwelo: Olu hlobo lwecebo lokucoca ulisebenzisa iibhloko zokuhamba kwinqanaba lokuhamba rhoqo. Oko kukuthi, basebenza njengesihluzi sokupasa esisezantsi kunye nefilitha yokupasa ephezulu, ngokuchaseneyo nokuhamba kwezona zandi zisezantsi kunye nezona ziphezulu ngaxeshanye. Ngamanye amagama, ivumela kuphela amaza aphakathi ukuba agqithe.
  • Icebo lokucoca ulwelo lebhendi: Ngokuchasene nokuchasene neyangaphambili, into eyenzayo kukuba icoca ukupasa kwamaza asembindini kwaye ivumele kuphela ezona ndawo zisezantsi neziphezulu.

Khumbula ukuba Ungenelelo bavumela amaza amaza asezantsi kwaye bachase ukuhamba kwamaza aphezulu. Endaweni yoko, capacitors bavumela ukuhamba kwamaza aphezulu kwaye bayakuchasa ukuhamba kwee-frequencies eziphantsi.

Ndingathanda ukongeza iifilitha kwinqanaba elifanelekileyo abafezekanga, kwaye banokuhlala bedlula kumaza asezantsi okanye aphakamileyo onokuthi ubabambe. Nangona kunjalo, benza umsebenzi wabo kakuhle kwizicelo ezininzi.

Kwaye okokugqibela, ndingathanda ukucacisa enye into, kwaye yile yokuba uvile nge Iifilitha ze-EMA kunye ne-DEMA. Iifayile ze-EMA (i-Exponential Moving A average) ezivumela ukufezekisa olu hlobo lokucoca ngendlela elula kwizixhobo ezifakiwe. Ngokubhekisele kwi-DEMA (uMndilili oPhakathi wokuHamba ngokuBonisa), banempendulo ekhawulezayo kune-EMA, begcina uxinzelelo olufanelekileyo lengxolo ofuna ukuyiphepha.

Into yeAlpha

El into ye-alpha, oya kubona ukuba iyavela kwiikhowudi ze-Arduino IDE kwicandelo elilandelayo, yiparameter ebeka imeko yokuziphatha kwesicoci sokubonisa. Inxulumene nexesha lokusikwa:

  • I-Alpha = 1: ebonelela ngomqondiso kwimveliso engacocwanga.
  • I-Alpha = 0: ixabiso lokucoca ulwelo liya kuhlala li-0.
  • I-Alpha = x: amanye amaxabiso anokufumana olunye utshintsho kwisihluzi se-EMA. Ukuba uyayinciphisa into yeAlfa, uya kusithambisa isignali yokuhamba rhoqo efumaneke ngakumbi, kwaye ixesha lokuphendula kwenkqubo nalo liyonyuswa (kuthatha ixesha elide ukuzinza).

Iifilitha kunye neArduino

I-Arduino I2C ibhasi

Ukusebenzisa ezi zihluzo, usebenzisa ilayibrari yeArduino IDE iya kwenza umsebenzi wakho ube lula. Ungasebenzisa okufanayo.

Kuya kufuneka uyazi ukuba akuyomfuneko ukwenza isekethe isihluzi sokupasa esiphakamileyo okanye isihluzi sokupasa esisezantsi ukuyidibanisa nebhodi yakho yeArduino kwaye usebenze nayo. Nangona ungazama kwaye wenze ezi ntlobo zeefilitha ezilula, unokuvavanya ukuba i-EMA iza kusebenza njani nebhodi yeArduino kunye nekhowudi elula yeArduino IDE. Yiyo kuphela kwento oyifunayo ukubona ukuba kulawula njani ukucoca ezinye iiarhente (kule meko isenzo silingisiwe kwaye ezinye iinombolo / iiflothi zihluzwa ngokulula ndilinganisa into endiza kuyenza Icebo lokucoca ulwelo ngokwenyani).

Nazi iisampulu zekhowudi onokuzisebenzisa ukuziqhelanisa.

Umzekelo wefilitha yedijithali elula kwiArduino yohlobo ukupasa okuphantsi:

float   lowpass_prev_out[LOWPASS_ANALOG_PIN_AMT], 
         lowpass_cur_out[LOWPASS_ANALOG_PIN_AMT];
int        lowpass_input[LOWPASS_ANALOG_PIN_AMT];
 
 
int adcsample_and_lowpass(int pin, int sample_rate, int samples, float alpha, char use_previous) {
  // pin:            Pin analógico de Arduino usado
  // sample_rate:    El ratio adecuado
  // samples:        Samples
  // alpha:          El factor Alpha para el filtro paso bajo
  // use_previous:   Si es true se sigue ajustando hasta el valor más reciente. 
 
  float one_minus_alpha = 1.0-alpha;
  int micro_delay=max(100, (1000000/sample_rate) - 160);  
  if (!use_previous) { 
    lowpass_input[pin] = analogRead(pin);
    lowpass_prev_out[pin]=lowpass_input[pin]; 
  }
  int i;
  for (i=samples;i>0;i--) {
    delayMicroseconds(micro_delay);
    lowpass_input[pin] = analogRead(pin);
    lowpass_cur_out[pin] = alpha*lowpass_input[pin] + one_minus_alpha*lowpass_prev_out[pin];
    lowpass_prev_out[pin]=lowpass_cur_out[pin];
  }
  return lowpass_cur_out[pin];
}
 
int resulting_value;
 
void setup() {
   Serial.begin(9600);
   resulting_value = adcsample_and_lowpass(0, 1000, 300, 0.015, false); 
}
 
void loop() {
   resulting_value = adcsample_and_lowpass(0, 1000, 150, 0.015, true);  
   Serial.println(resulting_value);

Umzekelo wekhowudi yohlobo lweArduino Ukupasa okuphezulu:

int sensorPin = 0;    //pin usado para el ADC
int sensorValue = 0;  //Inicia sensor variable equivalente a EMA Y
float EMA_a = 0.3;    //Inicialización del EMA Alpha
int EMA_S = 0;        //Iniciación del EMA s
int highpass = 0;
 
void setup(){
  Serial.begin(115200);              
  EMA_S = analogRead(sensorPin);     
}
 
void loop(){
  sensorValue = analogRead(sensorPin);              //Lee el valor del sensor ADC
  EMA_S = (EMA_a*sensorValue) + ((1-EMA_a)*EMA_S);  //Ejecuta el filtro EMA
  highpass = sensorValue - EMA_S;                   //Calcula la seña alta
 
  Serial.println(highpass);
   
  delay(20);                                //Espera 20ms
}

Umzekelo wekhowudi yeArduino Ukupasa kwebhendi:

int sensorPin = 0;        //Pin para el ADC
int sensorValue = 0;      //Inicia la variable del sensor, equivale a EMA Y
 
float EMA_a_low = 0.3;    //Inicia EMA Alpha
float EMA_a_high = 0.5;
 
int EMA_S_low = 0;        //Inicia EMA S
int EMA_S_high = 0;
 
int highpass = 0;
int bandpass = 0;
 
void setup(){
  Serial.begin(115200);                   
   
  EMA_S_low = analogRead(sensorPin);      
  EMA_S_high = analogRead(sensorPin);
}
 
void loop(){
  sensorValue = analogRead(sensorPin);    //Lee el valor del sensor ADC
   
  EMA_S_low = (EMA_a_low*sensorValue) + ((1-EMA_a_low)*EMA_S_low);  //Ejecuta EMA
  EMA_S_high = (EMA_a_high*sensorValue) + ((1-EMA_a_high)*EMA_S_high);
   
  highpass = sensorValue - EMA_S_low;     
  bandpass = EMA_S_high - EMA_S_low;     
 
  Serial.print(highpass);
  Serial.print(" ");
  Serial.println(bandpass);
   
  delay(20);                              
}

Umzekelo wekhowudi yeArduino yeqela:

int sensorPin = 0;          //Pin usado para el ADC
int sensorValue = 0;        //Inicio para EMA Y
 
float EMA_a_low = 0.05;     //Inicio de EMA alpha 
float EMA_a_high = 0.4;
 
int EMA_S_low = 0;          //Inicia EMA S
int EMA_S_high = 0;
 
int highpass = 0;
int bandpass = 0;
int bandstop = 0;
 
void setup(){
  Serial.begin(115200);                     
   
  EMA_S_low = analogRead(sensorPin);        
  EMA_S_high = analogRead(sensorPin);
}
 
void loop(){
  sensorValue = analogRead(sensorPin);      //Lee el valor del sensor ADC
   
  EMA_S_low = (EMA_a_low*sensorValue) + ((1-EMA_a_low)*EMA_S_low);          //Ejecuta EMA
  EMA_S_high = (EMA_a_high*sensorValue) + ((1-EMA_a_high)*EMA_S_high);
   
  bandpass = EMA_S_high - EMA_S_low;       
 
  bandstop = sensorValue - bandpass;        
 
  Serial.print(sensorValue);
  Serial.print(" ");
  Serial.print(EMA_S_low);
  Serial.print(" ");
  Serial.println(bandstop);
   
  delay(20);                                
}

Khumbula ukuba i-ADC sisiguquli seArduino Analog Digital. Sebenzisa uluhlu lwe-0-5v, ukwahlulahlula ku-0-1023. Ukuba ixabiso ngu-0v, ixabiso ledijithali elingu-0 lithathiwe, kwaye ukuba ngu-5v, 1023 liyakuthathwa njengexabiso lesiginali, i-1v ingangama-204m, i-2v ibe ngu-408, njl.

Ndikucebisa ukuba uguqule kwaye uzame ezi khowudi. Iziphumo unako Bona ngokuzoba kakhulu enkosi kwi-serial Plotter ye-Arduino IDE ... Khumbula ukuba ukuba unemibuzo malunga neenkqubo zeArduino okanye indlela yokusebenzisa i-IDE, unokuzikhuphelela Ikhosi yasimahla yeHwLibre kwiPDF.


Yiba ngowokuqala ukuphawula

Shiya uluvo lwakho

Idilesi yakho ye email aziyi kupapashwa. ezidingekayo ziphawulwe *

*

*

  1. Uxanduva lwedatha: UMiguel Ángel Gatón
  2. Injongo yedatha: Ulawulo lwe-SPAM, ulawulo lwezimvo.
  3. Umthetho: Imvume yakho
  4. Unxibelelwano lwedatha: Idatha ayizukuhanjiswa kubantu besithathu ngaphandle koxanduva lomthetho.
  5. Ukugcinwa kweenkcukacha
  6. Amalungelo: Ngalo naliphi na ixesha unganciphisa, uphinde uphinde ucime ulwazi lwakho.