Cov txheej txheem:

E-Ink: Lub hli / ISS / Cov neeg hauv Chaw : 6 Kauj Ruam
E-Ink: Lub hli / ISS / Cov neeg hauv Chaw : 6 Kauj Ruam

Video: E-Ink: Lub hli / ISS / Cov neeg hauv Chaw : 6 Kauj Ruam

Video: E-Ink: Lub hli / ISS / Cov neeg hauv Chaw : 6 Kauj Ruam
Video: Моя работа наблюдать за лесом и здесь происходит что-то странное 2024, Hlis ntuj nqeg
Anonim

Los ntawm emihermesFollow Ntxiv los ntawm tus sau:

Sijhawm Lapse Nrog Raspberry PI
Sijhawm Lapse Nrog Raspberry PI
Sijhawm Lapse Nrog Raspberry PI
Sijhawm Lapse Nrog Raspberry PI

Kuv muaj Raspberry thiab e-Paper HAT thiab kuv xav siv nws los qhia cov ntaub ntawv zoo li ISS nyob qhov twg lossis muaj pes tsawg tus neeg tam sim no nyob hauv qhov chaw …

Kuv tau hais kom saib yog tias muaj APIs hauv Is Taws Nem kom tau txais cov ntaub ntawv ntawd, thiab kuv pom lawv. OK, tau txais !!!!

Tos, HAT no muaj 4 khawm, thiab tom qab ntawd, kuv xav tau 4 cov ntaub ntawv los qhia …

- Tam sim no ISS nyob qhov twg?- Tam sim no muaj pes tsawg tus neeg nyob hauv qhov chaw?- Nyob rau theem twg yog lub hli?- Nws puas yuav los nag? Nws sov heev? …

Tam sim no, kuv tab tom qhia cov ntaub ntawv no, tab sis kuv tuaj yeem hloov kho qhov "Qhia" no sai li sai tau thaum kuv tau txais lub tswv yim zoo, lossis yog tias koj paub qhov zoo, koj tuaj yeem qhia nws rau kuv !!!

Zoo, Kuv tau ua nws ib hmo thiab "FrontEnd" tau xaus ob peb hnub tom qab. Tsis txhob yws yws txog cov ntaub ntawv qhia li cas, Kuv tsis nyiam ua qhov no:)

Khoom siv

- Raspberry PI (Xoom txaus).- 2.7inch e-Paper HAT. (Kuv yuav kuv li ntawm no)- SD daim npav (4Gb txaus).

Koj kuj tseem xav tau Token los ntawm OpenWeather siv lawv APIs (los ntawm no)

Kauj Ruam 1: Hloov Kho Software (SO)

Hloov Kho Software (SO)
Hloov Kho Software (SO)
Hloov Kho Software (SO)
Hloov Kho Software (SO)
Hloov Kho Software (SO)
Hloov Kho Software (SO)

Thawj kauj ruam, ib txwm, yog npaj koj li Raspberry PI nrog OS tshiab tshaj plaws.- Rub tawm OS tshiab kawg (nrog lub desktop) los ntawm no.- Sau daim duab ntawm daim npav SD tsis muaj dab tsi.- Tsim cov ntawv tsis muaj "ssh" kom pab tau kev sib txuas SSH.- Txuag "wpa_supplicant.conf" cov ntaub ntawv ntawm daim npav SD kom koj lub Wifi teeb tsa los txuas rau koj li Raspberry PI ntawm SSH (koj tau npaj nws hauv koj lub computer, kuv paub nws).

Pib koj Raspberry Pi.

Txuas mus rau nws ntawm SSH (koj tseem tuaj yeem ua nws yog tias koj muaj tus saib xyuas, keyboard thiab nas, tab sis kuv tsis muaj thiab kuv nyiam txuas ntawm SSH) thiab hloov kho nws….

sudo apt -tau hloov tshiab -y

sudo apt -tau hloov tshiab -y

Tam sim no, koj yuav tsum pab kom VNC muaj peev xwm sib txuas tau deb thiab SPI rau e-Paper HAT:

sudo raspi-teeb tsa

Kev xaiv cuam tshuam> VNC> YogInterfacing Options> SPI> Yog

Thiab reboot nws.

Kauj ruam 2: Xav tau Software

Xav Tau Software
Xav Tau Software

Ok, tam sim no peb tau khiav Raspberry PI nrog cov software tshiab kawg thiab txhua qhov pib los txuas rau nws.

Nws yog lub sijhawm los pib txhim kho cov software xav tau los tswj hwm e-Paper HAT.

Yog tias koj tsis tau ntsaws HAT ntawm koj li Raspberry PI, tam sim no yog lub sijhawm kawg los txuas nws. Hloov koj li Raspberry PI thiab muab HAT rau nws.

Rau cov kauj ruam tom ntej koj tuaj yeem ua raws cov lus qhia los ntawm Waveshare lossis ua raws nws nrog cov kauj ruam tom ntej….

Nruab BCM2835 cov tsev qiv ntawv:

wget

tar zxvf bcm2835-1.60.tar.gz cd bcm2835-1.60/sudo./configure sudo ua sudo ua kos sudo ua install #For more details, please refer to

Nruab wiringPi cov tsev qiv ntawv:

sudo apt-tau nruab wiringpi

#Rau Pi 4, koj yuav tsum hloov kho nws : cd/tmp wget https://project-downloads.drogon.net/wiringpi-latest.deb sudo dpkg -i wiringpi-latest.deb gpio -v #Koj yuav tau txais 2.52 cov ntaub ntawv yog tias koj nruab nws kom raug

Nruab Python cov tsev qiv ntawv: (Yog tias koj hloov kho SO nrog qhov hloov tshiab kawg, txhua qib no yuav zoo li "Yuav tsum tau ua tiav lawm").

sudo apt-tau hloov tshiab

sudo apt-tau nruab python3-pip sudo apt-tau nruab python3-pil sudo apt-tau nruab python3-numpy sudo pip3 nruab RPi. GPIO sudo pip3 nruab spidev

Tam sim no koj tuaj yeem rub tawm cov piv txwv los ntawm Waveshare: (Qhov no tsis xav tau, tab sis koj tuaj yeem rub tawm lawv kom paub tias nws ua haujlwm li cas).

sudo git clone

cd e-Paper/RaspberryPi / & JetsonNano/

Kuv pom zoo kom koj tshem qee cov ntawv:- e-Paper/Arduino (Nws yog Raspberry PI).- e-Paper/STM32 (Nws yog Raspberry PI).- e-Paper/Raspberry & JetsonNano/c (peb yuav siv nab nab. ntawm qhov project no).

Koj yuav tsis siv lawv, thiab koj tsis xav tau lawv ntawm Raspberry PI.

Thiab, yog tias koj xav tau, koj tuaj yeem tshem tawm txhua cov ntaub ntawv uas koj tsis xav tau los ntawm "lib" nplaub tshev, xws li: - epd1in02.py - epd1in54.py - epd2in9.py - …

Yog tias peb yuav siv 2.7inch, cov ntawv ntxiv tsis xav tau.

Kuv pom zoo kom koj txav lub "lib" nplaub tshev me ntsis rov qab los siv nws yooj yim:

sudo mv lib/tsev/pi/e-Ntawv/

Txawm li cas los xij, hauv kuv cov cai (los ntawm GitHub) cov tsev qiv ntawv suav nrog.

Txhua qhov xav tau software tau teeb tsa.

Cov kauj ruam tom ntej yog peb tus lej!

Kauj Ruam 3: Rub Kuv Cov Cai

Tam sim no peb yuav tsum rub tawm cov cai los ntawm GitHub:

sudo git clone

Nrog rau qhov no peb yuav muaj txhua txoj cai xav tau, suav nrog cov tsev qiv ntawv los ntawm Waveshare rau hauv qhov haujlwm tiag.

Kho cov ntaub ntawv "ShowInfo.py" txhawm rau ntxig koj li API-Token los ntawm OpenWeather.com….… Thiab Lub Nroog (siv lub npe lossis tus lej ntawm lub nroog):

def WeatherForecast (): cov

url = "https://api.openweathermap.org/data/2.5/forecast?" #url = url + "q = {city_name}" #url = url + "q = Düsseldorf" #ASCII teeb meem !!! url = url + "id = 2934246" #url = url + "& appid = {your_API_key}" url = url + "& units = metric" # Hauv Metric url = url + "& cnt = 6" # Tsuas yog 6 qhov tshwm sim

Txawm li cas los xij, peb yuav tsum tau teeb tsa cov ntawv fonts uas peb siv ntawm txoj haujlwm. Cov ntaub ntawv raug rub tawm nrog txhua tus lej.

Cov fonts nyob ntawm "e-Paper/fonts" nplaub tshev.

Txhawm rau unzip:

sudo unzip Bangers.zip -d/usr/qhia tawm/fonts/truetype/google/

sudo unzip Bungee_Inline.zip -d/usr/share/fonts/truetype/google/sudo unzip Bungee_Outline.zip -d/usr/share/fonts/truetype/google/sudo unzip Bungee_Shade.zip -d/usr/share/fonts/ truetype/google/sudo unzip droid-sans.zip -d/usr/qhia tawm/fonts/truetype/google/sudo unzip Indie_Flower.zip -d/usr/share/fonts/truetype/google/sudo unzip Jacques_Francois_Shadow.zip -d/ usr/qhia tawm/fonts/truetype/google/sudo unzip Londrina_Outline.zip -d/usr/qhia tawm/fonts/truetype/google/sudo unzip Londrina_Shadow.zip -d/usr/share/fonts/truetype/google/sudo unzip Londrina_Sketch. zip -d/usr/qhia tawm/fonts/truetype/google/sudo unzip Oswald.zip -d/usr/qhia tawm/fonts/truetype/google/sudo unzip Roboto.zip -d/usr/share/fonts/truetype/google/ sudo unzip Vast_Shadow.zip -d/usr/qhia tawm/fonts/truetype/google/

Kuv qhia koj kom rho tawm cov zip cov ntaub ntawv tom qab teeb tsa, vim tias peb tsis xav tau cov ntawv ntawd ntxiv lawm:

sudo rm -R fonts

Kauj Ruam 4: Ua TEST

Ua TEST
Ua TEST
Ua TEST
Ua TEST

Mus rau qhov tseeb nplaub tshev uas peb muaj cov ntawv xeem:

cd ~/eInk_Moon_ISS_PeopleSpace/e-Ntawv/ShowEInk

Ua cov ntawv xeem nrog version 3 ntawm Python:

python3 Test001.py cov

Koj yuav muaj cov kab lus taug qab thaum lub program tau ua tiav.

Thiab hauv e-Paper screen koj yuav pom cov lus.

Rau txhua khawm, lub vijtsam yuav qhia cov lus sib txawv.

Kauj Ruam 5: Qhia Lub Hli / Chaw / ISS Cov Ntaub Ntawv…

Qhia lub hli / Chaw / ISS Cov Ntaub Ntawv…
Qhia lub hli / Chaw / ISS Cov Ntaub Ntawv…
Qhia lub hli / Chaw / ISS Cov Ntaub Ntawv…
Qhia lub hli / Chaw / ISS Cov Ntaub Ntawv…
Qhia lub hli / Chaw / ISS Cov Ntaub Ntawv…
Qhia lub hli / Chaw / ISS Cov Ntaub Ntawv…
Qhia lub hli / Chaw / ISS Cov Ntaub Ntawv…
Qhia lub hli / Chaw / ISS Cov Ntaub Ntawv…

OK, peb txhua tus tau khiav thiab tam sim no peb xav pom qhov twg yog ISS thoob ntiaj teb, lossis theem ntawm lub hli …

Ua ntej koj yuav tsum ua cov ntaub ntawv "ShowInfo.py" (nyob ntawm "~/eInk_Moon_ISS_PeopleSpace/e-Paper/ShowEInk").

python3 ~/eInk_Moon_ISS_PeopleSpace/e-Paper/ShowEInk/ShowInfo.py

Thiab tam sim no, yog tias koj nias ib lub pob, koj yuav muaj cov ntaub ntawv ua haujlwm rau lub pob no:

● Khawm 1: Huab cua huab cua.

● Khawm 2: Leej Twg Nyob Hauv Qhov Chaw thiab Qhov Twg.

● Khawm 3: ISS nyob qhov twg thoob ntiaj teb.

● Khawm 4: Qhia Txog Lub Hli.

Kauj Ruam 6: Ua Nws Li Kev Pabcuam

Raws li lwm txoj hauv kev, Python tsab ntawv tuaj yeem pib thaum pib los ntawm kev tsim cov kev pabcuam - cov ntaub ntawv ntau ntxiv ntawm

Tsim cov ntaub ntawv tshiab hu ua ShowInfo.service thiab luam cov ntsiab lus hauv qab no rau hauv cov ntawv tshiab - kho txoj haujlwm ua haujlwm raws li txoj hauv kev:

[Chav]

Nqe lus piav = ShowInfo Tom qab = network-online.target Xav = network-online.target [Service] ExecStart =/usr/bin/python3 ShowInfo.py WorkingDirectory =/home/pi/eInk_Moon_ISS_PeopleSpace/e-Paper/ShowEInk/StandardOutput = inherit StandardError = txais qub txeeg qub teg = ib txwm Siv = pi [Nruab Nrab] WantedBy = ntau-user.target

Luam cov ntaub ntawv ShowInfo.service rau/etc/systemd/system li hauv paus:

sudo cp ShowInfo.service/etc/systemd/system/

Pib qhov kev pabcuam:

sudo systemctl pib ShowInfo.service

Txheeb xyuas yog tias qhov kev pabcuam ua haujlwm:

sudo systemctl xwm txheej ShowInfo.service

Cov zis yuav tsum zoo ib yam li:

● ShowInfo.service - ShowInfo

Loaded: loaded (/etc/systemd/system/ShowInfo.service; xiam oob qhab; tus muag khoom preset: qhib) Active: nquag (khiav) txij hnub Friday 2020-09-11 15:17:16 CEST; 14s dhau los Lub ntsiab PID: 1453 (python3) CGroup: /system.slice/ShowInfo.service └─1453/usr/bin/python3 ShowInfo.py Sep 11 15:33:17 eInk systemd [1]: Pib ShowInfo.

Yog tias qhov kev pabcuam tau ua haujlwm zoo, koj tuaj yeem pab nws thiab rov pib dua Raspberry Pi kom thauj khoom nws thaum lub sijhawm khau raj:

sudo systemctl pab ShowInfo.service

Txhawm rau nres qhov kev pabcuam:

sudo systemctl nres ShowInfo.service

Thiab yog txhua yam !!!!!

Ua tsaug !!!!!

Pom zoo: