Cov txheej txheem:

Tig Raspberry Pi rau hauv Bluetooth Beacon: 4 Cov Kauj Ruam
Tig Raspberry Pi rau hauv Bluetooth Beacon: 4 Cov Kauj Ruam

Video: Tig Raspberry Pi rau hauv Bluetooth Beacon: 4 Cov Kauj Ruam

Video: Tig Raspberry Pi rau hauv Bluetooth Beacon: 4 Cov Kauj Ruam
Video: HUNGRY SHARK WORLD EATS YOU ALIVE 2024, Kaum ib hlis
Anonim
Tig Raspberry Pi rau hauv Bluetooth Beacon
Tig Raspberry Pi rau hauv Bluetooth Beacon

Bluetooth yog ib lub thev naus laus zis tshiab los hloov cov ntaub ntawv wirelessly, tsim kev siv tshuab hauv tsev, tswj hwm lwm yam khoom siv thiab lwm yam.

Hauv cov lus qhia no, Kuv yuav sim tig Raspberry Pi rau hauv Bluetooth Beacon.

Yuav tsum muaj

  • Raspberry Pi
  • BleuIO (Bluetooth tsawg zog USB Dongle)
  • Lub Xov Tooj Ntawm Tes nrog Bluetooth thiab App xws li BLE Scanner, LightBlue lossis DSPS los ntawm Dialog Semiconductor.

Kauj ruam 1: Txuas Dongle

Txuas Dongle
Txuas Dongle
Txuas Dongle
Txuas Dongle

Txuas BleuIO dongle rau koj li Raspberry Pi.

Txhawm rau txheeb xyuas lub npe khoom twg lub dongle txuas nrog, koj yuav tsum tau khiav:

ls /dev

Koj yuav xav tau ua ob zaug, ib zaug ua ntej koj txuas lub dongle thiab ib zaug tom qab tuaj yeem txheeb xyuas qhov twg yog lub npe ntaus ntawv. Thaum pib ua haujlwm, lub dongle yuav qhib qhov chaw nres nkoj COM rau lub bootloader rau 10 vib nas this kom tso cai rau koj hloov kho lub firmware (lossis nyem koj tus kheej daim ntawv thov).

Tom qab ntawd nws yuav kaw qhov chaw nres nkoj ntawd thiab qhib qhov chaw nres nkoj tshiab rau BleuIO daim ntawv thov uas yog qhov peb xav tau ntawm no. Koj tuaj yeem khiav:

lsusb

Kauj Ruam 2: Kev Sib Txuas Lus

Kev Sib Txuas Lus
Kev Sib Txuas Lus

Koj yuav xav tau cov phiaj xwm kev sib txuas lus sib txuas lus nrog dongle. Rau qhov kev qhia no peb yuav siv Minicom. Koj tuaj yeem tau txais Minicom los ntawm kev khiav:

sudo apt-tau nruab minicom

Tam sim no, kom pib siv dongle khiav cov lus txib hauv qab no yog tias, piv txwv li, koj lub dongle txuas nrog lub cuab yeej lub npe ttyACM0:

minicom -b 9600 -o -D /dev /ttyACM0

Tam sim no sim ntaus AT-Command. Piv txwv

AT

Yog tias koj tau txais cov lus teb OK uas txhais tau tias dongle ua haujlwm.

Kauj ruam 3: Khiav Python Script

Peb muaj tsab ntawv nab nab npaj los pab tig Raspberry Pi no rau hauv Bluetooth Beacon.

Txhawm rau siv cov ntawv no koj yuav tsum muaj Python teeb tsa.

koj tseem yuav xav tau teeb tsa tus qauv pySerial. Txoj hauv kev yooj yim tshaj plaws los teeb tsa nws yog los ntawm pip (uas koj yuav tsum muaj tom qab txhim kho Python) los ntawm kev khiav:

Nab hab sej 2:

pip nruab pyserial

Nab hab sej 3:

python3 -m pip nruab pyserial

Tom qab txuas, koj tuaj yeem siv tus piv txwv piv txwv li ntawv nab npawb los teeb tsa koj tus kheej iBeacon.the qhov chaws tuaj yeem pom ntawm GitHub.

Txuag tsab ntawv no rau hauv cov ntawv hu ua ibeacon.py lossis koj tuaj yeem tso npe txhua yam uas koj nyiam.

Tam sim no qhib cov ntawv siv qhov hais kom ua los ntawm kev ntaus ntawv

nab hab sej ibeacon.py

Kauj ruam 4: Luam theej duab koj lub cuab yeej

Luam theej duab koj ntaus ntawv
Luam theej duab koj ntaus ntawv

Thaum koj pib Python tsab ntawv, koj yuav tsum tuaj yeem pom koj li iBeacon siv lub tshuab luam ntawv App tsim rau Bluetooth Tsawg Zog (BLE).

Piv txwv ntawm scanner App tuaj yeem yog BLE Scanner los ntawm Bluepixel Technologies.

Ntawm no koj tuaj yeem pom, koj lub cuab yeej tau pib tshaj tawm.

Koj kuj tseem tuaj yeem siv tsab ntawv Eddystone. Source code muaj nyob ntawm no.

Pom zoo: