Difference between revisions of "Microduino-Module BLE"
(→Have serial debugging of BT module by uart1 of Core+) |
(→How to Connect Two Microduino-BT Modules) |
||
Line 287: | Line 287: | ||
*Check the status of the serial communication: | *Check the status of the serial communication: | ||
** Send "AT"(with \r\n behind) after opening the serial monitor and if the return is "OK", it means the configuration is successful. | ** Send "AT"(with \r\n behind) after opening the serial monitor and if the return is "OK", it means the configuration is successful. | ||
− | |||
− | |||
==[[Intercommunication between Two Microduino-BT Modules]]== | ==[[Intercommunication between Two Microduino-BT Modules]]== |
Revision as of 10:11, 24 August 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
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
| ||||||||||
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);//Accoding 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 |