Cov txheej txheem:

Programmable Keypad: 5 Kauj Ruam (nrog Duab)
Programmable Keypad: 5 Kauj Ruam (nrog Duab)

Video: Programmable Keypad: 5 Kauj Ruam (nrog Duab)

Video: Programmable Keypad: 5 Kauj Ruam (nrog Duab)
Video: The One Where Our Heroes Talk With Gary Marsall | Ep #21 | Wired Unplugged Podcast 2024, Kaum ib hlis
Anonim
Programmable Keypad
Programmable Keypad
Programmable Keypad
Programmable Keypad

Hauv qhov haujlwm no kuv yuav qhia yuav ua li cas thiaj yooj yim thiab pheej yig programmable keypad rau kev teeb tsa koj cov keyboard uas siv ntau tshaj, cov ntawv thov thiab ntau ntxiv.

Cov keyboard no tau pom tias yog cov keyboard hauv txhua lub OS loj, tsis xav tau cov tsav tsheb ntxiv.

Khoom siv

  • Teb encoder.
  • Ntau ntau (nyob ntawm koj xav tau) thawb khawm.
  • Arduino Pro Micro, Arduino Leonardo lossis lwm yam dev board nrog Atmega32U4 MCU.
  • Hlau, solder, soldering hlau, thiab lwm yam.
  • (Tsis teb los tau) Qee lub hauv paus hnyav rau khaws cov keyboard los ntawm zawv zawg, Kuv siv 3.5 "HDD qub

Kauj Ruam 1: Hluav Taws Xob Hluav Taws Xob

Hluav Taws Xob Hluav Taws Xob
Hluav Taws Xob Hluav Taws Xob

Kuv xaiv siv Arduino Pro Micro dev board nrog Atmega32U4 MCU uas muaj 18 tus lej siv tau.

Cov pins txhawm rau txuas cov nyees khawm thiab cov lej nkag teb chaws tau xaiv yam tsis muaj kev xaj tshwj xeeb hauv siab, tab sis qee yam yuav tsum tau sau tseg:

  1. Txhua tus lej nyeem tau muaj peev xwm pins muaj sab hauv rub tawm uas tso cai rau txo qis sab nraud rub tawm tus tiv thaiv. Tau kawg cov cai yuav tsum tau hloov kho raws li, vim nws xav tias lub xeev tus pin mus los ntawm qis mus rau siab thaum thawb cov nyees khawm.
  2. Hauv encoder.h lub tsev qiv ntawv piv txwv tau sau tseg tias qhov ua tau zoo tshaj plaws ntawm tus lej nkag mus tau yog thaum ob tus pin txuas nrog MCU cuam tshuam cov peev txheej pins. Feem ntau ntawm cov koob sib piv ntawm Atmega32U4 tsis muaj peev xwm cuam tshuam.
  3. Qhov tseeb rub tawm tus nqi resistor tsis muaj teeb meem ntau, txhua yam los ntawm 1 kΩ txog 100 kΩ yuav ua haujlwm zoo. Qhov loj dua qhov tseem ceeb tso cai rau lub zog me me tso tawm tab sis ua rau qeeb tus pin teb rau qhov hloov pauv voltage. Tsuas yog xaiv tus nqi resistors koj muaj tshaj plaws.
  4. Cov khoos phis tawj encoders tsis yog yam uas ntseeg tau tshaj plaws vim kev sib cuag hnav thiab thaws. Tias yog vim li cas thiaj xav tau kev daws teeb meem zoo. Kuv xaiv tus nqi hluav taws xob thiab ncua sijhawm hauv cov lej tej zaum yuav tsis muab cov txiaj ntsig zoo tshaj rau koj. Yog li yuav tsum tau sim me ntsis. Los yog hloov mus rau qee yam xws li kho qhov muag encoder, tab sis nws tus nqi yog qhov siab dua.

Kauj ruam 2: Sib dhos

Los ua ke
Los ua ke
Los ua ke
Los ua ke
Los ua ke
Los ua ke
Los ua ke
Los ua ke

Kuv xav ua cov keyboard kom huv raws li qhov ua tau, yog li kuv tau siv tag nrho cov khoom nyob tom qab ntawm pawg thawj coj saib tsab ntawv. Kuv xam tias cov keyboard yuav ntau dua ergonomic yog tias nws tau siv nce ntawm lub kaum me me. Tias yog vim li cas kuv tau siv Arduino Pro Micro ntawm cais pawg thawj coj thiab txuas txhua lub koob digital nrog xaim los thawb khawm. Nws yooj yim dua los txuas USB cable li ntawd.

Kuv pom 3.5 HDD qub los siv ua lub hauv paus rau cov keypad, nws hnyav heev thiab tiv thaiv daim ntawv daim ntawv zawv zawg rooj thaum ua haujlwm (tiv thaiv plam los pab tau ib yam nkaus). tsau lub rooj tsavxwm ntawm lub kaum me ntsis.

Kauj ruam 3: Programming

Code tau sau nrog Arduino IDE. Koj yuav tsum tau teeb tsa 2 lub tsev qiv ntawv:

  • Encoder los ntawm Paul Stoffregen
  • Keyboard los ntawm Arduino

Txhawm rau suav sau rau Atmega32U4 koj kuj yuav tsum teeb tsa Arduino Pro Micro board file, Sparkfun muaj cov lus qhia zoo yuav ua li cas.

Ib yam uas yuav tsum tau ceeb toom ua ntej yog yuav tsum ceev faj tsis txhob tso "cov yuam sij" hauv koj li kev cai. Qhov no tau tshwm sim rau kuv thiab MCU tas li spamming qee qhov tseem ceeb ua ke. Tib txoj kev uas kuv paub yuav kho qhov no yog rov hlawv boot-loader rau MCU. Yog tias koj yuav zoo li kuv, koj tuaj yeem ua raws phau ntawv qhia no txhawm rau hlawv boot-loader, koj yuav xav tau lwm lub arduino board los siv ua tus programmer.

Hauv lub ntsiab lus tseem ceeb MCU thawj zaug nyeem txhua lub xeev khawm, yog lub xeev hloov los ntawm LOW mus rau HIGH raug kuaj pom, ua haujlwm keyboard_shortcut (i) yog ua tiav. Qhov txawv txav kuv yog tus lej ntawm lub pob nyem, tag nrho cov lej khawm tau txhais los ntawm ALL_BUTTONS (hauv kuv qhov xwm txheej 15). Thaum ua tiav, keyboard_shortcut (i) xa CTRL+SHIFT thiab tom qab ntawv uas tau teeb tsa rau khawm id: 1-> A, 2-> B, 3-> C thiab lwm yam. twb tau siv Windows 10 los ntawm lub neej ntawd (hauv qhov no los tsim daim nplaub tshev tshiab). Nov yog cov npe ntawm txhua qhov yuam kev Windows luv. Tom qab ncua sijhawm luv MCU xa cov teeb liab los tso tawm txhua tus yuam sij thiab ua haujlwm rov qab mus rau lub voj tseem ceeb.

Tom qab txhua lub khawm raug tshuaj xyuas, MCU kuaj xyuas yog tias txoj haujlwm hloov pauv hloov pauv thiab yog nws ua, keyboard_shortcut (i) tau ua tiav nrog tus lej tshwj xeeb.

Encoder khawm nias inverts encoderButtonFlag boolean sib txawv. Thaum tus lej nkag tau hloov pauv qhov sib txawv tau xa mus rau PC, nyob ntawm qhov kev taw qhia kev sib hloov thiab tus lej encoderButtonFlag.

Yog tias debugFlag teeb tsa rau 1 debug cov lus tau xa los ntawm UART mus rau tus lej saib xyuas.

Kauj ruam 4: Configuring Shortcuts

Configuring Shortcuts
Configuring Shortcuts
Configuring Shortcuts
Configuring Shortcuts

Yuav ua li cas txhua txoj kev luv luv ua rau koj thiab, peb txhua tus muaj qhov nyiam sib txawv. Kuv yuav muab cov ntawv luv uas kuv teeb tsa rau kuv tus kheej ua piv txwv. Kuv siv Linux Mint 19.3 nrog xfce4 tus thawj tswj hwm desktop, yog li kuv cov piv txwv feem ntau cuam tshuam nrog cov ntawv sau, tab sis kuv yuav qhia qee qhov piv txwv yooj yim rau Windows10 ib yam.

Hauv thawj daim duab koj tuaj yeem pom cov ntawv uas kuv tau kos rau qhov luv. Nws tau ua tiav los ntawm xfce cov ntawv qhia zaub mov, txheej txheem rau qhov no ncaj qha rau pem hauv ntej. Koj tuaj yeem pom cov ntawv sau no hauv kuv lub GitHub chaw cia khoom

Me me 6 thawb cov nyees khawm hauv qab yog rau kev pib siv xws li lub vev xaib lossis tus tswj xyuas cov ntaub ntawv, qee qhov ntawm cov ntawv thov hu ua los ntawm start_only_one_app.sh tsab ntawv, uas tau txais txhua daim ntawv thov pib npe thiab tshawb rau daim ntawv thov koj xav pib. Yog tias daim ntawv thov lub qhov rais twb muaj lawm nws tau tsom mus, lwm qhov tshiab ntawm daim ntawv thov tau pib.

Lwm cov ntawv sau:

  • 2nd_display_control.sh - hloov thib ob saib ON/OFF.
  • moon_lamp.sh - hloov kuv lub Teeb Lub Hli Lub Teeb ON/OFF.
  • pc_load.sh - tsim kev ceeb toom npuas nrog tam sim no CPU thiab GPU siv thiab ntsuas kub.
  • shutdown.sh - pib PC kaw nrog 1 feeb qeeb thiab tsim kev ceeb toom npuas uas lub sijhawm tseem tshuav tshwm.
  • spec_vpn.sh - txuas rau tshwj xeeb OpenVPN server lossis yog tias muaj kev sib txuas twb muaj lawm, txiav tawm ntawm server.
  • shortcut_controll.sh - siv qhov hais kom ua (ntxiv rau, rho tawm, tab, kaw) raws li kev sib cav, tshawb pom lub qhov rai tam sim no tau tsom mus thiab yog tias daim ntawv thov tshwj xeeb tau pom muaj kev ua tiav tswj kev nqis tes ua. Piv txwv li qhib lub tab tshiab hauv sublime text editor default shortcut yog "CTRL+N" thiab hauv xfce davhlau ya nyob twg - "CTRL+T", yog li tsab ntawv no tso cai qhib lub tab tshiab hauv sublime thiab davhlau ya nyob twg nrog tib lub laub khawm.

Thawj qhov ua haujlwm ntawm tus lej nkag teb chaws yog tswj lub ntim, qhov ua haujlwm thib ob yog los tswj lub qhov rai qhib nquag ntawm shortcut_controll.sh.

Rau Windows OS koj tuaj yeem ua daim ntawv qhia luv rau cov ntawv thov los ntawm cov txheej txheem cov cuab yeej qhov rai raws li qhia hauv daim duab thib ob. Rau lwm yam ntxiv koj yuav xav siv AutoHotkey. Nws yog automation scripting lus rau Windows.

Qee qhov piv txwv yooj yim ntawm AHK syntax:

; Tswj ntim

^+t:: Xa {Volume_Up}

rov qab

^+v:: Xa {Volume_Down}

rov qab

; Kaw lub qhov rai nquag

^+h:: WinGetTitle, Title, A.

PostMessage, 0x112, 0xF060,,, %Title %

rov qab

Kaw lub PC

^+b:: Khiav kaw /s

Kauj Ruam 5: Kev txhim kho

Kev txhim kho
Kev txhim kho

Qee qhov kev txhim kho tau:

  • Cov khawm zoo zoo dua.
  • Tsab ntawv PCB hloov pauv ntau heev thaum cov nyees khawm raug nias.
  • RGB teeb pom kev zoo kom hloov xim nyob ntawm seb qhov kev ua haujlwm teb encoder tau teeb tsa.
  • Cov nyees khawm ntxiv (siv IO nthuav dav IC).
  • Zoo dua encoder teb (lossis kev daws teeb meem zoo dua).

Pom zoo: