Page 1 of 1

How to use ESP32 as server to send data of a sensor through its bluetuth

Posted: Fri Dec 29, 2017 11:42 pm
by vima@espressif
Hi,

I am trying to send data of an accelorometer through bluetooth of ESP32 to an android cellphone. My knowledge about blueooth is so basic. According to my undrestanding from my studying about bluetooth BLE, here ESP32 acts as server and cellphone is the client.
My question is that to reach this goal which one of the available examles in esp_idf is more suitable to use? Since I see both examples named "ble_spp_server" and "gatt_server", and I don't undrestand which one should I use for this purpose?

I appreciate any answer.

Re: How to use ESP32 as server to send data of a sensor through its bluetuth

Posted: Mon Jan 22, 2018 9:44 am
by f.h-f.s.
Have you looked up what ssp does?
Serial Port Profile (SPP) If you're replacing a serial communication interface (like RS-232 or a UART) with Bluetooth, SPP is the profile for you. SPP is great for sending bursts of data between two devices.
Bluetooth Basics - learn.sparkfun.com
https://learn.sparkfun.com/tutorials/bl ... h-profiles
GATT is more structured, you can have a accelerometer "GATT Service", with a characteristic for each variable it produces. update each variable as it changes and have GATT on the phone notified of the change.

I bet you could accomplish it with spp too, but I would go for GATT.

Re: How to use ESP32 as server to send data of a sensor through its bluetuth

Posted: Tue Jan 23, 2018 7:29 am
by s.allasia
Hi,
I used "esp_ble_gatts_send_indicate" function in "esp_gatts_api.h".
Bye!