今天小編帶來是創(chuàng)客Hamid Sheibani的項(xiàng)目:鑰匙尋找器。使用了XIAO nRF52840開發(fā)板,與鑰匙串結(jié)合,讓你告別日常尋找鑰匙的煩惱!
背景故事
該設(shè)備利用低功耗藍(lán)牙(BLE)技術(shù),與智能手機(jī)同步,通過蜂鳴器和LED燈幫助用戶輕松找到遺失的鑰匙。本文將探討這款基于XIAO nRF52840模塊的智能鑰匙定位器的開發(fā)過程,并展示其核心功能。
材料清單
硬件
Seeed XIAO BLE nRF52840 Sense × 1
蜂鳴器 × 1
LED × 1
軟件
nRF Connect SDK
Seeed Fusion
核心組件及作用
這款智能鑰匙尋找器的核心是XIAO NRF52840模塊,這是一款小巧強(qiáng)大的開發(fā)板,內(nèi)置ARM Cortex-M4處理器,專為低功耗藍(lán)牙(BLE)通信而設(shè)計(jì)。其功能的實(shí)現(xiàn)離不開以下關(guān)鍵組件:
蜂鳴器:通過發(fā)出獨(dú)特聲音,幫助鑰匙主人快速找到鑰匙
LED燈:在昏暗環(huán)境下,LED燈發(fā)出亮光,讓丟失的鑰匙輕松現(xiàn)身。
按鈕:這實(shí)用的組件負(fù)責(zé)在找到鑰匙后關(guān)閉蜂鳴器和LED燈。
硬件配置
通過XIAO nRF52840的通用輸入輸出(GPIO)引腳連接到蜂鳴器、LED燈和按鈕。
程序邏輯與Arduino IDE
Arduino IDE:通過功能強(qiáng)大的Arduino集成開發(fā)環(huán)境(IDE),固件程序得以實(shí)現(xiàn),重點(diǎn)開發(fā)穩(wěn)定的BLE功能,實(shí)現(xiàn)與智能手機(jī)的無縫通信。
BLE同步:通過nRF Connect應(yīng)用,鑰匙定位器與智能手機(jī)建立BLE連接,搭建指令傳輸?shù)臉蛄骸?/p>
指令執(zhí)行:固件程序的核心是接收智能手機(jī)信號后精準(zhǔn)執(zhí)行指令,從而激活蜂鳴器和LED燈,引導(dǎo)用戶找到鑰匙。
高效電源管理:為了延長電池壽命,固件集成了智能省電機(jī)制,在設(shè)備空閑時(shí)切換到低功耗模式。
以下是可參考的Arduino代碼:
#includeBLEService KeyFinderService("19B10000-E8F2-537E-4F6C-D104768A1214"); // Bluetooth Low Energy KeyFinder Service // Bluetooth Low Energy Key Finder Characteristic - custom 128-bit UUID, read and writable by central BLEByteCharacteristic switchCharacteristic("19B10001-E8F2-537E-4F6C-D104768A1214", BLERead | BLEWrite); const int ledPin = LED_BUILTIN; // pin to use for the LED void setup() { Serial.begin(115200); // set LED pin to output mode pinMode(ledPin, OUTPUT); pinMode(D6, OUTPUT); pinMode(D5, OUTPUT); pinMode(D7, INPUT); // begin initialization if (!BLE.begin()) { Serial.println("starting Bluetooth Low Energy module failed!"); while (1); } // set advertised local name and service UUID: BLE.setLocalName("KeyFinder"); BLE.setAdvertisedService(KeyFinderService); // add the characteristic to the service KeyFinderService.addCharacteristic(switchCharacteristic); // add service BLE.addService(KeyFinderService); // set the initial value for the characeristic: switchCharacteristic.writeValue(0); // start advertising BLE.advertise(); Serial.println("BLE Key Finder Peripheral"); } void loop() { // listen for Bluetooth Low Energy peripherals to connect: BLEDevice central = BLE.central(); // if a central is connected to peripheral: if (central) { Serial.print("Connected to central: "); // print the central's MAC address: Serial.println(central.address()); // while the central is still connected to peripheral: while (central.connected()) { if (switchCharacteristic.written()) { if (switchCharacteristic.value()) { Serial.println("LED on"); digitalWrite(ledPin, LOW); // changed from HIGH to LOW digitalWrite(D5, HIGH); while(1) { tone(D6, 500, 500); delay(1000); if(digitalRead(D7) == 0) { Serial.println(F("LED off")); digitalWrite(ledPin, HIGH); // changed from LOW to HIGH digitalWrite(D5, LOW); digitalWrite(D6, LOW); break; } } } } } // when the central disconnects, print it out: Serial.print(F("Disconnected from central: ")); Serial.println(central.address()); } }
操作流程
BLE配對:通過nRF Connect應(yīng)用,智能手機(jī)能夠檢測到鑰匙定位器的存在,并建立BLE連接,打開了一個(gè)無縫的通信通道。
指令傳輸:智能手機(jī)傳輸預(yù)設(shè)的指令,激活蜂鳴器和LED燈,提供定位鑰匙的提示。
輕松發(fā)現(xiàn):用戶只需跟隨聽得見的提示音和LED燈的引導(dǎo),便能快速高效地找到鑰匙,告別忙亂的尋找過程。
優(yōu)勢與實(shí)際應(yīng)用場景
量身定制的用戶體驗(yàn):可定制的固件使用戶能夠根據(jù)個(gè)人偏好調(diào)整聲音和燈光模式。
適應(yīng)性強(qiáng)的設(shè)計(jì):該設(shè)備具備未來擴(kuò)展的潛力,可以集成更多傳感器,保持靈活與適應(yīng)性。
緊急援助:除了作為鑰匙尋找器,這款設(shè)備還能在關(guān)鍵時(shí)刻作為SOS信號燈,提供緊急求助功能。
結(jié)論
這款基于XIAO nRF52840模塊的鑰匙尋找器,通過BLE連接,優(yōu)雅地彌合了日常物品與智能解決方案之間的差距,展示了技術(shù)的純粹魅力。
-
定位器
+關(guān)注
關(guān)注
2文章
170瀏覽量
17676 -
BLE
+關(guān)注
關(guān)注
12文章
670瀏覽量
59590 -
nrf52840
+關(guān)注
關(guān)注
2文章
99瀏覽量
8344
原文標(biāo)題:創(chuàng)客項(xiàng)目秀|基于XIAO nRF52840的鑰匙尋找器
文章出處:【微信號:ChaiHuoMakerSpace,微信公眾號:柴火創(chuàng)客空間】歡迎添加關(guān)注!文章轉(zhuǎn)載請注明出處。
發(fā)布評論請先 登錄
相關(guān)推薦
Made with KiCad(八十九):一個(gè)很火的基于 promicro & nice!nano 的無線鍵盤項(xiàng)目
![Made with KiCad(八十九):一個(gè)很火的基于 promicro & nice!nano 的無線鍵盤項(xiàng)目](https://file1.elecfans.com//web1/M00/F4/D1/wKgZoWcy14SAOi4iAAahlusca54196.png)
汽車無鑰匙進(jìn)入及一鍵啟動功能介紹
![汽車無<b class='flag-5'>鑰匙</b>進(jìn)入及一鍵啟動功能介紹](https://file1.elecfans.com/web1/M00/F5/30/wKgZoWc4AaeAAFlBAAAMeY_WvqU444.jpg)
Made with KiCad(十):b-parasite傳感器
![Made with KiCad(十):b-parasite傳感<b class='flag-5'>器</b>](https://file1.elecfans.com//web1/M00/F4/D4/wKgZoWcy18yAHEnoAAzCBEPEbHI868.png)
基于XIAO的迷你激光數(shù)顯測距儀設(shè)計(jì)
![基于<b class='flag-5'>XIAO</b>的迷你激光數(shù)顯測距儀設(shè)計(jì)](https://file1.elecfans.com/web2/M00/0A/DD/wKgaomcXTteAFNprAAANn4541v4537.jpg)
nRF54L15—藍(lán)牙低功耗雙核系統(tǒng)級芯片(SoC)
![<b class='flag-5'>nRF</b>54L15—藍(lán)牙低功耗雙核系統(tǒng)級芯片(SoC)](https://file1.elecfans.com/web1/M00/F3/24/wKgZoWcQthWAPxpKAALl2ORfrek888.png)
nRF54L 系列SOC芯片NRF54L15 超低功耗藍(lán)牙5.4 SOC
NRF21540—低功耗藍(lán)牙,藍(lán)牙m(xù)esh、Thread和Zigbee和2.4 GHz私有協(xié)議范圍擴(kuò)展射頻前端模塊
![<b class='flag-5'>NRF</b>21540—低功耗藍(lán)牙,藍(lán)牙m(xù)esh、Thread和Zigbee和2.4 GHz私有協(xié)議范圍擴(kuò)展射頻前端模塊](https://file1.elecfans.com/web2/M00/08/11/wKgZomb0ypeAR8GYAAOC8xpWmCc288.png)
基于XIAO SAMD21開發(fā)板的多功能筆筒設(shè)計(jì)方案
![基于<b class='flag-5'>XIAO</b> SAMD21開發(fā)板的多功能筆筒設(shè)計(jì)方案](https://file1.elecfans.com/web2/M00/06/63/wKgaombaY_yAPbm7AADNNXPj61s563.png)
藍(lán)牙無鑰匙進(jìn)入方案
友宏科技推出最新一站式智能戒指設(shè)計(jì)
全跡科技UWB數(shù)字鑰匙到底“香在哪里”
![全跡科技UWB數(shù)字<b class='flag-5'>鑰匙</b>到底“香在哪里”](https://file1.elecfans.com/web2/M00/E5/37/wKgaomY_P12AfhhEAABsCvTyVX8992.png)
藍(lán)牙數(shù)字車鑰匙方案
![藍(lán)牙數(shù)字車<b class='flag-5'>鑰匙</b>方案](https://file1.elecfans.com//web2/M00/E4/D2/wKgaomY97FWAAbjMAACISv79L9M762.jpg)
NRF52832藍(lán)牙芯片詳細(xì)介紹及應(yīng)用方案
![<b class='flag-5'>NRF</b>52832藍(lán)牙芯片詳細(xì)介紹及應(yīng)用方案](https://file1.elecfans.com/web2/M00/E4/C6/wKgaomY9ujqALicKAACCy2hV45k822.png)
評論