I want to do a small project based on an ESP32 development board, along with an encoder and GPS. If I need to give more details I will, but in short:
The project is to count the revolutions of the encoder and every now and then, when the user presses a button connected to the ESP32 board, an IRQ interrupt will be triggered, which will handle two things:
- it will send the data - the number of revolutions of the encoder since the last trigger (use of the button),
and
- it will send the current coordinates - data from the GPS (at the place where the button was pressed).
This is the basic functionality I want to get. There will be a few other things, but I don't want to write about them to simplify the description.
Data will be short strings, a dozen or so characters, max. a few dozen. I want to send information from the ESP32 to the phone via Bluetooth Low Energy (BLE).
I have already read a bit about BLE, but I have questions for people who have already implemented BLE in the ESP32 for some hints, tips and tricks. The documentation of the protocol is extensive and I don't know a lot of things yet.
What is the best to use (what "services" to send relatively short strings, how best to solve device pairing, is it worth it and how to put BLE to sleep for a short time - up to a few minutes and your other solutions to problems/hardships you have encountered)?
UUUID will be permanently stored to facilitate pairing of both devices.
Thank you for any tips and advice!
I was thinking of making the ESP32 the server for ease of use, and making the phone the client. Or would a "simple" SPP suffice here? (Simplifying even further, the Beacon functionality would probably suffice, but I'm not entirely sure if that's a good idea). This would probably be enough, although, I don't know if this would work in case of some loss of connectivity / errors - I can't let some of the data not reach the phone, so it would be good to confirm receipt of the data (receipt and correctness, after validation on the phone). I don't know how much to rely on the BLE connection (although the distance between the device and the phone will not exceed a few metres).
Thanks in advance for your help and hints! .
The project is to count the revolutions of the encoder and every now and then, when the user presses a button connected to the ESP32 board, an IRQ interrupt will be triggered, which will handle two things:
- it will send the data - the number of revolutions of the encoder since the last trigger (use of the button),
and
- it will send the current coordinates - data from the GPS (at the place where the button was pressed).
This is the basic functionality I want to get. There will be a few other things, but I don't want to write about them to simplify the description.
Data will be short strings, a dozen or so characters, max. a few dozen. I want to send information from the ESP32 to the phone via Bluetooth Low Energy (BLE).
I have already read a bit about BLE, but I have questions for people who have already implemented BLE in the ESP32 for some hints, tips and tricks. The documentation of the protocol is extensive and I don't know a lot of things yet.
What is the best to use (what "services" to send relatively short strings, how best to solve device pairing, is it worth it and how to put BLE to sleep for a short time - up to a few minutes and your other solutions to problems/hardships you have encountered)?
UUUID will be permanently stored to facilitate pairing of both devices.
Thank you for any tips and advice!
I was thinking of making the ESP32 the server for ease of use, and making the phone the client. Or would a "simple" SPP suffice here? (Simplifying even further, the Beacon functionality would probably suffice, but I'm not entirely sure if that's a good idea). This would probably be enough, although, I don't know if this would work in case of some loss of connectivity / errors - I can't let some of the data not reach the phone, so it would be good to confirm receipt of the data (receipt and correctness, after validation on the phone). I don't know how much to rely on the BLE connection (although the distance between the device and the phone will not exceed a few metres).
Thanks in advance for your help and hints! .