Difference between revisions of "Microduino-Module BLE"
(→Communicate with Android Device) |
|||
Line 11: | Line 11: | ||
*Support iBecons mode; | *Support iBecons mode; | ||
*Multiple ways to restore factory settings; | *Multiple ways to restore factory settings; | ||
− | **Use | + | **Use "AT+ RENEW\r\n" instruction to restore; |
− | **Test pin DEF to GND and then power on the module. The LED light blinks after | + | **Test pin DEF to GND and then power on the module. The LED light blinks after LED 1 keeps on for three seconds and meantime, loose DEF and factory reset succeeds, you can see the LED light blinks every one second. |
*Capable of data power-off preservation function; | *Capable of data power-off preservation function; | ||
*Support AT instruction and flexible to change serial baud rate, device name, code matching as well as other parameters according to various needs; | *Support AT instruction and flexible to change serial baud rate, device name, code matching as well as other parameters according to various needs; | ||
Line 40: | Line 40: | ||
**The indicator of both the host and the slave machine keeps on for 100ms every five seconds. | **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. | *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 | + | *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); | **Work mode: 0(transmission), 1(Direct drive) and 2(iBeacon); | ||
**iBeacon can be tested by Locate iBeacons offered on App Store. | **iBeacon can be tested by Locate iBeacons offered on App Store. | ||
Line 50: | Line 50: | ||
===Main Components=== | ===Main Components=== | ||
− | * | + | *cc2541_datasheet:'''[[File:Cc2541.pdf]]''' |
===Android APP=== | ===Android APP=== | ||
*APP Installation package:'''[[File:BT APP.zip]]''' | *APP Installation package:'''[[File:BT APP.zip]]''' | ||
− | *APP | + | *APP Source: https://github.com/iascchen/android-microduino |
− | |||
If you want to develop your own app referring to the android code in github, you need pay attention to that the UUID must be same with the UUID of Microduino-BT. | If you want to develop your own app referring to the android code in github, you need pay attention to that the UUID must be same with the UUID of Microduino-BT. | ||
Line 96: | Line 95: | ||
**Unplug the Microduino Shield BT4.0 during downloading the program; | **Unplug the Microduino Shield BT4.0 during downloading the program; | ||
*If you want to change the jumper cables to meet your requirement, you need to cut the connection between two intermediate of the pad and RX0/TX1, and then connect them to D2, D3 (or D9, D10). | *If you want to change the jumper cables to meet your requirement, you need to cut the connection between two intermediate of the pad and RX0/TX1, and then connect them to D2, D3 (or D9, D10). | ||
− | **If it needs to change the jumper, you can change the serial connection of Microduino Shield BT4.0 and Microduino Core from "TX- | + | **If it needs to change the jumper, you can change the serial connection of Microduino Shield BT4.0 and Microduino Core from "TX-RX0, RX-TX1" to: |
***TX-D2, RX-D3 (For Core+'s Serial1) | ***TX-D2, RX-D3 (For Core+'s Serial1) | ||
***TX-D9, RX-D10 (you can adopt SoftwareSerial libray to solve the problem) | ***TX-D9, RX-D10 (you can adopt SoftwareSerial libray to solve the problem) | ||
Line 151: | Line 150: | ||
===Communicate with IOS Device=== | ===Communicate with IOS Device=== | ||
− | *Above | + | *Above iPhone 4s, iPod touch 5, iPad 3, and iPad mini; |
− | *Go to App Store to download | + | *Go to App Store to download LightBlue: |
[[File:LightBlue.jpg|400px|center|thumb|LightBlue]] | [[File:LightBlue.jpg|400px|center|thumb|LightBlue]] | ||
− | Step 1 | + | Step 1: Download the program to Microduino: |
− | Step 2 | + | Step 2: Install "lightblue". Open the software, and set the IOS device. Open the bluetooth of the IOS device. And open the serial port monitor on computer IDE. |
[[File:LightBlue_on_ble.jpg|400px|center|thumb]] | [[File:LightBlue_on_ble.jpg|400px|center|thumb]] | ||
− | Step 3 | + | Step 3: Open LightBlue: The interface that you have entered is bluetooth device searching interface. Find the bluetooth device of Microduino from the list under "Peripherals Nearby", and click it to connect it with the mobile phone; |
|- | |- | ||
| | | | ||
Line 166: | Line 165: | ||
[[File:ble-Connection1.jpg|400px|center|thumb|Connection2]] | [[File:ble-Connection1.jpg|400px|center|thumb|Connection2]] | ||
− | Step 4 | + | Step 4: Choose and click Characteristic6, and look at the format of the code at the top right corner of the screen, and the default is Hex 16 binary code. If you want it displays the string, please click on the button where the Hex is and choose UTF-8 code format. Then click "Listen for notifications" to make the mobile phone into listening state. |
[[File:ble-Connection5.jpg|400px|center|thumb]] | [[File:ble-Connection5.jpg|400px|center|thumb]] | ||
− | Step 6 | + | Step 6: Click "Write new value", and the text editing interface will come out. |
[[File:ble-Connection2.jpg|400px|center|thumb]] | [[File:ble-Connection2.jpg|400px|center|thumb]] | ||
Custom input a string of English and digital, and observe the result that the mobile and serial port display. | Custom input a string of English and digital, and observe the result that the mobile and serial port display. | ||
Line 175: | Line 174: | ||
[[File:ble-Connection3.jpg|400px|center|thumb]] | [[File:ble-Connection3.jpg|400px|center|thumb]] | ||
[[File:ble-Connection4.jpg|400px|center|thumb]] | [[File:ble-Connection4.jpg|400px|center|thumb]] | ||
− | + | You can see from the picture that the serials have received the "12345" that the mobile phone sent, and the mobile also has received the "bluetooth respond" that the bluetooth returned. It proves that the Bluetooth two-way communication is smooth. | |
===Communicate with MAC Device=== | ===Communicate with MAC Device=== | ||
Line 217: | Line 216: | ||
*Program download | *Program download | ||
**Stack the mCookie-BT and mCookie-CoreUSB togethe. Insert the USB cable into the jack of mCookie-CoreUSB, and connect the other end to the USB port of the computer; | **Stack the mCookie-BT and mCookie-CoreUSB togethe. Insert the USB cable into the jack of mCookie-CoreUSB, and connect the other end to the USB port of the computer; | ||
− | **Start Arduino IED, and copy the program to | + | **Start Arduino IED, and copy the program to IDE; |
− | **Choose Microduino CoreUSB at tools -> Board, and choose the corresponding serial port number at tools -> | + | **Choose Microduino CoreUSB at tools -> Board, and choose the corresponding serial port number at tools -> Serial; |
**Click on the compile (√) at the top left corner of the IDE co compile the program. After finishing profiling, click the download (->) button to write the program to the board; | **Click on the compile (√) at the top left corner of the IDE co compile the program. After finishing profiling, click the download (->) button to write the program to the board; | ||
− | *Open the serial port monitor, and set it | + | *Open the serial port monitor, and set it as: "\r\n", "9600baud". |
[[File:ble-Serial.jpg|600px|center|thumb|Serial]] | [[File:ble-Serial.jpg|600px|center|thumb|Serial]] | ||
*Input the specified commands in the serial port monitor, and you can see the result returned. And the reference document can change the parameter of BT. | *Input the specified commands in the serial port monitor, and you can see the result returned. And the reference document can change the parameter of BT. | ||
Line 229: | Line 228: | ||
//Use SoftwareSerial to use other soft serial ports. | //Use SoftwareSerial to use other soft serial ports. | ||
#include <SoftwareSerial.h> | #include <SoftwareSerial.h> | ||
− | SoftwareSerial mySerial(4, 5);// | + | SoftwareSerial mySerial(4, 5);//According to the serial port selected, select the corresponding port numbers (2, 3) or (4, 5). |
#define my_Serial mySerial | #define my_Serial mySerial | ||
Line 263: | Line 262: | ||
! rowspan="1" | HM-10 module pin name || Microduino pin || Function | ! rowspan="1" | HM-10 module pin name || Microduino pin || Function | ||
|- | |- | ||
− | | TX|| RX0(orD2/D4) || Serial sending pin(TTL level), capable of connection RXD | + | | TX|| RX0(orD2/D4) || Serial sending pin(TTL level), capable of connection RXD of a microcontroller. |
|- | |- | ||
| RX || TX1(orD3/D5) || Serial receiving pin(TTL level), capable of connecting TXD of a microcontroller. | | RX || TX1(orD3/D5) || Serial receiving pin(TTL level), capable of connecting TXD of a microcontroller. | ||
Line 305: | Line 304: | ||
**This issue is mostly caused by the version of the BT. This module only supports BT4.0 protocol. | **This issue is mostly caused by the version of the BT. This module only supports BT4.0 protocol. | ||
**For Andriod OS: 4.3 and higher | **For Andriod OS: 4.3 and higher | ||
− | **For IOS: | + | **For IOS: iPhone 4s and higher, iPod Touch 5 and higher, iPad 3 and higher,iPad mini and higher. |
==Buy== | ==Buy== | ||
Line 311: | Line 310: | ||
==History== | ==History== | ||
*On July, 28, 2014, the module scheme was cancelled. The new BT version adopts CC25541 chip, supporting iBeacons mode. For the old version, you can refer to [[Microduino-【BT】]]. | *On July, 28, 2014, the module scheme was cancelled. The new BT version adopts CC25541 chip, supporting iBeacons mode. For the old version, you can refer to [[Microduino-【BT】]]. | ||
− | *On June 5, 2014, the second proofing was finished, changing its name to <nowiki>Microduino-[BT]</nowiki> and | + | *On June 5, 2014, the second proofing was finished, changing its name to <nowiki>Microduino-[BT]</nowiki> and add the third optional serial port—UART1. It is divided into two versions—version 2.1, a module used for HM09 and 4.0 version, a module used for HM10. |
*On 10, May, 2013, the board design was finished. | *On 10, May, 2013, the board design was finished. | ||
Revision as of 03:57, 28 September 2016
Language: | English • 中文 |
---|
Microduino-BT is a BLE serial transparent transmission module based on CC2541 chip. It is custom-made for U-shaped 27PIN standard interface of Microduino. The old version can refer to Microduino-【BT】. ContentsFeatures
Specification
DocumentEagle PCB File:Microduino-BT Shield.zip Support AT instruction configuration/control: File:Microduino-BLE.pdf Main Components
Android APP
If you want to develop your own app referring to the android code in github, you need pay attention to that the UUID must be same with the UUID of Microduino-BT. DevelopmentSerial Port Communication Requirements
Use PC to Debug
Use USBTTL and Core to Download and Debug
//Use SoftwareSerial to use other soft serial ports.
#include <SoftwareSerial.h>
SoftwareSerial mySerial(4, 5);
#define my_Serial mySerial //Use soft serial ports 4 and 5.
//#define my_Serial Serial1
String msg = ""; //To define a string.
void setup()
{
// Initialize the Bluetooth communication baud rate.
my_Serial.begin(9600);
// Initialize the serial communication baud rate monitor.
Serial.begin(9600);
}
void loop()
{
//Every time receive a signal, feedback to the other end of the communication.
if (my_Serial.available() > 0) //If there are signals being transferred into the serial port.
{
msg = my_Serial.readStringUntil('\n'); //Get all the contents before the newline character.
Serial.println(msg); //The serial monitor displays the string received in the MSG.
my_Serial.println("^_^ Hello,Microduino!"); //Send data to the other end of Bluetooth communication.
}
} Communicate with Android Device
File:MSerial.zip | ||||||||||
Step 1: Download programs to Microduino; | ||||||||||
Step 2: Begin to set Android device. Open the bluetooth of the Android deice, open the App, and open the serial port monitor at the computer IDE; Step 3: Click on the SCAN button at the top right corner of the App, which is used to search bluetooth access point around, and after clicking on the button, it will display surrounding bluetooth devices. Click the corresponding Microduino bluetooth number. After entering the interface, waiting about 2-3 seconds. When it changes into "Serial ready" on the top right corner of the screen, the mobile phone has been connected to the Bluetooth. The mobile sends English characters to Microduino, and the serial port monitor receives them. At the same time the mobile phone has received "^_^ Hello,Microduino!" that is sent by Microduino, which has proved the bidirectional communication function of Bluetooth. Communicate with IOS Device
Step 1: Download the program to Microduino: Step 2: Install "lightblue". Open the software, and set the IOS device. Open the bluetooth of the IOS device. And open the serial port monitor on computer IDE. Step 3: Open LightBlue: The interface that you have entered is bluetooth device searching interface. Find the bluetooth device of Microduino from the list under "Peripherals Nearby", and click it to connect it with the mobile phone; | ||||||||||
After connecting, you will enter the interface as following: Step 4: Choose and click Characteristic6, and look at the format of the code at the top right corner of the screen, and the default is Hex 16 binary code. If you want it displays the string, please click on the button where the Hex is and choose UTF-8 code format. Then click "Listen for notifications" to make the mobile phone into listening state. Step 6: Click "Write new value", and the text editing interface will come out. Custom input a string of English and digital, and observe the result that the mobile and serial port display. You can see from the picture that the serials have received the "12345" that the mobile phone sent, and the mobile also has received the "bluetooth respond" that the bluetooth returned. It proves that the Bluetooth two-way communication is smooth. Communicate with MAC Devicemac bluetooth can't connect with BT search directly, so you need to use Light Blue to develop and download.
ExtensionUse AT to view or change the parameter of BT
//Use SoftwareSerial to use other soft serial ports.
//#include <SoftwareSerial.h>
//SoftwareSerial mySerial(4, 5); // RX, TX
//#define my_Serial mySerial
#define my_Serial Serial1 //Define serial ports CoreUSB and BT.
void setup()
{
Serial.begin(9600);//Serial communication baud rate monitor
my_Serial.begin(9600);//BT communication baud rate.
}
void loop()
{
if (Serial.available())//Monitor the data of the serial port monitor.
my_Serial.write(Serial.read());//Write data into BT.
if (my_Serial.available())//Monitor the data of BT serial port.
Serial.write(my_Serial.read());//Print the data in the serial port monitor.
}
Use software serial port communication program: //Use SoftwareSerial to use other soft serial ports.
#include <SoftwareSerial.h>
SoftwareSerial mySerial(4, 5);//According to the serial port selected, select the corresponding port numbers (2, 3) or (4, 5).
#define my_Serial mySerial
String msg = "";
void setup()
{
//Initialize the Bluetooth communication baud rate.
my_Serial.begin(9600);
// Initialize the serial communication baud rate monitor.
Serial.begin(9600);
}
void loop()
{
//Every receiving the signal, feedback to the other end of the communication
if (my_Serial.available() > 0) //If there are data transferred into the serial ports.
{
msg = my_Serial.readStringUntil('\n'); //Get all the contents before the newline character.
Serial.println(msg); //The serial monitor displays the string received in the MSG.
my_Serial.println("bluetooth respond"); //Send data to the other end of the bluetooth communication.
}
} Pin Description
ApplicationProgram DownloadProgram test: File:BLE debug uart1.zip,File:BLE LightBlue time.zip Serial Port Debug Shield BT4.0 by CoreUSB
Have serial debugging of BT module by uart1 of Core+
Intercommunication between Two Microduino-BT ModulesMicroduino BT Serial port Transmits Data to IOS DeviceNote:If you use Android device to debug, you need to make sure the system should be version 4.3 or higher so that Microduino-BT can be detected.A simple test of Microduino-Shield BT4.0
FQA
BuyHistory
| ||||||||||
PicturesVideo |