INHOUDSOPGAWE:

Advent Lantern With POV Animation: 7 Stappe
Advent Lantern With POV Animation: 7 Stappe

Video: Advent Lantern With POV Animation: 7 Stappe

Video: Advent Lantern With POV Animation: 7 Stappe
Video: Lantern Rite Promotional Video: Dream Upon a Lantern|Genshin Impact 2024, November
Anonim
Image
Image

Persistence of Vision (POV) -projekte bestaan al geruime tyd, eenvoudige en goedkoop selfdoenstelle is selfs aanlyn beskikbaar. POV is gebaseer op 'n optiese illusie waar ons verligte voorwerpe sien nadat die voorwerp nie meer verlig is nie, al is dit net vir 'n kort rukkie. Tradisionele POV -projekte bevat stilbeelde wat op hierdie beginsel gebaseer is of hoogstens horlosies. Niks verhinder egter om animasies te projekteer met behulp van mikrobeheerders met voldoende kloksnelheid en slim RGB -LED's nie. Hierdie spesifieke animasie is van 'n rendier -gesleepte kersfees vir Advent -versiering, wat op afstand beheer kan word deur enige mobiele toestel met 'n webblaaier. Die lantern word aangedryf deur die Wemos ESP8266 D1 Mini -mikrobeheerder van die Arduino -familie. Krediet vir die geanimeerde 8-bis rendier-rame word toegeskryf aan 'n talentvolle grafiese kunstenaar Richard Fenyo.

Stap 1: Onderdele lys

Stappe van die Vergadering
Stappe van die Vergadering

U benodig 'n omhulsel vir hierdie projek wat swaar genoeg is om die roterende eenheid op sy plek te hou sonder om om te keer. 'N Ou PSU -omhulsel is perfek, maar wees versigtig om die kondensators te laat ontlaai voordat dit gedemonteer word. U benodig ook 'n 5V-12V voedingsadapter om die GS-motor aan te dryf. Elke stroom van 500mA en hoër sal dit werklik doen.

Die vereiste onderdele word hieronder gelys met webwinkelskakels en huidige pryse.

  • 2 stuks 18650 battery, $ 4, 78
  • Batteryhouer vir 2x18650, USD 0, 63
  • Wemos D1 Mini, USD 2, 14
  • Black Straw, USD 0, 10
  • Infrarooi reflektiewe sensor, USD 0, 38
  • 250V Power Rocker -skakelaar, USD 0, 10
  • Skakel Skyfskakelaar, USD 0, 02
  • 6-900 rpm DC-motor, USD 3, 99
  • Adafruit Neopixel WS2812 8-bis, USD 1, 01

Die totale koste is minder as USD 15, - maar u benodig ook handgereedskap, boor, warm gom, saam met soldeertoerusting en vaardighede.

Stap 2: Stappe van die vergadering

Die eenheid kan volledig saamgestel word volgens hierdie stappe.

  1. Die stilstaande basis is gebou met 'n GS -motor en 'n skakelaar.
  2. Neopixels word gesoldeer en aan die strooikas vasgemaak.
  3. Die roterende tuig is gebou met 'n mikrobeheerder, skuifskakelaar, infra -sensor en strooi -as.
  4. Bedrading word aan die verbindings van die elektriese onderdele gesoldeer
  5. Arduino -kode word na die Wemos -mikrobeheerder opgelaai.

Stap 3: 1. Stationêre basis met DC -motor

1. Stationêre basis met DC -motor
1. Stationêre basis met DC -motor
1. Stationêre basis met DC -motor
1. Stationêre basis met DC -motor
1. Stationêre basis met DC -motor
1. Stationêre basis met DC -motor
  1. Boor 'n gat op die omhulsel en maak die GS -motor vas sodat die as na bo wys.
  2. Soldeer die tuimelschakelaar en 'n gewone 5V-12V kragadapter volgens die onderstaande bedradingsdiagram.
  3. Die verwysde gelykstroommotor draai by ongeveer 800 omw / min (rotasies per minute) by 12V, wat ongeveer 10 FPS (rame per sekonde) tot gevolg het in die finale opstelling, afhangende van die werklike windweerstand van die strooikas.
  4. Koppel die kragadapter aan op die uitgang (110 of 220V).
  5. Skakel die tuimelaar aan en kyk of die GS -motor werk.

Vervolgens word die roterende tuig gemonteer en op die DC -as van die basis vasgemaak.

Stap 4: 2. Neopixel -aanhegsel

2. Neopixel Aanhegsel
2. Neopixel Aanhegsel
2. Neopixel Aanhegsel
2. Neopixel Aanhegsel
  1. Sny die punt van die strooi in twee teenoorgestelde kante aan die een kant in ongeveer 1,5 cm, soos op die foto getoon word.
  2. Kant drie langer drade in die strooi. Dit verbind Neopixel -penne met Wemos -poorte op die tuig.
  3. Soldeer die drie drade aan die Neopixel-penne GND, 5V en D-IN.
  4. Warmgom die drade netjies en netjies van Neopixels soldeerpunt tot in die middel van die LED -balk.
  5. Trek die gesnyde vlerke van die strooi uitmekaar en plak dit met presiese simmetrie op die middel van die LED -balk vas (bo -op die drade aan die een kant).
  6. Die drade loop binne -in die strooi tot by die tuig om by die bypassende Wemos -poorte te kom.

Stap 5: 3. Montering van roterende tuig

3. Samestelling van roterende tuig
3. Samestelling van roterende tuig

Die hele tuig moet volledig gemonteer word voordat dit aan die GS -motoras vasgemaak word. Dit is omdat die bevestigingspunt gebalanseer moet word sodat die rotasie perfek gesentreer is sonder om te wankel.

  1. Plak die Wemos D1 Mini -mikrokontroleerder en die skuifskakelaar aan die een kant van die batteryhouer vas soos op die foto.
  2. Plak die infrarefleksiesensor warm aan die ander kant van die batteryhouer.
  3. Plaas die batterye in die houer.
  4. Plaas die ander kant van die strooi bo -op die batterye en maak dit vas. 'N Klein skroefie of 'n rubberring kan dit doen. Maak seker dat dit nie verlore raak as die tuig teen 10 rpm begin draai nie.
  5. Vind die hele swaartepunt van die tuig aan die onderkant. Om dit op die punt van jou vinger te balanseer, sal dit doen.
  6. Maak 'n klein gaatjie op die presiese plek aan die onderkant van die batteryhouer.
  7. Smeer 'n bietjie warm gom aan en maak die motoras in die gat vas. Maak seker dat die warm gom nie in die motorliggaam kom nie. Hou dit konstant totdat die gom droog word.
  8. Sny 'n klein stukkie wit papier en plak dit vas op die stilstaande basis sodat die infrarooi reflektiewe sensor presies naby die papier draai. Dit sal die teken van die rame van die animasie op die presiese plek in elke rotasie veroorsaak. Die prentjie toon hierdie refleksiestuk in die linker onderste hoek van die basis.

Stap 6: 4. Bedrading van elektriese komponente

4. Bedrading van elektriese komponente
4. Bedrading van elektriese komponente

Volg die bedradingsdiagram en soldeer die elektriese komponente in die volgende stappe. Let daarop dat dieselfde poort van die Wemos D1 Mini -mikrobeheerder verskeie kere met verskillende drade gesoldeer sal word. Dit verg 'n bietjie oefening, of verbind hierdie drade in voorbereiding voordat u aan die Wemos -poort soldeer.

  1. Drie drade (GND, 5V en D-IN) word op Wemos-poorte G, 5V en D3 onderskeidelik gesoldeer.
  2. Twee drade van die infrarooi reflektiewe sensor (VCC, GND, OUT) word op Wemos -poorte 5V, G en D2 onderskeidelik gesoldeer.
  3. Die houer van die batteryhouer (swart) word aan Wemos -poort G gesoldeer.
  4. Die positiewe (rooi) draad van die batteryhouer word aan die pen van die skuifskakelaar gesoldeer.
  5. Wemos 5V -poort word aan die ander pen van die skuifskakelaar gesoldeer.

Stap 7: 5. Arduino -kode

5. Arduino -kode
5. Arduino -kode

Hierdie spesifieke kode is vir die 24 -bis weergawe van die POV Lantern, kan op afstand beheer word deur alle mobiele toestelle met webblaaiers en beskik oor visuele effekte soos World Map, Matrix Animation Effect en die Reindeer Sleight -animasie. Pas die aantal pixels, effekparameters of WiFi -afstandskoppelvlak aan volgens u behoeftes in die bronkode.

// 24 bits POV Lantern - 2019 Peter Csurgay

#sluit ESP8266WiFiMulti.h in

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

#definieer DEBUG 1

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

const uint8_t palet [8] [3] = {

{0, 0, 0}, // 0 - Deursigtig {0, 0, 127}, // 1 - Blou {127, 0, 0}, // 2 - Rooi {127, 127, 0}, // 3 - Geel {0, 127, 0}, // 4 - Groen {127, 24, 0}, // 5 - Oranje {127, 0, 127}, // 6 - Magenta {127, 127, 127} // 7 - Wit};

const ongetekende char wêreld [24] [42] PROGMEEM =

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

#definieer INFRATRIGGER_PIN D2

#definieer NEOPIXELS_PIN D3 #definieer NEO_NUMPIXELS 24

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

IPAddress localIPaddress;

IPAddress apIPaddress; WiFiServer -bediener (80); WebSocketsServer webSocket = WebSocketsServer (81); uint8_t doek [24] [65]; uint8_t ko = 0; uint8_t toneel = 0; uint8_t numScenes = 5; String scenes [6] = {"WORLD", "SANTA", "PEPPER", "TEXT", "MATRIX"}; uint8_t draai = 1; uint8_t numGreens = 0; // MATRIX aantal vallende lyne uint8_t setperke [64] [2]; // MATRIX ewekansige pos x en y van vallende lyne

ongeldige opstelling () {

as (DEBUG) {Serial.begin (9600); Serial.println ("Begin …"); } vertraging (3000);

ESP8266WiFiMulti wifiMulti;

wifiMulti.addAP ("wifissid", "pwd"); wifiMulti.addAP ("mobilessid", "pwd"); wifiMulti.addAP ("laptopssid", "pwd"); as (DEBUG) Serial.print ("Stasie verbind met"); terwyl (wifiMulti.run ()! = WL_CONNECTED) {vertraging (1000); as (DEBUG) Serial.print ("."); } as (DEBUG) Serial.println (""); as (DEBUG) Serial.print ("WiFi gekoppel: SSID ="); as (DEBUG) Serial.println (WiFi. SSID ()); localIPaddress = WiFi.localIP (); as (DEBUG) Serial.print ("IP -adres van die plaaslike stasie:"); as (DEBUG) Serial.println (localIPaddress);

bediener.begin ();

as (DEBUG) Serial.println ("Server (80) begin"); webSocket.begin (); webSocket.onEvent (webSocketEvent); as (DEBUG) Serial.println ("WebSocket (81) begin"); uint8_t coli = 0; for (int i = 0; i <24; i ++) {for (int j = 0; j <64; j ++) {canvas [j] = coli ++; coli = coli % 7; } doek [64] = 0; } pinMode (INFRATRIGGER_PIN, INPUT); attachInterrupt (digitalPinToInterrupt (INFRATRIGGER_PIN), verf, RISING); pixels.begin (); pixels.show (); as (DEBUG) {Serial.print ("Neopixel begin, NUMPIXELS:"); Serial.println (pixels.numPixels ()); }}

void webSocketEvent (uint8_t num, WStype_t type, uint8_t * payload, size_t length) {

if (type == WStype_TEXT) {String req = String ((const char *) payload); as (DEBUG) {Serial.print ("81 Vraag:"); Serial.println (req); } processReq (req); }}

String rip2 (String s) {

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

leegte processReq (stringreq) {

as (req.indexOf ("/draai")! = -1) {draai = 1; } anders as (req.indexOf ("/scene")! = -1) {rotate = 0; String sc = rip2 (req); as (isDigit (sc [0])) scene = sc.toInt (); anders {toneel = 0; vir (int i = 0; i

leemte -lus () {

webSocket.loop (); WiFiClient -kliënt = server.available (); as (! kliënt) {opgawe; } String req = client.readStringUntil ('\ r'); as (DEBUG) {Serial.print ("80 Vraag:"); Serial.println (req); } processReq (req);

client.flush ();

String s = "HTTP/1.1 200 OK / r / nContent-Type: text/html; charset = UTF-8 / r / n Access-Control-Allow-Headers: Content-Type / r / n Access-Control-Allow-Origin: *\ r / n Verbinding: sluit / r / n / r / n "; s + = "localIP:" + ipToString (localIPaddress) + ""; s + = "apIP:" + ipToString (apIPaddress) + ""; client.print (s); vertraging (100); client.stop (); }

leë verf () {

for (int i = 0; i <65; i ++) {for (int j = 0; j <24; j ++) {ongetekende char ind = canvas [j] ; pixels.setPixelColor (j, pixels. Color (palet [ind] [0], palet [ind] [1], palet [ind] [2])); } pixels.show (); delayMicroseconds (10); } ko = (ko + 1) % 40; if (draai) {if (co == 0) {scene = (scene+1) % numScenes; as (DEBUG) {Serial.print ("Toneel:"); Serial.println (toneel); }} if (co == 0) loadCanvas (tonele [toneel]); } if (scenes [scene].indexOf ("SANTA")! = -1) {for (int i = 0; i <8; i ++) for (int j = 0; j = co && j

void loadCanvas (string wat) {

clearCanvas (); as (DEBUG) {Serial.print ("loadCanvas:"); Serial.println (wat); } if (what.indexOf ("TEKST")! = -1) {vir (int l = 0; l <3; l ++) vir (int n = 0; n = 12 && j <51) doek [j] = pgm_read_byte_near (peper +j-12); } anders as (what.indexOf ("WORLD")! = -1) {for (int i = 0; i <24; i ++) vir (int j = 0; j = 11 && j <53) canvas [j] = pgm_read_byte_near (wêreld +j-11); }}

leegte clearCanvas () {

as (DEBUG) Serial.println ("clearCanvas"); for (int i = 0; i <24; i ++) vir (int j = 0; j <65; j ++) canvas [j] = 0; }

String ipToString (IPAddress ip) {

String s = ""; vir (int i = 0; i <4; i ++) s+= i? "." + String (ip ): String (ip ); terugkeer s; }

Aanbeveel: