Cov txheej txheem:

Ntse Teeb (TCfD) - Zaj sawv + Suab Nkauj Visualizer: 7 Kauj Ruam (nrog Duab)
Ntse Teeb (TCfD) - Zaj sawv + Suab Nkauj Visualizer: 7 Kauj Ruam (nrog Duab)

Video: Ntse Teeb (TCfD) - Zaj sawv + Suab Nkauj Visualizer: 7 Kauj Ruam (nrog Duab)

Video: Ntse Teeb (TCfD) - Zaj sawv + Suab Nkauj Visualizer: 7 Kauj Ruam (nrog Duab)
Video: Tsev Neeg Muaj Lajlim Txujci-Niamtxiv Txawj Coj Menyuam Txawj Mloog-Vu Classic Band 2024, Hlis ntuj nqeg
Anonim
Image
Image
Daim duab Circuit Court
Daim duab Circuit Court

Txoj haujlwm no ua tiav rau chav Kawm Technology rau Kev Tsim Qauv ntawm TUDelft

Qhov khoom kawg yog ESP-32 lub hauv paus LED teeb thiab txuas nrog tus neeg rau zaub mov. Rau cov qauv, lub teeb muaj ob txoj haujlwm; zaj sawv zaj uas ua rau muaj xim zoo nkauj hloov pauv mus rau nws ib puag ncig thiab lub suab thib ob pom qhov twg LED pixel "seev cev" raws qib suab. Lub kaw lus txuas nrog wifi thiab tus neeg siv tuaj yeem xaiv qhov txiaj ntsig uas lawv xav tau los ntawm lub teeb ntawm WIFI.

Tus nqi pheej yig ESP-32 microchip muab rau peb nrog cov txheej txheem muaj zog, inbuilt hall sensor, ntsuas kub, kov sensor thiab tseem muaj peev xwm wifi thiab bluetooth. Nrog rau qhov no, Whilst tsuas yog ob qhov cuam tshuam raug xaiv rau txoj haujlwm no, Qhov cuam tshuam ntawm lub teeb "ntse" no tsis muaj qhov txwv. Nws yuav siv los qhia huab cua rau tus neeg siv, lossis qhov kub ntawm chav, lub teeb nws tus kheej tuaj yeem ua lub tswb tswb lossis nws tuaj yeem muab lub hnub ci ci ci ci nyob ib sab ntawm koj lub txaj ua piv txwv txog hnub tuaj rau qhov kev paub zoo.

Kauj Ruam 1: Cov Khoom Xav Tau

Arduino esp32

Suab sensor

Plaub txoj kev Bi-Directional Logic Level converter

Neopixel coj 2m 60 coj/m

Jumper xov hlau

Micro USB cable nrog adapter

Kev sib txuas hauv Is Taws Nem

Kauj Ruam 2: Daim duab Circuit Court

Ib daim duab qhia chaw tau kos thiab Circuit tau ua raws li tau hais hauv

daim duab hauv qab no.

Kauj Ruam 3: Arduino Code

Ntawm no, ua ntej pom qhov chaws tau ua. Tom qab ntawd, ob qho piv txwv code

; "Neoplxel RGBW starndtest"; thiab "yooj yimWebServerWifi" tau hloov kho thiab sib koom ua ke hauv cov lej pom kev. Txawm hais tias txoj cai tseem muaj kab laum nyob rau qee lub sijhawm (kev coj ua lub teeb pom kev zoo rau lub sijhawm). Kev rov ua dua ntawm cov cai (ib zaug peb tau txais sijhawm txaus) yuav raug hloov kho.

#suav nrog

#ifdef _AVR_

#suav nrog

#ib

const int numReadings = 5;

int nyeem [numReadings];

int readIndex = 0;

int tag nrho = 0;

int nruab nrab = 0;

int micPin = 33;

#Txhais tus lej PIN 4

#define NUM_LEDS 120

#define BRIGHTNESS 100

Adafruit_NeoPixel strip = Adafruit_NeoPixel (NUM_LEDS, PIN, NEO_GRBW + NEO_KHZ800);

byte neopix_gamma = {

0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 5, 5, 5, 5, 6, 6, 6, 6, 7, 7, 7, 7, 8, 8, 8, 9, 9, 9, 10, 10, 10, 11, 11, 11, 12, 12, 13, 13, 13, 14, 14, 15, 15, 16, 16, 17, 17, 18, 18, 19, 19, 20, 20, 21, 21, 22, 22, 23, 24, 24, 25, 25, 26, 27, 27, 28, 29, 29, 30, 31, 32, 32, 33, 34, 35, 35, 36, 37, 38, 39, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 50, 51, 52, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 66, 67, 68, 69, 70, 72, 73, 74, 75, 77, 78, 79, 81, 82, 83, 85, 86, 87, 89, 90, 92, 93, 95, 96, 98, 99, 101, 102, 104, 105, 107, 109, 110, 112, 114, 115, 117, 119, 120, 122, 124, 126, 127, 129, 131, 133, 135, 137, 138, 140, 142, 144, 146, 148, 150, 152, 154, 156, 158, 160, 162, 164, 167, 169, 171, 173, 175, 177, 180, 182, 184, 186, 189, 191, 193, 196, 198, 200, 203, 205, 208, 210, 213, 215, 218, 220, 223, 225, 228, 231, 233, 236, 239, 241, 244, 247, 249, 252, 255 };

