Cov txheej txheem:
- Kauj Ruam 1: Tsab Cai Lij Choj
- Kauj Ruam 2: NeoPixel LED Qhov Muag Pob
- Kauj Ruam 3: Chav Sensor
- Kauj ruam 4: Arduino Code
- Kauj ruam 5: Kev ua haujlwm
Video: Kev Pom Qhov Muag Pom Kev Siv Infrared Sensor: 5 Kauj Ruam
2024 Tus sau: John Day | [email protected]. Kawg hloov kho: 2024-01-30 09:28
Kuv siv lub ntsuas hluav taws xob txhawm rau nkag siab qhov muag txav thiab tswj LED.
Kuv ua qhov muag nrog daim kab xev LED NeoPixel.
Kauj Ruam 1: Tsab Cai Lij Choj
Kuv siv ob lub ntsuas QTR - 1A rau qhov muag taug qab. Pom nrog Arduino thiab tswj hwm LED.
Cheebtsam
- SparkFun Arduino Pro Mini 328 - 5V/16MHz
- Adafruit LiIon/LiPoly Backpack Ntxiv-Ntxiv rau Pro Trinket/ItsyBitsy
- Roj teeb LiPo
- NeoPixel sawb
- QTR-1A Reflectance Sensor
Kauj Ruam 2: NeoPixel LED Qhov Muag Pob
NeoPixel LED daim kab xev tau siv. LED yog 68 chav nyob.
LED tau tsau rau lub tais nrog daim kab xev ob tog thiab xaim.
Kauj Ruam 3: Chav Sensor
Kuv siv ob lub ntsuas QTR - 1A rau qhov muag taug qab. QTR - 1A tau muab tso rau ntawm daim ntawv yas ntawm qhov deb ntawm qhov dav ntawm lub qhov muag.
Ib feem ntawm lub sensor thiab lub microcontroller ib feem tau tsau rau lub tsom iav nrog daim clip raws.
Kauj ruam 4: Arduino Code
Thaum lub iris nce mus txog ib lub sensor, lub teeb pom kev zoo txo qis thiab lub txiaj ntsig tus nqi nce. Hloov pauv, thaum lub qhov muag txav mus deb, lub teeb pom kev nce ntxiv thiab qhov txiaj ntsig ntawm daim duab tsom iav poob qis.
Txoj cai thiab sab laug txav ntawm cov menyuam kawm ntawv ntawm LED qhov muag pom qhov nce thiab txo ntawm ib tus nqi sensor thiab tswj nws. Thaum ntsais muag, ob qho tib si qhov txiaj ntsig qis dua, yog li yog ob lub ntsuas qhov ntsuas qis ib txhij, daim tawv muag ntawm lub qhov muag LED yuav nqes mus.
Kuv siv lub tsev qiv ntawv hauv qab no.
- QTRsensors:
- Adafruit_NeoPixel:
#ncig #ncig
#define NUM_SENSORS 2 // tus lej ntsuas siv#txhais NUM_SAMPLES_PER_SENSOR 10 // qhov nruab nrab#txhais EMITTER_PIN QTR_NO_EMITTER_PIN
int iniSensorValL, sensorValL; int iniSensorValR, sensorValR; #define PIN A3 Adafruit_NeoPixel coj = Adafruit_NeoPixel (68, PIN, NEO_GRB + NEO_KHZ800); int blackNum = 24; int pupilNum = 12; uint32_t xim; int qhov ci = 40; byte qhov muag xim; int LR = 7; boolean hau = tsis tseeb; int cnt = 0;
// Qhov muag dub L&R cov duab animation blackLED [15] [24] = {{12, 32, 35, 55, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68}, {12, 13, 31, 36, 54, 55, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68}, {11, 13, 14, 30, 37, 53, 54, 56, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68}, {10, 11, 14, 15, 29, 38, 52, 53, 56, 57, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68}, {9, 10, 11, 12, 15, 16, 28, 33, 34, 39, 51, 52, 55, 56, 57, 58, 68, 68, 68, 68, 68, 68, 68, 68, 68}, {0, 8, 9, 10, 11, 12, 13, 16, 17, 27, 32, 35, 40, 50, 51, 54, 55, 56, 57, 58, 59, 67, 68, 68}, {0, 1, 7, 8, 9, 10, 13, 14, 17, 18, 26, 31, 36, 41, 49, 50, 53, 54, 57, 58, 59, 60, 66, 67}, {1, 2, 6, 7, 8, 9, 14, 15, 18, 19, 25, 30, 37, 42, 48, 49, 52, 53, 58, 59, 60, 61, 65, 66}, {2, 3, 5, 6, 7, 8, 15, 16, 19, 20, 24, 29, 38, 43, 47, 48, 51, 52, 59, 60, 61, 62, 64, 65}, {3, 4, 5, 6, 7, 16, 17, 20, 21, 23, 28, 39, 44, 46, 47, 50, 51, 60, 61, 62, 63, 64, 68, 68}, {4, 5, 6, 17, 18, 21, 22, 27, 40, 45, 46, 49, 50, 61, 62, 63, 68, 68, 68, 68, 68, 68, 68, 68}, {4, 5, 18, 19, 26, 41, 48, 49, 62, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68}, {4, 19, 20, 25, 42, 47, 48, 63, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68}, {20, 21, 24, 43, 46, 47, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68}, {21, 23, 44, 46, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68; ib.
// menyuam kawm ntawv L&R animationint pupilLED [15] [12] = {{33, 34, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68}, {32, 33, 34, 35, 68 68, 68, 68, 68, 68, 68, 68, 68}, {12, 31, 32, 33, 34, 35, 36, 55, 68, 68, 68, 68, 68}, {12, 13, 30, 31, 32, 33, 34, 35, 36, 37, 54, 55}, {13, 14, 29, 30, 31, 32, 35, 36, 37, 38, 53, 54}, {14, 15, 28, 29, 30, 31, 36, 37, 38, 39, 52, 53}, {15, 16, 27, 28, 29, 30, 37, 38, 39, 40, 51, 52}, {16, 17 26, 27, 28, 29, 38, 39, 40, 41, 50, 51}, {17, 18, 25, 26, 27, 28, 39, 40, 41, 42, 49, 50}, {18, 19, 24, 25, 26, 27, 40, 41, 42, 43, 48, 49}, {19, 20, 23, 24, 25, 26, 41, 42, 43, 44, 47, 48}, {20, 21, 22, 23, 24, 25, 42, 43, 44, 45, 46, 47}, {21, 22, 23, 24, 43, 44, 45, 46, 68, 68, 68, 68 }, {22, 23, 44, 45, 68, 68, 68, 68, 68, 68, 68, 68}, {22, 45, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68; ib.
// Blink animationint daim tawv muag = 0; int eyelidNum [8] = {0, 4, 8, 16, 24, 34, 44, 56}; int eyelidLED [56] = {64, 65, 66, 67, 58, 59, 60, 61, 56, 57, 62, 63, 49, 50, 51, 52, 47, 48, 53, 54, 38, 39, 40, 41, 46, 55, 36, 37, 42, 43, 26, 27, 28, 29, 35, 44, 24, 25, 30, 31, 15, 16, 17, 18, 34, 45, 23, 32, 13, 14, 19, 20, 6, 7, 8, 9}; QTRSensorsAnalog qtra ((tsis tau kos npe ) {0, 1}, NUM_SENSORS, NUM_SAMPLES_PER_SENSOR, EMITTER_PIN); unsigned int sensorValues [NUM_SENSORS];
tsis muaj qhov muag ntsais (qhov muag muag, int LR) {yog (qhov muag! = 8) {// Pewter rau (uint16_t kuv = 0; i <led.numPixels (); i ++) {led.setPixelColor (i, led. Color (66), 66, 66)); }
// Qhov muag dub rau (uint16_t i = 0; kuv coj.setPixelColor (blackLED [LR] , xim);}
// menyuam kawm ntawv rau (uint16_t i = 0; i
led.setPixelColor (menyuam kawm ntawv LED [LR] , coj. Color (0, 0, 66)); }
// daim tawv muag rau (int i = 0; kuv <eyelidNum [qhov muag]; kuv ++) {led.setPixelColor (qhov muag LED , 0); }} lwm tus yog (qhov muag == 8) {led.clear (); } coj.show ();}
void teeb tsa () {
Serial.begin (115200); coj.begin (); coj.setBrightness (ci ntsa iab); // Pib Brightness 40 coj.show (); // Initialize tag nrho cov pixels rau 'tawm' xim = led. Color (0, 177, 55); // tub ntxhais xim ncua (100); qtra.read (sensorValues); iniSensorValL = sensorValues [0]; iniSensorValR = sensorValues [1]; ntsais muag (tawv muag, LR); }
void loop () {// QTR - 1A sensor tus nqi qtra.read (sensorValues); sensorValL = sensorValues [0]; sensorValR = sensorValues [1];
ob npaug rasioL = (ob npaug) sensorValL / iniSensorValL;
ob npaug rasioR = (ob npaug) sensorValR / iniSensorValR;
Serial.print (rasioL);
Serial.print (""); Serial.println (rasioR);
yog (rasioL> 0.985 && rasioR <0.985) {// txoj cai rau (int i = LR; kuv <12; i ++) {ntsais (0, i); ncua (40); LR = kuv; }} lwm qhov yog (rasioL 0.985) {// sab laug rau (int i = LR; i> 2; i-) {ntsais (0, i); ncua (40); LR = kuv; }} lwm qhov yog (hau == tsis tseeb && rasioL <0.96 && rasioR <0.96) {// Tsaus muag kaw rau (int i = 1; i 0.96 && rasioR> 0.96) {// Blinking qhib rau (int i = 8; i > 0; i-) {blink (kuv, LR); ncua (40); hau = tsis tseeb; }} lwm yog (hau == tsis tseeb && rasioL> 0.96 && rasioR> 0.96) {// ib txwm // cnt ++; // qhov muag = 0; yog (LR <= 7) {rau (int i = LR; kuv <= 7; i ++) {ntsais (0, i); ncua (40); LR = kuv; }} lwm {rau (int kuv = LR; kuv> = 7; kuv-) {ntsais muag (0, kuv); ncua (40); LR = kuv; }}}
// Tus nqi pib dua yog tias (cnt> 10) {iniSensorValL = sensorValL; iniSensorValR = sensorValR; nc = 0; }}
Kauj ruam 5: Kev ua haujlwm
Tshawb xyuas sab laug thiab sab xis txav thiab ntsais ntawm tus menyuam kawm ntawv nrog lub ntsuas, thiab tswj lub qhov muag LED.
Pom zoo:
Tsis Siv Neeg Kab Hlau Rhuav/Qhov Muag Qhov Muag Siv Arduino thiab LDR: 3 Cov Kauj Ruam
Tsis Siv Neeg Kab Hlau Rhuav/Qhov Muag Qhov Muag Qhov Muag Siv Arduino thiab LDR: Hauv qhov kev qhia no peb yuav los qhia yuav ua li cas thiaj ua lub qhov muag tsis pom qhov muag tsis siv Arduino thiab LDR Module. Thaum nruab hnub daim ntaub/Qhov muag dig qhov muag yuav ntog thiab thaum hmo ntuj nws yuav dov tawm
Ntsej Muag Hloov Qhov Muag Qhov Muag - Ua Dab Tsi: 14 Kauj Ruam (nrog Duab)
Lub ntsej muag hloov qhov ntsej muag - Ua Dab Tsi: Koj ua dab tsi thaum koj tsis tuaj yeem txiav txim siab yam koj xav ua rau Xus? Ua txhua yam. Lub npog ntsej muag yog suav nrog daim npog 3D luam tawm dawb, lub paj yeeb raspberry, lub projector me me thiab lub roj teeb. Nws muaj peev xwm kwv yees txhua yam thiab txhua yam
Neeg Hlau Ua Haujlwm Qhov Muag Tsis Pom Qhov Muag: 5 Kauj Ruam
Neeg Hlau Ua Haujlwm Qhov Muag Tsis Pom Qhov Muag: Cov lus qhia no tau tsim los ua kom tiav ntawm txoj haujlwm xav tau ntawm Makecourse ntawm Tsev Kawm Qib Siab South Florida (www.makecourse.com) .Qhov project no yog siv lub qhov muag tsis pom qhov rai uas tuaj yeem tswj tau los ntawm koj lub xov tooj ntawm Bluetooth. Cov s
Siv Sonar, Lidar, thiab Khoos Phis Tawj Lub Zeem Muag ntawm Microcontrollers los Pab Qhov Muag Tsis Pom Kev: 16 Cov Kauj Ruam
Siv Sonar, Lidar, thiab Khoos Phis Tawj Lub Zeem Muag ntawm Microcontrollers los Pab Qhov Muag Tsis Pom Kev: Kuv xav tsim qhov ntse 'pas nrig' uas tuaj yeem pab cov neeg uas muaj qhov muag tsis pom ntau dua li cov kev daws teeb meem tam sim no. Tus pas nrig yuav tuaj yeem ceeb toom rau tus neeg siv khoom ntawm lub hauv ntej lossis ntawm ob sab los ntawm kev ua suab nrov hauv ib puag ncig lub suab hom headphon
Pom Qhov Pom Pom Pom Pom Lub Koob Yees Duab (TfCD): 15 Kauj Ruam (nrog Duab)
Pom Qhov Pom Pom Pom Pom Lub Koob Yees Duab (TfCD): Cov kev pabcuam paub uas tuaj yeem paub txog kev xav, ntsej muag ntawm tib neeg lossis cov khoom yooj yim tam sim no tseem nyob rau theem pib ntawm kev txhim kho, tab sis nrog kev kawm tshuab, thev naus laus zis no tau nce zuj zus. Peb tuaj yeem cia siab tias yuav pom ntau ntxiv ntawm cov khawv koob no hauv