INHOUDSOPGAWE:

Studeerkamer -timer: 7 stappe
Studeerkamer -timer: 7 stappe

Video: Studeerkamer -timer: 7 stappe

Video: Studeerkamer -timer: 7 stappe
Video: Lukas Graham - 7 Years [Official Music Video] 2024, November
Anonim
Studeerkamer -timer
Studeerkamer -timer
Studeerkamer -timer
Studeerkamer -timer
Studeerkamer -timer
Studeerkamer -timer

Instruksies oor hoe om 'n timer vir 'n studeerkamer te skep.

Stap 1: Interaksievideo

drive.google.com/file/d/12z5zQR52AXILX2AGb3EplfbmZWANZiCl/view?usp=drivesdk

Stap 2: Probleemstelling

Meestal word studeerkamers altyd ingeneem. Dit gebeur omdat mense baie langer in die kamer wil bly as wat hulle nodig het. Ons het 'n timer ontwerp waarmee elke persoon 'n totaal van 2 uur en mense kan wag om die kamer te versoek om die volgende groep te wees. Die gebruik van RGB op Neopixels sal die hoeveelheid tyd wat oor is, uitdruk.

Stap 3: Oorsig van hoe dit werk

Die timer bestaan uit dele wat deur die lasersnyer gesny is, 3 knoppies, 1 LED, 1 potensiometer.

Die Neopixels en potensiometer word aan die NodeMCU gekoppel. Die NodeMCU is geprogrammeer om te hersien hoe ver die potensiometer gedraai is om die hoeveelheid LED's wat op die sirkelvormige Neopixel -strook brand, te verander. Die knoppie Versoek stop die funksie van die begin-, stop- en stel tydfunksie. Die kleur van die LED's op die timer in die kamer is dieselfde kleur as die LED aan die kant van die boks. Die neopixel aan die kant van die boks verteenwoordig die vertoning in die voorportaal van die gebou om te weet watter kamer geneem word en hoeveel tyd daar oor is. Twee LED's word vir elke kamer voorgeskryf, een LED dui aan of die kamer geneem word en die ander LED weerspieël die kleur van die LED's op die timer (groen is meer tyd, dan geel, dan rooi vir minder tyd).

Stap 4: Lys van materiale en gereedskap

-Helder Akriel

-MicroUSB -kabel

www.digikey.com/product-detail/en/stewart-…

-Broodbord

www.amazon.com/gp/product/B01EV6LJ7G/ref=o…

-Potensiometer

www.alliedelec.com/honeywell-380c32500/701…

-3 knoppies

www.digikey.com/product-detail/en/te-conne…

-NodeMCU

www.amazon.com/gp/product/B07CB4P2XY/ref=o…

- 2 Neopixel -stroke

www.amazon.com/Lighting-Modules-NeoPixel-W…

-Weerstande

www.digikey.com/product-detail/en/te-conne…

- Drade

www.digikey.com/product-detail/en/sparkfun…

-1 LED

www.mouser.com/ProductDetail/Cree-Inc/C512…

-Warm lijmpistool

www.walmart.com/ip/AdTech-Hi-Temp-Mini-Hot…

-Sticky klittenbandstroke

www.amazon.com/VELCRO-Brand-90076-Fastener…

Stap 5: Begin bou met die broodbord

Begin bou met die broodbord
Begin bou met die broodbord

A0 tot middelste pen op potensiometer

Vin to Power on Neopixel ring

3v3 aan die een kant van die potensiometer

Alle gronde vir grond op NodeMCU

D1 om versoekknoppie

D2 om LED aan te vra

D3 na die Start -knoppie

D4 tot stopknoppie

D5 na weerstand teen Neopixel Ingang op ring

D6 teen weerstand teen Neopixel Invoerstrook

Stap 6: Begin die kode

Dit is die kode om seker te maak dat u projek tot dusver werk. Die timer moet slegs 'n paar sekondes per LED op die Neopixel -ring wees. Sodra u weet dat dit tot op hierdie punt werk, hoef u slegs die tyd as die stellings hieronder na u gespesifiseerde reeks te verander. Ek sal elke keer '#Verander tyd' plaas as stellings wat u moet verander vir u tydstoekenning.

Probeer die kode:

invoer utime

invoer tyd

vanaf masjien invoer ADC

invoer masjien

invoer neopixel

adc = ADC (0)

pin = machine. Pin (14, machine. Pin. OUT)

np = neopixel. NeoPixel (pen, 12)

pin2 = machine. Pin (12, machine. Pin. OUT)

np2 = neopixel. NeoPixel (pin2, 8)

l1 = machine. Pin (4, machine. Pin. OUT)

b1 = machine. Pin (5, machine. Pin. IN, machine. Pin. PULL_UP)

b3 = machine. Pin (2, machine. Pin. IN, machine. Pin. PULL_UP)

b2 = machine. Pin (0, machine. Pin. IN, machine. Pin. PULL_UP)

l1.waarde (0)

def tglled (): # skakel 'versoek' LED -funksie in

as l1.waarde () == 0:

l1.waarde (1)

anders:

l1.waarde (0)

x = 0

b1temp1 = 0

b1temp2 = 0

t = 0

b2temp1 = 0

b2temp2 = 0

b3temp1 = 0

b3temp2 = 0

s = 0

terwyl dit waar is:

# Dit is die knoppie wat die 'versoek' -LED skakel

b1temp2 = b1.waarde ()

as b1temp1 en nie b1temp2 nie:

tglled ()

tyd. slaap (0,05)

b1temp1 = b1temp2

# Dit is die rooster

np2 [0] = np [11]

as l1.waarde () == 1:

np2 [1] = (30, 0, 0)

anders:

np2 [1] = (0, 0, 30)

np2.write ()

# Hier kies ons hoeveel tyd ons nodig het

as t == 0:

vir i in die reeks (-1, 12):

as (l1.waarde () == 0):

as (adc.read ()> = (85.34 * (i+1))):

np = (0, 0, 0)

np [11] = (0, 0, 30)

s = (i + 1)

anders:

np = (0, 0, 30)

np.write ()

anders:

np = (0, 0, 0)

np.write ()

# Dit is die knoppie om die timer te begin

as (l1.waarde () == 0) en (t == 0):

b2temp2 = b2.waarde ()

as b2temp1 en nie b2temp2 nie:

x += 1

t += (s * 100)

tyd. slaap (0,05)

b2temp1 = b2temp2

# Hierdie knoppie eindig die timer

as (l1.waarde () == 0):

b3temp2 = b3.waarde ()

as b3temp1 en nie b3temp2 nie:

x = 0

t = 0

tyd. slaap (0,05)

b3temp1 = b3temp2

# Dit is die timer

as x> 0:

t += 1

as (t> 0) en (t <= 100): #Verander tyd

np [0] = (5, 30, 0)

np [1] = (5, 30, 0)

np [2] = (5, 30, 0)

np [3] = (5, 30, 0)

np [4] = (5, 30, 0)

np [5] = (5, 30, 0)

np [6] = (5, 30, 0)

np [7] = (5, 30, 0)

np [8] = (5, 30, 0)

np [9] = (5, 30, 0)

np [10] = (5, 30, 0)

np [11] = (5, 30, 0)

np.write ()

as (t> 100) en (t <= 200): #Verander tyd

np [0] = (0, 0, 0)

np [1] = (10, 30, 0)

np [2] = (10, 30, 0)

np [3] = (10, 30, 0)

np [4] = (10, 30, 0)

np [5] = (10, 30, 0)

np [6] = (10, 30, 0)

np [7] = (10, 30, 0)

np [8] = (10, 30, 0)

np [9] = (10, 30, 0)

np [10] = (10, 30, 0)

np [11] = (10, 30, 0)

np.write ()

as (t> 200) en (t <= 300): #Verander tyd

np [0] = (0, 0, 0)

np [1] = (0, 0, 0)

np [2] = (15, 30, 0)

np [3] = (15, 30, 0)

np [4] = (15, 30, 0)

np [5] = (15, 30, 0)

np [6] = (15, 30, 0)

np [7] = (15, 30, 0)

np [8] = (15, 30, 0)

np [9] = (15, 30, 0)

np [10] = (15, 30, 0)

np [11] = (15, 30, 0)

np.write ()

as (t> 300) en (t <= 400): #Verander tyd

np [0] = (0, 0, 0)

np [1] = (0, 0, 0)

np [2] = (0, 0, 0)

np [3] = (20, 30, 0)

np [4] = (20, 30, 0)

np [5] = (20, 30, 0)

np [6] = (20, 30, 0)

np [7] = (20, 30, 0)

np [8] = (20, 30, 0)

np [9] = (20, 30, 0)

np [10] = (20, 30, 0)

np [11] = (20, 30, 0)

np.write ()

as (t> 400) en (t <= 500): #Verander tyd

np [0] = (0, 0, 0)

np [1] = (0, 0, 0)

np [2] = (0, 0, 0)

np [3] = (0, 0, 0)

np [4] = (25, 30, 0)

np [5] = (25, 30, 0)

np [6] = (25, 30, 0)

np [7] = (25, 30, 0)

np [8] = (25, 30, 0)

np [9] = (25, 30, 0)

np [10] = (25, 30, 0)

np [11] = (25, 30, 0)

np.write ()

as (t> 500) en (t <= 600): #Verander tyd

np [0] = (0, 0, 0)

np [1] = (0, 0, 0)

np [2] = (0, 0, 0)

np [3] = (0, 0, 0)

np [4] = (0, 0, 0)

np [5] = (30, 30, 0)

np [6] = (30, 30, 0)

np [7] = (30, 30, 0)

np [8] = (30, 30, 0)

np [9] = (30, 30, 0)

np [10] = (30, 30, 0)

np [11] = (30, 30, 0)

np.write ()

as (t> 600) en (t <= 700): #Verander tyd

np [0] = (0, 0, 0)

np [1] = (0, 0, 0)

np [2] = (0, 0, 0)

np [3] = (0, 0, 0)

np [4] = (0, 0, 0)

np [5] = (0, 0, 0)

np [6] = (30, 25, 0)

np [7] = (30, 25, 0)

np [8] = (30, 25, 0)

np [9] = (30, 25, 0)

np [10] = (30, 25, 0)

np [11] = (30, 25, 0)

np.write ()

as (t> 700) en (t <= 800): #Verander tyd

np [0] = (0, 0, 0)

np [1] = (0, 0, 0)

np [2] = (0, 0, 0)

np [3] = (0, 0, 0)

np [4] = (0, 0, 0)

np [5] = (0, 0, 0)

np [6] = (0, 0, 0)

np [7] = (30, 20, 0)

np [8] = (30, 20, 0)

np [9] = (30, 20, 0)

np [10] = (30, 20, 0)

np [11] = (30, 20, 0)

np.write ()

as (t> 800) en (t <= 900): #Verander tyd

np [0] = (0, 0, 0)

np [1] = (0, 0, 0)

np [2] = (0, 0, 0)

np [3] = (0, 0, 0)

np [4] = (0, 0, 0)

np [5] = (0, 0, 0)

np [6] = (0, 0, 0)

np [7] = (0, 0, 0)

np [8] = (30, 15, 0)

np [9] = (30, 15, 0)

np [10] = (30, 15, 0)

np [11] = (30, 15, 0)

np.write ()

as (t> 900) en (t <= 1000): #Verander tyd

np [0] = (0, 0, 0)

np [1] = (0, 0, 0)

np [2] = (0, 0, 0)

np [3] = (0, 0, 0)

np [4] = (0, 0, 0)

np [5] = (0, 0, 0)

np [6] = (0, 0, 0)

np [7] = (0, 0, 0)

np [8] = (0, 0, 0)

np [9] = (30, 10, 0)

np [10] = (30, 10, 0)

np [11] = (30, 10, 0)

np.write ()

as (t> 1000) en (t <= 1100): #Verander tyd

np [0] = (0, 0, 0)

np [1] = (0, 0, 0)

np [2] = (0, 0, 0)

np [3] = (0, 0, 0)

np [4] = (0, 0, 0)

np [5] = (0, 0, 0)

np [6] = (0, 0, 0)

np [7] = (0, 0, 0)

np [8] = (0, 0, 0)

np [9] = (0, 0, 0)

np [10] = (30, 5, 0)

np [11] = (30, 5, 0)

np.write ()

as (t> 1100) en (t <= 1200): #Verander tyd

np [0] = (0, 0, 0)

np [1] = (0, 0, 0)

np [2] = (0, 0, 0)

np [3] = (0, 0, 0)

np [4] = (0, 0, 0)

np [5] = (0, 0, 0)

np [6] = (0, 0, 0)

np [7] = (0, 0, 0)

np [8] = (0, 0, 0)

np [9] = (0, 0, 0)

np [10] = (0, 0, 0)

np [11] = (30, 0, 0)

np.write ()

as t> = 1300: #Verander tyd

t = 0

x = 0

Stap 7: afwerking

As u eers so ver is, moet u die werkkode na die NodeMCU laat oplaai en al die dele op die broodbord bedraad. Sodra u die kode probeer het en enige stukke wat u aan die buitekant het, gesny het, dit wil sê lasersnit omhulsel, kan u die drade nou aan die NodeMCU soldeer. Die soldeer is opsioneel, maar dit kan dit veiliger en kleiner maak vir u omhulsel. Hier is 'n paar van die lasergesnyde onderdele wat ons gemaak het.

Aanbeveel: