Cov txheej txheem:

Raspi-Nextion Huab Cua Clock: 7 Kauj Ruam
Raspi-Nextion Huab Cua Clock: 7 Kauj Ruam

Video: Raspi-Nextion Huab Cua Clock: 7 Kauj Ruam

Video: Raspi-Nextion Huab Cua Clock: 7 Kauj Ruam
Video: Interface with Raspberry PI with Nextion Display 2024, Hlis ntuj nqeg
Anonim
Raspi-Nextion Huab Cua Clock
Raspi-Nextion Huab Cua Clock
Raspi-Nextion Huab Cua Clock
Raspi-Nextion Huab Cua Clock

Pom ntau lub moos sib txawv ua nrog arduino thiab raspberry Pi qhov kev tshoov siab kuv. Kuv xav ua ib yam nkaus.

Kuv pib los ntawm kev siv arduino mega nrog ESP8266 tab sis pom 8266 wifi kom muaj hiccups ntau dhau. Kuv txiav txim siab siv lub Pi uas kuv muaj (Raspberry Pi3 Model B) txawm hais tias kuv tsis tau siv Python. Kuv pom qee qhov kev qhia rau siv tus lej arduino ntawm Pi, tab sis txhua qhov no zoo li yog bandaids.

Raspi-Nextion Weather Clock siv Pi khiav Raspian txuas nrog Nextion 5 txhim kho screen.thru qhov chaw nres nkoj txuas nrog cov haujlwm sau hauv Python.

Kuv kuj tau luam tawm 3D (nrog kev pab ntawm qee tus phooj ywg) rooj plaub.

Sai li qhov program pib - nws tau txais hnub & sijhawm los ntawm Google

Nws tseem yuav tau txais huab cua siv thingspeak.com

Koj yuav tsum tau kos npe ntawm https://thingspeak.com/apps thiab siv ThingHTTP

Lub vijtsam yuav hloov raws li huab cua hloov pauv - piv txwv li: yog tias nws tshav ntuj tawm ntawm lub vijtsam yuav muaj lub hnub ci tom qab, yog tias nws daus, lub vijtsam yuav muaj daus puv tom qab

Lub vijtsam yuav tsaus ntuj thaum tsaus ntuj yog li koj tuaj yeem tsaug zog - qhov no tuaj yeem kho tau hauv qhov haujlwm raws li lub sijhawm nws dims thiab tsis pom kev

Thaum nws yog hnub so, koj yuav pom keeb kwm hnub so thiab lub vijtsam yuav rov qab tom qab yog li koj tuaj yeem pw hauv…

Txhua qhov keeb kwm yav dhau tuaj yeem kho tau siv cov software txuas ntxiv

tsim kev tshuaj ntsuam rau hnub yug, hnub tseem ceeb, hnub tseem ceeb…

Kauj Ruam 1: Daim Ntawv Teev Npe

Nov yog cov npe khoom thiab software kuv siv:

Kho vajtse

1. Raspberry Pi 3 Model B ($ 50 ntawm Amazon)

1a ib. Koj yuav xav tau microSD - Kuv muaj khoom seem nrog usb rau microSD adapter

2. Nextion 5 Enhanced Screen ($ 72 los ntawm ITead)

3. 2 tus neeg hais lus me me - xaiv tau - Kuv xav ntxiv 2 tus hais lus bluetooth

4. Bluetooth suab amp-yeem-https://www.amazon.com/INSMA-Amplifier-TDA7492P-Re…

5. lub zog siv hluav taws xob - xaiv tau - yog tias koj ntxiv tus hais lus nws zoo los ntxiv lub zog siv hluav taws xob uas yuav muab lub Raspberry thiab lub suab amp -

6. Kuv kuj tau ntxiv cov tshuab luam ntawv 3D rau txhua tus neeg nyiam

Software:

1 Raspian -

2. Win32 Disk Imager - siv los sau raspian rau microSD rau Raspberry Pi -

3. Nextion Editor - rau tsim kev teeb tsa kev tshuaj ntsuam tus kheej -

Ntxiv:

1. lub computer tshuaj ntsuam los txuas rau PI - ib ntus

2 usb keyboard thiab nas txuas rau pi - ib ntus

Kauj Ruam 2: Nruab Raspbian & Load Nextion Screen

Nruab Raspbian & Load Nextion Screen
Nruab Raspbian & Load Nextion Screen

Thaum koj tau rub tawm cov duab raspian, unzip lub iso rau koj lub PC.

Muab daim npav microSD tso rau hauv USB adapter thiab ntsaws rau hauv koj lub PC

Ua daim ntawv nrawm ntawm daim npav sd (fs = fat32)

Load qhov screen:

1. ntsaws daim npav SD rau hauv koj lub pc thiab muab cov ntawv hmi txuas rau ntawm daim npav

2. nruab microSD rau hauv Nextion screen thiab tso lub zog

3. tos kom cov duab thauj khoom. Thaum ua tiav tshem lub hwj chim los ntawm lub vijtsam thiab tshem daim npav

4. Ua daim ntawv nrawm ntawm daim npav SD (fs = fat32)

Load Rapian rau microSD:

Pib Win32 disk imager thiab sau cov duab rau microSD

1. xaiv tsab ntawv ntawm koj microSD

2. xaiv cov duab raspian iso ntawv koj unzipped

3. Nyem sau

4. Thaum ua tiav koj tuaj yeem kaw Win32 disk imager thiab tshem lub microSD ntawm koj lub pc.

5. Txuas lub microSD rau hauv raspberry Pi

Kauj Ruam 3: Pib Raspberry Pi & Txuas Nextion

Khau raj Raspberry Pi & Txuas Nextion
Khau raj Raspberry Pi & Txuas Nextion
Khau raj Raspberry Pi & Txuas Nextion
Khau raj Raspberry Pi & Txuas Nextion
Khau raj Raspberry Pi & Txuas Nextion
Khau raj Raspberry Pi & Txuas Nextion

Muaj qee qhov kev teeb tsa hloov pauv uas yuav tsum tau ua ntawm Raspberry Pi.

Piv txwv li, txhawm rau siv cov ntawv tso tawm ntawm Pi3 Model B, koj yuav tsum xiam lub bluetooth.

Sib sau ua ke PI thiab ntsaws rau hauv koj cov keyboard, nas, SD daim npav thiab pc lub vijtsam siv hdmi tso zis ntawm PI

1. Thaum koj ntsaws lub hwj chim rau hauv Pi, nws yuav pib khau raj. Thaum khau raj, koj yuav pom koj muaj lub desktop zoo nrog txhua yam koj xav tau twb tau teeb tsa.

1A. Nyem rau lub cim wifi nyob rau sab xis saum toj ntawm lub vijtsam thiab txuas Pi rau koj lub wifi thiab txuag qhov chaw

2. Lub npe ntawm GPIO 14 & 15 yog neeg xiam oob khab vim nws tau siv los ntawm bluetooth. Txhawm rau ua kom muaj kev sib txuas, koj yuav tsum ntxiv cov kab hauv qab no rau /boot/config.txt koj yuav tsum ua qhov no hla lub davhlau ya nyob twg siv sudo nano /boot/config.txt

  • nyem lub davhlau ya nyob twg icon (lub vijtsam dub screen) nyob rau sab saum toj ntawm lub vijtsam
  • ntaus sudo nano /boot/config.txt
  • siv koj cov xub, nqes mus rau hauv qab ntawm qhov screen thiab ntxiv kab hauv qab no mus rau hauv qab ntawm cov ntawv

#disable bluetooth li nextion tuaj yeem ua haujlwm ntawm cov lej 0

dtoverlay = pi3-disable-bt enable_uart = 1

enable_uart = 1

  • Thaum cov kab no tau ntxiv, tom ntej no peb txuag thiab tawm mus
  • nias tswj x kom tawm
  • nias Y kom txuag tau
  • nias [sau] kom txuag tau cov ntaub ntawv

kaw & tshem tawm pwr los ntawm pi

rov pib dua.

qhib lub davhlau ya nyob twg thiab ntaus pinout

peb yuav siv GPIO 14 & 15 rau cov lej txuas mus rau qhov txuas ntxiv mus

Koj yuav pom tus pin ntawm Raspberrys GPIO yog GPIO 14 & 15 ntawm qhov screen

3. Kaw Pi thiab txuas lub vijtsam raws li qhia hauv kab ntawv txuas

4. Pib dua Pi

5. Qhib lub davhlau ya nyob twg thiab ntaus sudo raspi-config

6. mus rau Interfacing cov kev xaiv, tom qab ntawv txuas thiab ua kom lub chaw nres nkoj txuas thiab ua haujlwm tsis zoo

7. Tab kom tiav

8. Rov pib dua ib zaug

Kauj Ruam 4: Sau Koj Txoj Haujlwm Python

Sau Koj Txoj Haujlwm Python
Sau Koj Txoj Haujlwm Python

Xaiv qhov koj nyiam nab nab IDE thiab mus rau coding…

Kuv xaiv Geany raws li nws twb tau teeb tsa ntawm Raspian duab. Nws kuj tseem siv tau yooj yim heev thiab sim qhov program tsis tuaj yeem yooj yim dua. Txhua yam koj yuav tsum ua yog nyem lub cim lub dav hlau daim ntawv nyob rau sab saum toj ntawm Geany npo thiab nws pib qhov haujlwm

Kuv tau txuas kuv qhov program ua piv txwv. Qhov no yuav pab qhia koj yuav ua li cas nkag mus rau qhov chaw nres nkoj thiab cov haujlwm sib txawv ntawm Nextion screen. Xav tias dawb los kho raws li koj pom haum

Kauj Ruam 5: Pib Txoj Haujlwm Thaum Raspberry Boots …

Pib Txoj Haujlwm Thaum Raspberry Boots…
Pib Txoj Haujlwm Thaum Raspberry Boots…

Txog lub sijhawm no, koj yuav tsum muaj peev xwm ua qhov haujlwm ntawm koj lub vijtsam

Yog tias koj xav kom tuaj yeem ua haujlwm koj li raspberry pi program tsis muaj cov keyboard, nas thiab pc screen ua raws cov theem hauv qab no.

1. ntxiv kab no rau saum koj qhov program #!/Usr/bin/nab hab sej

2. ua kom koj cov haujlwm tiav los ntawm kev siv chmod hais kom ua hauv davhlau ya nyob twg.

  • nyem lub nplaub tshev icon nyob rau sab saud ntawm Raspian screen thiab mus rau daim nplaub tshev uas koj qhov program nyob. Kuv yog ntawm lub desktop hauv daim nplaub tshev npe py
  • Txoj nyem rau ntawm daim nplaub tshev (Kuv yuav nyem rau ntawm daim nplaub tshev py thiab xaiv qhib davhlau ya nyob twg)
  • Ntaus cov lus txib sudo chmod +x ua raws los ntawm txoj hauv kev mus rau qhov haujlwm thiab nyem [nkag mus]
  • sudo chmod +x /home/pi/Desktop/py/NameOfProgram.py
  • kaw lub davhlau ya nyob twg thaum ua tiav

3. Tam sim no txav mus rau /etc nplaub tshev

4. Txoj nyem rau ntawm daim nplaub tshev thiab xaiv qhib ternal

5. Hauv davhlau ya nyob twg hom sudo nano rc.local

6. Siv koj cov xub, nqes mus rau hauv qab ntawm nplooj ntawv, mus rau kab saum toj saud tawm 0

7. Ntxiv txoj hauv kev rau koj txoj haujlwm ua haujlwm /home/pi/Desktop/py/NameOfProgram.py

8. Nyem tswj + x kom tawm, Y txuag thiab nyem [nkag mus]

8a ib. [Kho kom raug] - Koj tseem yuav tsum ua rc.local cov ntaub ntawv ua tiav los ntawm tam sim no ntaus ntawv sudo chmod a+X rc.local

9. Reboot tus pi los ntawm ntaus reboot hauv lub davhlau ya nyob twg thiab thaum nws rov pib dua qhov haujlwm yuav tsum pib ua haujlwm:)

Kauj Ruam 6: Xaiv Cov Hais Lus Bluetooth

Yeem Bluetooth Hais Lus
Yeem Bluetooth Hais Lus
Yeem Bluetooth Hais Lus
Yeem Bluetooth Hais Lus

Lub bluetooth audio amp xav tau raws li peb xiam bluetooth siv lub chaw nres nkoj

Yog tias siv cov lus qhia hluav taws xob, koj yuav tsum tshem tawm cov xov hlau thiab siv 5V rau Raspberry thiab 12V rau bluetooth suab amp.

Txuas lub zog thiab hais lus raws li daim duab txuas.

Cov hais lus kuv siv tau coj los ntawm qhov qub tsis ua haujlwm bluetooth chav ntxuam/hais lus teeb

Kauj Ruam 7: Siv ThingSpeak

Siv ThingSpeak
Siv ThingSpeak

Koj yuav tsum tau kos npe ntawm https://thingspeak.com/apps thiab siv ThingHTTP

Kuv pib ib qho rau qhov kub thiab lwm qhov rau huab cua piv txwv li: tshav ntuj. pos huab, snow …

Thaum teeb tsa ThingHttp, koj yuav xav tau URL txhawm rau xa daim ntawv thov mus rau

Kuv siv -

Txoj kev yog Tau

HTTP ver - 1.0

Parse txoj hlua yog qhov nyuaj me ntsis

1. Mus rau qhov chaw huab cua hauv av rau koj lub nroog

2. Hauv google chrome, nias F12 (mus rau kauj ruam 3 lossis 3a)

3. Ntawm sab xis ntawm qhov screen, nrhiav thiab nyem lub cim rau "xaiv ib qho hauv nplooj ntawv los tshuaj xyuas"

3a ib. Los yog qhov tseem ceeb thiab nyem rau ntawm kab ntawv uas koj xav tau thiab xaiv "Txheeb Xyuas" (hla mus rau qib 5)

4. Tam sim no hais txog qhov ntsuas kub

5. Ntawm sab xis koj yuav pom kab ib qho hais txog - Txoj cai nyem rau kab no, mus theej thiab xaiv Luam XPath

6. Txuag qhov no raws li koj txoj kab ntawv cais hauv koj li teeb tsa

7. Txuag yam khoom HTTP thiab koj yuav muab qhov txuas rau siv rau txoj haujlwm nrog koj li API Key

8. Teeb koj qhov txuas ib yam li kuv muaj hauv qhov program.

9. Koj tuaj yeem sim qhov kev thov yooj yim nrog txoj haujlwm hu ua Insomnia, tab sis qhov ntawd yog lwm qhov kev qhia..

Pom zoo: