Cov txheej txheem:

Cov Ntsiab Lus Tseem Ceeb: 5 Kauj Ruam
Cov Ntsiab Lus Tseem Ceeb: 5 Kauj Ruam

Video: Cov Ntsiab Lus Tseem Ceeb: 5 Kauj Ruam

Video: Cov Ntsiab Lus Tseem Ceeb: 5 Kauj Ruam
Video: Tseem Ev Lub Kawm - Koos Loos 2024, Hlis ntuj nqeg
Anonim
Cov Ntsiab Lus Tseem Ceeb
Cov Ntsiab Lus Tseem Ceeb

Txog kuv txoj haujlwm nrog Alexa kev txawj kuv xav tau qhov yooj yim (tsis ntxiv qhov nyuaj ntxiv) cov cuab yeej tawm tswv yim; pom thiab hnov tau.

Tsis tas li ntawd, kuv lub CPU nyob hauv kuv "chav thaiv kab hlau rhuav" thiab kuv xav tau cov khoom tso tawm kom nyob hauv qhov chaw muaj txiaj ntsig, tab sis lwm yam tsis cuam tshuam.

Kuv txiav txim siab ntawm RF chaw taws teeb ua rau lub siab ntawm daim npav tos txais suab paj nruag. Kuv muab qhov no tso rau hauv lub thawv me me uas kuv tau tso txog thiab ntxiv tus xa mus rau hauv rooj plaub ntawm kuv RPi3B+.

Yooj yim rau/tawm cov lus txib ntawm RPI3B+ pib lub teeb thiab suab nrog qhov tsis tshua pom pom kis tau qeeb.

Kauj ruam 1: Pinouts

Pinouts
Pinouts
Pinouts
Pinouts

Cov duab no yog los ntawm tus muag ntawm Amazon nplooj ntawv (txuas saum toj no). Tsuas yog daim ntawv yooj yim rau siv.

Nco tseg: daim duab qub tau sau npe tsis raug; Kuv ntxiv cov hloov tshiab (hauv ntsuab). (Qhov no tau txheeb xyuas hauv ntu lus ntawm nplooj ntawv Amazon)

Kauj Ruam 2: Tsab Ntawv

Tsab ntawv
Tsab ntawv
Tsab ntawv
Tsab ntawv

Siv txhua ib nrab ntawm lub khob cij los cais tus xa thiab tus txais. Powered los ntawm 3.7v (them rau 4.25v) roj teeb.

Txij li qhov no tsuas yog kev siv ntawm tus pin-outs, Kuv tsis tau tsim daim duab qhia chaw.

Kuv suav nrog LED hauv koob nrog 3.3K resistor rau kev sim.

Txhawm rau sim, tsuas yog txuas tus pin tswj (ntawm no cov xaim dawb) rau hauv av. Kev qhib LEDs (liab) teeb rau ntawm ob lub tshuab xa khoom thiab tus txais, thiab kuv 'thauj khoom' LED tua tawm. (daim duab)

Kauj Ruam 3: Kev cuam tshuam

Qee lub sij hawm tus xa thiab tus txais tsis tau ua khub kom raug, lossis koj tuaj yeem xav hloov tus cwj pwm tsis zoo.

Kuv suav nrog ntawm no tus muag khoom cov lus qhia rau cov khoom siv no:

************************************************************************

Pins Qhia

Txais

  • GND: av lossis tus ncej tsis zoo
  • +V: DC3.3 ~ 5V cov tswv yim
  • D0-3: Cov ntaub ntawv tso tawm
  • VT: Cov zis (kab no mus qis yog/thaum cov ntaub ntawv kab mus qis)

Yuav ua li cas kom phim tus xa thiab tus txais

  1. Rho tawm cov ntaub ntawv tam sim no: Nias kev kawm khawm (ntawm tus txais) 8 zaug. Teb: LED teeb 7 zaug.
  2. Kawm cov cai nyob deb: nias lub pob kawm (ntawm tus txais) ib zaug, ob zaug lossis peb zaug (saib hauv qab). LED tig rau: hom kev kawm tau ua haujlwm.
  3. Nias ib lub pob ntawm cov chaw taws teeb tswj. LED qhov taw qhia teeb peb zaug: kev kawm tiav ua tiav.
  4. Kuaj: tom qab ua haujlwm saum toj no, lub rooj txais khoom tuaj yeem tswj tau los ntawm cov chaw taws teeb tswj.

Ntau tus neeg xa xov nrog tus lej sib txawv tuaj yeem kawm thiab khaws cia ntxiv, pib nrog qib 2. Kev sib xyaw ntawm ntau hom sib txawv tuaj yeem ua tau.

Khawm siv (teeb tsa hom thiab pib txheej txheem ua khub):

  • Nias ib zaug: Nkag hom (Hom Momentary)
  • Nias ob zaug: Hom ntsuas tus kheej (Toggle-Mode ntawm 4 Channels)
  • Nias peb zaug: hom sib cuam tshuam (xaiv cov channel nquag thiab raug tshem tawm, yog tias lwm lub channel dhau los ua haujlwm) - aka xov tooj cua khawm

Kauj Ruam 4: Kev Txhim Kho

Kev teeb tsa
Kev teeb tsa

Tom qab siv cov khoom sib txuas raws li lawv tau txuas nrog ntawm lub khob cij, thiab npog hauv tshav kub-ntsws kom tsis txhob luv luv Circuit Court, Kuv tau teeb tsa lub transmitter ntawm RPi3B+.

Kuv siv 3v lub zog txij li qhov ntawd yog Raspberry lub zog hluav taws xob ib txwm muaj. (Ceeb toom: Kuv siv cov xim tsis yog txheej txheem vim tias nws yooj yim siv cov hlua txuas uas twb muaj lawm)

wrclr: hlau colorpi-pin: tus pin ntawm RPi3B+trnspin: tus pin ntawm tus xa tawm

wrclr pi-pin trnspin -------- ---------------------- grey 01 zog V+ ntshav 06 av GND xim av 11 BCM17 Cov ntaub ntawv 1 liab 13 BCM27 Cov Ntaub Ntawv 0

Cov chaw taws teeb/txais tau siv nrog lub qub micro-USB hloov pauv. Kuv siv lub qhov (socket) USB yog li kuv tuaj yeem siv lub txhab nyiaj hluav taws xob yog tias kuv xav tau nws tsis muaj ib hnub.

Kauj ruam 5: Code

Txoj cai yooj yim tshaj plaws rau kev lees paub: (qhov chaw)

ntshuam RPi. GPIO ua GPIOimport lub sij hawm GPIO.setmode (GPIO. BCM) GPIO.setwarnings (Cuav) GPIO.setup (27, GPIO. OUT) luam "LED rau" GPIO.output (27, GPIO. HIGH) time.sleep (1) luam tawm "LED tawm" GPIO.output (27, GPIO. LOW)

kom ua: python pintst.py

Pom zoo: