Link:
Adsense HTML/JavaScript
Thursday, October 8, 2020
Bluetooth Serial communication between HC-08(Master) and HC-04(Slave)
Link:
Thursday, September 17, 2020
Program Seeeduino XIAO as USB-to-Serial bridge, to access HC-08 BLE 4.0 Module/ESP WiFi Modules.
HC-08 is a Bluetooth 4.0 low energy module. It provide TTL Serial interface. If we want to access it using PC, normal a USB-to-Serial adapter is used.
In this exercise, Seeeduino XIAO is programmed as a USB-to-Serial bridge to read/write HC-08 from Raspberry Pi using Arduino IDE's Serial Monitor.
Connection between Seeeduino XIAO and HC-08
XIAO HC-08
=====================
3V3 VCC
GND GND
TX RX
RX TX
For the code, simple foreward date from SerialUSB to Serial1, and foreward Serial1 to SerialUSB.
X_USBbridge.ino
/*
Xiao act as a bridge between USB and Serial device
It's assumed the device is running 3V3
Connection
Xiao Rx - device Tx
Xiao Tx - device Rx
XIAO GND - device GND
XIAO 3V3 - device VCC
*/
void setup()
{
pinMode(LED_BUILTIN, OUTPUT);
delay(1000);
SerialUSB.begin(9600);
Serial1.begin(9600);
//wait serial ports to device
//while(SerialUSB);
while(!Serial1);
//Blink the LED 3 times to indicate program started
for(int i=0; i<3; i++){
digitalWrite(LED_BUILTIN, HIGH);
delay(500);
digitalWrite(LED_BUILTIN, LOW);
delay(500);
}
}
void loop()
{
if(SerialUSB.available() > 0){
Serial1.write(SerialUSB.read());
}
if(Serial1.available() > 0){
SerialUSB.write(Serial1.read());
}
}
This video show how it work.
Before HC-08 connected (LED blinking), You can read/write HC-08 status with AT Command.
After HC-08 connected with test app on Android phone (LED on), you can send/receive text to/from the app.
To know where/how to download datasheet (with AT Command Set) and test app for HC-08, read the post "HC-08 Bluetooth Module (BLE 4.0)".
To install Seeeduino XIAO board to Arduino IDE, read the post "Seeeduino XIAO".
This can be used to access HC-04 Dual Mode BLE SPP Bluetooth Module also.
Access ESP WiFi Modules:
X_USBbridge_115200.ino
/*
Xiao act as a bridge between USB and Serial device
It's assumed the device is running 3V3
Connection
Xiao Rx - device Tx
Xiao Tx - device Rx
XIAO GND - device GND
XIAO 3V3 - device VCC
*/
void setup()
{
pinMode(LED_BUILTIN, OUTPUT);
delay(1000);
SerialUSB.begin(115200);
Serial1.begin(115200);
//wait serial ports to device
//while(SerialUSB);
while(!Serial1);
//Blink the LED 3 times to indicate program started
for(int i=0; i<3; i++){
digitalWrite(LED_BUILTIN, HIGH);
delay(500);
digitalWrite(LED_BUILTIN, LOW);
delay(500);
}
}
void loop()
{
if(SerialUSB.available() > 0){
Serial1.write(SerialUSB.read());
}
if(Serial1.available() > 0){
SerialUSB.write(Serial1.read());
}
}
Arduino IDE run on Raspberry Pi, to program Xiao as bridge to access ESP-01S:
Sunday, September 13, 2020
HC-08/HC-04 Bluetooth Module
HC-08 is a Bluetooth 4.0 low energy module, it can easily connect to iOS 5 and Android 4.3 or above by using a serial terminal app. You can use the Bluetooth communication up to 87 yards (80 meters) with this Bluetooth BLE module. It also runs on a 2.4GHz frequency. The chipset is CC2540 with 256K Byte space. You can change the role and serial baud rate and it supports AT commands for configuration.
It is very small in size, 1.1 x 0.5 in (26.9 x 13mm). The PCB thickness is 0.03 (0.7mm). Half-cut holes run along the lengths of the board, so it’s very easy to embed into your own project. It also has Tx and Rx 2.54 pin out, from which you can do a quick function test. Included are 90-degree male header pins.
HC-08 is a relatively new module made by an experienced Bluetooth design and manufacturing supplier in China. It’s mass produced and therefore well-tested. It can be incorporated into products or projects without worrying about being able to get it again. It’s already widely used in many Bluetooth projects.
Product page: http://www.hc01.com/products/6 (in Chinese)
Summary of AT Command Set in the datasheet is captured here.
HC-04 Dual Mode BLE SPP Bluetooth Module