Mundarija:
- 1 -qadam: Konstitutsiya
- 2 -qadam: NeoPixel LED ko'z to'pi
- 3 -qadam: Sensor qurilmasi
- 4 -qadam: Arduino kodi
- 5 -qadam: operatsiya
Video: Infraqizil sensor yordamida ko'z harakatini kuzatish: 5 qadam
2024 Muallif: John Day | [email protected]. Oxirgi o'zgartirilgan: 2024-01-30 13:26
Ko'z harakatini sezish va LEDni boshqarish uchun infraqizil sensor ishlatilgan.
Men LED lenta NeoPixel yordamida ko'zoynak yasadim.
1 -qadam: Konstitutsiya
Ko'zni kuzatish uchun ikkita QTR - 1A datchiklaridan foydalanardim. Arduino yordamida sezish va LEDni boshqarish.
komponentlar
- SparkFun Arduino Pro Mini 328 - 5V/16MGts
- Pro Trinket/ItsyBitsy uchun Adafruit LiIon/LiPoly xalta qo'shimchasi.
- LiPo batareyasi
- NeoPixel tasmasi
- QTR-1A aks ettirish sensori
2 -qadam: NeoPixel LED ko'z to'pi
NeoPixel LED tasmasi ishlatiladi. LED - 68 birlik.
LED idishga ikki tomonlama lenta bilan mahkamlanadi va simlanadi.
3 -qadam: Sensor qurilmasi
Ko'zni kuzatish uchun ikkita QTR - 1A datchiklaridan foydalanardim. QTR - 1A plastmassa varaqqa taxminan ko'zning kengligida joylashtiriladi.
Sensor qismi va mikrokontroller qismi ko'zoynakka mos ravishda qisqich bilan mahkamlangan.
4 -qadam: Arduino kodi
Iris bitta sensorga yaqinlashganda, aks ettirilgan yorug'lik kamayadi va sensorning qiymati oshadi. Aksincha, ìrísí uzoqlashganda, aks ettirilgan yorug'lik kuchayadi va foto reflektorning sensori qiymati kamayadi.
LED ko'z olmasi o'quvchisining o'ng va chap harakati bitta sensor qiymatining oshishi va kamayishini sezadi va uni boshqaradi. Yonib -o'chganda, ikkala sensorning qiymati ham kamayadi, shuning uchun agar ikkita sensorning qiymati bir vaqtning o'zida kamayib ketsa, LED ko'z olmasining ko'z qovoqlari pastga tushadi.
Men quyidagi kutubxonadan foydalandim.
- QTR sensorlar:
- Adafruit_NeoPixel:
#qo'shing #qo'shing
#ta'rif NUM_SENSORS 2 // ishlatilgan sensorlar soni#NUM_SAMPLES_PER_SENSOR 10 ni belgilash // o'rtacha#aniqlash EMITTER_PIN QTR_NO_EMITTER_PIN
int iniSensorValL, sensorValL; int iniSensorValR, sensorValR; #define PIN kodi A3 Adafruit_NeoPixel led = Adafruit_NeoPixel (68, PIN, NEO_GRB + NEO_KHZ800); int blackNum = 24; int pupilNum = 12; uint32_t rangi; int yorqinligi = 40; baytli ko'z rangi; int LR = 7; mantiqiy qopqoq = noto'g'ri; int cnt = 0;
// Qora ko'z L&R animatsiyasi qora LED [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, 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, 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, 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 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 68, 68}};
// o'quvchi L&R animatsiyasi o'quvchiga [15] [12] = {{33, 34, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68}, {32, 33, 34, 35, 68, 68, 68, 68, 68, 68, 68, 68}, {12, 31, 32, 33, 34, 35, 36, 55, 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}};
// Ko'zni yumish animatsiyasi ko'z qovog'ida = 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 ((imzosiz belgi ) {0, 1}, NUM_SENSORS, NUM_SAMPLES_PER_SENSOR, EMITTER_PIN); imzosiz int sensorValues [NUM_SENSORS];
bo'sh ko'z yumish (int ko'z qovog'i, int LR) {if (ko'z qovog'i! = 8) {// Pewter for (uint16_t i = 0; i <led.numPixels (); i ++) {led.setPixelColor (i, led. Color (66), 66, 66)); }
// Qora ko'z uchun (uint16_t i = 0; i led.setPixelColor (blackLED [LR] , rang);}
// uchun o'quvchi (uint16_t i = 0; i
led.setPixelColor (o'quvchiLD [LR] , led. Color (0, 0, 66)); }
// ko'z qovog'i (int i = 0; i <ko'z qovog'iNum [ko'z qovog'i]; i ++) {led.setPixelColor (ko'z qovog'iLED , 0); }} else if (ko'z qovog'i == 8) {led.clear (); } led.show ();}
bo'sh o'rnatish () {
Serial.begin (115200); led.begin (); led.setBrightness (yorqinlik); // Initial Brightness 40 led.show (); // Barcha piksellarni "off" color = led. Color (0, 177, 55) holatiga o'tkazing; // o'quvchi rangining kechikishi (100); qtra.read (sensorValues); iniSensorValL = sensorValues [0]; iniSensorValR = sensorValues [1]; miltillash (ko'z qovog'i, LR); }
void loop () {// QTR - 1A sensori qiymati qtra.read (sensorValues); sensorValL = sensorValues [0]; sensorValR = sensorValues [1];
er -xotin rasioL = (er -xotin) sensorValL / iniSensorValL;
er -xotin rasioR = (er -xotin) sensorValR / iniSensorValR;
Serial.print (rasioL);
Serial.print (""); Serial.println (rasioR);
if (rasioL> 0.985 && rasioR <0.985) {// right (int i = LR; i <12; i ++) {blink (0, i); kechikish (40); LR = i; }} else if (rasioL 0.985) {// for (int i = LR; i> 2; i-) {blink (0, i); kechikish (40); LR = i; }} if if (lid == false && rasioL <0.96 && rasioR <0.96) {// Yonib -o'chib yonish (int i = 1; i 0.96 && rasioR> 0.96) {// Yonib -o'chish (int i = 8; i > 0; i-) {miltillash (i, LR); kechikish (40); qopqoq = noto'g'ri; }} boshqa if (lid == false && rasioL> 0.96 && rasioR> 0.96) {// normal // cnt ++; // ko'z qovog'i = 0; if (LR <= 7) {for (int i = LR; i <= 7; i ++) {milt (0, i); kechikish (40); LR = i; }} boshqa {uchun (int i = LR; i> = 7; i-) {miltillash (0, i); kechikish (40); LR = i; }}}
// boshlang'ich qiymatni yangilash, agar (cnt> 10) {iniSensorValL = sensorValL; iniSensorValR = sensorValR; cnt = 0; }}
5 -qadam: operatsiya
Sensor yordamida o'quvchining chap va o'ng harakatini va miltillashini aniqlang va ko'zning diodli LEDini boshqaring.
Tavsiya:
VR uchun bosh harakatini kuzatish tizimi: 8 qadam
VR uchun bosh harakatini kuzatish tizimi: Mening ismim Sam KODO, bu darsda men sizga Arduino IMU sensorlaridan VR uchun bosh kuzatuv tizimini yaratish uchun qanday qadamma -qadam o'rgataman. Bu loyihada sizga kerak bo'ladi: - HDMI LCD displey. : https: //www.amazon.com/Elecrow-Capacitive-interfac … … va
Inson ko'zining harakatini kuzatish: 6 qadam
Inson ko'zining harakatini kuzatish: Ushbu loyiha inson ko'zining harakatini tasvirga olishga qaratilgan bo'lib, uning harakatini ko'z shaklida joylashtirilgan LED chiroqlar majmuasida aks ettiradi. Ushbu turdagi loyihalar robototexnika sohasida, xususan, huma sohasida juda ko'p qo'llanilishi mumkin
Python yordamida Raspberry Pi va AIS328DQTR yordamida tezlashtirishni kuzatish: 6 qadam
Python yordamida Raspberry Pi va AIS328DQTR yordamida tezlashtirishni kuzatish: Menimcha, tezlanish- bu fizikaning ba'zi qonunlariga muvofiq.- Terri Rayli Gepard quvishda tezlikni tez o'zgarishini va tez o'zgarishini qo'llaydi. Eng tez qirg'oqqa chiqadigan jonivor, o'ljani tutish uchun tezligidan foydalanadi.
Python yordamida Raspberry Pi va MMA7455 yordamida tezlashuv turlarini kuzatish: 6 qadam
Python yordamida Raspberry Pi va MMA7455 yordamida tezlashuv turlarini kuzatish: men qoqilmadim, tortish kuchini sinab ko'rdim. Bu hali ham ishlaydi … Tezlashib borayotgan kosmik kemaning tasviri shuni ko'rsatdiki, tortishish vaqtining kengayishi tufayli, sayyoraning eng yuqori nuqtasida joylashgan soat bazadagi tezlikdan ko'ra tezroq bo'ladi. Biroz
Kapasitiv sezish va LED chiqishi orqali Tfcd 3D harakatini kuzatish: 6 qadam (rasmlar bilan)
Tfcd 3D harakatini sig'im sensori va LED chiqishi orqali kuzatish: Ushbu yo'riqnomada qo'lning harakatini 3D maydonda sig'imli sezish printsipi yordamida qanday kuzatilishi tushuntiriladi. Alyuminiy zaryadlangan folga va qo'lingiz orasidagi masofani o'zgartirib, kondansatkichning quvvati o'zgaradi