Xadow - BLE Slave

Introduction

This is a Bluetooth 4.0 module(Bluetooth 4.0 slave module). Compared with Bluetooth version 2.0 and 3.0, it’s more advanced for its lower power consumption. You can easily connect your own project to the primary device of Bluetooth 4.0 by using this module. For instance, it can transfer the detected data which is about the information of your body to phone for displaying or analyzing, then, help you better manage your physical condition.

Specification


  • Bluetooth 4.0 Module
  • PIN:0000
  • Default Baudrate:38400
  • Dimensions: 25.43mm x 20.35mm

Demonstration


The demo is going to show you how to connect bluetooth device with Xadow BLE Slave and communicate. You can use it to communicate with phone(with Bluetooth 4.0). Now let us have a test: - Connect the Xadow BLE Slave to Xadow Main Board and connect Main Board to PC with a USB cable. In normal mode, the blue LED will blink once a time. If the blue led is off, please click the “reset” button on Xadow Main Board .

Note

When connect XadowBLE Slave to Xadow Main Board, you should concern about the connection direction. The connection method is that the unfilled corner of one Xadow module need to connect to the right angle of another module(see four corners of each Xadow module).

  • Upload the test code to your Xadow Main Board.
int error=0;
int n;
void setup()
{
    Serial.begin(38400);
    delay(100);
    PORTB|=0x04;
    TESTIO();
    if(error==0)
    {
        DDRB|=0x81;
        for(n=0;n<40;n++)
        {
            PORTB&=~0x81;
            delay(50);
            PORTB|=0x81;
        }
    }

    Serial1.begin(38400);
}
void loop()
{
    boot();
}
void TESTIO(void)
{
    DDRB|=0x0e;
    PORTB&=~0x0e;
    DDRF|=0x01;
    PORTF&=~0x01;
    DDRD&=~0x0f;

    PORTB|=0x04;
    PORTF|=0x01;
    delay(30);
    if(!(PIND&0x01))
    {
        error=1;
    }
    if(PIND&0x02)
    {
        error=1;
    }
    if(!(PIND&0x04))
    {
        error=1;
    }
    if(PIND&0x08)
    {
        error=1;
    }
    PORTB&=~0x04;
    PORTB|=0x0a;
    PORTF&=~0x01;
    delay(30);
    if(PIND&0x01)
    {
        error=1;
    }
    if(!(PIND&0x02))
    {
        error=1;
    }
    if(PIND&0x04)
    {
        error=1;
    }
    if(!(PIND&0x08))
    {
        error=1;
    }
    Serial.println(error);
}
void boot(void)
{
    for(;;)
    {
        if(Serial.available())
        {
            Serial1.write(Serial.read());
        }
        if(Serial1.available())
        {
            Serial.write(Serial1.read());
        }
    }
}
  • Select a serial tool to send and receive data. Here we use the Sscom32E. BaudRate should be 38400.

  • Get your Phone device ready and install “BlueSPP” APP and launch the BlueSPP. Remember that your device should be Bluetooth 4.0.

Tips

You should pair phone with BLE module first in the device manager of phone if the ‘BlueSPP’ can’t find the BLE module.

  • After connecting, the screen on Device is as following. You could type texts and data will send. It will show on serial tool of your PC. Of course, you can send data to phone by serial tool of your PC.

Resources


Help us make it better

Welcome to the new documentation system of Seeed Studio. We have made a lot of progress comparing to the old wiki system and will continue to improve it to make it more user friendly and helpful. The improvement can't be done without your kindly feedback. If you have any suggestions or findings, you are most welcome to submit the amended version as our contributor via Github or give us suggestions in the survey below, it would be more appreciated if you could leave your email so that we can reply to you. Happy Hacking!