Page 2 of 2

Re: ESP32 Bluetooth SPP with bidirectional communication (send and receive)

Posted: Mon Mar 11, 2019 2:12 pm
by suriyaelango
Hi,
Can someone please tell me if Bluetooth SPP supports multiple clients in case of bi-directional communication? If yes, implementation code, please.

Re: ESP32 Bluetooth SPP with bidirectional communication (send and receive)

Posted: Tue Mar 12, 2019 4:20 pm
by gunar.kroeger
suriyaelango wrote: Hi,
Can someone please tell me if Bluetooth SPP supports multiple clients in case of bi-directional communication? If yes, implementation code, please.
It does. You will have to save the connection handle from incoming clients and direct the messages with esp_spp_write to the correct handle

Re: ESP32 Bluetooth SPP with bidirectional communication (send and receive)

Posted: Mon Mar 18, 2019 7:57 am
by suriyaelango
The esp_spp_write function is an IDF function. Any chance it works with the Arduino framework for ESP32?

Re: ESP32 Bluetooth SPP with bidirectional communication (send and receive)

Posted: Tue Mar 19, 2019 4:01 pm
by ESP_Me-no-dev
We already have a library and example in Arduino for SPP use: https://github.com/espressif/arduino-es ... rialBT.ino

Re: ESP32 Bluetooth SPP with bidirectional communication (send and receive)

Posted: Wed Mar 20, 2019 7:29 pm
by SpartaYigit
ESP_Me-no-dev wrote:
Tue Mar 19, 2019 4:01 pm
We already have a library and example in Arduino for SPP use: https://github.com/espressif/arduino-es ... rialBT.ino
The BluetoothSerial library does not allow to connect directly to other devices (when a UUID is given) using SPP. Is this correct? If not, is there an example to do this in Arduino?

(I want to connect the ESP32 to the Neurosky Mindwave Mobile which uses Serial Port Profile (classic bluetooth). I have looked into the SPP_initiator example and it allows me to connect to the device but couldn't receive any data from it.)

Re: ESP32 Bluetooth SPP with bidirectional communication (send and receive)

Posted: Wed Apr 24, 2019 3:33 am
by JWardell
SpartaYigit wrote:
Wed Mar 20, 2019 7:29 pm
The BluetoothSerial library does not allow to connect directly to other devices (when a UUID is given) using SPP. Is this correct? If not, is there an example to do this in Arduino?

(I want to connect the ESP32 to the Neurosky Mindwave Mobile which uses Serial Port Profile (classic bluetooth). I have looked into the SPP_initiator example and it allows me to connect to the device but couldn't receive any data from it.)
I'm trying to do the same thing, to connect to an existing bluetooth serial device. Have you figured out a way to do with with Arduino?
Thanks.

Re: ESP32 Bluetooth SPP with bidirectional communication (send and receive)

Posted: Wed Apr 24, 2019 12:37 pm
by SpartaYigit
JWardell wrote:
Wed Apr 24, 2019 3:33 am
SpartaYigit wrote:
Wed Mar 20, 2019 7:29 pm
The BluetoothSerial library does not allow to connect directly to other devices (when a UUID is given) using SPP. Is this correct? If not, is there an example to do this in Arduino?

(I want to connect the ESP32 to the Neurosky Mindwave Mobile which uses Serial Port Profile (classic bluetooth). I have looked into the SPP_initiator example and it allows me to connect to the device but couldn't receive any data from it.)
I'm trying to do the same thing, to connect to an existing bluetooth serial device. Have you figured out a way to do with with Arduino?
Thanks.
Yeah, currently it is working with arduino. I have changed the bluetooth serial library to allow connecting to the Mindwave headset. The only problem left is the data that i am receiving. I can only see the raw data that the headset sends over (every 2 ms). I cannot seem to get the eSense values out of it which is sent every 1 second. Maybe we can help eachother out.

Re: ESP32 Bluetooth SPP with bidirectional communication (send and receive)

Posted: Thu Apr 25, 2019 2:39 am
by JWardell
SpartaYigit wrote:
Wed Apr 24, 2019 12:37 pm
Yeah, currently it is working with arduino. I have changed the bluetooth serial library to allow connecting to the Mindwave headset. The only problem left is the data that i am receiving. I can only see the raw data that the headset sends over (every 2 ms). I cannot seem to get the eSense values out of it which is sent every 1 second. Maybe we can help eachother out.
So you had to modify the bluetooth serial library to allow pairing etc, or did you change to a different library? How difficult is it? Is there a way to get a list of discoverable devices?

Trying to find what you are trying to interface with, some kind of EEG?

Re: ESP32 Bluetooth SPP with bidirectional communication (send and receive)

Posted: Sun Apr 28, 2019 8:24 am
by SpartaYigit
JWardell wrote:
Thu Apr 25, 2019 2:39 am
SpartaYigit wrote:
Wed Apr 24, 2019 12:37 pm
Yeah, currently it is working with arduino. I have changed the bluetooth serial library to allow connecting to the Mindwave headset. The only problem left is the data that i am receiving. I can only see the raw data that the headset sends over (every 2 ms). I cannot seem to get the eSense values out of it which is sent every 1 second. Maybe we can help eachother out.
So you had to modify the bluetooth serial library to allow pairing etc, or did you change to a different library? How difficult is it? Is there a way to get a list of discoverable devices?

Trying to find what you are trying to interface with, some kind of EEG?
Correct, I was trying to get the brainwave values from a Neurosky MindWave headset through the bluetooth conection.

I modified the Bluetooth Serial library with the SPP_initiator example from ESP32-IDF to have the buffer functionality of the library when data is being received. It was a lot of work in the beginning to understand the code but now it finally works. There is code available on Qita https://qiita.com/ajtajta_j/items/297c6191635b47c945cb from which i started to directly connect to a device when the UUID is known (but has no buffer). There is a bt_discovery example on GitHub to see a list of discoverable devices.

Feel free to ask if something is not clear.