Sisukord:

Advendilatern koos POV -animatsiooniga: 7 sammu
Advendilatern koos POV -animatsiooniga: 7 sammu

Video: Advendilatern koos POV -animatsiooniga: 7 sammu

Video: Advendilatern koos POV -animatsiooniga: 7 sammu
Video: Голубая стрела (1958) фильм 2024, November
Anonim
Image
Image

Visiooni visiooni (POV) projektid on juba mõnda aega olemas, lihtsad ja odavad DIY -komplektid on saadaval isegi veebis ostmiseks. POV põhineb optilisel illusioonil, kus näeme valgustatud objekte pärast seda, kui objekt pole enam valgustatud, isegi kui see on lühike. Traditsioonilistes POV -projektides on sellel põhimõttel põhinevad fotod või maksimaalselt töötavad kellad. Miski ei takista aga animatsioonide projitseerimist piisava kellakiirusega mikrokontrollerite ja nutikate RGB -LED -ide abil. See konkreetne animatsioon kujutab endast põhjapõtrade poolt lohistatud jõulupüha advendikaunistuseks, mida saab kaugjuhtida iga veebibrauseriga WiFi -toega mobiilseadmega. Laterna toiteallikaks on Arduino perekonna mikrokontroller Wemos ESP8266 D1 Mini. Animeeritud 8-bitiste põhjapõtrade kelguraamide eest kuulub andekas graafik Richard Fenyo.

Samm: osade loend

Assamblee sammud
Assamblee sammud

Selle projekti jaoks vajate korpust, mis on piisavalt raske, et hoida pöörlev seade paigal ilma ümberminekuta. Vana toiteplokk on ideaalne, lihtsalt olge ettevaatlik, et kondensaatorid enne demonteerimist tühjaks saaksid. Samuti vajate alalisvoolumootori toiteks mis tahes tüüpi 5V-12V toiteadapterit. Tõepoolest, iga voolutugevus alates 500 mA ja üle selle teeb seda.

Nõutavad osad on loetletud allpool koos veebipoe linkide ja praeguste hindadega.

  • 2tk 18650 aku, 4 USD, 78 USD
  • Akuhoidik 2x18650, USD 0, 63
  • Wemos D1 Mini, 2 USD, 14 USD
  • Must õle, 0 USD, 10 USD
  • Infrapuna peegeldav andur, 0 USD, 38 USD
  • 250 V toitelüliti, 0 USD, 10 USD
  • Lülituslüliti, 0 USD, 02 USD
  • 6–900 p / min alalisvoolumootor, 3 USD, 99 USD
  • Adafruit Neopixel WS2812 8-bitine, USD 1, 01

Kogumaksumus on alla 15 USA dollari, kuid vajate ka käsitööriistu, puurimist, kuumliimi, jootmisseadmeid ja oskusi.

2. samm: kokkupaneku sammud

Seadme saab täielikult kokku panna järgmiselt.

  1. Statsionaarne alus on ehitatud alalisvoolumootori ja lülitiga.
  2. Neopikslid on joodetud ja õlgvõlli külge kinnitatud.
  3. Pöörlev seade on ehitatud mikrokontrolleri, liuglüliti, infraanduri ja õlgvõlliga.
  4. Juhtmed on joodetud elektriliste osade pistikutele
  5. Arduino kood laaditakse üles Wemose mikrokontrollerisse.

3. samm: 1. Alalisvoolumootoriga statsionaarne alus

1. Statsionaarne alus alalisvoolumootoriga
1. Statsionaarne alus alalisvoolumootoriga
1. Statsionaarne alus alalisvoolumootoriga
1. Statsionaarne alus alalisvoolumootoriga
1. Statsionaarne alus alalisvoolumootoriga
1. Statsionaarne alus alalisvoolumootoriga
  1. Puurige korpusele auk ja kinnitage alalisvoolumootor nii, et võll on suunatud üles.
  2. Jootke klahvi toitelüliti ja tavaline 5V-12V toiteadapter, järgides allolevat ühendusskeemi.
  3. Nimetatud alalisvoolumootor pöörleb kiirusel 12 V umbes 800 p / min (pööret minutis), mille tulemuseks on umbes 10 FPS (kaadrit sekundis), sõltuvalt õlgvõlli tegelikust tuuletakistusest.
  4. Ühendage toiteadapter pistikupessa (110 või 220 V).
  5. Lülitage klapp sisse ja kontrollige alalisvoolumootori tööd.

Seejärel pannakse pöörlev platvorm kokku ja kinnitatakse aluse alalisvoolumootori võllile.

4. samm: 2. Neopikseli kinnitamine

2. Neopikseli kinnitus
2. Neopikseli kinnitus
2. Neopikseli kinnitus
2. Neopikseli kinnitus
  1. Lõika kõrre ots kahest vastasküljest ühest otsast umbes 1,5 cm, nagu pildil näidatud.
  2. Pitsi kolm pikemat traati õlgedest üles. Need ühendavad Neopixeli tihvtid seadme Wemose portidega.
  3. Jootke kolm juhet Neopixeli tihvtidele GND, 5V ja D-IN.
  4. Kuumliimige Neopixeli joodetud juhtmed korralikult ja korras LED -riba täpselt keskel.
  5. Tõmmake kõrre lõigatud tiivad laiali ja liimige need kuuma sümmeetriaga kuuma liimiga LED -riba keskele (ühel pool juhtmete peale).
  6. Juhtmed jooksevad õlgede seest üles kuni rigini, et jõuda sobivate Wemose pordideni.

5. samm: 3. Pöörleva seadme kokkupanek

3. Pöörleva seadme kokkupanek
3. Pöörleva seadme kokkupanek

Enne alalisvoolumootori võlli külge kinnitamist tuleb kogu seade täielikult kokku panna. Selle põhjuseks on asjaolu, et kinnituskoht tuleb tasakaalustada, nii et pöörlemine oleks ideaalselt tsentreeritud, ilma igasuguse kõikumiseta.

  1. Kuumalt liimige Wemos D1 Mini mikrokontroller ja liuglüliti akuhoidiku ühele küljele, nagu pildil näidatud.
  2. Kuumalt liimige infrapeegeldusandur patareipesa teisele küljele.
  3. Asetage patareid hoidikusse.
  4. Asetage ja kinnitage kõrre teine ots patareide peale. Väike kruvi või kummist rõngas teeb seda. Veenduge, et see ei läheks kaduma, kui seade hakkab pöörlema kiirusel 10 p / min.
  5. Leidke kogu platvormide raskuskese alumisel küljel. Selle tasakaalustamine sõrmeotsaga teeb seda.
  6. Tehke akuhoidiku põhja täpselt täpne koht.
  7. Kandke kuuma liimi ja kinnitage mootori võll sellesse auku. Veenduge, et kuum liim ei satuks mootori korpusesse. Hoidke seda kindlalt, kuni liim kuivab.
  8. Lõigake väike tükk valget paberit ja kleepige see statsionaarsele alusele, nii et infrapuna peegeldav andur pöörleb täpselt selle paberi lähedal. See käivitab animatsiooni kaadrite joonistamise iga pöörde täpses kohas. Pildil on see peegeldustükk aluse vasakus alumises nurgas.

6. samm: 4. Elektriliste komponentide juhtmestik

4. Elektriliste komponentide juhtmestik
4. Elektriliste komponentide juhtmestik

Juhtimisskeemi järgides jootke elektrilised komponendid järgmistes etappides. Pange tähele, et Wemos D1 Mini mikrokontrolleri sama port joodetakse mitu korda mitme erineva juhtmega. See nõuab teatavat harjutamist või ühendage need juhtmed enne Wemose porti jootmist ettevalmistamisel.

  1. Kolm juhet (GND, 5V ja D-IN) on joodetud vastavalt Wemose portidele G, 5V ja D3.
  2. Kaks infrapuna peegeldava anduri (VCC, GND, OUT) juhet on joodetud vastavalt Wemose portidele 5V, G ja D2.
  3. Akuhoidiku maandusjuhe (must) on joodetud Wemose pordi G külge.
  4. Akuhoidiku positiivne (punane) juhe on joodetud liuglüliti lähima tihvti külge.
  5. Wemos 5V port on joodetud liuglüliti teise tihvti külge.

Samm 7: 5. Arduino kood

5. Arduino kood
5. Arduino kood

See konkreetne kood on mõeldud POV -laternate 24 -bitisele versioonile, seda saab kaugjuhtida mis tahes veebibrauseriga mobiilseadmest ja sellel on visuaalsed efektid, nagu World Map, Matrix Animation Effect ja Reindeer Sleight animatsioon. Pikslite arvu, efektiparameetreid või WiFi kaugliidest saate lähtekoodis vastavalt vajadusele kohandada.

// 24 bitti POV Lantern - 2019 Peter Csurgay

#include ESP8266WiFiMulti.h

#include WiFiClient.h #include ESP8266WebServer.h #include WebSocketsServer.h #include Adafruit_NeoPixel.h

#define DEBUG 1

Stringi tekst [3] = {"JUHISED", "ARDUINO", "KONKURS"};

const uint8_t palett [8] [3] = {

{0, 0, 0}, // 0 - läbipaistev {0, 0, 127}, // 1 - sinine {127, 0, 0}, // 2 - punane {127, 127, 0}, // 3 - kollane {0, 127, 0}, // 4 - roheline {127, 24, 0}, // 5 - oranž {127, 0, 127}, // 6 - magenta {127, 127, 127} // 7 - valge};

const unsigned char world [24] [42] PROGMEM =

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

#define INFRATRIGGER_PIN D2

#define NEOPIXELS_PIN D3 #define NEO_NUMPIXELS 24

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

IPAddress localIPaddress;

IPAddress apIPaddress; WiFi -serveri server (80); WebSocketsServer webSocket = WebSocketsServer (81); uint8_t lõuend [24] [65]; uint8_t co = 0; uint8_t stseen = 0; uint8_t numScenes = 5; Stringistseenid [6] = {"MAAILM", "JÕULUVANA", "PEPPER", "TEKST", "MATRIX"}; uint8_t pöörlema = 1; uint8_t numGreens = 0; // MATRIX langevate joonte arv uint8_t greens [64] [2]; // MATRIX langevate joonte juhuslik pos x ja y

tühine seadistus () {

kui (DEBUG) {Serial.begin (9600); Serial.println ("Alusta …"); } viivitus (3000);

ESP8266WiFiMulti wifiMulti;

wifiMulti.addAP ("wifissid", "pwd"); wifiMulti.addAP ("mobilessid", "pwd"); wifiMulti.addAP ("laptopssid", "pwd"); if (DEBUG) Serial.print ("Jaama ühendamine"); while (wifiMulti.run ()! = WL_CONNECTED) {delay (1000); if (DEBUG) Serial.print ("."); } if (DEBUG) Serial.println (""); if (DEBUG) Serial.print ("WiFi ühendatud: SSID ="); if (DEBUG) Serial.println (WiFi. SSID ()); localIPaddress = WiFi.localIP (); if (DEBUG) Serial.print ("Kohaliku jaama IP -aadress:"); if (DEBUG) Serial.println (localIPaddress);

server.begin ();

if (DEBUG) Serial.println ("Server (80) start"); webSocket.begin (); webSocket.onEvent (webSocketEvent); if (DEBUG) Serial.println ("WebSocket (81) start"); uint8_t coli = 0; jaoks (int i = 0; i <24; i ++) {jaoks (int j = 0; j <64; j ++) {lõuend [j] = coli ++; coli = coli % 7; } lõuend [64] = 0; } pinMode (INFRATRIGGER_PIN, INPUT); attachInterrupt (digitalPinToInterrupt (INFRATRIGGER_PIN), paint, RISING); pixels.begin (); pixels.show (); if (DEBUG) {Serial.print ("Neopixel start, NUMPIXELS:"); Serial.println (pixels.numPixels ()); }}

void webSocketEvent (uint8_t number, WStype_t tüüp, uint8_t * kasulik koormus, size_t pikkus) {

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

String rip2 (stringid) {

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

void processReq (String req) {

if (req.indexOf ("/rotate")! = -1) {rotate = 1; } else if (req.indexOf ("/stseen")! = -1) {rotate = 0; String sc = rip2 (req); if (isDigit (sc [0])) stseen = sc.toInt (); else {stseen = 0; jaoks (int i = 0; i

void loop () {

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

client.flush ();

String s = "HTTP/1.1 200 OK / r / nContent-Type: text/html; charset = UTF-8 / r / nAccess-Control-Allow-Headers: Content-Type / r / nAccess-Control-Allow-Origin: *\ r / nühendus: sule / r / n / r / n "; s + = "localIP:" + ipToString (localIPaddress) + ""; s + = "apIP:" + ipToString (apIPaddress) + ""; klient.print (id); viivitus (100); client.stop (); }

tühi värv () {

jaoks (int i = 0; i <65; i ++) {for (int j = 0; j <24; j ++) {unsigned char ind = canvas [j] ; pixels.setPixelColor (j, pixels. Color (palett [ind] [0], palett [ind] [1], palett [ind] [2])); } pixels.show (); delayMikrosekundid (10); } co = (co + 1) % 40; kui (pööra) {kui (co == 0) {stseen = (stseen+1) % numScenes; if (DEBUG) {Serial.print ("Stseen:"); Serial.println (stseen); }} if (co == 0) loadCanvas (stseenid [stseen]); } kui (stseenid [stseen].indexOf ("JÕULUVANA")! = -1) {jaoks (int i = 0; i <8; i ++) jaoks (int j = 0; j = co && j

void loadCanvas (String mida) {

clearCanvas (); if (DEBUG) {Serial.print ("loadCanvas:"); Serial.println (mida); } kui (mis.indexOf ("TEKST")! = -1) {jaoks (int l = 0; l <3; l ++) (int n = 0; n = 12 && j <51) lõuendile [j] = pgm_read_byte_near (pipar +j-12); } else if (what.indexOf ("WORLD")! = -1) {for (int i = 0; i <24; i ++) for (int j = 0; j = 11 && j <53) lõuend [j] = pgm_read_byte_near (maailm +j-11); }}

void clearCanvas () {

if (DEBUG) Serial.println ("clearCanvas"); (int i = 0; i <24; i ++) jaoks (int j = 0; j <65; j ++) lõuend [j] = 0; }

String ipToString (IPAddress ip) {

String s = ""; jaoks (int i = 0; i <4; i ++) s+= i? "". + String (ip ): string (ip ); tagasitulek s; }

Soovitan: