Kana iwe uri kuongorora maitiro ekuyera vibrations uchishandisa iyo SW-18020P sensor pamwe neArduino, iwe wauya panzvimbo chaipo. Ne sensor iyi zvemari y kuita zvinhu zvakasiyana-siyana, unogona kuona kufamba kamwe kamwe nenzira iri nyore uye inoshanda. Pano tinotsanangura zvayo kushanda, kereke uye a kodhi muenzaniso izvo zvichakubatsira iwe kuishandisa mumapurojekiti ako.
Iyi mhando ye sensor yakanakira maapplication ekutanga nekuda kwayo kureruka kwekushandiswa y mutengo wakaderedzwa. Muchikamu chino iwe unowana zvese zvaunoda kuziva nezve SW-18020P sensor, kusanganisira zvirongwa zvemagetsi, kereke uye kuitwa kwe a code kuona vibrations.
Chii chinonzi SW-18020P sensor?
Iyo SW-18020P inonzwa vibration yakagadzirirwa kuona zvinokanganisa o kudengenyeka munzvimbo umo a kukurumidza kuita. Iyi sensor yakakwana pakuziva kufamba kamwe kamwe, sezvo inogadzira a digital chiratidzo painoona kudengenyeka, kumira kana kufamba kwakamira.
Rinoshanda sei? Iyo sensor inosanganisira a ingenious mechanical design: simbi yakagadzikana yakakomberedzwa nechitubu. Kana kudengenyeka kukaitika, chitubu chinobata chinhu chakamisikidzwa, kugadzira dunhu rakavharwa rinogona kuverengerwa ne microcontroller kufanana neArduino.
Sensor Advantages
- Mutengo unokwanisika: Unogona kuwana mapakeji e10 sensors pa isingasviki € 1 pamapuratifomu seAliExpress.
- Zviri nyore kuita: Dhizaini yako zvekutanga inoita kuti ive nyore kuwana vanotanga.
Dhiyagiramu yemagetsi uye gungano
Dhiyagiramu yemagetsi yeiyi sensor ndeye zvekutanga. Batanidza iyo VCC pini ye sensor kune iyo 5V yeArduino, iyo GND kune iyo GND pini yeiyo microcontroller, uye yedhijitari inobuda (DO) pini kune yekupinza yedhijitari, senge 8. Iyi dhizaini inobvumira sensor kuita sea chinja iyo inoshandura mamiriro kana yaona vibrations.
Kuisa sensor pane a chingwa, kubatanidza a 220Ω kuramba pakati pe cathode ye LED uye GND. Iyo anode inobatana nepini yedhijitari 13 kubva kuArduino kufambisa chiratidzo zvekuona nemeso kuonekwa.
sampuli yekodhi
Kuita iyo SW-18020P sensor mune yako Arduino chirongwa chiri nyore chaizvo. Apa une a muenzaniso wekutanga kodhi:
int sensorPin = 8;
int ledPin = 13;
void setup() {
pinMode(sensorPin, INPUT);
pinMode(ledPin, OUTPUT);
}
void loop() {
if (digitalRead(sensorPin)) {
digitalWrite(ledPin, HIGH);
delay(1000);
digitalWrite(ledPin, LOW);
delay(1000);
} else {
digitalWrite(ledPin, LOW);
}
}
Kodhi iyi inoita sei? Iyo inoverenga iyo sensor yedhijitari yekupinda uye, kana ikaona vibration, inobatidza LED kwenguva yakati rebei. yechipiri. Chimiro chiri nyore uye inoshanda, yakanakira avo vanotanga mumapurojekiti emhando iyi.
Anoshanda mafomu
Iyo SW-18020P sensor ine akawanda utilities:
- Ziva Hits o kudengenyeka mumichina.
- Monitor mafambiro muzvivakwa zvakaita semabhiriji kana zvivakwa.
- Gadzira maalarm systems reactive to mavibe asina kujairika.
Iyi sensor, pamwe chete negungano rayo rakareruka uye kodhi, inopa nzira inoshanda yekubata mapurojekiti ane chekuita nazvo kudengenyeka kushandisa Arduino. Yake mutengo unodhura y zvinoshanda chiite mudziyo zvakakosha Zvemagetsi hobbyists uye nyanzvi zvakafanana. Tora nguva yekuyedza uye kuongorora mikana inogona kupa mudziyo uyu.