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

vima@espressif
Posts: 3
Joined: Mon Nov 27, 2017 12:32 am

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

Postby vima@espressif » Fri Dec 29, 2017 11:42 pm

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.

f.h-f.s.
Posts: 185
Joined: Thu Dec 08, 2016 2:53 pm

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

Postby f.h-f.s. » Mon Jan 22, 2018 9:44 am

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.

s.allasia
Posts: 13
Joined: Tue Jan 09, 2018 3:12 pm

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

Postby s.allasia » Tue Jan 23, 2018 7:29 am

Hi,
I used "esp_ble_gatts_send_indicate" function in "esp_gatts_api.h".
Bye!

Who is online

Users browsing this forum: Bing [Bot], jean.passepartout and 9 guests