#suav nrog

#suav nrog

char ssid = "koj lub Network"; // koj lub network SSID (lub npe)

char pass = "secretPassword"; // koj tus password network

int keyIndex = 0; // koj lub network qhov tseem ceeb Index tus lej (xav tau tsuas yog rau WEP)

int xwm txheej = WL_IDLE_STATUS;

WiFiServer server (80);

void teeb tsa ()

{

Serial.begin (9600); // initialize serial kev sib txuas lus

pinMode (9, NTAWV); // teeb tsa tus pin LED hom

// xyuas seb puas muaj daim ntaub thaiv:

yog (WiFi.status () == WL_NO_SHIELD) {

Serial.println ("Tsis muaj ntaub thaiv npog WiFi");

thaum (muaj tseeb); // tsis txhob txuas ntxiv

}

Txoj hlua fv = WiFi.firmwareVersion ();

yog (fv! = "1.1.0") {

Serial.println ("Thov hloov kho lub firmware");

}

// sim txuas rau Wifi network:

thaum (xwm txheej! = WL_CONNECTED) {

Serial.print ("Sim ua txuas rau Network npe:");

Serial.println (ssid); // luam lub npe network (SSID);

// Txuas rau WPA/WPA2 network. Hloov kab no yog siv qhib lossis WEP network:

xwm txheej = WiFi.begin (ssid, dhau);

// tos 10 vib nas this rau kev txuas:

ncua (10000);

}

server.begin (); // pib lub web server ntawm chaw nres nkoj 80

printWifiStatus (); // koj tau txuas nrog tam sim no, yog li luam tawm cov xwm txheej

}

{

Serial.begin (9600);

strip.setBrightness (BRIGHTNESS);

strip.begin ();

strip.show (); // Pib tag nrho cov pixels rau 'tawm'

pinMode (micPin, INPUT);

rau (int thisReading = 0; thisReading <numReadings; thisReading ++) {

nyeem [thisReading] = 0;

}

}

tsis muaj zaj sawv (uint8_t tos) {

uint16_t kuv, j;

rau (j = 0; j <256; j ++) {

rau (i = 0; i

strip.setPixelColor (i, Log ((i+j) & 255));

}

strip.show ();

ncua (tos);

}

}

void visualizer () {

tag nrho = tag nrho - nyeem [readIndex];

nyeem [readIndex] = analogRead (micPin);

tag nrho = tag nrho + nyeem [readIndex];

readIndex = readIndex + 1;

yog (readIndex> = numReadings) {

readIndex = 0;

}

nruab nrab = tag nrho / numReadings;

ncua (1);

int micpixel = (nruab nrab -100)/5;

Serial.println (micpixel);

yog (micpixel> 0) {

{

rau (int j = 0; j <= micpixel; j ++)

strip.setPixelColor (j, (micpixel*2), 0, (90-micpixel), 0);

rau (int j = micpixel; j <= NUM_LEDS; j ++)

strip.setPixelColor (j, 0, 0, 0, 0);

strip.show ();

}

}

yog (micpixel <0) {

rau (int j = 0; j <= 20; j ++)

strip.setPixelColor (j, 0, 0, 50, 0);

strip.show ();

}

}

void voj () {

{

WiFiClient tus thov = server.available (); // mloog rau cov neeg siv khoom tuaj

yog tias (tus neeg siv khoom) {// yog tias koj tau txais tus neeg siv khoom, Serial.println ("tus neeg siv khoom tshiab"); // luam tawm cov lus tawm ntawm qhov chaw nres nkoj

Txoj hlua tam sim no = ""; // ua txoj hlua los tuav cov ntaub ntawv nkag los ntawm tus neeg siv khoom

thaum (client.connected ()) {// voj thaum tus neeg siv tau txuas nrog

yog (client.available ()) {// yog tias muaj bytes nyeem los ntawm tus neeg siv khoom, char c = client.read (); cov. // nyeem ib byte, ces

Serial.write (c); // luam nws tawm ntawm tus saib xyuas

yog (c == '\ n') {// yog tias byte yog tus cwj pwm tshiab

// yog tias kab tam sim no tsis muaj dab tsi, koj tau txais ob kab ntawv tshiab hauv kab.

// uas yog qhov kawg ntawm tus thov HTTP thov, yog li xa cov lus teb:

yog (currentLine.length () == 0) {

// HTTP headers ib txwm pib nrog cov lus teb (piv txwv li HTTP/1.1 200 OK)

// thiab cov ntsiab lus-hom yog li tus neeg siv khoom paub dab tsi los, tom qab ntawd kab dawb paug:

client.println ("HTTP/1.1 200 OK");

client.println ("Cov ntsiab lus-hom: ntawv/html");

client.println (); cov.

// cov ntsiab lus ntawm HTTP cov lus teb ua raws hauv kab ntawv:

client.print ("Nyem qhov no Qhib Cov Zaj sawv Zaj");

client.print ("Nyem qhov no Qhib Visualizer");

// HTTP cov lus teb xaus nrog lwm kab dawb paug:

client.println (); cov.

// tawg tawm ntawm lub voj thaum:

tawg;

} ntxiv {// yog tias koj tau txais kab ntawv tshiab, tom qab ntawd tshem tam sim noLine:

currentLine = "";

}

} lwm tus yog (c! = '\ r') {// yog tias koj tau txais lwm yam tab sis lub tsheb rov qab ua cim, currentLine += c; // ntxiv nws mus rau qhov kawg ntawm currentLine

}

// Txheeb xyuas seb tus neeg thov kev pab yog "GET /H" lossis "GET /L":

yog (currentLine.endsWith ("GET /R")) {

Zaj sawv (10); // Zaj sawv nyhuv qhib

}

yog (currentLine.endsWith ("GET /V")) {

Visualizer (); // Visualizer tau qhib

}

}

}

// kaw qhov txuas:

client.stop (); cov.

Serial.println ("tus neeg siv txuas nrog");

}

}

void printWifiStatus () {

// luam SSID ntawm lub network koj txuas nrog:

Serial.print ("SSID:");

Serial.println (WiFi. SSID ());

// luam koj li ntaub thaiv npog WiFi tus IP chaw nyob:

IPAddress ip = WiFi.localIP ();

Serial.print ("IP Chaw Nyob:");

Serial.println (ip);

// luam qhov tau txais lub teeb liab lub zog:

ntev rssi = WiFi. RSSI ();

Serial.print ("teeb liab lub zog (RSSI):");

Serial.print (rssi);

Serial.println ("dBm");

// luam qhov twg mus hauv browser:

Serial.print ( Txhawm rau pom nplooj ntawv no ua haujlwm, qhib qhov browser rau

Serial.println (ip);

}

}

uint32_t Log (byte WheelPos) {

WheelPos = 255 - WheelPos;

yog (WheelPos <85) {

rov qab strip. Color (255 - WheelPos * 3, 0, WheelPos * 3, 0);

}

yog (WheelPos <170) {

WheelPos -= 85;

rov qab strip. Color (0, WheelPos * 3, 255 - WheelPos * 3, 0);

}

WheelPos -= 170;

rov qab strip. Color (WheelPos * 3, 255 - WheelPos * 3, 0, 0);

}

uint8_t liab (uint32_t c) {

rov qab (c >> 16);

}

uint8_t ntsuab (uint32_t c) {

rov qab (c >> 8);

}

uint8_t xiav (uint32_t c) {

rov qab (c);

}

}

//Serial.println(micpixel);

}

Kauj Ruam 4: 3d Luam Ntawv Pib Lub Teeb

3d Luam Ntawv Pib Lub Teeb
3d Luam Ntawv Pib Lub Teeb

Ib qho qauv 3D ntawm lub teeb puag tau ntsuas, tsim thiab luam tawm nrog qhov loj txaus kom haum rau txhua qhov khoom siv hluav taws xob sab hauv lub hauv paus.

Kauj Ruam 5: Coj Txuas

Cov ntawv txuas
Cov ntawv txuas

Led tau cua nyob rau hauv cov ntawv los xij thiab txuas nrog siv daim kab xev ob tog, lub qhov tau raug laum rau hauv qab kom dhau cov xaim hla

Kauj Ruam 6: Teeb Lub Teeb

Teeb Lub Teeb
Teeb Lub Teeb

Lub thawv ntim khoom tau tsim los ntawm kev nrhiav lub raj mis pob tshab nrog qhov dav sib xws li lub hauv paus teeb thiab qhov siab raws li cov ntawv txuas LED. Qhov no twb tau npog nrog cov ntawv tuab kom nthuav dav zoo dua ntawm lub teeb. Xwb, nws muaj peev xwm siv cov iav khov los yog cov yas yas zoo li lub thaiv teeb.

Kauj ruam 7: Teeb tsa

Teeb
Teeb

Txhua yam tau glued ua ke thiab sib sau ua ke. Thiab lub teeb tau npaj rau qee qhov kev sim!.

Pom zoo: