Cov txheej txheem:

Raspberry Pi Amateur Radio Digital Clock: 8 Kauj Ruam (nrog Duab)
Raspberry Pi Amateur Radio Digital Clock: 8 Kauj Ruam (nrog Duab)

Video: Raspberry Pi Amateur Radio Digital Clock: 8 Kauj Ruam (nrog Duab)

Video: Raspberry Pi Amateur Radio Digital Clock: 8 Kauj Ruam (nrog Duab)
Video: 10 самых АТМОСФЕРНЫХ мест Дагестана. БОЛЬШОЙ ВЫПУСК #Дагестан #ПутешествиеПоДагестану 2024, Kaum ib hlis
Anonim
Raspberry Pi Amateur Xov Tooj Cua Digital
Raspberry Pi Amateur Xov Tooj Cua Digital

Txheej txheem cej luam

Amateur Radio Operators (aka HAM Radio) siv 24 teev UTC (Universal Coordinated Time) rau ntau ntawm lawv cov haujlwm. Kuv txiav txim siab tsim lub moos digital siv tus nqi qis TM1637 4 tus lej qhia thiab Raspberry Pi Zero W hloov chaw tsuas yog GUI moos. (Kho vajtse yog kev lom zem!)

TM1637 cov zaub uas tau tsav muaj plaub 7 ntu leds nrog lub hauv paus nyuv ":" nruab nrab ntawm ob pawg lej. Nws xav tau ob lub xov hlau los tsav cov zaub ntxiv rau 5V + thiab Av rau tag nrho ntawm 4 xov hlau.

Txog qhov haujlwm tshwj xeeb no, Kuv xav kom Raspi tau txais nws lub sijhawm los ntawm NTP (Network Time Protocol) servers ntawm Internet. Kuv tab tom npaj lwm lub sijhawm ntawm lub moos no los ua haujlwm ntawm Arduino Uno thiab Lub Sijhawm Sijhawm Sijhawm tiag, rau thaum tsis muaj WiFi muaj thiab rau kev ua haujlwm ntau dua.

Kuv kuj xav kom lub moos qhia Lub Sijhawm Hauv Zos hauv 12 teev thiab 24 teev ib yam li UTC hauv 12 teev thiab 24 teev. Lub software tau tsim los tso cai rau koj siv tsuas yog UTC 24 teev (hams raug) lossis lub sijhawm sib txawv ntawm txog 4 qhov sib txawv.

Koj tseem tuaj yeem teeb tsa ZOO ZOO ZOO uas koj xav siv tsis yog lub sijhawm hauv zos. Yog li txhua ntawm plaub qhov lus pom tuaj yeem qhia lub sijhawm sib txawv thiab hauv 12 teev lossis 24 teev hom.

Txoj haujlwm no xav tau kev sib txuas txuas lossis xov hlau mus rau Pi thiab/lossis tm1637 cov qauv.

Cov lus qhia tag nrho kuj muaj nyob ntawm GITHUB:

Kauj ruam 1: Yuav tsum tau ua

Yuav tsum muaj
Yuav tsum muaj

• Raspberry Pi2, 3, lossis Zero W. (piv txwv li ib qho pi nrog 40 tus pin header thiab Ethernet/Wifi)

• 4-TM1637 4 digit Display modules

Thiab/lossis

NCO TSEG: koj tuaj yeem siv qhov loj dua lossis me dua, tsuav yog lawv sib haum TM1637.

• Cov hlua xaim nrog 16 xaim (txhua TM1637 xav tau 4 xov hlau)

• Solderless Breadboard thiab xov hlau Los yog

• Solder-tau Breadboard & ntau tus pin txuas.

• 8GB MicroSD lossis loj dua rau Pi

• 5v fais fab mov rau Pi.

Kauj Ruam 2: Kev Txhim Kho Software

Daim ntawv thov no siv qhov yooj yim siv 161637.py python tsev qiv ntawv sau los ntawm Tim Waizenegger. (Yog tias koj xav paub ntxaws txog lub tsev qiv ntawv, txheeb xyuas:

Koj puas paub?

Yog tias koj nruab Raspbian ntawm daim npav SD siv PC, koj tuaj yeem tsim ob daim ntawv ntawm daim npav txhawm rau teeb tsa WiFi thiab SSH nkag ua ntej koj khau raj ntawm Raspberry?

Txog qhov no, xav tias koj daim npav SD tam sim no tau teeb tsa ua K: ntawm koj lub PC:

1) Nruab Raspbian Lite duab rau SD.

www.raspberrypi.org/software/operating-systems/#raspberry-pi-os-32-bit

2) Nrog notepad, tsim cov ntawv hu ua "ssh" thiab siv Txuag Raws li "Txhua cov ntaub ntawv" rau K: / ssh

Cov ntawv tuaj yeem muaj dab tsi. Nws yog lub npe ntawv uas tseem ceeb. Yuav tsum tsis yog "ssh.txt" !!!

3) Nrog notepad, tsim cov ntaub ntawv thib ob hu ua "wpa_supplicant.conf" nrog rau hauv qab no:

ctrl_interface = DIR =/var/run/wpa_supplicant GROUP = netdevupdate_config = 1 network = {ssid = "mySSID" psk = "mypassword" key_mgmt = WPA-PSK}

Siv Txuag Raws Li "Txhua cov ntaub ntawv" rau K: / wpa_supplicant.conf

Ib zaug ntxiv, tsis txhob cia Notepad hloov nws mus rau “wpa_supplicant.conf.txt” !!

Thaum koj khau raj Raspberry thawj zaug, Raspbian yuav nrhiav cov no thiab txuas rau koj li Wifi. Koj yuav tsum tau saib ntawm koj tus Router rau tus IP chaw nyob, txawm li cas los xij, txij li nws tau pib ua haujlwm.

Kauj Ruam 3: Kev Txhim Kho Software - Pt.2

1. Yog tias koj tseem tsis tau muaj, teeb tsa Raspbian Lite version mus rau 8GB lossis loj dua daim npav microSD. Koj TSIS TXHOB xav tau GUI version, vim qhov haujlwm no tsis siv lub monitor lossis keyboard.

NCO TSEG!: Txoj haujlwm no xav kom Python2.7!

www.raspberrypi.org/software/operating-systems/#raspberry-pi-os-32-bit

2. Koj yuav tsum nkag mus rau Raspberry nyob deb ntawm SSH. Ntawm Windows, koj tuaj yeem siv PUTTY SSH lub davhlau ya nyob twg. Ntawm Mac, tsuas yog nqa cov lus txib qhib qhov rai.

3. Ntxig daim npav microSD rau hauv Pi thiab ntsaws lub zog tam sim no. Nws yuav siv ob peb feeb los khau raj.

4. Txhawm rau nkag mus rau koj tus Raspberry Pi nyob deb, koj yuav tsum nrhiav nws tus IP chaw nyob. Koj tuaj yeem sim: $ ssh [email protected] (Los yog los ntawm Putty, nkag mus rau hostname [email protected] Txwv tsis pub, koj yuav tsum tau saib yog tias koj li Router yuav qhia tus IP chaw nyob ntawm koj li khoom siv hauv paus. Default id/passwd is “pi /Raspberry Cov.

Thaum nkag mus ua tus neeg siv pi:

5. Hloov kho koj tus Raspbian: $ sudo apt hloov tshiab $ sudo apt hloov tshiab

6. Kho qhov Raspberry: $ sudo raspi-config a. Hloov Tus Neeg Siv Tus password b. Localization Options -> Hloov Timezone Xaiv koj Lub Sijhawm Zaum Hauv Z c. Tab kom tiav

7. Nruab RaspiDigiHamClock software: $ cd/home/pi $ sudo apt hloov tshiab $ sudo apt nruab git $ git clone

8. Fais fab tuag koj tus Pi rau teeb tsa kho vajtse $ kaw tam sim no Tom qab LED tawm mus tshem lub hwj chim

Kauj Ruam 4: Kev Kho Vajtse

Kho vajtse thaiv
Kho vajtse thaiv
Kho vajtse thaiv
Kho vajtse thaiv
Kho vajtse thaiv
Kho vajtse thaiv

Koj tuaj yeem txuas cov kab txuas mus rau TM1637 cov qauv thiab Raspberry Pi (yog tias nws tsis muaj qhov txuas). Ua ntej pib, txiav txim siab yuav ua li cas koj xav teeb tsa cov lus qhia thiab yog tias koj yuav siv lub khob cij los yog cov kab hlau txuas ncaj qha mus rau Pi thiab tso saib cov qauv.

TM1637 Module Pins

Cov Lus Cim Txuas: Qee qhov tm1637 modules tig lub +5v thiab GND pins! Yog li yuav tsis tshwm tib yam li cov duab.

TM1637 tus qauv yog 4 tus lej coj ua qauv uas siv TM1637 tus tsav tsheb nti. Nws xav tau tsuas yog ob qhov kev sib txuas los tswj 4-tus lej 8-ntu zaub. Ob lub xov hlau txuas ntxiv 5+ lub zog hluav taws xob thiab hauv av.

PIN DESC CLK Moos DIO Cov Ntaub Ntawv Hauv GND Av 5V +5 volts

Qee qhov tm1637 modules tig lub +5v thiab GND pins, yog li xyuas koj cov cim cim

Kuaj txhua qhov ModuleI qhia kom pib nrog ib leeg 4 xaim poj niam txuas txuas txuas nrog txiv neej txuas txuas rau ib qho ntawm cov qauv thiab Pi. Tom qab ntawd ib ntus txuas thawj tus qauv mus rau cov koob qhia hauv qab no.

TEMPORARY TEST A MODULETM1637 Module Pin Pi Physical Pin# 5V 2 GND 6 CLK 40 DIO 38 Saib GPIO Diagrams nyob deb dua kom pom tus pin teeb tsa.

Daim duab thib ob qhia pom ob qho khoom siv ib ntus rau Raspberry Pi 3 nrog rau software ua haujlwm.

1. Thaum koj muaj tus qauv txuas ib ntus thiab tshawb xyuas koj cov thaiv

2. Fais fab Raspberry Pi. Liab LED ntawm Module yuav tsum teeb, tab sis yuav tsis muaj DISPLAY tseem.

3. SSH rau hauv koj Pi dua li yav tas los.

$ cd RaspiDigiHamClock

$ python test.py

Koj yuav tsum pom lub voj voog tso tawm los ntawm ntau yam lus luv. Yog tias koj tsis ua, xub tshuaj xyuas koj cov xov ntxiv! Nws yog qhov yooj yim tig lub xaim lossis txuas rau qhov tsis raug GPIO Pin ntawm Pi. Yog tias koj tau txais Python lus yuam kev, txheeb xyuas koj li Python version siv:

$ nab nab -V (peev "V")

Nab hab sej 2.7. X

Kuv tsis tau sim tawm tsam Python 3, yog li tsis paub tseeb tias lub tsev qiv ntawv puas sib xws.

Luam cov lus yuam kev (feem ntau yog kab kawg ntawm qhov ua yuam kev) thiab Muab tshuaj txhuam rau hauv Google tshawb nrhiav. Qhov no tuaj yeem qhia meej txog qhov tshwm sim.

Yog tias koj tus qauv ua haujlwm, Zoo siab nrog koj! Koj paub tus qauv thiab Pi ua haujlwm. Tam sim no rov ua dua rau txhua tus qauv los ntsuas nws. (Kuv hais kom kaw Pi thiab tshem tawm ua ntej plugging/unplugging modules !!)

$ sudo kaw tam sim no

Kauj Ruam 5: GPIO Pins ntawm Raspi

GPIO Pins ntawm Raspi
GPIO Pins ntawm Raspi
GPIO Pins ntawm Raspi
GPIO Pins ntawm Raspi
GPIO Pins ntawm Raspi
GPIO Pins ntawm Raspi

Txoj haujlwm no siv GPIO lub cev BOARD ID rau Pins.

Ntawd yog Tus Pin 1 txog Tus Pin 40. Tsis yog "BCM" GPIO tus lej lej. (Yog, me ntsis tsis meej pem, tab sis BOARD tsuas yog tus lej suav los ntawm sab laug mus rau sab xis hauv qab.)

Zaub Module TM1637 Module Pin Pi Lub Cev Pin#Lub Hwj Chim 5V 2 Av GND 6

Qauv #1 CLK 33

PAB 31

Qauv #2 CLK 36

PIB 32

Qauv #3 CLK 37

PAB 35

Qauv #4 CLK 40

PAB 38

Nco tseg: Koj tsis tas yuav ntxiv tag nrho 4 tus qauv yog xav tau. Koj tuaj yeem muaj ntawm 1 thiab 4 tus qauv. (Yog lawm, nws tuaj yeem mus rau ntau qhov qauv, tab sis koj yuav tsum hloov kho txoj cai los txhawb nqa ntxiv.)

TAB SIS, koj YUAV TSUM ntsaws rau hauv cov modules ua ntu zus pib ntawm Module #1

Qhov no vim tias TM1637 lub tsev qiv ntawv cia siab tias ACK los ntawm tus qauv yog li zoo li dai tos lwm yam.

Cov duab piv txwv ntawm Soldered BreadboardKoj yuav tsum ua raws li koj tus kheej cov qauv thaiv kom phim GPIO pins qhia ua ntej, txij li cov txuas thiab cov qauv uas kuv siv yuav tsis haum koj li.

Kauj ruam 6: Xeem

Wow, qhov ntawd yog qhov txuas me ntsis! Tam sim no lub sijhawm rau kev sim haus luam yeeb…

Txij li koj twb paub tus kheej cov qauv thiab Pi ua haujlwm (koj tau sim cov qauv raws li tau piav qhia yav dhau los?), Tom qab ntawd cov kauj ruam tom ntej yog teeb tsa. INI cov ntaub ntawv thiab ua haujlwm lub moos:

1. Kho qhov raspiclock.ini

$ cd/tsev/pi/RaspiDigiHamClock

$ nano raspiclock.ini

2. Hloov tus lej_modules rau pes tsawg tus koj tau txuas. Qhov no tseem ceeb heev li lub tsev qiv ntawv yuav tos tos ACK yog tias nws tsis tuaj yeem tham nrog tus qauv. Nco ntsoov xaim xov tooj ntawm cov qauv, NYEEM NTAWV QHIA SHOW hauv. INI Nco tseg: Ntxiv TZ thiab HR thiab GPIO PINS raug tsis quav ntsej yog cov lej_modules tsawg dua 4.

3. Ntxiv Timezones rau txhua tus qauv.

Nov yog Linux TZ Cov Npe, zoo li 'America/New_York', EST5EDT, UTC, lossis 'Local' rau koj lub sijhawm hauv cheeb tsam raws li teeb tsa ntawm raspi-config. Lub neej ntawd yog UTC

4. Teem seb yuav tso saib 12hr lossis 24hr hom rau txhua tus qauv

[NYEEM]; Tus naj npawb ntawm TM1637 Cov Qauv (ntawm 1 thiab 4) num_modules = 2

; Zones Lub Sijhawm rau txhua Tus Qauv

; Siv raspi-teeb tsa los teeb tsa lub sijhawm hauv zos; Default yog UTC; Hom ntawv yog Linux TZ cov npe lossis 'Hauv Zos' rau lub sijhawm hauv zos; 'America/New_York', EST5EDT, UTC, 'Local' TZ1 = Local TZ2 = UTC TZ3 = TZ4 =

; 12/24 Teev rau txhua Tus Qauv

HR1 = 12 HR2 = 24 HR3 = 12 HR4 = 24

; QHOV TSEEB (thaj tsam 1..7)

LUAM = 1

5. Koj yuav tsum tsis txhob hloov kho GPIO koob tshwj tsis yog tias koj ntsaws rau hauv tus pin sib txawv ntawm tus Pi.

6. Txuag qhov kev hloov pauv thiab tom qab ntawd khiav lub moos:

$ python raspiclock.py

Yog tias txhua yam zoo, txhua yam ntawm koj lub khoos phis tawj yuav tsum teeb nrog lub sijhawm raws li teeb tsa hauv. INI cov ntaub ntawv.

Nrog koj zoo siab! Hla qhov kev daws teeb meem thiab mus rau zaum kawg Install…

Kauj ruam 7: Troubleshooting

Koj yuav tsum pom qee cov lus debug yooj yim tshwm:

Kev pib ua… Tus lej ntawm cov qauv = 4 Pib lub moos moos… Module#1 displayTM () Module#2 displayTM () Module#3 displayTM () Module#4 displayTM () (repeating…)

Yog tias koj sim cov qauv yav dhau los thiab lawv txhua tus ua haujlwm, tom qab ntawd koj paub cov qauv thiab Raspberry zoo.

A) HANG - Yog tias cov lus debug zoo li dai ntawm ib qho chaw, txoj haujlwm tau tos rau ACK los ntawm tus qauv#.

Ua ntej kuaj koj cov thaiv! Nws yog qhov yooj yim tig lub xaim lossis txuas rau qhov tsis raug GPIO Pin ntawm Pi.

Qhov thib ob, sib pauv cov qauv kom pom tias tus qauv tam sim ntawd tsis zoo.

Thib peb, txheeb xyuas cov ntaub ntawv raspiclock.ini kom raug. Yog tias tsim nyog, rho tawm tag nrho cov npe thiab ua lwm qhov GIT CLONE kom rov tau txais dua.

Plaub, xyuas koj cov xov ntxiv!;-)

B) Yog tias koj tau txais Python lus yuam kev, txheeb xyuas koj li Python version siv:

$ nab nab -V (peev "V")

Nab hab sej 2.7. X

Kuv tsis tau sim tawm tsam Python 3, yog li tsis paub tseeb tias lub tsev qiv ntawv puas sib xws. Luam cov lus yuam kev (feem ntau yog kab kawg ntawm qhov ua yuam kev) thiab Muab tshuaj txhuam rau hauv Google tshawb nrhiav. Qhov no tuaj yeem qhia meej txog qhov tshwm sim.

Kauj Ruam 8: Kev Txhim Kho Kawg

Kev Txhim Kho Kawg
Kev Txhim Kho Kawg

1. Kho cov ntaub ntawv. INI dua thiab teeb debug = 0. $ cd/home/pi/RaspiDigiHamClock

$ nano raspiclock.ini

2. Kuj txheeb xyuas lub sijhawm sijhawm TZ thiab HR 12/24 teev teev yog raws li koj xav tau.

3. Teem lub Brightness raws li xav tau ntawm 1 thiab 7.

4. Khiav install.sh tsab ntawv ntxiv rau pi crontab rau kev pib tsis siv neeg ntawm khau raj.

$ sh install.sh

5. Rov pib dua

$ sudo rov pib dua

6. Nws yuav tsum rov pib dua thiab tom qab ntawd tuaj txog.

Ua tiav!

Pom zoo: