Cov txheej txheem:

Tswj lub suab Buzzer Nrog Arduino: 7 Kauj Ruam
Tswj lub suab Buzzer Nrog Arduino: 7 Kauj Ruam

Video: Tswj lub suab Buzzer Nrog Arduino: 7 Kauj Ruam

Video: Tswj lub suab Buzzer Nrog Arduino: 7 Kauj Ruam
Video: LITTLE HMONG PRINCESS in TALENT ROUND - Kev Peevxwm Ntawm Me Ntxhais Hmoob Koobtswv 2024, Hlis ntuj nqeg
Anonim
Tswj lub Buzzer Suab Nrog Arduino
Tswj lub Buzzer Suab Nrog Arduino

Muaj ntau txoj haujlwm sib tham uas tuaj yeem ua tiav nrog Arduino, qhov ntau thiab feem ntau siv yog suab thiab teeb pom kev.

Cov khoom siv feem ntau uas tuaj yeem ua suab yog lub suab nrov thiab lub suab nrov. Sib piv ob qhov, lub suab nrov yog qhov yooj yim dua thiab siv tau yooj yim dua, yog li peb tau siv nws hauv qhov kev sim no.

Kauj Ruam 1: Cov Cheeb Tsam Xav Tau

Cov hauv qab no yog cov khoom uas yuav tsum tau npaj:

Arduino UNO maub los*1

Lub suab nrov*1

Lub khob cij*1

Breadboard jumper khi*1

Kauj ruam 2: Txuas lub Circuit Court

Txuas lub Circuit Court
Txuas lub Circuit Court

Txuas cov khoom siv kho mob raws li lub voj voog hauv daim duab.

Kauj Ruam 3: Txoj Haujlwm

Program
Program

Luam cov cai hauv qab no rau hauv Arduino IDE raws li qhia:

#suav nrog "pitches.h"

int suab paj nruag = {

NOTE_C4, NOTE_G3, NOTE_G3, NOTE_A3, NOTE_G3, 0, NOTE_B3, NOTE_C4

};

int noteDurations = {

4, 8, 8, 4, 4, 4, 4, 4

};

void teeb tsa () {

rau (int thisNote = 0; thisNote <8; thisNote ++)

{

int noteDuration = 1000/noteDurations [thisNote];

suab nrov (8, suab paj nruag [thisNote], nco tseg sijhawm);

int pauseBetweenNotes = noteDuration * 1.30;

ncua (pauseBetweenNotes);

noTone (8);

}

}

void lub voj ()

{

}

Kauj ruam 4: Upload

Siv USB cable txuas Arduino UNO tus tswj hwm thiab lub khoos phis tawj, xaiv lub hom phiaj raug (Arduino UNO thiab), chaw nres nkoj, thiab nyem upload.

Kauj Ruam 5: Txheeb Xyuas Txoj Cai

Rov Ntsuam Xyuas Txoj Cai
Rov Ntsuam Xyuas Txoj Cai

suab nrov (): Lub luag haujlwm yog tsim kom muaj lub voj voos xwmfab nrog qhov tshwj xeeb tshwj xeeb (50% lub voj voog ua haujlwm) ntawm tus pin. Lub sijhawm tuaj yeem teeb tsa, txwv tsis pub lub waveform yuav raug tsim kom txog rau thaum tsis ua haujlwm noTone (). Tus pin no tuaj yeem txuas nrog piezoelectric buzzer lossis lwm tus neeg hais lus los ua suab.

cov qauv sau ntawv:

suab (tus pin, zaus)

suab (tus pin, zaus, sijhawm)

tsis:

tus pin: tus pin los tsim lub suab zaus: zaus ntawm lub suab, hauv Hz, ntaus yam tsis tau kos npe rau lub sijhawm: lub sijhawm ntawm lub suab, hauv milliseconds (xaiv tau), ntaus unsigned ntev

Kauj Ruam 6: Tshuaj Kho Mob: Buzzer

Kho vajtse tshuaj xyuas: Buzzer
Kho vajtse tshuaj xyuas: Buzzer

Lub suab nrov ua suab los ntawm kev muab lub zog rau cov khoom siv hluav taws xob. Cov ntaub ntawv Piezoelectric tuaj yeem hloov kho qhov sib txawv nrog qhov sib txawv ntawm qhov sib txawv thiab qhov ntau zaus, yog li ua suab nrov sib txawv.

Lub suab nrov nquag muaj lub hauv paus kev co sab hauv, yog li nws tuaj yeem ua suab ntev li nws tau muab nrog DC lub zog. Qhov sib xws passive buzzer tsis muaj kev sib xyaw ua ke los, Yog li, nws yuav tsum tau hnov hauv lub suab tso tawm Circuit. Peb tuaj yeem paub qhov txawv buzzers nquag los ntawm passive buzzers hauv ob txoj hauv kev:

(1) Txiav txim los ntawm qhov tsos

* Lub rooj sib tham ntawm lub passive buzzer feem ntau yog liab qab.

* Lub rooj sib tham ntawm lub suab nrov nrov feem ntau yog npog nrog yas.

(2) Siv lub ntsuas ntsuas los ntsuas lub suab nrov tsis kam thiab txiav txim

* Qhov tsis kam ntawm passive buzzer feem ntau yog 8 ohm lossis 16 ohm.

* Qhov tsis kam ntawm lub buzzer nquag muaj ntau dua.

Lwm Yam Tshaj Tawm: Xeem Capacitors nrog Buzzer

Kauj Ruam 7: Kev Nyuaj Siab

Kev Nyuaj Siab
Kev Nyuaj Siab

Raws li qhia hauv daim duab, yooj yim txuas lub buzzer yam tsis muaj lwm txoj hlua. Tom qab qhov program tau tso rau Arduino UNO tus tswj hwm, lub suab nrov yuav tso lub suab zoo ib yam li qhov kawg ntawm qhov kev ua si, thiab tom qab ntawd nres kom txog thaum khawm rov pib dua.

Pom zoo: