Cov txheej txheem:

Kawm Chav Timer: 7 Kauj Ruam
Kawm Chav Timer: 7 Kauj Ruam

Video: Kawm Chav Timer: 7 Kauj Ruam

Video: Kawm Chav Timer: 7 Kauj Ruam
Video: Plab Plab Ntswg..(Pluav Pluav Ntswg) Maiv Twm New Song 2023-2024 2024, Kaum ib hlis
Anonim
Kawm Chav Timer
Kawm Chav Timer
Kawm Chav Timer
Kawm Chav Timer
Kawm Chav Timer
Kawm Chav Timer

Cov lus qhia yuav ua li cas thiaj tsim lub sijhawm teem rau chav kawm.

Kauj Ruam 1: Kev Sib Tham Yees Duab

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

Kauj Ruam 2: Nqe Lus Teeb Meem

Feem ntau, chav kawm ib txwm coj mus. Qhov no tshwm sim vim tias tib neeg nyiam nyob hauv chav ntev dua li qhov lawv xav tau. Peb tau tsim lub sijhawm uas tso cai rau txhua tus neeg tag nrho 2 teev thiab tib neeg tos lub peev xwm los thov chav nyob ua pab pawg tom ntej. Kev siv RGB ntawm Neopixels yuav qhia txog lub sijhawm tshuav.

Kauj ruam 3: Txheej txheem cej luam ntawm Nws Ua Haujlwm Li Cas

Lub sijhawm ntsuas suav nrog ntu txiav los ntawm lub tshuab txiav laser, 3 khawm, 1 LED, 1 lub zog ntsuas.

Neopixels thiab potentiometer tau txuas rau NodeMCU. Lub NodeMCU tau teeb tsa kom rov ua kom deb npaum li cas lub hwj chim tau tig los hloov cov nqi ntawm LED uas tau teeb ntawm lub voj Neopixel ib puag ncig. Kev thov khawm nres qhov haujlwm ntawm Pib, Nres, thiab Teem sijhawm ua haujlwm. Cov xim ntawm LED nyob ntawm lub sijhawm nyob hauv chav yog tib xim ntawm LED teeb nyob rau sab ntawm lub thawv. Neopixel nyob ntawm ib sab ntawm lub npov sawv cev rau cov khoom tso rau hauv qhov chaw tos txais ntawm lub tsev kom paub tias chav twg raug coj mus thiab tshuav sijhawm ntau npaum li cas. 2 LED tau teev tseg rau txhua chav, ib qho LED sawv cev yog tias chav raug coj mus thiab lwm qhov tsom iav coj cov xim ntawm LED nyob ntawm lub sijhawm (ntsuab yog ntau lub sijhawm, tom qab ntawd daj, tom qab ntawd liab rau lub sijhawm tsawg dua).

Kauj Ruam 4: Sau Cov Khoom Siv thiab Cov Cuab Yeej

-Txhua Acrylic

-MicroUSB Cable

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

-Breadboard

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

-Potentiometer

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

-3 khawm

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

-NodeMCU

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

- 2 Neopixel Sawb

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

-Resistors

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

- Cov xov hlau

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

-1 LEDs

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

-Hot Glue Gun

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

-Sticky Velcro Strips

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

Kauj Ruam 5: Pib Lub Tsev Nrog Breadboard

Pib Lub Tsev Nrog Breadboard
Pib Lub Tsev Nrog Breadboard

A0 rau tus pin nruab nrab ntawm Potentiometer

Vin rau Fais fab ntawm lub nplhaib Neopixel

3v3 rau ib sab ntawm Potentiometer

Txhua qhov chaw rau hauv av ntawm NodeMCU

D1 los thov khawm

D2 thov LED

D3 rau Pib Khawm

D4 Nres Nres Khawm

D5 los tiv thaiv rau Neopixel Cov tswv yim ntawm lub nplhaib

D6 los tiv thaiv rau Neopixel Input strip

Kauj Ruam 6: Pib Txoj Cai

Nov yog txoj cai kom paub tseeb tias koj txoj haujlwm ua haujlwm kom deb li deb. Lub sijhawm yuav tsum tsuas yog ob peb feeb ntawm ib lub LED ntawm Neopixel Ring. Thaum koj paub tias nws ua haujlwm txog tam sim no, txhua yam koj yuav tsum tau ua yog hloov lub sijhawm yog cov lus hauv qab no rau koj qhov tshwj xeeb. Kuv yuav muab '#Hloov sijhawm' ntawm txhua lub sijhawm yog cov lus hais tias koj xav tau hloov pauv rau koj li kev faib sijhawm.

Sim Txoj Cai:

ntshuam sijhawm

lub sij hawm ntshuam

los ntawm tshuab ntshuam ADC

ntshuam tshuab

ntshuam neopixel

ADC = ADC (0)

tus pin = tshuab. Pin (14, tshuab. Pin. OUT)

np = neopixel. NeoPixel (pin, 12)

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

np2 = neopixel. NeoPixel (pin2, 8)

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

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

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

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

l1. nqi (0)

def tglled (): # toggle 'thov' LED muaj nuj nqi

yog l1.value () == 0:

l1. nqi (1)

lwm tus:

l1. nqi (0)

x = 0 os

b1temp1 = 0

b1temp2 = 0

t = 0 hli

b2temp1 = 0

b2temp2 = 0

b3temp1 = 0

b3temp2 = 0

s = 0 hli

thaum Muaj Tseeb:

# Nov yog lub pob uas hloov qhov 'thov' LED

b1temp2 = b1.value ()

yog tias b1temp1 thiab tsis yog b1temp2:

twg ()

sijhawm.s pw (0.05)

b1temp1 = b1temp2

# Nov yog daim phiaj

np2 [0] = np [11]

yog l1.value () == 1:

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

lwm tus:

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

np2.write ()

# Nov yog qhov uas peb xaiv sijhawm ntau npaum li cas peb xav tau

yog t == 0:

rau kuv hauv ntau (-1, 12):

yog (l1.value () == 0):

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

np = (0, 0, 0)

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

s = (kuv + 1)

lwm tus:

np = (0, 0, 30)

np.write ()

lwm tus:

np = (0, 0, 0)

np.write ()

# Nov yog lub pob kom pib lub sijhawm

yog (l1.value () == 0) thiab (t == 0):

b2temp2 = b2.value ()

yog tias b2temp1 thiab tsis yog b2temp2:

x +1 = np

t += (s * 100) cov

sijhawm.s pw (0.05)

b2temp1 = b2temp2

# Lub pob no xaus lub sijhawm

yog (l1.value () == 0):

b3temp2 = b3.value ()

yog tias b3temp1 thiab tsis b3temp2:

x = 0 os

t = 0 hli

sijhawm.s pw (0.05)

b3temp1 = b3temp2

# Nov yog timer

yog x> 0:

t +ib = 1

yog (t> 0) thiab (t <= 100): #Hloov sijhawm

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 ()

yog (t> 100) thiab (t <= 200): #Hloov sijhawm

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 ()

yog (t> 200) thiab (t <= 300): #Hloov sijhawm

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 ()

yog (t> 300) thiab (t <= 400): #Hloov sijhawm

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 ()

yog (t> 400) thiab (t <= 500): #Hloov sijhawm

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 ()

yog (t> 500) thiab (t <= 600): #Hloov sijhawm

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 ()

yog (t> 600) thiab (t <= 700): #Hloov sijhawm

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 ()

yog (t> 700) thiab (t <= 800): #Hloov sijhawm

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 ()

yog (t> 800) thiab (t <= 900): #Hloov sijhawm

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 ()

yog (t> 900) thiab (t <= 1000): #Hloov sijhawm

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 ()

yog (t> 1000) thiab (t <= 1100): #Hloov sijhawm

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 ()

yog (t> 1100) thiab (t <= 1200): #Hloov sijhawm

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 ()

yog t> = 1300: #Hloov sijhawm

t = 0 hli

x = 0 os

Kauj Ruam 7: Tiav Touches

Tam sim no, ib zaug koj nyob deb no, koj yuav tsum muaj cov cai ua haujlwm xa mus rau NodeMCU thiab tag nrho cov ntu txuas rau lub khob cij. Thaum koj tau sim cov cai thiab txiav ib daim uas koj muaj rau sab nrauv, piv txwv li laser txiav casing, tam sim no koj tuaj yeem txuas cov xov hlau mus rau NodeMCU. Kev siv tshuaj txhuam yog xaiv tau tab sis tuaj yeem ua rau nws muaj kev nyab xeeb dua thiab me dua rau koj lub casing. Nov yog qee qhov laser txiav qhov uas peb tau ua.

Pom zoo: