Cov txheej txheem:
- Kauj ruam 1: Kev tshuaj xyuas
- Kauj Ruam 2: Vim Li Cas AnalogRead () Rov Qab Tus Nqi Ntawm 0 thiab 1023?
- Kauj Ruam 3: Yog li AREF yog dab tsi?
- Kauj Ruam 4: Sab Nraud AREF
- Kauj Ruam 5: Internal AREF
Video: Arduino AREF Pin: 6 Kauj Ruam
2024 Tus sau: John Day | [email protected]. Kawg hloov kho: 2024-01-30 09:26
Hauv qhov kev qhia no peb yuav saib yuav ua li cas koj tuaj yeem ntsuas qhov ntsuas hluav taws xob me me nrog qhov raug ntau dua los siv cov lus qhia sib piv ntawm koj li Arduino lossis pawg thawj coj saib ua ke nrog AREF tus pin. Txawm li cas los thawj zaug peb yuav ua qee qhov kev tshuaj xyuas kom ua rau koj nrawm dua. Thov nyeem cov ntawv no ua ntej ua haujlwm nrog AREF thawj zaug.
Kauj ruam 1: Kev tshuaj xyuas
Koj yuav nco qab tias koj tuaj yeem siv Arduino analogRead () ua haujlwm los ntsuas qhov hluav taws xob ntawm qhov hluav taws xob tam sim no los ntawm cov ntsuas hluav taws xob thiab ntxiv rau siv ib qho ntawm cov lej sib piv. Tus nqi xa rov qab los ntawm analogRead () yuav nyob nruab nrab ntawm xoom 1023, nrog xoom sawv cev rau xoom volts thiab 1023 sawv cev rau kev ua haujlwm hluav taws xob ntawm Arduino board siv.
Thiab thaum peb hais qhov ua haujlwm hluav taws xob - qhov no yog qhov muaj hluav taws xob muaj rau Arduino tom qab lub hwj chim muab hluav taws xob. Piv txwv li, yog tias koj muaj Arduino Uno board zoo ib yam thiab khiav nws los ntawm lub qhov (socket) USB - paub meej, muaj 5V muaj rau ntawm lub rooj tsavxwm los ntawm lub qhov (socket) USB ntawm koj lub khoos phis tawj lossis lub hub - tab sis qhov hluav taws xob tau txo me ntsis raws li cua tam sim no nyob ib puag ncig Circuit Court mus rau microcontroller - lossis USB qhov chaw tsuas yog tsis yog khawb.
Qhov no tuaj yeem pom tau yooj yim los ntawm kev txuas Arduino Uno rau USB thiab tso cov ntsuas ntsuas ntsuas ntsuas qhov hluav taws xob hla 5V thiab GND pins. Qee cov laug cam yuav rov qab qis li 4.8 V, qee qhov siab dua tab sis tseem qis dua 5V. Yog li yog tias koj tab tom tua phom kom raug, siv koj lub rooj tsavxwm los ntawm lub zog hluav taws xob sab nraud los ntawm DC lub qhov (socket) lossis Vin pin - xws li 9V DC. Tom qab ntawd dhau los ntawm kev tswj hwm lub zog hluav taws xob koj yuav muaj 5V zoo, piv txwv li daim duab.
Qhov no yog qhov tseem ceeb raws li qhov tseeb ntawm ib qho analogRead () qhov txiaj ntsig yuav raug cuam tshuam los ntawm qhov tsis muaj qhov tseeb 5 V. Yog tias koj tsis muaj kev xaiv, koj tuaj yeem siv qee qhov lej hauv koj daim duab los txhawm rau them rau qhov poob qis. Piv txwv, yog tias koj qhov hluav taws xob yog 4.8V - analogRead () ntau ntawm 0 ~ 1023 yuav cuam tshuam nrog 0 ~ 4.8V thiab tsis yog 0 ~ 5V. Qhov no yuav tsis tseem ceeb, txawm li cas los xij yog tias koj tab tom siv lub ntsuas hluav taws xob rov qab tus nqi raws li qhov hluav taws xob (piv txwv li TMP36 qhov ntsuas kub) - suav tus nqi yuav tsis raug. Yog li hauv kev txaus siab ntawm qhov raug, siv lub zog hluav taws xob sab nraud.
Kauj Ruam 2: Vim Li Cas AnalogRead () Rov Qab Tus Nqi Ntawm 0 thiab 1023?
Qhov no yog vim qhov kev daws teeb meem ntawm ADC. Kev daws teeb meem (rau kab lus no) yog qib uas qee yam tuaj yeem sawv cev ua lej. Qhov kev daws teeb meem siab dua, qhov tseeb ntau dua uas qee yam tuaj yeem sawv cev. Peb ntsuas kev daws teeb meem raws li tus lej ntawm cov khoom daws teeb meem.
Piv txwv li, kev daws teeb meem 1-ntsis tsuas yog tso cai ob (ob rau lub zog ntawm ib qho) qhov tseem ceeb-xoom thiab ib qho. Kev daws teeb meem 2-ntsis yuav tso cai plaub (ob rau lub zog ntawm ob) qhov tseem ceeb-xoom, ib, ob thiab peb. Yog tias peb tau sim ntsuas tsib volt ntau nrog ob qhov kev daws teeb meem, thiab ntsuas qhov ntsuas hluav taws xob yog plaub volts, peb ADC yuav rov qab tus lej lej ntawm 3-raws li plaub volts poob ntawm 3.75 thiab 5V. Nws yog qhov yooj yim dua los xav txog qhov no nrog daim duab.
Yog li nrog peb qhov piv txwv ADC nrog 2-ntsis kev daws teeb meem, nws tsuas tuaj yeem sawv cev rau qhov hluav taws xob nrog plaub qhov ua tau txiaj ntsig txiaj ntsig. Yog tias qhov ntsuas hluav taws xob poob nruab nrab ntawm 0 thiab 1.25, ADC rov ua lej 0; yog qhov hluav taws xob poob nruab nrab ntawm 1.25 thiab 2.5, ADC rov qab tus lej lej ntawm 1. Thiab ntxiv rau. Nrog peb Arduino's ADC ntau ntawm 0 ~ 1023-peb muaj 1024 qhov tseem ceeb-lossis 2 rau lub zog ntawm 10. Yog li peb Arduinos muaj ADC nrog 10-ntsis kev daws teeb meem.
Kauj Ruam 3: Yog li AREF yog dab tsi?
Txhawm rau txiav cov dab neeg luv luv, thaum koj Arduino siv qhov kev nyeem sib piv, nws sib piv qhov ntsuas hluav taws xob ntsuas ntawm tus lej sib piv tau siv tawm tsam qhov paub tias yog qhov ntsuas hluav taws xob siv. Nyob rau hauv ib txwm siv Nyeem ntawv, siv qhov ntsuas hluav taws xob yog qhov ua haujlwm ntawm lub rooj tsavxwm.
Rau cov pawg Arduino nrov dua xws li Uno, Mega, Duemilanove thiab Leonardo/Yún cov laug cam, kev ua haujlwm ntawm 5V. Yog tias koj muaj Arduino Due board, lub zog ua haujlwm yog 3.3V. Yog tias koj muaj lwm yam ntxiv - txheeb xyuas Arduino cov khoom lag luam nplooj ntawv lossis nug koj pawg thawj coj khoom.
Yog li yog tias koj muaj qhov ntsuas hluav taws xob ntawm 5V, txhua lub tsev xa rov qab los ntawm analogRead () muaj nuj nqis ntawm 0.00488 V. (Qhov no suav los ntawm kev faib 1024 rau 5V). Yuav ua li cas yog tias peb xav ntsuas qhov ntsuas hluav taws xob ntawm 0 thiab 2, lossis 0 thiab 4.6? ADC yuav paub li cas yog 100% ntawm peb qhov hluav taws xob ntau?
Thiab nyob ntawm qhov no yog vim li cas rau tus pin AREF. AREF txhais tau tias yog Analogue REFerence. Nws tso cai rau peb pub Arduino siv qhov ntsuas hluav taws xob los ntawm lub zog hluav taws xob sab nraud. Piv txwv li, yog tias peb xav ntsuas qhov ntsuas hluav taws xob nrog qhov siab tshaj ntawm 3.3V, peb yuav pub cov khoom zoo 3.3V rau hauv tus pin AREF - tej zaum los ntawm tus tswj hluav taws xob IC.
Tom qab ntawd txhua kauj ruam ntawm ADC yuav sawv cev ib puag ncig 3.22 millivolts (faib 1024 rau 3.3). Nco ntsoov tias qhov ntsuas hluav taws xob qis tshaj plaws uas koj tuaj yeem muaj yog 1.1V. Muaj ob daim ntawv ntawm AREF - sab hauv thiab sab nraud, yog li cia peb txheeb xyuas lawv.
Kauj Ruam 4: Sab Nraud AREF
AREF sab nraud yog qhov uas koj muab lwm qhov hluav taws xob siv hluav taws xob rau Arduino board. Qhov no tuaj yeem los ntawm kev tswj fais fab mov, lossis yog tias koj xav tau 3.3V koj tuaj yeem tau txais los ntawm Arduino tus pin 3.3V. Yog tias koj siv lub zog hluav taws xob sab nraud, nco ntsoov txuas GND rau Arduino's GND tus pin. Lossis yog tias koj siv Arduno's 3.3V qhov chaw - tsuas yog khiav lub jumper los ntawm 3.3V tus pin rau AREF tus pin.
Txhawm rau qhib sab nrauv AREF, siv cov hauv qab no hauv qhov tsis muaj teeb tsa teeb tsa ():
analogReference (sab nrauv); // siv AREF rau qhov ntsuas hluav taws xob
Qhov no teeb tsa qhov ntsuas hluav taws xob rau txhua yam koj tau txuas nrog AREF tus pin - uas tau kawg yuav muaj qhov hluav taws xob nruab nrab ntawm 1.1V thiab pawg thawj coj saib xyuas kev ua haujlwm. Vim qhov tseem ceeb tshaj - thaum siv qhov ntsuas hluav taws xob sab nraud, koj yuav tsum teeb tsa cov lus sib piv rau sab nrauv ua ntej siv analogRead (). Qhov no yuav tiv thaiv koj los ntawm kev ua kom luv zog sab hauv siv hluav taws xob thiab tus pin AREF, uas tuaj yeem ua rau lub microcontroller puas tsuaj ntawm lub rooj tsavxwm. Yog tias tsim nyog rau koj daim ntawv thov, koj tuaj yeem thim rov qab mus rau pawg thawj coj saib xyuas kev ua haujlwm rau AREF (uas yog - rov zoo li qub) nrog cov hauv qab no
analogReference (DEFAULT);
Tam sim no los qhia txog AREF sab nraud ntawm kev ua haujlwm. Siv 3.3V AREF, cov duab hauv qab no ntsuas qhov hluav taws xob los ntawm A0 thiab qhia txog feem pua ntawm tag nrho AREF thiab suav qhov hluav taws xob:
#suav nrog "LiquidCrystal.h"
LiquidCrystal lcd (8, 9, 4, 5, 6, 7);
int analoginput = 0; // peb tus pin analog
int analogamount = 0; // khw muag khoom tus nqi ntab feem pua = 0; // siv los khaws peb feem pua tus nqi ntab voltage = 0; // siv los khaws cov nqi hluav taws xob
void teeb tsa ()
{lcd.begin (16, 2); analogReference (sab nrauv); // siv AREF rau qhov ntsuas hluav taws xob}
void lub voj ()
{lcd.clear (); analogamount = analogRead (analog nkag); feem pua = (analogamount/1024.00)*100; qhov hluav taws xob = analogamount*3.222; // hauv millivolts lcd.setCursor (0, 0); lcd.print ("% ntawm AREF:"); lcd.print (feem pua, 2); lcd.setCursor (0, 1); lcd.print ("A0 (mV):"); lcd.println (qhov hluav taws xob, 2); ncua (250); }
Cov txiaj ntsig ntawm qhov kos duab saum toj no tau qhia hauv video.
Kauj Ruam 5: Internal AREF
Cov tswj hwm microcontrollers ntawm peb cov laug cam Arduino tseem tuaj yeem tsim qhov ntsuas hluav taws xob sab hauv ntawm 1.1V thiab peb tuaj yeem siv qhov no rau AREF ua haujlwm. Tsuas yog siv kab:
analogReference (sab hauv);
Rau Arduino Mega boards, siv:
analogReference (INTERNAL1V1);
hauv qhov tsis muaj teeb tsa teeb tsa () thiab koj tawm. Yog tias koj muaj Arduino Mega kuj tseem muaj 2.56V qhov ntsuas hluav taws xob muaj uas tau qhib nrog:
analogReference (INTERNAL2V56);
Thaum kawg - ua ntej txiav txim siab qhov txiaj ntsig los ntawm koj tus pin AREF, ib txwm ntsuas qhov nyeem tawm tsam qhov paub zoo multimeter.
Xaus
AREF muaj nuj nqi muab rau koj hloov pauv tau yooj yim dua nrog kev ntsuas cov cim sib piv.
Cov ntawv tshaj tawm no tau coj tuaj rau koj los ntawm pmdway.com - txhua yam rau cov kws tsim khoom thiab cov khoom siv hluav taws xob, nrog kev xa khoom dawb thoob ntiaj teb.
Pom zoo:
ICSP Txuas rau Arduino Nano Tsis Muaj Soldered Pin Header Tab sis Pogo Pin: 7 Kauj Ruam
ICSP Connector rau Arduino Nano Tsis muaj Soldered Pin Header Tab sis Pogo Pin: Ua tus ICSP txuas rau Arduino Nano yam tsis siv tus pin txuas lub taub hau ntawm lub rooj tsav xwm tab sis Pogo Pin.Parts3 × 2 Pin Socket x1 - APitch 2.54mm Dupont Kab Hlau Tus Poj Niam Txuas Txuas Lub Tsev Terminals x6 -BP75-E2 (1.3mm Lub Taub Hau Lub Taub Hau) Lub Caij Nplooj Ntoos Zeeg Kev Tshawb Fawb Pogo Pin
Arduino Tsheb Rov Qab Chaw Nres Tsheb Ceeb Toom - Cov Kauj Ruam ntawm Kauj Ruam: 4 Kauj Ruam
Arduino Tsheb Rov Qab Chaw Nres Tsheb Ceeb Toom | Cov kauj ruam ib kauj ruam: Hauv txoj haujlwm no, kuv yuav tsim qhov yooj yim Arduino Tsheb Rov Qab Tsheb Nres Tsheb Nres Sensor Siv Arduino UNO thiab HC-SR04 Ultrasonic Sensor. Qhov no Arduino raws Lub Tsheb Rov Qab ceeb toom tuaj yeem siv rau Kev Tshawb Fawb Txog Tus Kheej, Robot Ranging thiab lwm yam
Yuav Ua Li Cas Nyeem Ntau Qhov Analog Qhov Tseem Ceeb Siv Ib Tus Pin Pin: 6 Kauj Ruam (nrog Duab)
Yuav Ua Li Cas Nyeem Ntau Qhov Analog Tus Nqi Siv Ib Tus Pin Pin: Hauv qhov kev qhia no, kuv yuav qhia koj yuav ua li cas nyeem ntau yam sib piv qhov txiaj ntsig siv tsuas yog ib tus lej nkag nkag
ISP 6 Tus Pin rau 8 Tus Pin: 4 Kauj Ruam
ISP 6 Tus Pin rau 8 Tus Pin: Qhov laj thawj kuv tau tsim qhov haujlwm no yog txhawm rau program ATTiny45, uas muaj 8 tus pin txuas, thaum kuv USBtinyISP (los ntawm Ladyada) tsuas muaj 10 tus pin thiab 6 tus pin txuas. Tom qab snooping ncig internet txog 3-4 lub lis piam kuv pom tsis muaj dab tsi
Tus Pin Pin: 14 Cov Kauj Ruam (nrog Duab)
Tus Pin Pin: Ua kom tus pin ntse no ua raws cov lus qhia ib qib zuj zus los ntawm peb tus HSBC Tus Tsim Qauv Hauv Chaw Nyob Lao Jianhua.Koj tuaj yeem nyeem txog Lao Jianhua qhov chaw nyob hauv nws qhov Blog: microsites/lao-jianhua/blog/Victoria & Albert M… nyeem ntxiv