查看“MCookie-BT”的源代码
←
MCookie-BT
跳转至:
导航
、
搜索
因为以下原因,您没有权限编辑本页:
您所请求的操作仅限于该用户组的用户使用:
用户
您可以查看与复制此页面的源代码。
{{Language|mCookie-BT}} {| style="width: 800px;" |- | [[file:mCookie-bt-rect.jpg|400px|thumb|right|mCookie-BT]] mCookie-BT is low-consumption serial transmission module, which can communicate with other Bluetooth devices such as phone and ipad. ==Features== *Low power consumption *Support iBeacons ; *Small, stackable, open and cheap; ==Specification== * Way of Communication: Serial port transmission and the default serial port is D0(RX), D1(TX); *Power supply: +3.3VDC 50mA; *Status indicator: **Before Bluetooth connection *** Host machine indicator keeps on for 100ms every second when not recording slave machine address; Host machine indicator keeps on for 900ms every second when recording slave machine address; *** Slave machine indicator keeps on for one second every two seconds. **After connection: *** The indicator of both the host and the slave machine keeps on for 100ms every five seconds. * During the transmission, each data package should include less than 120 bytes. The higher the baud rate is, the longer transmission interval is. There exists loss rate during Bluetooth data transmission. So users should be ready for re-transmission or data check. *All AT instructions end with "\r\n " so you should choose "\r\n " while debugging under AT instructions. Most AT instructions work before connection and all data pass through after connection. * iBeacon has been integrated. Set by AT instruction “AT+MODE2\r\n” can be achieved only under slave machine. ** Work mode: 0(transmission), 1(Direct drive) and 2(iBeacon); ** iBeacon can be tested by Local iBeacons offered on App Store. Here is the reference: http://blog.csdn.net/mzy202/article/details/20365691 [[File:ble-rule.jpg|600px|center|thumb]] *Way of Communication: Serial port transmission and the default serial port is D4(RX), D5(TX); *Power Supply: +3.3VDC 50mA; *Bluetooth Protocol: Bluetooth Specification V4.0 BLE; *Service Support: Central & Peripheral UUID FFE0,FFE1; *Frequency: 2.4GHz ISM band; *Way of Modulation: GFSK(Gaussian Frequency Shift Keying); *Transmit Power: ≤4dBm; *Flexibility: ≤-84dBm at 0.1% BER; *Transmission Rate: **Asynchronous: 6 kbps; **Synchronous: 6 kbps; *Status Indicator: **Before connection: ***Host machine indicator keeps on for 100ms every second when not recording slave machine address; ***Host machine indicator keeps on for 900ms every second when recording slave machine address; ***Slave machine indicator keeps on for one second every two seconds. **After connection: **The indicator of both the host and the slave machine keeps on for 100ms every five seconds. *During the transmission, each data package should include less than 120 bytes. The higher the baud rate is, the longer transmission interval is. There exists loss rate during Bluetooth data transmission. So users should be ready for re-transmission or data check. *iBeacon has been integrated. Set by AT instruction “AT+MODE2\r\n” can be achieved only under slave machine. **Work mode: 0(transmission), 1(Direct drive) and 2(iBeacon); **iBeacon can be tested by Locate iBeacons offered on App Store. Here is the reference: http://blog.csdn.net/mzy202/article/details/20365691 ==Document== Support AT instruction configuration/control: '''[[File:Microduino-BLE.pdf]]''' ==Development== ===Serial Communication Requirements=== *Default serial port configuration is: **Baud rate:9600 **No check **data bit: 8 **Stop bit: 1 **Set as:" \r\n " "9600baud " [[File:Serial-mcookie.jpg|thumb|600px|center]] ===Communicate with other BT devices via CoreUSB === *Program <source lang="cpp"> //Use soft SoftwareSerial //#include <SoftwareSerial.h> //SoftwareSerial mySerial(4, 5); //#define my_Serial mySerial #define my_Serial Serial1 //Define serial communication as Serial1 String msg = ""; //Define a string of characters void setup() { // Initialize Bluetooth communication baud rate my_Serial.begin(9600); // Initialize serial monitor communication baud rate Serial.begin(9600); } void loop() { //Receives signal once and give feedback once to the other communication side. if (my_Serial.available() > 0) //If there is data input in serial port { msg = my_Serial.readStringUntil('\n'); //All content before acquiring line break Serial.println(msg); //Display character string of msg in the serial monitor my_Serial.println("bluetooth respond"); //Send data to the other side of Bluetooth communication } } </source> ===Communicate with Android Device=== *Only version 4.3 or higher phone can communicate with mCookie-BT module *Download Android communication software and install it on the phone. [[File:BT—APP.zip]] |- | Step 1: Download program to mCoookie; |- | [[File:ble-Download2.png|600px|center|thumb|Download]] Step 2: Start to set Android device. Open Bluetooth function of the device, copy and install ".apk " file from testing package to the phone, then open APP and open serial monitor on computer IDE side; Step 3: Click SCAN on top right of the APP and it'll show Bluetooth devices around you as follows: [[File:202KIT-android-system3.jpg|600px|center|thumb|App—蓝牙搜索]] Click the corresponding Microduino Bluetooth number and enter the following interface: [[File:202KIT-android-system4.jpg|600px|center|thumb|App—蓝牙通信]] Wait for 2-3 seconds and see "Ready" on the screen, meaning a successful connection between the phone and the Bluetooth. Click " Sync RTC With Phone " and see changes of "RT TIME" above and the serial monitor. [[File:202KIT-android-system5.jpg|600px|center|thumb|App—串口监视器]] [[File:202KIT-android-system6.jpg|600px|center|thumb|App—手机App]] You'll see the phone receiving message " bluetooth respond " from mCookie and on the other side, the serial monitor also gets the time and content of the message. Thus, bidirectional communication function of Bluetooth can be verified. ===Communicate with IOS Device === *iPhone4s or higher, iPod touch 5 or higher, iPad 3 or higher and iPad mini or higher; *Come to App Store and download LightBlue [[File:LightBlue.jpg|400px|center|thumb|LightBlue]] Step 1: Download program to mCookie; Step 2: Install "LightBlue", open the software and start to set IOS device. And then open IOS device's Bluetooth function and open serial monitor on the computer's IDE side. [[File:LightBlue_on_ble.jpg|400px|center|thumb]] Step 3: Open LightBlue: Enter Bluetooth device searching interface, find Microduino Bluetooth device from "Peripherals Nearby", Click this item and make its connection your phone. |- | [[File:ble-Connection.jpg|400px|center|thumb|Connection1]] Enter the following interface after connection: [[File:ble-Connection1.jpg|400px|center|thumb|Connection2]] Step 4: Select and click "Characteristic6" and see encoding format on the top right of the screen. (The default is Hex 16 band encoding.) Click Hex button if you need to display character strings and choose UTF-8 encoding format, click "Listen for notifications" and let your phone enter monitoring state. [[File:ble-Connection5.jpg|400px|center|thumb]] Step 5: Click " Write new value " and pop up text editing interface [[File:ble-Connection2.jpg|400px|center|thumb]] Enter a character string combined by English characters and numbers and check result from the phone and the serial port. [[File:ble-Connection3.jpg|400px|center|thumb]] [[File:ble-Connection4.jpg|400px|center|thumb]] You can see from the picture that the serial port receives phone data "12345" and the phone side also gets return data " bluetooth respond " from Bluetooth, meaning the bidirectional Bluetooth communication is smooth. ==Extension== ===Use AT to Check or Change BT Parameters=== *AT instruction configuration/control document: '''[[File:Microduino-BLE.pdf]]''' *Program <source lang="cpp"> //Use other soft serial port " SoftwareSerial" //#include <SoftwareSerial.h> //SoftwareSerial mySerial(4, 5); // RX, TX //#define my_Serial mySerial #define my_Serial Serial1 //Define serial ports of CoreUSB and BT void setup() { Serial.begin(9600);//Serial monitor communication & Baud rate my_Serial.begin(9600);//BT communication baud rate } void loop() { if (Serial.available())//Monitor data from serial monitor my_Serial.write(Serial.read());//Wrote data into BT if (my_Serial.available())//Monitor serial data of BT Serial.write(my_Serial.read());//Print data in the serial monitor } </source> *Download program **Stack mCookie-BT and mCooikie-CoreUSB, plug USB cable to mCookie-CoreUSB on one side and connect to your computer on the other side; **Start Arduino IDE, copy program to IDE; **Choose Microduino CoreUSB from (toools)-> (Board) and select the right serial number from (tools)-> (Serial; **Click compile button (√) on the top left of IDE and start compiling. After that, click download (->) and burn the program to board; *Open serial monitor and set it to: "\r\n " "9600baud " [[File:ble-Serial.jpg|600px|center|thumb|Serial]] *在Enter fixed instructions in the serial monitor and you'll return result. (This reference file can change BT's parameters. ) [[File:ble-AT.jpg|600px|center|thumb|AT]] ===Change Serial Communication Pin=== The default serial is D0(RX), D1(TX). Users can change serial port according to personal needs, which can refer to: [[File:ble-Serial-change.jpg|600px|center|thumb]] Use soft communication program: <source lang="cpp"> //Use other soft serial "SoftwareSerial" #include <SoftwareSerial.h> SoftwareSerial mySerial(4, 5);//Select the corresponding port numbers--(2,3) or (4,5) according to the serial ports. #define my_Serial mySerial String msg = ""; void setup() { // Initialize Bluetooth communication baud rate my_Serial.begin(9600); // Initialize serial monitor communication baud rate Serial.begin(9600); } void loop() { //Receive signal once and then give feedback to the other side of the communication. if (my_Serial.available() > 0) //If serial port has data input { msg = my_Serial.readStringUntil('\n'); //Acquire all content before line break Serial.println(msg); //Receive character strings of msg in the serial monitor my_Serial.println("bluetooth respond"); //Sending data to the other side of the Bluetooth communication } } </source> ==Project== '''Related Projects:''' [[Bluetooth Light]] [[Bluetooth Night Lamp]] ==FQA== *This module can’t make pair with win7? **Check the BT version in win7, this module only support BLE 4.0 version and default password is 000000. *Does this module can reset by button? **No, it can be reset by power down. *This module can’t make pair with iphone and Android phone? **This issue mostly is caused by the BT version. This module only supports BT4.0 protocol. **For Andriod OS: 4.3 release **For IOS: iPhone4s upper, iPod touch 5 upper, iPad 3 upper and iPad mini upper ==Pictures== [[file:mCookie-BT-t1.jpg|thumb|600px|center]] [[file:mCookie-BT-b1.jpg|thumb|600px|center]] [[file:mCookie-BT-t.jpg|thumb|600px|center|mCookie-BT Front]] [[file:mCookie-BT-b.jpg|thumb|600px|center|mCookie-BT Back]] |}
该页面使用的模板:
模板:Language
(
查看源代码
)
模板:Nmbox
(
查看源代码
)
返回至
MCookie-BT
。
导航菜单
个人工具
创建账户
登录
名字空间
页面
讨论
变种
视图
阅读
查看源代码
查看历史
更多
搜索
Welcome
首页
创客大赛
大赛详情
3D打印
安装月球车
图形化编程
操控月球车
升级月球车
编程工具下载
软件下载
Arduino
Processing
Mixly
Scratch
模块套件
Microduino 102
mCookie 102
mCookie 202
mCookie 302
IBC
其他
应用套件
四轴飞行器
平衡车
小车CUBE
音乐播放器
刷卡音乐播放器
wifi气象站
彩虹音乐触摸灯
分贝检测仪
迎门汇报
LED点阵时钟
LED点阵屏幕
硬件
mCookie
Sensor
Microduino
MicroWrt
MicroNux
MicroRobot-Core
MicroRobot-CoreESP
ideaBoard
ideaBox
MicroMV
MicroAI
帮助
常见问题
帮助
工具
链入页面
相关更改
特殊页面
页面信息