Cov txheej txheem:

HiFive1 Arduino Nrog HC-05 Bluetooth Module Tutorial: 7 Kauj Ruam
HiFive1 Arduino Nrog HC-05 Bluetooth Module Tutorial: 7 Kauj Ruam

Video: HiFive1 Arduino Nrog HC-05 Bluetooth Module Tutorial: 7 Kauj Ruam

Video: HiFive1 Arduino Nrog HC-05 Bluetooth Module Tutorial: 7 Kauj Ruam
Video: Explorando o NuttX - Bancada do Embarcados 05 2024, Hlis ntuj nqeg
Anonim
HiFive1 Arduino Nrog HC-05 Bluetooth Module Tutorial
HiFive1 Arduino Nrog HC-05 Bluetooth Module Tutorial

HiFive1 yog thawj Arduino-tshaj RISC-V raws lub rooj tsavxwm ua nrog FE310 CPU los ntawm SiFive. Lub rooj tsavxwm yog kwv yees li 20 zaug sai dua Arduino UNO thiab raws li UNO tsis muaj kev sib txuas wireless. Hmoov zoo, muaj ntau qhov qauv tsis kim ntawm kev ua lag luam txhawm rau txo qhov kev txwv no.

Txog WiFi txuas nrog ESP01 / ESP32 / ESP8266, koj tuaj yeem tshawb xyuas AT, WEB thiab MQTT kev qhia.

Hauv qhov kev qhia no, peb siv HC-05 Bluetooth module. Nws yog qhov pheej yig, tuaj yeem ua haujlwm ua qhev lossis tus tswv thiab yooj yim ua haujlwm nrog ntawm AT cov lus txib. Lwm qhov kev xaiv yog ESP32 tab sis nws kim dua thiab xav tau programmed cais.

Txoj haujlwm no tau tsom mus rau tsim kev sib txuas wireless ntawm HiFive1 thiab Windows PC lossis Android Phone siv HC-05 Bluetooth module. Los ntawm kev txuas, peb yuav tswj hwm HiFive1 built-in RGB LED xim.

Rau qhov haujlwm no koj yuav xav tau:

  • HiFive1 pawg thawj coj saib
  • HC-05 Bluetooth module
  • Jumper Cable x 4
  • Android Phone lossis Windows PC

Kauj Ruam 1: Teeb Ib puag ncig

Teem Ib puag ncig
Teem Ib puag ncig
Teem Ib puag ncig
Teem Ib puag ncig
  1. Nruab Arduino IDE
  2. Ua raws cov lus qhia txhawm rau teeb tsa HiFive1 board Arduino pob thiab USB tsav tsheb.

Kauj Ruam 2: Txuas HC-05

Txuas HC-05
Txuas HC-05
Txuas HC-05
Txuas HC-05
Txuas HC-05
Txuas HC-05

DI/O 10 (HiFive1) -> Tx (HC -05) DI/O 11 (HiFive1) -> Rx (HC -05) GND (HiFive1) -> GND (HC -05) 3.3v (HiFive1) -> VCC (HC-05)

Nco ntsoov tias IOREF jumper tau teeb tsa rau 3.3V raws li qhia hauv daim duab los ntawm lub voj voog liab.

Kauj ruam 3: Programming

Ua ntej kev teeb tsa teeb tsa "Cov Cuab Yeej-> Pawg" rau HiFive1 pawg thawj coj, "Cuab Yeej-> CPU Clock Zaus" mus rau "256MHz PLL", "Cov Cuab Yeej-> Tus Kws Ua Haujlwm" rau "SiFive OpenOCD" thiab teeb tsa qhov chaw nres nkoj raug.

Tom qab txuas txhua yam ua ke peb tuaj yeem sim tham nrog HC-05 ntawm Arduino Serial Monitor. Rau qhov no, peb yuav tsum tau teeb tsa cov duab kos yooj yim txuas hauv qab no. Nws tau mloog AT cov lus txib los ntawm Tus Saib Xyuas ntawm HW Serial channel thiab xa lawv mus rau HC-05 ntawm SoftwareSerial32 channel. Nws tau mloog HC05 cov lus teb los ntawm SoftwareSerial32 channel thiab tau xa lawv mus rau Tus Saib Xyuas ntawm HW Serial channel.

Yog tias txhua yam tau teeb tsa kom raug hauv cov kauj ruam dhau los, txhua AT Command yuav tsum rov qab "OK" cov lus teb los ntawm HC-05.

Nco tseg: Nco ntsoov teeb tsa Serial Monitor rau 9600 baudrate nrog "Ob NL & CR"

Cov duab kos yog ua raws cov cai pom ntawm no

Xav paub ntau ntxiv txog AT Commands tuaj yeem pom ntawm no

Kauj Ruam 4: Kho HC-05

Hauv theem no, peb yuav teeb tsa HC-05. Koj tsuas yog yuav tsum ua cov kauj ruam no ib zaug raws li kev teeb tsa tom qab ntawd yuav nco qab hauv HC-05.

  • Nkag mus rau AT Hom ntawm HC-05. Qhov no yog ua tiav los ntawm kev tshem VCC cable los ntawm HC-05, tom qab ntawd nyem lub pob nyob rau hauv qab txoj cai thaum ntsaws VCC rov qab rau hauv.
  • Qhib Serial Monitor hauv IDE uas sib raug rau lub rooj tsav xwm txuas nrog HC-05. Nco ntsoov Serial Monitor tau teeb tsa Baud Rate 9600 thiab "Ob NL + CR" raug xaiv. Yog tias ua tiav, thaum koj xa "AT", nws yuav tsum rov qab "OK".
  • Nkag mus rau "AT+ORGL" (Qhov no rov teeb tsa tus qauv rau lub chaw teeb tsa).
  • Sau "AT+ROLE = 0" (Qhov no teeb tsa tus qauv rau "Qhev" lub luag haujlwm).
  • Nkag mus "AT+CMODE = 0" (Qhov no teeb tsa tus qauv txuas rau txhua lub cuab yeej).
  • Sau "AT+NAME = _" Hloov cov cim nrog lub npe uas koj xaiv (Lub npe no yuav tshwm rau hauv Bluetooth pom).
  • Nkag mus "AT+UART = 38400, 0, 0" (Qhov no teeb tsa tus qauv baud tus nqi rau 38400)
  • Sau "AT+RESET" kom tawm AT hom.
  • Tam sim no upload qhov kev kos duab zaum kawg nrog rau cov kauj ruam no
  • Kauj Ruam 5: Teeb tsa Chaw Taws Teeb (Windows PC)

    Teeb tsa Chaw Taws Teeb (Windows PC)
    Teeb tsa Chaw Taws Teeb (Windows PC)
    Teeb tsa Chaw Taws Teeb (Windows PC)
    Teeb tsa Chaw Taws Teeb (Windows PC)

    Nco tseg: Yog tias koj siv Android Xov Tooj es hla mus rau kauj ruam tom ntej.

    1. Qhib Bluetooth.
    2. Hauv qab cov khoom siv saib rau lub npe koj muab hauv Kauj Ruam 3 - Teeb Tus Qhev.
    3. Cov lej ua lej yog 1234.
    4. Hauv tus thawj tswj ntaus ntawv, koj yuav tsum pom qhov chaw nres nkoj COM tshiab rau Bluetooth. *
    5. Rub tawm thiab teeb tsa PuTTY.
    6. Qhib PuTTY.
    7. Txheeb xyuas qhov "Serial" xaiv thiab hloov "COM1" nrog "COM_" (qhov qis dua yuav tsum yog koj tus lej COM chaw nres nkoj tshiab).

    * Yog tias ntau dua ib qhov chaw nres nkoj COM tau ntxiv sim qib 7 nrog cov chaw nres nkoj sib txawv kom txog thaum ua haujlwm.

    Kauj Ruam 6: Teeb Chaw Taws Teeb (Xov Tooj Hauv)

    Teem Cov Chaw Taws Teeb (Android Xov Tooj)
    Teem Cov Chaw Taws Teeb (Android Xov Tooj)
    1. Qhib Bluetooth.
    2. Hauv qab cov cuab yeej Bluetooth saib rau lub npe koj muab hauv Kauj Ruam 4 - Kev teeb tsa HC -05.
    3. Cov lej ua lej yog 1234.
    4. Qhib koj Arduino Bluetooth App.
    5. Nws yuav tsum qhia koj kom xaiv lub cuab yeej dua.
    6. Qhib lub davhlau ya nyob twg.

    Kauj Ruam 7: Qhov Kawg

    Zaum Kawg
    Zaum Kawg
    Zaum Kawg
    Zaum Kawg
    Zaum Kawg
    Zaum Kawg

    Rov pib dua lub Rooj Tsav Xwm HiFive1 (tsuas yog qhov xwm txheej) thiab qhib Serial Monitor.

    Ntaus 'r', 'g' lossis 'b' rau hauv koj lub davhlau ya nyob twg thiab tom qab ntawd xaiv qhov sib zog nruab nrab ntawm 0 thiab 255 thiab ntxiv 'n' mus rau qhov kawg ntawm qhov kev siv uas koj tau xaiv ('n' yog siv los ua tus cim).

    Qhov no yuav ua kom pom qhov teeb tsa hauv RGB LED rau qhov muaj txiaj ntsig raws li koj tau xaiv qhov hnyav.

Pom zoo: