Cov txheej txheem:

Arduino LCD Kev Ceeb Toom Kev Nyab Xeeb Hluav Taws Xob: 9 Kauj Ruam
Arduino LCD Kev Ceeb Toom Kev Nyab Xeeb Hluav Taws Xob: 9 Kauj Ruam

Video: Arduino LCD Kev Ceeb Toom Kev Nyab Xeeb Hluav Taws Xob: 9 Kauj Ruam

Video: Arduino LCD Kev Ceeb Toom Kev Nyab Xeeb Hluav Taws Xob: 9 Kauj Ruam
Video: BTT SKR2 — Обновлены основы SKR 2 (Rev B) 2024, Hlis ntuj nqeg
Anonim
Arduino LCD Kev Ceeb Toom Kev Nyab Xeeb Hluav Taws Xob
Arduino LCD Kev Ceeb Toom Kev Nyab Xeeb Hluav Taws Xob
Arduino LCD Kev Ceeb Toom Kev Nyab Xeeb Hluav Taws Xob
Arduino LCD Kev Ceeb Toom Kev Nyab Xeeb Hluav Taws Xob
Arduino LCD Kev Ceeb Toom Kev Nyab Xeeb Hluav Taws Xob
Arduino LCD Kev Ceeb Toom Kev Nyab Xeeb Hluav Taws Xob

Nov yog tub ntxhais kawm ua qhov haujlwm uas sib txuas ua haujlwm ntawm LCD Screen, lub suab nrov, RGB thiab DHT ntsuas kub.

Qhov kub ib puag ncig tam sim no tau tshwm sim thiab hloov tshiab ntawm lub vijtsam LCD.

Cov lus luam tawm ntawm lub vijtsam LCD qhia rau tus neeg siv ntawm "qib phom sij".

Qhov screen dims thiab flashes ceeb toom rau tus neeg siv ntawm kev txaus ntshai.

Lub suab nrov nrov nrov thiab nrawm dua rau ceeb toom rau tus neeg siv ntawm kev phom sij nyob ntawm qib ntawm kev pheej hmoo tam sim no.

RGB hloov ntsuab, daj, txiv kab ntxwv thiab liab nyob ntawm seb qib kev pheej hmoo tam sim no.

Muaj peev xwm muab tso rau hauv daim ntawv luam tawm 3D kom pom kev zoo dua.

Qhov no daws qhov teeb meem hauv ntiaj teb tiag ntawm tib neeg tsis paub thaum muaj kev pheej hmoo ntawm hluav taws kom txog thaum nws lig dhau lawm

Kauj Ruam 1: Sau Cov Khoom

Sau Cov Khoom
Sau Cov Khoom
Sau Cov Khoom
Sau Cov Khoom
Sau Cov Khoom
Sau Cov Khoom

Cov ntaub ntawv siv hauv Txoj Haujlwm no:

1x LCD Zaub

1x DHT_11 Kub Sensor

1 x rgb

1x Piezo Passive Buzzer 1.0v

2x Cov Ntawv Me Me

3x Standard resistors

1x Qhov Loj Me Me Breadboard

1 x Arduino UNO

Bluetack txhawm rau xauv xov hlau nyob hauv qhov chaw.

Ib qho kev sib txawv ntawm cov xov hluav taws xob sib txawv, ob leeg qhib tas thiab ib leeg tau xaus.

Ib lub cuab yeej los khiav cov cai

Nkag mus rau lub tshuab luam ntawv 3D yog tias koj xav tau lub plhaub sab nrauv thiab zoo nkauj dua

Kauj ruam 2: Teeb tsa Breadboards

Teeb tsa Breadboards
Teeb tsa Breadboards
Teeb tsa Breadboards
Teeb tsa Breadboards

1. Txuas cov kab xev txiv kab ntxwv los ntawm tus lej cim "GND" ntawm Arduino board thiab txuas nws mus rau qhov tsis zoo (xiav) ntawm lub khob cij. Txij ntawm no mus, yog tias peb xav tau siv GND rau ib qho khoom siv sab nraud peb yuav yooj yim muab lawv tso rau hauv tib kab ntawv ib yam li qhov no ntawm lub khob cij.

2. Txuas cov xaim liab los ntawm tus pin sau tias "5V" ntawm Arduino board thiab txuas nws mus rau qhov zoo (liab) sab ntawm lub khob cij. Txij ntawm no mus, yog tias peb xav tau siv 5V rau ib qho khoom siv sab nraud peb yuav yooj yim muab lawv tso rau hauv tib kab ntawv ntawm qhov no ntawm lub khob cij.

Kauj Ruam 3: Teeb LCD Zaub

Teeb tsa LCD Zaub
Teeb tsa LCD Zaub
Teeb tsa LCD Zaub
Teeb tsa LCD Zaub
Teeb tsa LCD Zaub
Teeb tsa LCD Zaub

1. Tig lub rooj tsavxwm hla kom nws tig ntsej muag nrog txhua tus pin ntawm sab laug.

2. Txuas tus xaim 5 los ntawm sab saud sab laug rau kab sab saum toj ntawm tus pin thiab txuas nws tus lej tus lej 4 ntawm Arduino UNO.

3. Txuas tus xaim 6 los ntawm sab laug sab laug rau kab sab saum toj ntawm tus pin thiab txuas nws mus rau tus lej tus lej 5 ntawm Arduino UNO.

4. Txuas tus xaim 7 los ntawm sab laug sab laug rau kab sab saum toj ntawm tus pin thiab txuas nws tus lej tus lej 6 ntawm Arduino UNO.

5. Txuas tus xaim 8 los ntawm sab laug sab laug rau kab sab saum toj ntawm tus pin thiab txuas nws rau tus lej tus lej 7 ntawm Arduino UNO.

6. Txuas tus xaim 9 los ntawm sab saud sab laug rau kab sab saum toj ntawm tus pin thiab txuas nws tus lej tus lej 8 ntawm Arduino UNO.

7. Txuas tus xaim 10 los ntawm sab laug sab laug rau kab sab saum toj ntawm tus pin thiab txuas nws tus lej tus lej 9 ntawm Arduino UNO.

8. Txuas lub xaim 3 los ntawm txoj cai hauv qab thiab txuas nws mus rau 5V Kab ntawm lub khob cij

9. Txuas ib lub xaim 4 los ntawm txoj cai hauv qab thiab txuas nws mus rau GND Row ntawm lub khob cij

NYEEM NTXIV TSHIAB CIRCUIT DIAGRAM qhia qhov sib txawv LCD

Kauj Ruam 4: Teeb Piezo Buzzer

Teeb tsa Piezo Buzzer
Teeb tsa Piezo Buzzer
Teeb tsa Piezo Buzzer
Teeb tsa Piezo Buzzer
Teeb tsa Piezo Buzzer
Teeb tsa Piezo Buzzer
Teeb tsa Piezo Buzzer
Teeb tsa Piezo Buzzer

1. Txuas ib lub xov hlau los ntawm GND tus pin ntawm lub buzzer mus rau GND kem (Xiav) ntawm lub khob cij

2. Txuas ib lub xov hlau los ntawm VCC tus pin ntawm lub buzzer mus rau 5V kem (Liab) ntawm lub khob cij

3. Txuas ib lub xov hlau los ntawm SIG tus pin ntawm tus buzzer rau tus lej lej "10" ntawm arduino UNO board

NYEEM SAWV DAWS LI QHIA LI CAS CIRCUIT DIAGRAM qhia qhov sib txawv BUZZER

Kauj Ruam 5: Teeb DHT Kub Sensor

Teeb DHT Kub Sensor
Teeb DHT Kub Sensor
Teeb DHT Kub Sensor
Teeb DHT Kub Sensor
Teeb DHT Kub Sensor
Teeb DHT Kub Sensor
Teeb DHT Kub Sensor
Teeb DHT Kub Sensor

1. Teeb DHT sensor hauv daim ntawv qhia zaub mov raws li qhia saum toj no

2. Txuas thawj tus pin ntawm sab laug ntawm DHT sensor (daim ntawv lo VCC hauv daim duab qhia ib feem) mus rau 5V kem (Liab) ntawm lub khob cij

3. Txuas tus pin thib ob ntawm sab laug ntawm DHT sensor (Labeled DATA hauv ntu daim duab) rau A0 chaw nres nkoj ntawm Arduino UNO

4. Txuas thawj tus pin ntawm sab xis ntawm DHT sensor (Labeled GND hauv daim duab qhia ib sab) mus rau GND kem (Xiav) ntawm lub khob cij

5. Saib ib qho kev qhia thiab ntxiv dht.h Lub Tsev Qiv Ntawv pom tom kawg ntawm kev qhia rau Arduino. (Qhov no yuav tsum tau ua)

Kauj Ruam 6: Teeb RGB

Kev teeb tsa RGB
Kev teeb tsa RGB
Kev teeb tsa RGB
Kev teeb tsa RGB
Kev teeb tsa RGB
Kev teeb tsa RGB
Kev teeb tsa RGB
Kev teeb tsa RGB

1. Muab lub RGB tso rau hauv lub khob cij me me raws li tau hais los saum no, hais txog ntawm ob txhais ceg ntawm sab laug ntawm RGB yog ib qho nyob ze dua lwm qhov peb

2. Tso tus qauv tiv thaiv tus thawj, tus thib peb thiab tus pin thib plaub. Tawm hauv qhov chaw kom tsawg kawg ib txoj xov hlau ntxiv (raws li qhia saum toj no).

3. Txuas ib lub xov hlau los tom qab tus tiv thaiv ntawm tus pin sab laug ntawm RGB mus rau tus pin Labeled 2 ntawm Arduino UNO

4. Txuas ib lub xov hlau los tom qab qhov thib ob uas nyob deb ntawm tus pin sab laug ntawm RGB mus rau GND (xiav) kem ntawm lub khob cij.

5. Txuas ib lub xov hlau los tom qab tus tiv thaiv tus thib ob los ntawm tus pin sab xis ntawm RGB mus rau tus pin Labeled 1 ntawm Arduino UNO

6. Txuas ib lub xov hlau los ntawm tom qab tus tiv thaiv ntawm sab xis ntawm RGB mus rau tus lej Cim 3 ntawm Arduino UNO

Kauj Ruam 7: Yeem 3D Luam Vaj Tsev

Yeem 3D Luam Vaj Tsev
Yeem 3D Luam Vaj Tsev
Yeem 3D Luam Vaj Tsev
Yeem 3D Luam Vaj Tsev
Yeem 3D Luam Vaj Tsev
Yeem 3D Luam Vaj Tsev

1. Nrhiav kev qhia paub yuav ua li cas luam 3D.

2. Luam cov ntawv txuas hauv qab no tsim los ntawm Autodesk Fusion 360 (.stl file)

3. Tshem tawm cov khoom 3D ntau tshaj thiab ua kom du rau saum npoo

4. Saib daim duab saum toj no rau kev taw qhia qhov chaw tso cov khoom Arduino.

Kauj Ruam 8: Txoj Cai thiab Cov Ntaub Ntawv

Cov Cai thiab Cov Ntaub Ntawv
Cov Cai thiab Cov Ntaub Ntawv

-Lub tsev qiv ntawv DHT.h tau txuas nrog. (UNZIP)

-Cov Cai nrog cov ncauj lus ntxaws ntxaws tau txuas nrog tab sis tseem nyob rau theem tom ntej.

-Cov.stl cov ntaub ntawv rau 3D vaj tsev nyob nrog

-Qhov Circuit daim duab tau txuas ntxiv. Nco ntsoov xa mus rau cov kauj ruam tiag tiag rau lub vijtsam LCD thiab piezo buzzer raws li cov khoom sib txawv tau siv.

Kauj Ruam 9: Arduino Code

Arduino Txoj Cai
Arduino Txoj Cai
Arduino Txoj Cai
Arduino Txoj Cai

// LCD TSEEM CEEB TSHUAJ TSEEB TSHUAB // Nyeem cov tswv yim los ntawm DHT Kub Tus Pin thiab nyob ntawm seb nws kub lossis tsis, hloov rgb thiab tus hais lus los qhia tus neeg siv yog tias lawv muaj kev phom sij ntawm hluav taws. // Kuj tseem qhia qhov kub ntawm lub vijtsam LCD.

// DHT teeb tsa

#suav nrog // suav nrog lub tsev qiv ntawv DHT

#define dht_dpin A0 // Qhia rau pawg thawj coj saib tias DHT tus pin nyob hauv analog analog 0

dht DHT; // dht = DHT

// LIQUID CRYSTAL teeb tsa

#suav nrog // suav nrog Lub Tsev Qiv Crystal Liquid

LiquidCrystal lcd (8, 9, 4, 5, 6, 7); // Ua kom luv rau LCD /qhia arduino qhov chaw nres nkoj lcd nyob

// Txheeb xyuas RGB + BUZZER

#define redpin 1 // Txhais redpin ntawm RGB hauv chaw nres nkoj 1

#define greenpin 2 // Txhais greenpin ntawm RGB hauv chaw nres nkoj 2

#define bluepin 3 // Txhais bluepin ntawm RGB hauv chaw nres nkoj 3

#define buzzerpin 10 // Txhais buzzerpin hauv chaw nres nkoj 10

// VARIABLE/S.

int temp = analogRead (DHT.temperature); // Tsim kom muaj Integer "temp" uas yog tus nqi los ntawm DHT.temperature hais kom ua

void teeb tsa () {

// OUTPUT/INPUT

analogWrite (redpin, OUTPUT); // Tshaj tawm/txheeb xyuas redpin li Cov Zis

analogWrite (greenpin, OUTPUT); // Tshaj tawm/txhais cov kab ntsuab raws li Tso Tawm

analogWrite (bluepin, OUTPUT); // Tshaj tawm/txheeb xyuas bluepin li cov zis

tus pinMode (buzzerpin, OUTPUT); // Tshaj tawm/txheeb xyuas buzzerpin li cov zis

// LCD npo

lcd.begin (16, 2); // Txhais LCD npo ua 16 kab thiab 2 kab}

void voj () {

// LCD CODE TSIS YOG VARIABILITY

DHT.read11 (dht_dpin); // Nyeem cov tswv yim los ntawm dht_dpin kuj (A0)

lcd.setCursor (0, 0); // Teeb tus curser rau Kab 0, Kab 0

lcd.print ("Nws yog"); // Sau "Nws" ntawm lub vijtsam LCD

lcd.print (DHT.temperature); // Luam tawm DHT.temperature tus nqi los ntawm DHT tus pin ntawm kab 0, Kab 0

lcd.print (""); // Luam tawm qhov chaw tom qab ntsuas kub

lcd.print ((kab ntawv) 223); // luam daim ntawv kos npe tom qab ntsuas kub

lcd.print ("C"); // Luam tawm "c" tom qab cov qib ntsuas los ua piv txwv txog Celsius

// LCD FLASHING

lcd.setCursor (0, 1); // Teeb tus curser rau Kab 0, Kab 1

lcd.noDisplay ();

lcd.print ("Tsis Muaj Kev Nyab Xeeb Hluav Taws"); // Luam tawm "Tsis Muaj Sijhawm Hluav Taws"

lcd.noDisplay (); // Tig LCD tso tawm (ib feem ntawm nyem)

ncua (1000); // Nyob qis qis rau 1 thib ob

lcd.display (); // Qhib LCD zaub rov qab rau

ncua (1000); // Nyob twj ywm rau 1 thib ob

// RGB + BUZZER CODE

analogWrite (redpin, 0); // Tsis muaj cov zis los ntawm tus pin liab

analogWrite (greenpin, 255); // 255 tso tawm los ntawm greenpin (Ua rau RGB ntsuab)

analogWrite (bluepin, 0); // Tsis muaj cov zis los ntawm tus pin xiav

suab (buzzerpin, 20, 20); // // Tshaj Tawm Zaus ntawm 20 hertz rau 0.02 Seconds los ntawm buzzer

// YOG TEMP YOG 25-30

yog ((int (DHT.temperature)> = 25.00) && (int (DHT.temperature) <= 30.00)) {

lcd.clear (); // Clear LCD Screen

lcd.setCursor (0, 1); // Teeb tus curser rau Kab 0, Kab 1

lcd.print ("Kev Ceeb Toom Me"); // Luam tawm "Kev Ceeb Toom Me" ntawm Kab 0, Kab 1

lcd.noDisplay (); // Tig LCD tso tawm (ib feem ntawm nyem)

ncua (1000); // Nyob qis qis rau 1 thib ob

lcd.display (); // Qhib LCD zaub rov qab rau

ncua (1000); // Nyob twj ywm rau 1 thib ob

analogWrite (redpin, 255); // 255 tso tawm los ntawm redpin (Ua rau RGB daj)

analogWrite (greenpin, 255); // 255 tso tawm los ntawm greenpin (Ua rau RGB daj)

analogWrite (bluepin, 0); // Tsis muaj qhov tso tawm los ntawm tus pin xiav

suab (buzzerpin, 200, 100); // Tshaj Tawm Zaus ntawm 200 hertz rau 0.1 Seconds los ntawm buzzer

ncua (300); //.3 Kev ncua thib ob

} // YOG TEMP YOG 31-37 ntxiv yog ((int (DHT.temperature) = 37.00)) {

lcd.clear (); // Clear LCD Screen

lcd.setCursor (0, 1); // Teeb tus curser rau Kab 0, Kab 1

lcd.print ("Nruab Nrab Ceeb Toom"); // Luam tawm "Kev Ceeb Toom Nruab Nrab" ntawm Kab 0, Kab 1

lcd.noDisplay (); // Tig LCD tso tawm (ib feem ntawm nyem)

ncua (500); // Nyob qis qis rau 0.5 thib ob

lcd.display (); // Qhib LCD zaub rov qab rau

ncua (500); // Nyob twj ywm rau 0.5 thib ob

analogWrite (redpin, 255); // 255 tso tawm los ntawm redpin (Ua RGB txiv kab ntxwv)

analogWrite (ntsuab ntsuab, 165); // 165 tso tawm los ntawm greenpin (Ua RGB txiv kab ntxwv)

analogWrite (bluepin, 0); // Tsis muaj cov zis los ntawm bluepin

suab (buzzerpin, 500, 900); // Tshaj Tawm Zaus ntawm 500 hertz rau 0.9 Thib Ob los ntawm buzzer

ncua (300); //.3 Kev ncua thib ob

} // YOG TEMP YOG 38-100

lwm yog ((int (DHT.temperature) = 100.00)) {

lcd.clear (); // Clear LCD Screen

lcd.setCursor (0, 1); // Teeb tus curser rau Kab 0, Kab 1

lcd.print ("Hu rau 000"); // Luam tawm "Hu 000" ntawm Kab 0, Kab 1

lcd.noDisplay (); // Tig LCD tso tawm (ib feem ntawm nyem)

ncua (250); // Nyob qis qis rau 0.25 thib ob

lcd.display (); // Qhib LCD zaub rov qab rau

ncua (250); // Nyob twj ywm rau 0.25 thib ob

analogWrite (redpin, 255); // 255 tso tawm los ntawm redpin (Ua rau RGB liab)

analogWrite (ntsuab ntsuab, 0); // Tsis muaj cov zis los ntawm greenpin

analogWrite (bluepin, 0); // Tsis muaj cov zis los ntawm bluepin

suab (buzzerpin, 1000, 900); // Tshaj Tawm Zaus ntawm 1000 hertz rau 0.9 Thib Ob los ntawm buzzer

ncua (300); //.3 Kev ncua thib ob

}}

Pom zoo: