Cov txheej txheem:
- Khoom siv
- Kauj Ruam 1: Tsim Koj Li Circuit Court:
- Kauj ruam 2: Programming Koj Arduino:
- Kauj Ruam 3: Programming Python rau Graph Cov Ntaub Ntawv Los Ntawm Arduino:
- Kauj Ruam 4: Qhov Kev Kawm Kawg los Txheeb Xyuas Qhov Teeb Pom Kev Zoo hauv Chav
- Kauj Ruam 5: Qhov tshwm sim:
Video: Lub Teeb Nyeem Plotting Siv Arduino thiab Python's Arduino Master Library: 5 Kauj Ruam
2024 Tus sau: John Day | [email protected]. Kawg hloov kho: 2024-01-30 09:26
Arduino yog qhov kev lag luam tseem tsis tau muaj txiaj ntsig zoo thiab muaj txiaj ntsig zoo, ua haujlwm hauv Embedded C ua rau cov txheej txheem ntawm kev ua cov haujlwm tsis txaus ntseeg! Arduino_Master module ntawm Python ua rau qhov no yooj yim thiab cia peb ua cov lej, tshem tawm cov txiaj ntsig pov tseg, thiab npaj kab lus kom pom qhov sawv cev ntawm cov ntaub ntawv.
Yog tias koj tsis paub txog tus qauv no tseem tsis tau, nruab nws siv cov lus txib pip nruab Arduino_Master
Tsis txhob txhawj xeeb yog tias koj tsis paub siv tus qauv no, mus saib qhov txuas no => Arduino_Master
Txawm li cas los xij, txoj cai rau txoj haujlwm no ib txwm muaj nyob hauv phau ntawv qhia no.
Khoom siv
Rau qhov haujlwm no, koj yuav xav tau cov hauv qab no:
- Ib Arduino
- Lub Teeb Ntsuas Tus Kws Tiv Thaiv (LDR) thiab
- Nab hab sej 3 ntsia koj lub computer.
Kauj Ruam 1: Tsim Koj Li Circuit Court:
Peb yuav siv tus pin A1 ntawm Arduino kom tau txais cov ntaub ntawv nkag mus. Koj tseem tuaj yeem siv 5V thiab GND pins ntawm Arduino hloov lub Roj Teeb. Ua qhov txuas raws li hauv qab no:
- Txuas ib kawg ntawm LDR mus rau lub davhlau ya nyob twg zoo ntawm 5V roj teeb lossis rau 5V tus pin ntawm Arduino.
- Txuas lwm qhov kawg ntawm LDR ua ke rau tus pin A1 thiab qhov tsis zoo ntawm lub roj teeb lossis GND tus pin ntawm Arduino.
- Siv tus tiv thaiv kom ntseeg tau tias txhua qhov tam sim no tsis ntws mus rau GND uas yuav ua rau koj tsis tau txais lub teeb liab txaus kom nkag siab ntawm A1 davhlau ya nyob twg ntawm Arduino. (Kuv siv tus tiv thaiv ntawm 10k ohms).
Kauj ruam 2: Programming Koj Arduino:
Arduino_Master module siv Serial Monitor ntawm Arduino xa thiab txais cov ntaub ntawv. Qhov zoo ntawm kev siv tus qauv no yog, thaum koj program koj Arduino, koj tuaj yeem hloov pauv qhov kev pab cuam nab nab ib leeg rau cov haujlwm sib txawv txij li kev ua haujlwm hauv nab nab yog piv tau yooj yim!
Txoj Cai:
// LDR_1 qhov sib txawv tau siv los qhia tus pin A1 ntawm Arduino.
int LDR_1 = A1;
// Cov ntaub ntawv tau txais los ntawm A1 yuav raug khaws cia hauv LDR_Value_1.
ntab LDR_Value_1;
Txoj hlua tawm tswv yim;
void teeb tsa ()
{pinMode (LDR_1, INPUT); // LDR_1 tau teeb tsa ua tus pin INPUT. Serial.begin (9600); // Kev sib txuas lus baudrate tau teeb tsa ntawm 9600.}
void lub voj ()
{yog (Serial.available ()> 0) // yog tias muaj cov tswv yim muaj nyob hauv cov ntawv saib tom qab ntawd ua mus ntxiv. {input = Serial.readString (); // Nyeem cov tswv yim ua ib txoj hlua. yog (input == "DATA") {LDR_Value_1 = analogRead (LDR_1) * (5.0 / 1023.0); // (5 /1023) yog qhov hloov pauv kom tau txais tus nqi hauv Volts. Serial.println (LDR_Value_1); // Yog tias cov tswv yim sib npaug rau "DATA", tom qab ntawv nyeem cov ntaub ntawv los ntawm LDR_1 thiab luam tawm ntawm Serial Monitor. } lwm int i = 0; // yog cov tswv yim tsis sib npaug rau "DATA", tsis ua dab tsi! }
}
Kauj Ruam 3: Programming Python rau Graph Cov Ntaub Ntawv Los Ntawm Arduino:
Txhua tus thiab txhua LDR yuav muaj nws tus kheej qhov tseem ceeb tiv thaiv thiab peb yuav tsum nco ntsoov tias tsis muaj cov khoom siv hluav taws xob tau zoo ib yam nkaus hauv kev ua haujlwm. Yog li ua ntej peb yuav tsum nrhiav qhov hluav taws xob ntawm qhov sib txawv ntawm lub teeb.
Rub cov program hauv qab no rau koj li nab nab IDE thiab khiav nws:
Ua qhov no rau qhov sib txawv ntawm lub teeb thiab siv cov duab kos cov lus xaus piv txwv yog tias kev siv tsawg dua 1, chav tsaus ntuj heev. Rau kev siv nruab nrab ntawm 1 thiab 2, chav nyob tsaus ntuj heev. Rau kev siv ntau dua 2, lub teeb tau qhib rau.
# Ntshuam Arduino_Master module
los ntawm Arduino_Master ntshuam *
# khaws cov ntaub ntawv
data = filter (ardata (8, nyem = Tsis yog, dynamic = True, msg = "DATA", kab = 30), xav tau_type = 'num', txwv = [0, 5])
# txwv tau teev rau 5 vim peb tab tom siv roj teeb 5V.
# Plotting qhov tseem ceeb
Teeb duab (cov ntaub ntawv, stl = 'dark_background', daim ntawv lo = 'Teeb pom kev zoo')
Kauj Ruam 4: Qhov Kev Kawm Kawg los Txheeb Xyuas Qhov Teeb Pom Kev Zoo hauv Chav
Tom qab los txog qhov xaus los ntawm cov ntaub ntawv koj tau txais, rub cov program hauv qab no thiab xyuas kom hloov pauv qhov txwv raws li koj qhov xaus.
# Ntshuam Arduino_Master module
los ntawm Arduino_Master ntshuam # khaws cov ntaub ntawv cov ntaub ntawv = lim (ardata (8, nyem = Tsis tseeb, hloov pauv = Muaj tseeb, msg = "DATA", kab = 50), xav tau_type = 'num', txwv = [0, 5]) # cais cov ntaub ntawv raws li qhov xaus cov ntaub ntawv = rau kuv hauv kab (len (cov ntaub ntawv)): siv = cov ntaub ntawv yog siv 1 thiab siv = 2: info.append ('Teeb ON') # Plotting Graph. compGraph (cov ntaub ntawv, cov ntaub ntawv, stl = 'dark_background', label1 = 'Teeb pom kev zoo', label2 = 'Xeev')
Kauj Ruam 5: Qhov tshwm sim:
Txoj haujlwm yuav siv sijhawm li ib lossis ob feeb los ua haujlwm txij li koj tau nyeem 50 qhov txiaj ntsig tam sim los ntawm Arduino.
Yog tias koj xav ua kom nrawm dua cov txheej txheem sim hloov cov kab kev ntsuas ntawm cov haujlwm ardata. Tab sis nco ntsoov tias qhov tsawg dua qhov kev soj ntsuam, qhov tsawg dua yuav yog qhov zoo ntawm cov ntaub ntawv.
Nco tseg: Yog tias daim duab ua tiav hauv daim duab saum toj no tsis pom, xa cov duab saum toj no Tshooj Lus Taw Qhia.
Pom zoo:
Cheeb Tsam Impedance Siv Cov Lej Nyeem Nyeem Nyeem Ntawv: 6 Kauj Ruam
Cheeb Tsam Impedance Siv Cov Zauv Ua Ntej: Nov yog daim ntawv thov siv ntawm cov lej ua lej sib luag.Qhov no yog qhov tseeb cov txheej txheem muaj txiaj ntsig zoo uas koj tuaj yeem siv los qhia tus yam ntxwv, lossis txawm tias lub kav hlau txais xov, ntawm qhov ua ntej ua ntej yog tias koj tau tinkering nrog hluav taws xob koj tej zaum yog fam
Nyeem thiab Teeb Duab Lub Teeb thiab Kub Sensor Cov Ntaub Ntawv Nrog Raspberry Pi: 5 Cov Kauj Ruam
Nyeem thiab Teeb Duab Lub Teeb thiab Kub Sensor Cov Ntaub Ntawv Nrog Raspberry Pi: Hauv Cov Lus Qhia no koj yuav kawm paub yuav nyeem lub teeb thiab ntsuas kub li cas nrog raspberry pi thiab ADS1115 analog rau cov hloov pauv thiab teeb nws siv matplotlib. Cia pib nrog cov ntaub ntawv xav tau
Kev Siv Lub Teeb Nyeem Kom Siv BH1715 thiab Particle Photon: 5 Kauj Ruam
Kev Siv Lub Teeb Nyeem Kom Paub Siv BH1715 thiab Particle Photon: Nag hmo peb tau ua haujlwm ntawm LCD cov lus, thiab thaum ua haujlwm dhau ntawm lawv peb tau pom qhov tseem ceeb ntawm kev suav lub teeb. Kev siv lub teeb tsis yog tsuas yog qhov tseem ceeb hauv lub cev ntawm lub ntiaj teb no tab sis nws muaj nws lub luag haujlwm hais tau zoo hauv biologi
Lub Teeb Siv Lub Teeb Tsis Siv Lub Tshuab.: 7 Kauj Ruam (nrog Duab)
Lub Teeb Siv Lub Tshuab Ntsuas Tsis Siv Lub Tshuab.: Cov lus qhia no yog hais txog kev siv lub ntsuas qhov ntsuas qhov yooj yim yam tsis siv Arduino lossis lwm yam khoom siv tswj hwm lossis lub cajmeem. Lub ntsuas ntsuas lub teeb qhia pom sib txawv ntawm lub teeb siv nrog xim sib txawv ntawm LED's. LED liab
Lub Teeb Siv Lub Zog Txuag Siv Lub Tshuab Luam Ntawv thiab Thermistors: 6 Cov Kauj Ruam
Kev Siv Lub Zog Siv Lub Zog Txuag Siv Photocells thiab Thermistors: Cov lus qhia no yog tsim los qhia koj li cas kom txuag hluav taws xob los ntawm kev hloov lub teeb siv lub photocells thiab thermistors. Peb yuav qhia koj yuav ua li cas tsim cov Circuit Court thiab code Arduino siv MATLAB