Cov txheej txheem:

AT Cov Lus Hais rau Bluetooth Module (HC-05 W/ EN Pin thiab BUTTON) Siv Arduino Board!: 5 Kauj Ruam
AT Cov Lus Hais rau Bluetooth Module (HC-05 W/ EN Pin thiab BUTTON) Siv Arduino Board!: 5 Kauj Ruam

Video: AT Cov Lus Hais rau Bluetooth Module (HC-05 W/ EN Pin thiab BUTTON) Siv Arduino Board!: 5 Kauj Ruam

Video: AT Cov Lus Hais rau Bluetooth Module (HC-05 W/ EN Pin thiab BUTTON) Siv Arduino Board!: 5 Kauj Ruam
Video: How To Pair Two Bluetooth HC-05 Module Arduino 2024, Kaum ib hlis
Anonim
AT Cov Lus Hais rau Bluetooth Module (HC-05 W/ EN Pin thiab BUTTON) Siv Arduino Board!
AT Cov Lus Hais rau Bluetooth Module (HC-05 W/ EN Pin thiab BUTTON) Siv Arduino Board!

Los ntawm Jay Amiel AjocGensan PH

Cov lus qhia no yuav pab koj pib siv koj li HC05 bluetooth module. Ua qhov kawg ntawm cov lus qhia no, koj yuav tau kawm txog kev xa AT cov lus txib rau tus qauv txhawm rau teeb tsa/hloov kho nws (npe, tus lej cim, tus lej tus lej thiab lwm yam) siv koj li board.

Kauj ruam 1: Cov ntaub ntawv

1. Arduino UNO

2. HC05 Bluetooth Module

3. Jumper Wires

4. Cov qhob cij

5. Resistors (1k thiab 2k)

Qhov ntawd yog nws!

Kauj Ruam 2: Daim Kab Xev

Daim duab thaiv
Daim duab thaiv

Ua raws cov txheej txheem no yog tias koj xav pib AT comms nrog koj HC-05 (nrog EN tus pin thiab BUTTON ntawm sab xis-sab xis ntawm BT)

Ua cov kev sib txuas ff!

BT VCC rau Arduino 5V

BT GND rau Arduino GND

BT TX to Arduino D2

BT RX rau Arduino D3 (Siv VOLTAGE DIVIDER rau ntu no! BT Rx tswj tsis tau 5V teeb liab los ntawm arduino!)

Kauj ruam 3: Upload Code rau Arduino Board

NCO TSEG: Ua ntej rub tawm, tshem lub tx thiab rx wirings tawm hauv 5V thiab kev sib txuas hauv av nkaus xwb.

Tom qab qhov "Ua tiav qhov xa tawm", rov txuas BT TX rau ARDUINO D2 thiab BT RX rau ARDUINO D3 (tseem, nrog qhov faib hluav taws xob).

LED ntawm HC-05 yuav tsum ntsais muag sai li ntawm 5 zaug ib pliag.

#suav nrog

SoftwareSerial BTserial (2, 3); // RX | UA TX // Txuas HC-05 TX rau Arduino tus pin 2 RX.

// Txuas HC-05 RX rau Arduino tus pin 3 TX

char c = ``;

void teeb tsa () {

Serial.begin (9600);

Serial.println ("Arduino npaj tau lawm");

Serial.println ("Nco ntsoov xaiv Ob leeg NL & CR hauv cov ntawv saib xyuas");

// HC-05 default serial speed rau AT hom yog 38400

BTserial.begin (38400);

}

void voj () {

// Khaws nyeem los ntawm HC-05 thiab xa mus rau Arduino Serial Monitor

yog tias (BTserial.available ()) {

c = BTserial.read ();

Serial.write (c);

}

// Khaws nyeem los ntawm Arduino Serial Monitor thiab xa mus rau HC-05

yog (Serial.available ()) {

c = Serial.read ();

BTserial.write (c); }

}

Kauj Ruam 4: Muab BT Module rau AT MODE

Image
Image
Muab BT Module rau AT MODE
Muab BT Module rau AT MODE

Nrog Arduino ntawm, ua cov hauv qab no:

Tshem tawm 5V txuas rau BT VCC

Nias thiab tuav lub pob hloov ntawm BT module

Rov txuas BT VCC rau 5V (thaum tseem nias lub pob nyem), LED yuav tsum tuaj.

Tso lub khawm hloov thiab LED yuav tsum ntsais ntsais maj mam qhib/tawm ib zaug txhua ob peb feeb (kwv yees li 2 vib nas this).

Qhov no qhia AT hom.

Kauj ruam 5: Xa AT Commands

Tam sim no koj nyob hauv AT hom, tam sim no koj tuaj yeem pib AT comms.

Nov yog qee qhov piv txwv ntawm AT cov lus txib koj tuaj yeem siv lossis koj tuaj yeem tshawb hauv internet rau lwm AT lus txib.

Kom rov qab HC-05 rau mfg. default settings: "AT+ORGL"

Txhawm rau tau txais koj li HC-05 sau: "AT+VERSION?"

Txhawm rau hloov lub npe ntaus ntawv los ntawm lub neej ntawd HC-05 los hais tias MYBLUE sau: "AT+NAME = MYBLUE"

Txhawm rau hloov pauv txoj cai ruaj ntseg los ntawm 1234 txog 2987 sau: "AT+PSWD = 2987"

Txhawm rau hloov HC-05 baud tus nqi los ntawm lub neej ntawd 9600 rau 115200, 1 nres me ntsis, 0 sib npaug nkag: "AT+UART = 115200, 1, 0"

CEEB TOOM CEEB TOOM: Yog tias koj siv AT cov lus txib nrog "?", Ua qhov no, thaum nias lub pob ntawm BT pawg thawj coj, nyem nkag mus rau hauv lub computer. Qhov ntawd yuav tsum ua.

Pom zoo: