Cov txheej txheem:

DIY Huab Cua Chaw Nres Tsheb nrog Nextion Zaub thiab Arduino: 11 Kauj Ruam
DIY Huab Cua Chaw Nres Tsheb nrog Nextion Zaub thiab Arduino: 11 Kauj Ruam

Video: DIY Huab Cua Chaw Nres Tsheb nrog Nextion Zaub thiab Arduino: 11 Kauj Ruam

Video: DIY Huab Cua Chaw Nres Tsheb nrog Nextion Zaub thiab Arduino: 11 Kauj Ruam
Video: Saib Mis paub Poj niam (hluas nkauj) tus yam ntxwv lub siab 2024, Kaum ib hlis
Anonim
Image
Image
Koj Yuav Tsum Tau Dab Tsi
Koj Yuav Tsum Tau Dab Tsi

Hauv qhov kev qhia no peb yuav siv Nextion zaub, rtc1307 lub sijhawm module, Arduino UNO, thiab Visuino los tso saib lub sijhawm tam sim no, ntsuas kub thiab av noo.

Saib daim vis dis aus.

Kauj ruam 1: Yam Koj Yuav Tsum Tau

Koj Yuav Tsum Tau Dab Tsi
Koj Yuav Tsum Tau Dab Tsi
Koj Yuav Tsum Tau Dab Tsi
Koj Yuav Tsum Tau Dab Tsi
  • Arduino uno (lossis nano, mega leej twg tuaj yeem siv tau)
  • Nextion lcd 2.8 nti nx3224t028_011 (lwm qhov txuas ntxiv lcd tseem yuav ua haujlwm)
  • I2C RTC DS1307 24C32 Lub Sijhawm Tiag Module rau Arduino
  • Jumper xov hlau
  • Cov qhob cij
  • Visuino program: Rub tawm Visuino
  • Nextion Editor program: Rub tawm ntawm no

Kauj Ruam 2: Txhim Kho Kev Sib Tham hauv Nextion Editor

Tsim Kev Sib Tham hauv Nextion Editor
Tsim Kev Sib Tham hauv Nextion Editor
Tsim Kev Sib Tham hauv Nextion Editor
Tsim Kev Sib Tham hauv Nextion Editor
Tsim Kev Sib Tham hauv Nextion Editor
Tsim Kev Sib Tham hauv Nextion Editor

Ua ntej tshaj kom ntseeg tau tias daim npav SD tau muab tso rau hauv FAT32 (Siv qee cov software zoo li daim npav tsim)

  • Pib Nextion Editor software thiab nyem "Tshiab" thiab Txuag koj txoj haujlwm rau qee yam xws li "Huab Cua"
  • Tom qab ntawd "Chaw" Dialog yuav qhia, xaiv hom Zaub uas koj muaj.
  • Ib daim ntawv dawb dawb yuav raug tsim.
  • Los ntawm Toolbox ntawm sab laug rub 3x duab.
  • Ntawm sab laug-hauv qab xaiv "Duab" tab, nyem + khawm thiab thauj cov duab. Koj tuaj yeem rub tawm qee lub cim zoo los ntawm Is Taws Nem rau lub sijhawm, ntsuas kub thiab av noo (zoo li Iconarchive lub vev xaib)
  • Xaiv txhua daim duab thiab ntawm sab xis-hauv qab "Tus Cwj Pwm" qhov rai ob npaug nyem rau ntawm "pic" teb thiab xaiv daim duab, ua qhov no rau txhua daim duab (3x).

Ntawm cov ntawv qhia zaub mov nyem rau ntawm "Cuab Yeej> Font generator"

  • Tsim cov ntawv uas yuav siv los tso saib lub sijhawm, kub thiab av noo thiab teeb lub npe zoo li "MyFont1"
  • Nyem "Tsim Font" thiab txuag nws nyob qhov twg, thaum nug "Ntxiv cov font tsim?" nyem Yog
  • Kaw lub npov Dialog thiab cov font tsim tawm yuav tshwm nyob rau hauv qab sab laug hauv qab "Fonts" tab nrog tus lej 0
  • Los ntawm Toolbox ntawm sab laug rub 3x "ntawv", tso nws qhov twg nws yuav qhia cov ntaub ntawv
  • Rau txhua kab ntawv teev nyob rau hauv qab txoj cai "Tus Cwj Pwm" lub qhov rai, font mus rau 0 <tus lej ntawm tus font koj tau tsim ua ntej, koj tuaj yeem siv ntau tus fonts thiab teeb ID rau txhua kab ntawv
  • Koj tuaj yeem teeb tus nqi ntawv tsis raug nyob hauv "txt" teb piv txwv "Sijhawm", "C", "%
  • Koj tuaj yeem teeb cov xim los ntawm nyem rau ntawm "pco" daim teb Nco ntsoov tias txhua kab ntawv muaj qee yam khoom lub npe xws li "t0" thiab lwm yam, qhov no yuav siv tom qab hauv Visuino
  • Koj tuaj yeem pom txhua lub npe khoom hauv qab "tus cwj pwm" qhov rai> objname

Thaum koj tau tso thiab tso tag nrho cov ntsiab lus:

  • nyem rau ntawm "Compile" khawm
  • nyem rau ntawm cov ntawv qhia zaub mov "Cov Ntaub Ntawv"> "Qhib Tsim Cov Ntawv" nrhiav cov ntawv hauv peb kis "Weather.tft" thiab luam nws rau hauv daim npav SD.

Kauj ruam 3: Circuit Court

Qhov Circuit
Qhov Circuit
  • Txuas Arduino tus pin [5v] rau breadboard Zoo tus pin [Liab]
  • Txuas Arduino tus pin [GND] rau breadboard Tsis zoo tus pin [Xiav]
  • Txuas DHT11 sensor tus pin [-] rau Arduino tus pin [GND]
  • Txuas DHT11 sensor tus pin [-] rau breadboard tus pin zoo [Liab]
  • Txuas DHT11 sensor teeb liab tus pin [S] rau Arduino tus pin [7]
  • Txuas Lub Sijhawm DS1307 tus lej tus lej [Vcc] mus rau lub rooj noj mov zoo tus pin [Liab]
  • Txuas Lub Sijhawm DS1307 tus lej tus lej [GND] rau lub khob cij tsis zoo tus pin [Xiav]
  • Txuas Sijhawm DS1307 module tus pin [SDA] rau Arduino tus pin [SDA]
  • Txuas Sijhawm DS1307 tus lej pin [SCL] rau Arduino tus pin [SCL]
  • Txuas Nextion Display pin [VCC] mus rau breadboard tus pin zoo [Liab]
  • Txuas Nextion Display pin [GND] mus rau lub khob cij tsis zoo tus pin [Xiav]
  • Txuas Nextion Display pin [RX] rau Arduino tus pin [TX]
  • Txuas Nextion Display pin [TX] rau Arduino tus pin [RX]

Kauj Ruam 4: Pib Visuino, thiab Xaiv Arduino UNO Board Type

Pib Visuino, thiab Xaiv Arduino UNO Board Type
Pib Visuino, thiab Xaiv Arduino UNO Board Type
Pib Visuino, thiab Xaiv Arduino UNO Board Type
Pib Visuino, thiab Xaiv Arduino UNO Board Type

Txhawm rau pib ua haujlwm rau Arduino, koj yuav tsum muaj Arduino IDE teeb tsa los ntawm no:

Thov nco ntsoov tias muaj qee qhov teeb meem tseem ceeb hauv Arduino IDE 1.6.6. Nco ntsoov tias koj nruab 1.6.7 lossis siab dua, txwv tsis pub Cov Lus Qhia no yuav tsis ua haujlwm! Yog tias koj tsis tau ua raws cov kauj ruam hauv Phau Ntawv Qhia no teeb tsa Arduino IDE rau program Arduino UNO! Visuino: https://www.visuino.eu tseem yuav tsum tau teeb tsa. Pib Visuino raws li pom hauv thawj daim duab Nyem rau ntawm "Cov cuab yeej" khawm ntawm Arduino tivthaiv (Daim Duab 1) hauv Visuino Thaum qhov kev sib tham tshwm, xaiv "Arduino UNO" raws li qhia hauv daim duab 2

Kauj Ruam 5: Hauv Visuino Ntxiv Cheebtsam

Hauv Visuino Ntxiv Cheebtsam
Hauv Visuino Ntxiv Cheebtsam
Hauv Visuino Ntxiv Cheebtsam
Hauv Visuino Ntxiv Cheebtsam
Hauv Visuino Ntxiv Cheebtsam
Hauv Visuino Ntxiv Cheebtsam
  1. Ntxiv "Pib" tivthaiv
  2. Ntxiv "Lub Sijhawm Tiag (RTC) DS 1307" tivthaiv
  3. Ntxiv "Clock Generator" tivthaiv
  4. Ntxiv "Vaum thiab Ntsuas Kub DHT11" tivthaiv
  5. Ntxiv 2x "Analog rau cov ntawv" tivthaiv
  6. Ntxiv "Decode (Split) datetime" tivthaiv
  7. Ntxiv "Nextion Display" tivthaiv

Kauj Ruam 6: Hauv Visuino Teeb Cov Khoom

Hauv Visuino Teeb Cov Txheej Txheem
Hauv Visuino Teeb Cov Txheej Txheem
Hauv Visuino Teeb Cov Txheej Txheem
Hauv Visuino Teeb Cov Txheej Txheem
Hauv Visuino Teeb Cov Txheej Txheem
Hauv Visuino Teeb Cov Txheej Txheem

Ob npaug nias rau "RealTimeClock1" tivthaiv, lub qhov rai qhib yuav qhib thiab:

  • Luag "Teeb Hnub" thiab hauv qab lub qhov rai khoom teeb tsa "Tus nqi" rau koj hnub tam sim no
  • Luag "Teeb Xyoo" thiab hauv qab qhov khoom tsim qhov teeb tsa "Tus Nqi" rau koj xyoo tam sim no
  • Luag "Teeb Hli" thiab hauv qab qhov khoom tsim qhov teeb tsa "Tus nqi" rau koj lub hlis tam sim no
  • Luag "Teev Sijhawm" thiab hauv qab lub qhov rai khoom teeb tsa "Tus nqi" rau koj teev tam sim no
  • Luag "Teeb feeb" thiab hauv qab qhov khoom tsim qhov teeb tsa "Tus nqi" rau koj li feeb tam sim no

Xaiv "FormattedText1" tivthaiv thiab hauv cov khoom qhov rai teeb tsa "ntawv" rau:%0:%1:%2

Ob npaug nias rau "FormattedText1" tivthaiv, lub qhov rai qhib yuav qhib thiab:

Luag 3x "Text Element" mus rau sab laug

Ob npaug nias rau "DisplayNextion1" tivthaiv, lub qhov rai qhib yuav qhib thiab:

Luag 3x "Text" element mus rau sab laug thiab rau txhua ntu teeb tsa:

  • rau thawj lub npe nws lub sijhawm: Sijhawm
  • rau ntu thib ob lub npe nws: Kub
  • rau ntu thib peb lub npe nws: Vaum
  • Rau txhua ntu teeb tsa "Nplooj ntawv ntsuas": 0
  • rau thawj ntu teeb tsa "Element name": t0 (qhov no yog lub npe uas pom hauv Nextion editor saum toj no txhua qhov hauv kuv qhov xwm txheej nws t0)
  • rau ntu thib ob teeb tsa "Element name": t1 (qhov no yog lub npe uas pom hauv Nextion editor saum toj no txhua qhov hauv kuv qhov xwm txheej nws t1)
  • rau ntu thib ob teeb tsa "Element name": t2 (qhov no yog lub npe uas pom tau hauv Nextion editor saum toj no txhua qhov hauv kuv qhov xwm txheej nws t2)

Kauj Ruam 7: Hauv Visuino Connect Components

Hauv Visuino Connect Components
Hauv Visuino Connect Components
  • Txuas "Pib1" tus pin "Tawm" rau "RealTimeClock1"> "Teeb Hnub 1" tus pin "Clock"
  • Txuas "Pib1" tus pin "Tawm" rau "RealTimeClock1"> "Teeb Teev 1" tus pin "Clock"
  • Txuas "Pib1" tus pin "Tawm" rau "RealTimeClock1"> "Teeb Xyoo 1" tus pin "Clock"
  • Txuas "Pib1" tus pin "Tawm" mus rau "RealTimeClock1"> "Teeb Hli 1" tus pin "Clock"
  • Txuas "Pib1" tus pin "Tawm" mus rau "RealTimeClock1"> "Teem feeb 1" tus pin "Clock"
  • Txuas "RealTimeClock1" tiv thaiv tus pin [Tawm] rau "DecodeDateTime1" tus pin [Hauv]
  • Txuas "RealTimeClock1" tiv thaiv tus pin [Tswj] rau Arduino board I2C tus pin [Hauv]
  • Txuas "ClockGenerator1" tiv thaiv tus pin [Tawm] mus rau "HumidityThermometer1" tiv thaiv tus pin [Clock]
  • Txuas "DecodeDateTime1" tivthaiv rau tus pin [Teev] rau "FormattedText1"> "Textelement1" tus pin [Hauv]
  • Txuas "DecodeDateTime1" tivthaiv rau tus pin [Teev] rau "FormattedText1"> "Textelement2" tus pin [Hauv]
  • Txuas "DecodeDateTime1" tivthaiv rau tus pin [Teev] rau "FormattedText1"> "Textelement3" tus pin [Hauv]
  • Txuas "HumidityThermometer1" tivthaiv tus pin [Kub] mus rau "AnalogToText1" tivthaiv tus pin [Hauv]
  • Txuas "HumidityThermometer1" tiv thaiv tus pin [Vaum] rau "AnalogToText2" tiv thaiv tus pin [Hauv]
  • Txuas "HumidityThermometer1" tiv thaiv tus pin [Sensor] rau Arduino board digital pin [7]
  • Txuas "FormattedText1" tiv thaiv tus pin [Tawm] rau "DisplayNextion1" tiv thaiv tus pin Sijhawm [Hauv]
  • Txuas "AnalogToText1" tiv thaiv tus pin [Tawm] rau "DisplayNextion1" tiv thaiv tus pin Kub [Hauv]
  • Txuas "AnalogToText2" tiv thaiv tus pin [Tawm] rau "DisplayNextion1" tiv thaiv tus pin Vaum [Hauv]

Txuas "DisplayNextion1" tus pin [Tawm] rau arduino board "Serial [0]" tus pin [Hauv]

Kauj Ruam 8: Luam Nextion File rau SD Card

Nco ntsoov tias koj muaj cov ntawv Nextion ntawm SD card

  • Tua tawm Nextion Display
  • Muab daim npav SD tso rau Nextion Display
  • Qhib ON Nextion Display thiab koj yuav tsum pom qhov kev nce qib ntawm kev hloov kho Nextion zaub
  • Tua tawm Nextion Display
  • Tshem daim npav SD los ntawm Nextion zaub

Tam sim no Nextion Display tau npaj tiav.

Kauj Ruam 9: Tsim, Ua Ke, thiab Tshaj Tawm Arduino Code

Tsim, Sau, thiab Tso Tawm Arduino Code
Tsim, Sau, thiab Tso Tawm Arduino Code
Tsim, Sau, thiab Tso Tawm Arduino Code
Tsim, Sau, thiab Tso Tawm Arduino Code

Hauv Visuino, Nias F9 lossis nyem rau ntawm lub pob uas qhia ntawm daim duab 1 los tsim cov lej Arduino, thiab qhib Arduino IDE Hauv Arduino IDE, nyem rau ntawm Upload khawm, kom suav thiab xa cov cai (Daim duab 2) Nco tseg:

Nco ntsoov thaum koj rub tawm cov cai rau Arduino rau Disconnect Arduino tus pin [RX] thiab Arduino tus pin [TX] Tom qab rub tawm tiav txuas rov qab Arduino tus pin [RX] thiab Arduino tus pin [TX]

Kauj ruam 10: Ua si

Yog tias koj siv zog Arduino UNO module, Cov Zaub yuav pib qhia qhov ntsuas kub thiab av noo tam sim no + lub sijhawm uas koj teeb tsa hauv Visuino. Nrog koj zoo siab! Koj tau ua tiav koj txoj haujlwm chaw nres tsheb huab cua nrog Visuino.

Kuj txuas nrog yog Visuino qhov haujlwm, uas kuv tau tsim rau Cov Lus Qhia no Koj tuaj yeem rub tawm thiab qhib nws hauv Visuino:

thiab

Nextion Cov Ntaub Ntawv rau Nextion Editor (Weather. HMI) thiab suav ua cov ntawv Nextion (Weather.tft) uas koj tuaj yeem luam ncaj qha rau koj lub Nextion zaub.

Kauj Ruam 11: Cov peev txheej

Koj tseem tuaj yeem tshawb xyuas qhov kev qhia zoo no kom kawm paub ua haujlwm nrog Nextion Cov Lus Qhia li cas

Pom zoo: