1
\$\begingroup\$

I searched quite a long time now but I'm still not sure whether it's possible using (just one) ESP32 module.

What I need/want:

I have some sensors sending their data using Bluetooth Low Energy about every 200 ms, but they are too far away to catch them all with just one receiver, and mesh has too high energy consumption. My idea now is to use ESP32 modules as gateways/repeaters (their consumption doesn't matter.)

The ESP32 should connect as a central to like 3 or 4 of the peripherals and receive their data, and then using WiFi push it into a MySQL database on a nearby server/hotspot.

Is this possible? Stay connected to WiFi, receive Bluetooth data, send via WiFi with good timing, or would I need to involve like two modules per gateway one for Bluetooth receiving and one for sending via WiFi and those two connected via SPI/I²C?

\$\endgroup\$
0

1 Answer 1

1
\$\begingroup\$

Yes it's possible.

Finding the code to do it would be off topic, but do a web search for beacon scanner examples especially ones that push results to an MQTT broker or something like that.

If you need to connect and query BLE characteristics rather than simply receive unconnectable advertisements (ie, beacons) you'll need to do some additional work.

Likely you'll have to spend some time becoming familiar with the typical operation and organization of ESP32 programs by the time you get everything working.

Also put some thought into how you want to do wifi provisioning; there's source code for a BLE based method of provisioning but getting that to play nice with other things is tricky; for a quick proof-of-concept I ended up going with two quite distinct operating modes for setup vs. usage and basically rebooting to get between them.

\$\endgroup\$
2
  • \$\begingroup\$ Thank you very much for your wholesome answer. Yes, my Bluetooth peripherals send their data as notifications in a connected state for minimal energy consumption. They are currently on ble5 long range only but I'll revert them back for ble4 compatibility. WiFi provisioning can and will simply be hardcoded. Do you know how many concurrent connections the ESP32 can hold as a central using Arduino? My current receiver (nrf52840) can hold 20 connections using Nordic SDK.. but ArduinoBLE library for Arduino Nanosense (same Bluetooth Module) e. g. only supports 3 afaik. But ESP32 BLElib is another? \$\endgroup\$
    – user263830
    Commented Sep 26, 2020 at 15:45
  • \$\begingroup\$ To the extent that it's not a protocol/timing limitation any smaller limit would presumably be in software. You'll have to look at the ESP-IDF documentation to see what it says, then if you need to improve that perhaps the code itself to see how deeply into things source is available, vs if there's a point at which it switches to being binary-only vendor code. I would not recommend using Arduino-based development for this project. You might also consider not being connected to all devices at the same time, or switching to advertisements which do not require connection... \$\endgroup\$ Commented Sep 26, 2020 at 15:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.