Cov txheej txheem:

Automated Piano: 5 Kauj Ruam
Automated Piano: 5 Kauj Ruam

Video: Automated Piano: 5 Kauj Ruam

Video: Automated Piano: 5 Kauj Ruam
Video: Lil Nas X - Old Town Road (Official Video) ft. Billy Ray Cyrus 2024, Kaum ib hlis
Anonim
Tsis siv neeg Piano
Tsis siv neeg Piano

Kuv xav ua piano uas tuaj yeem ua si tau yooj yim los ntawm kev mloog kuv lub suab nkauj tam sim ntawd. Yog li kuv muab nws sim nrog arduino uno kuv tau dag ib puag ncig. ntawm lub sijhawm thiab kuv txuas ntxiv nrog uno.

Kauj ruam 1: Txoj kev xav

Tus ntaus piano yog ua los ntawm kev sib piv qhov zaus ntawm tus hu nkauj mus rau lub piano.so peb yuav tsum tau coj mus kuaj qhov zaus ntawm tus hu nkauj thiab rov ua nws hauv lub sijhawm tiag tiag. Kuv siv lub zog faib hluav taws xob tawm ntawm lub trimpot vim tias lub suab yog ac thiab arduino tsis tuaj yeem daws cov teeb meem tsis zoo yog li siv qhov hluav taws xob muab los ntawm qhov faib hluav taws xob raws li siv thiab teeb nws ntawm 2.5v. Cov tswv yim tau muab rau ntawm A0 tus pin ntawm arduino. Kuv tom qab ntawd tau npaj cov arduino los tshuaj xyuas thaum qhov hluav taws xob nyob ntawm qib siv uas kuv ntsuas thiab npe nws pib thiab tom qab ntawd ntsuas lub sijhawm sib nrug ntawm qhov txuas txuas mus txuas ntxiv thiab tom qab ntawd suav qhov zaus. qhov sib txawv tau siv los khaws lub suab nrov tam sim ntawd ntawm lub teeb liab kom tshem tawm lub suab nrov uas muaj qhov siab tshaj 15 adc tus nqi lossis 0.0733 volts. Ib qhov txwv tau muab tso rau hauv qhov ntau zaus kom qhov tseem ceeb tsis cuam tshuam zaj nkauj.

Kauj Ruam 2: Cov Khoom Yuav Tsum Tau

Cov Khoom Yuav Tsum Tau
Cov Khoom Yuav Tsum Tau
Cov Khoom Yuav Tsum Tau
Cov Khoom Yuav Tsum Tau
Cov Khoom Yuav Tsum Tau
Cov Khoom Yuav Tsum Tau

1) Arduino Uno lossis sib npaug

2) Passive piezo hluav taws xob buzzer lossis tus hais lus nrog lub tshuab hluav taws xob Circuit Court

3) Siab tsis kam trimpot (nco ntsoov tias tam sim no ntws los ntawm nws ntawm 5v yuav tsum me me hauv ob peb millamps)

4) jumper xov hlau

5) lub thawv ntawv

6) 3.5mm audio jack lossis mic nrog lub tshuab hluav taws xob Circuit Court (Kuv siv kuv lub xov tooj txawb ua lub tshuab hluav taws xob raws li kuv pom kuv tus kheej tub nkeeg los tsim ib qho)

7) Android Xov Tooj (Ua si suab)

8) arduino cable (Rau qhov program nws)

Kauj Ruam 3: Kev Sib Txuas

Kev sib txuas
Kev sib txuas
Kev sib txuas
Kev sib txuas

1) Mount trimpot ntawm lub rooj mov ci thiab muab nws hauv av thiab +5v los ntawm arduino siv cov xov hluav taws xob.

2) Txuas hauv av ntawm 3.5mm nkaus rau tus pin thib peb ntawm trimpot los ua haujlwm raws li kev faib hluav taws xob teeb tsa thiab channel rau A0 tus pin ntawm arduino.

3) Txuas hauv av ntawm buzzer rau arduino av thiab teeb liab rau tus pin 13 ntawm arduino.

Kauj ruam 4: Arduino Code

Arduino Txoj Cai
Arduino Txoj Cai

Nov yog qhov ua tiav

Kuv tau tawm tswv yim tawm qee nqe lus ntawm cov ntawv luam tawm uas siv rau kev sim

uint64_t curtime = 0, ltime = 0; uint32_t freq = 0; uint16_t pib, val, del = 0; bool kawg, curr; tsis muaj teeb tsa teeb tsa () {// muab koj cov cai teeb tsa ntawm no, kom khiav ib zaug: ncua (1000); /*Serial.begin(115200); ncua (1000); Serial.println ("system pib");*/ initial = analogRead (A0); yog (analogRead (A0)

void loop () {// muab koj tus lej tseem ceeb ntawm no, kom rov ua dua: val = analogRead (A0); yog (val> = pib) curr = 1; lwm curr = 0; del = (int) val- (int) pib; yog (kawg == 0 && curr == 1) {curtime = micros (); freq = 1000000/(2*(sijhawm-sijhawm)); /*Serial.print(freq, DEC); Serial.print ("nqis"); Serial.println (del);*/ yog (freq> 50 && freq15) suab (13, freq, 500); ncua (100); ltime = micros (); kawg = 1; }

Kauj ruam 5: Hwj chim !

Txuas koj lub xov tooj los ua suab paj nruag thiab yog tias koj xav hu nkauj ces koj tuaj yeem siv txhua lub cuab yeej app uas tuaj yeem rub tawm ntawm play store. Ntau yog qhov txuas

play.google.com/store/apps/details?id=com.pradhyu.alltoolseveryutility&hl=en

Tom qab rub tawm, qhib qhov kev xaiv mike thiab hu nkauj!

Nov yog qhov nws ua haujlwm li cas!

Pom zoo: