receive data from BrainLink Lite to Arduino Leonardo via Bluetooth HC-05

Hi everyone!

I trying to get neuro data from neurodevice BrainLink Lite via Bluetooth Shield 2.2 (based on HC-05), but receive nothing.
Below code and configurations of devices.

1. configure bluetooth module
Bluetooth Shield 2.2 has a mode switcher DAT\CMD. Switch it to the CMD mode.
Connect RX, TX to arduino 0, 1 pins. Vcc 5V, GND.

Write simple echo sketch:

void setup() {
  delay(5000);
  Serial.begin(9600);
  Serial1.begin(38400);

  Serial.println("setup done");
}

void loop() {
  if (Serial1.available())
  {
    byte a = Serial1.read();
    Serial.write(a);
  }

  if (Serial.available())
  {
    byte a = Serial.read();
    Serial1.write(a);
  }
}

configure bluetooth module via at-commands:

at+orgl // default settings
at+reset // reset
at+rmaad // delete all auth devices
at+role=1 // role - master
at+cmode=0 // connectto fixed address
at+uart=57600,0,0 // neuro device work on 57600 baud
at+init // init bluetooth spp
at+bind=addr // set fixed address of neuro device

switch Bluetooth Shield to DATA mode and disconnect RX\TX pins.
done

2. upload sketch to receive bytes from bluetooth device:

# define DEBUGOUTPUT 1

void setup() {
  delay(5000);
  Serial.begin(9600);
  Serial1.begin(57600);

  Serial.println("setup done");
}

void loop() {
  readOneByte();
}

byte readOneByte() {
  while(!Serial1.available());
  byte readByte = Serial1.read();
  #if DEBUGOUTPUT
    Serial.print((char) readByte);
  #endif

  return readByte;
}

3. connect jumpers between arduino and bluetooth shield. Turn on BrainLink Lite and wait for connection.
Serial monitor are empty...

any ideas? I don't see any mistake
pls help, I wasted already 2 weeks =(
Thanks a lot!
Are welcome to detail questions.

4. Expected questions:

  • Are you really sure that connection between bluetooth and neuro device was installed?

  • Yes, go check
    switch again to CMD mode and check that connection really exist:
    at+mrad -> BrainLink address // recently used authenticated device
    at+adcn -> 1 // count of connection

  • Do both devices support the same bluetooth profiles?

  • Yes
    BrainLink Lite based on NeuroSky MindWave and support SPP for transmit brainwaves

  • Have you tried to connect the smartphone and the neurodevice via any Bluetooth Terminal?

  • Yes, data are receiving

Your code implies you are using a Mega. Is this correct? If yes, bluetooth is connected to wrong pins - use pins 18,19. If no, what is this Serial1 all about?

Nick_Pyner:
Your code implies you are using a Mega. Is this correct? If yes, bluetooth is connected to wrong pins - use pins 18,19. If no, what is this Serial1 all about?

The Arduino Leonardo board uses Serial1 to communicate via TTL (5V) serial on pins 0 (RX) and 1 (TX). Yes, that is correct.

OK. I forget about Leonardo.