Mundarija:

POV animatsiyasi bilan chiqish chirog'i: 7 qadam
POV animatsiyasi bilan chiqish chirog'i: 7 qadam

Video: POV animatsiyasi bilan chiqish chirog'i: 7 qadam

Video: POV animatsiyasi bilan chiqish chirog'i: 7 qadam
Video: Bu videoda siz klaviaturani chiroğini yoqishni òrganishinggiz mumkin. 2024, Noyabr
Anonim
Image
Image

Vizyonning barqarorligi (POV) loyihalari uzoq vaqtdan beri mavjud, oddiy va arzon DIY to'plamlari hatto onlayn xarid qilish uchun ham mavjud. POV optik xayolotga asoslangan bo'lib, biz ob'ekt yoritilmasa ham, qisqa vaqt bo'lsa ham, biz yoritilgan narsalarni ko'ramiz. An'anaviy POV loyihalarida ushbu tamoyilga asoslangan harakatsiz tasvirlar yoki eng ko'p ishlaydigan soatlar mavjud. Biroq, etarli soat tezligi va aqlli RGB svetodiodli mikrokontroller yordamida animatsiyalarni loyihalashtirishga hech narsa to'sqinlik qilmaydi. Bu o'ziga xos animatsiya - bu bug'u Adventni bezatish uchun Rojdestvo chizig'ini tortib olgan, uni veb -brauzerli Wi -Fi -ga ulangan har qanday mobil qurilmadan masofadan turib boshqarish mumkin. Chiroq Arduinolar oilasining Wemos ESP8266 D1 Mini mikrokontrolleridan quvvatlanadi. 8-bitli bug'ularning yupqa ramkalari uchun animatsiya iste'dodli grafik rassom Richard Fenyoga beriladi.

1 -qadam: qismlar ro'yxati

Assambleyaning qadamlari
Assambleyaning qadamlari

Bu loyiha uchun aylanadigan qurilmani ag'darilmasdan joyida ushlab turadigan og'irlikdagi sumka kerak bo'ladi. Eski PSU korpusi juda zo'r, faqat demontaj qilishdan oldin kondansatkichlarning zaryadsizlanishiga e'tibor bering. Bundan tashqari, sizga shahar motorini quvvatlantirish uchun har qanday 5V-12V quvvat manbai adapteri kerak bo'ladi. Haqiqatan ham 500 mA va undan yuqori bo'lgan har qanday amper uni bajaradi.

Kerakli qismlar quyida veb -do'kon havolalari va joriy narxlar bilan ko'rsatilgan.

  • 2 dona 18650 Batareya, 4, 78 dollar
  • Batareya ushlagichi 2x18650, USD 0, 63
  • Wemos D1 Mini, 2, 14 dollar
  • Qora somon, 0, 10 AQSh dollari
  • Infraqizil aks ettirish sensori, USD 0, 38
  • 250V Power Rocker Switch, USD 0, 10
  • Slaydni almashtirish, 0 AQSh dollari, 02
  • 6-900 rpm DC motor, 3, 99 dollar
  • Adafruit Neopixel WS2812 8 bitli, 1 AQSh dollari, 01

Umumiy qiymati 15 dollardan kam, lekin sizga qo'l asboblari, burg'ulash, issiq elim, lehim uskunalari va ko'nikmalari kerak bo'ladi.

2 -qadam: Assambleyaning qadamlari

Ushbu bosqichlarni bajarib, jihozni to'liq yig'ish mumkin.

  1. Statsionar tayanch doimiy dvigatel va kalit bilan qurilgan.
  2. Neopiksellar lehimlangan va somon miliga biriktirilgan.
  3. Aylanadigan dastgoh mikrokontroller, slaydni almashtirish, infraqizil va somon milidan iborat.
  4. Elektr qismlari ulagichlariga simlar lehimlanadi
  5. Arduino kodi Wemos mikrokontrolleriga yuklanadi.

3 -qadam: 1. DC motorli statsionar tayanch

1. DC motorli statsionar tayanch
1. DC motorli statsionar tayanch
1. DC motorli statsionar tayanch
1. DC motorli statsionar tayanch
1. DC motorli statsionar tayanch
1. DC motorli statsionar tayanch
  1. Kosonda teshik oching va milni yuqoriga qaratadigan shahar motorini mahkamlang.
  2. Quyidagi simlar sxemasiga binoan, rok-ruchkani va 5V-12V quvvat manbaini lehimlang.
  3. Belgilangan shahar dvigateli 12 V da taxminan 800 RPM (daqiqada aylanish) atrofida aylanadi, natijada somon milining haqiqiy shamol qarshiligiga qarab yakuniy sozlashda 10 FPS (sekundiga kadr) atrofida bo'ladi.
  4. Quvvat manbai adapterini rozetkaga ulang (110 yoki 220 V).
  5. Rokerni yoqing va shahar motorining ishlashini tekshiring.

Keyinchalik, aylanadigan dastgoh yig'ilib, taglikning doimiy dvigatel miliga o'rnatiladi.

4 -qadam: 2. Neopixel biriktirilishi

2. Neopixel biriktirilishi
2. Neopixel biriktirilishi
2. Neopixel biriktirilishi
2. Neopixel biriktirilishi
  1. Somonning uchini rasmda ko'rsatilgandek qarama -qarshi tomondan bir chetidan taxminan 1,5 sm kesib oling.
  2. Somonga uchta uzunroq ipni dantellang. Ular Neopixel pinlarini qurilmadagi Wemos portlariga ulashadi.
  3. Uch simni GND, 5V va D-IN Neopixel pinlariga lehimlang.
  4. Issiq yopishtiruvchi, Neopixellardan lehimlangan simlarni toza va tartibli, LED chizig'ining o'rtasiga qadar.
  5. Somonning kesilgan qanotlarini bir -biridan ajratib oling va ularni aniq simmetriya bilan LED chiziqning o'rtasiga yopishtiring (simlarning bir tomonida).
  6. Simlar mos keladigan Wemos portlariga etib borish uchun somon ichidan burg'ulash dastgohigacha o'tadi.

5 -qadam: 3. Aylanadigan qurilmani yig'ish

3. Aylanadigan qurilmani yig'ish
3. Aylanadigan qurilmani yig'ish

DC dvigatel miliga mahkamlashdan oldin butun burg'uni to'liq yig'ish kerak. Sababi, mahkamlanadigan joy muvozanatli bo'lishi kerak, shunda aylanish hech qanday tebranmasdan mukammal markazlashtirilgan bo'ladi.

  1. Rasmda ko'rsatilgandek, Wemos D1 Mini mikrokontrolderi va batareya ushlagichining bir tomonidagi slaydni issiq yopishtiruvchi.
  2. Batareya ushlagichining boshqa tomoniga infraqizil sensori issiq yopishtiruvchi.
  3. Batareyalarni ushlagichga joylashtiring.
  4. Somonning ikkinchi uchini batareyalar ustiga qo'ying va mahkamlang. Kichkina vint yoki kauchuk halqa buni amalga oshiradi. Qurilma 10 RPM da aylana boshlagach, uning yo'qolmasligiga ishonch hosil qiling.
  5. Pastki tomonda butun burg'ulash og'irlik markazini toping. Barmoq uchida uni muvozanatlash buni amalga oshiradi.
  6. Batareya ushlagichining pastki qismidagi aniq joyda kichik teshik qiling.
  7. Bir oz issiq elim surting va motor milini shu teshikka mahkamlang. Issiq elim vosita korpusiga tushmasligiga ishonch hosil qiling. Yelim quriguncha uni barqaror holatda saqlang.
  8. Kichik oq qog'ozni kesib oling va uni statsionar tayanchga yopishtiring, shunda infraqizil reflektor sensori aynan shu qog'ozga buriladi. Bu har bir aylanishda aniq joyda animatsiya ramkalarini chizishga olib keladi. Rasmda taglikning chap pastki burchagidagi aks ettirish qismi ko'rsatilgan.

6 -qadam: 4. Elektr komponentlarini ulash

4. Elektr komponentlarini ulash
4. Elektr komponentlarini ulash

Ulanish sxemasidan so'ng, elektr komponentlarini quyidagi bosqichlarda lehimlang. E'tibor bering, Wemos D1 Mini mikrokontrollerining bir xil porti bir necha marta turli xil simlar bilan lehimlanadi. Bu biroz amaliyotni talab qiladi yoki Wemos portiga lehimlashdan oldin bu simlarni tayyorgarlik ishlariga ulang.

  1. Uch sim (GND, 5V va D-IN) mos ravishda W, G, 5V va D3 portlariga lehimli.
  2. Infraqizil reflektorli sensordan (VCC, GND, OUT) ikkita sim mos ravishda 5V, G va D2 portlariga lehimlanadi.
  3. Batareya ushlagichining (qora) simlari Wemos G portiga lehimlangan.
  4. Batareya ushlagichining musbat (qizil) simlari slayd -kalitning eng yaqin piniga lehimlanadi.
  5. Wemos 5V porti slayd kalitining boshqa piniga lehimlangan.

7 -qadam: 5. Arduino kodi

5. Arduino kodi
5. Arduino kodi

Bu maxsus kod POV Lantern -ning 24 bitli versiyasi uchun mo'ljallangan bo'lib, veb -brauzerli har qanday mobil qurilmalar tomonidan masofadan boshqarilishi mumkin va World Map, Matrix Animation Effect va Reindeer Sleight animatsiyasi kabi vizual effektlarga ega. Manba kodidagi ehtiyojlaringizga qarab piksellar sonini, effekt parametrlarini yoki WiFi masofaviy interfeysini sozlang.

// 24 bitli POV chiroq - 2019 Piter Csurgay

#ESP8266WiFiMulti.h ni qo'shing

#WiFiClient.h qo'shish #ESP8266WebServer.h qo'shish #WebSocketsServer.h qo'shish #Adafruit_NeoPixel.h qo'shish

#DEBUGni aniqlang 1

String text [3] = {"INSTRUCTABLES", "ARDUINO", "CONCEST"};

const uint8_t palitrasi [8] [3] = {

{0, 0, 0}, // 0 - Shaffof {0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0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0 }, { 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0 } } };

INFRATRIGGER_PIN D2 ni aniqlang

#NEOPIXELS_PIN D3 ni aniqlang #NEO_NUMPIXELS 24 ni aniqlang

Adafruit_NeoPixel piksellari = Adafruit_NeoPixel (NEO_NUMPIXELS, NEOPIXELS_PIN, NEO_GRB + NEO_KHZ800);

IPAddress localIPaddress;

IPAddress apIPadress; WiFiServer serveri (80); WebSocketsServer webSocket = WebSocketsServer (81); uint8_t kanvas [24] [65]; uint8_t co = 0; uint8_t sahna = 0; uint8_t numScenes = 5; String sahnalari [6] = {"DUNYO", "SANTA", "QAMP", "TEXT", "MATRIX"}; uint8_t aylantirish = 1; uint8_t numGreens = 0; // MATRIX tushayotgan chiziqlar soni uint8_t ko'katlar [64] [2]; // MATRIX tasodifiy pos x va y tushayotgan chiziqlar

bo'sh o'rnatish () {

if (DEBUG) {Serial.begin (9600); Serial.println ("Boshlash …"); } kechikish (3000);

ESP8266WiFiMulti wifiMulti;

wifiMulti.addAP ("wifissid", "pwd"); wifiMulti.addAP ("mobilessid", "pwd"); wifiMulti.addAP ("noutbuklar", "pwd"); if (DEBUG) Serial.print ("Stantsiyani ulash"); while (wifiMulti.run ()! = WL_CONNECTED) {kechiktirish (1000); if (DEBUG) Serial.print ("."); } agar (DEBUG) Serial.println (""); if (DEBUG) Serial.print ("WiFi ulangan: SSID ="); if (DEBUG) Serial.println (WiFi. SSID ()); localIPaddress = WiFi.localIP (); if (DEBUG) Serial.print ("Mahalliy stansiyaning IP -manzili:"); if (DEBUG) Serial.println (localIPaddress);

server.begin ();

if (DEBUG) Serial.println ("Server (80) ishga tushirildi"); webSocket.begin (); webSocket.onEvent (webSocketEvent); if (DEBUG) Serial.println ("WebSocket (81) ishga tushdi"); uint8_t coli = 0; for (int i = 0; i <24; i ++) {for (int j = 0; j <64; j ++) {kanvas [j] = coli ++; coli = coli % 7; } tuval [64] = 0; } pinMode (INFRATRIGGER_PIN, INPUT); attachInterrupt (digitalPinToInterrupt (INFRATRIGGER_PIN), bo'yoq, RISING); piksel.begin (); piksel.show (); if (DEBUG) {Serial.print ("Neopixel boshlandi, NUMPIXELS:"); Serial.println (piksel.numPixels ()); }}

yaroqsiz webSocketEvent (uint8_t num, WStype_t turi, uint8_t * yuk hajmi, size_t uzunligi) {

if (type == WStype_TEXT) {String req = String ((const char *) yuk); if (DEBUG) {Serial.print ("81 Req:"); Serial.println (req); } processReq (talab); }}

String rip2 (String s) {

String res; int i = 0; while (s ! = '/') i ++; i ++; while (s ! = '/') i ++; i ++; while (s ! = '/' && s ! = '' && s ! = '\ r' && s ! = '\ n') res+= s [i ++]; qaytarish; }

void processReq (String req) {

if (req.indexOf ("/aylantirish")! = -1) {aylantirish = 1; } else if (req.indexOf ("/sahna")! = -1) {aylantirish = 0; Satr sc = rip2 (req); if (isDigit (sc [0])) sahna = sc.toInt (); boshqa {sahna = 0; uchun (int i = 0; i

void loop () {

webSocket.loop (); WiFiClient mijozi = server.available (); if (! mijoz) {qaytish; } String req = client.readStringUntil ('\ r'); if (DEBUG) {Serial.print ("80 Req:"); Serial.println (req); } processReq (talab);

mijoz.flush ();

String s = "HTTP/1.1 200 OK" *\ r / nUlanish: yopish / r / n / r / n "; s + = "localIP:" + ipToString (localIPaddress) + ""; s + = "apIP:" + ipToString (apIPaddress) + ""; client.print (lar); kechikish (100); client.stop (); }

bo'sh bo'yoq () {

for (int i = 0; i <65; i ++) {for (int j = 0; j <24; j ++) {unsigned char ind = canvas [j] ; piksel.setPixelColor (j, piksellar. Color (palitrasi [ind] [0], palitrasi [ind] [1], palitrasi [ind] [2])); } piksel.show (); kechikish mikrosaniyalari (10); } ko = (co + 1) % 40; if (aylantirish) {if (co == 0) {sahna = (sahna+1) % numScenes; if (DEBUG) {Serial.print ("Sahna:"); Serial.println (sahna); }} if (co == 0) loadCanvas (sahnalar [sahna]); } if (sahnalar [sahna].indexOf ("SANTA")! = -1) {uchun (int i = 0; i <8; i ++) uchun (int j = 0; j = co && j

void loadCanvas (String what) {

ClearCanvas (); if (DEBUG) {Serial.print ("loadCanvas:"); Serial.println (nima); } if (what.indexOf ("TEXT")! = -1) {for (int l = 0; l <3; l ++) uchun (int n = 0; n = 12 && j <51) tuval [j] = pgm_read_byte_near (qalampir +j-12); } if if (what.indexOf ("WORLD")! = -1) {for (int i = 0; i <24; i ++) for (int j = 0; j = 11 && j <53) kanvas [j] = pgm_read_byte_near (dunyo +j-11); }}

void clearCanvas () {

if (DEBUG) Serial.println ("clearCanvas"); uchun (int i = 0; i <24; i ++) uchun (int j = 0; j <65; j ++) tuval [j] = 0; }

String ipToString (IPAddress ip) {

Satr s = ""; uchun (int i = 0; i <4; i ++) s+= i? "." + String (ip ): satr (ip ); qaytish s; }

Tavsiya: