Cov txheej txheem:

Arduino Piezo Buzzer Piano: 5 Kauj Ruam
Arduino Piezo Buzzer Piano: 5 Kauj Ruam

Video: Arduino Piezo Buzzer Piano: 5 Kauj Ruam

Video: Arduino Piezo Buzzer Piano: 5 Kauj Ruam
Video: Tutorial - Arduino Piano w/8 pushbuttons + passive buzzer. Coding w/mBlock 3 + Extensions. 2024, Kaum ib hlis
Anonim
Arduino Piezo Buzzer Piano
Arduino Piezo Buzzer Piano
Arduino Piezo Buzzer Piano
Arduino Piezo Buzzer Piano

Ntawm no peb yuav ua Arduino piano uas siv piezo buzzer ua tus hais lus. Txoj haujlwm no yooj yim dua thiab tuaj yeem ua haujlwm nrog ntau lossis tsawg sau ntawv, nyob ntawm koj! Peb yuav tsim nws nrog tsuas yog plaub lub khawm/cov yuam sij kom yooj yim. Nov yog txoj haujlwm lom zem thiab yooj yim uas yuav tsum tau siv txuj ci me me, tab sis tuaj yeem ua rau qee yam nyuaj dua lossis loj dua.

Khoom siv:

  • 1x Arduino Uno (lwm pawg Arduino yuav tsum zoo tab sis tsis tau sim)
  • 1x Ib nrab me me lossis loj dua lub rooj noj mov
  • 1x Active piezo buzzer
  • 4x lub sijhawm thawb khawm
  • 11x khob cij board jumper xov hlau (6 dub rau qhov tsis zoo thiab 5 xim rau khawm & buzzer

Kauj ruam 1: Kev thaiv kab

Thaiv
Thaiv
Thaiv
Thaiv
Thaiv
Thaiv

Txhawm rau pib, peb yuav tso 4 khawm nyob ze ib leeg thiab lub piezo buzzer nyob rau lwm sab ntawm lub rooj mov ci, raws li qhia hauv daim duab thawj. Tom ntej no, peb yuav txuas cov xov hlau tsis zoo. Ua ntej, peb yuav txuas txoj kab tsis zoo ntawm lub rooj mov ci rau tus pin tsis zoo sau tias "GND" ntawm Arduino. Tom qab ntawd, peb txuas ib ceg ntawm txhua lub khawm mus rau txoj kev tsis zoo. Piezo buzzer muaj ib txhais ceg luv dua, uas yog qhov tsis zoo. Peb tseem yuav txuas nws mus rau txoj kev tsheb ciav hlau tsis zoo.

Tam sim no nws yog lub sijhawm los txuas rau lwm cov xov hlau. Peb yuav txuas lwm ceg ntawm cov nyees khawm rau tus pin 2-5, raws li qhia hauv daim duab. Thaum kawg, peb yuav txuas qhov zoo ntawm piezo buzzer (ntev dua) rau tus pin 10. Tus lej tus lej tuaj yeem hloov pauv tau yooj yim hauv tus lej tom qab. Thov tshuaj xyuas cov duab kom pom meej dua.

Kauj ruam 2: Programming

Programming
Programming

Cov cai yog yooj yim zoo nkauj thiab piav qhia tus kheej. Nyob rau sab saum toj, peb muab tus lej tus lej rau qhov sib txawv. Tom qab ntawd, peb tshaj tawm txhua tus raws li kev tawm tswv yim lossis tso tawm. Thaum kawg, peb hais tias yuav ua li cas thaum lub khawm raug nias. Cov nyees khawm sau tias but1-but4 txhua qhov sib raug rau qhov ua kom nquag plias thaum lawv raug thawb. But1 yog qhov qis tshaj ntawm 100hz, thaum tab sis 4 muaj qhov siab tshaj plaws ntawm 400hz. Peb siv lub suab () ua haujlwm los ua suab nrov hauv Hertz. Nws tau teeb tsa zoo li no:

suab (buzzerPin, [zaus hauv hertz], [ntev]);

Yog tias koj xav ntxiv cov nyees khawm ntxiv, tom qab ntawd koj yuav tsum tsim qhov hloov pauv tshiab thiab tshiab 'yog' nqe lus rau thaum nws raug nias. Nws yog ib qho yooj yim heev rau theej tawm.

Txawm li cas los xij, Nco ntsoov tias Arduino tuaj yeem ua suab ib zaug xwb. Yog tias koj nias ntau lub nyees khawm ib zaug, lub suab yuav tsis raug vim Arduino hloov pauv sai ntawm qhov sib txawv.

Kauj Ruam 3: Saib Tones ntawm Oscilloscope

Saib Tones ntawm Oscilloscope
Saib Tones ntawm Oscilloscope
Saib Tones ntawm Oscilloscope
Saib Tones ntawm Oscilloscope
Saib Tones ntawm Oscilloscope
Saib Tones ntawm Oscilloscope
Saib Tones ntawm Oscilloscope
Saib Tones ntawm Oscilloscope

Thaum peb txuas lub oscilloscope mus rau txoj kev tsis zoo thiab tus lej xov tooj, peb tau txais ob peb lub voos xwmfab sib txawv. Qhov ntau zaus, nyob ze ua ke cov spikes yog. Thawj daim duab qhia pom ntau zaus hauv peb qhov haujlwm (400hz), thiab daim duab kawg qhov qis tshaj (100hz). Cov xwm txheej tsis tau txais ntxiv thiab sib nrug ntxiv thaum qhov zaus qis dua. Txheeb xyuas cov duab kom pom cov nyhuv.

Los ntawm sab laug mus rau sab xis:

400hz, 300hz, 200hz, thiab 100hz

Kauj Ruam 4: Actuall Piano Keys?

Actuall Piano Keys?
Actuall Piano Keys?

Yog tias koj nkag tau rau lub tshuab luam ntawv 3D, koj yuav xav ua qee tus yuam sij rau koj Arduino piezo buzzer keyboard. Cov no muab cov nyees khawm me me kom zoo dua. Koj tuaj yeem pom lawv ntawm no ntawm prusaprinters.org.

Kauj Ruam 5: Xaus

Xaus
Xaus

Kuv vam tias koj nyiam tsim Arduino piezo buzzer keyboard, thiab kuv kuj txhawb koj kom tweak cov cai. Yog tias koj nyiam txoj haujlwm no, thov tso koj cov lus hauv qab no lossis tawm lus. Ua tsaug!: D

Pom zoo: