Gibberish in BLE- Server works, client babbles

Good morning!
I have a BLE pair, a server and a client. The server sends up a service, and the client is looking for that service.

I have a reproducible problem. I can read the server’s ‘Hello World’ in a BLE scanner, but the client side says this in serial:
␜�F8����� W�r1BP�␐9␂R��
B���␐90��␜>U��␐9@n�X����␐92N�S����␐9B�H�␏=B��␐9B�Ǜ!�ˍ�����<��"om.␞np�␑��q␑�eY���␙H�␔)Xo��� ����"SF�U�݄��S�@b��4�␙H�␐9B��1��)q�Q9b�1O�)�␐9B^�a&���␐9␂���!�E�␐9BR�x�R�

This has happened with two different example scripts I’ve lifted fom library examples, but they’re all copies from ol’ Niel. I learn by re-building the thing I want, learning which pieces go where. I think I can build a basic BLE peripheral using the code I’ve seen, but the central isn’t as easy for me to follow.

I guess my big question is, “Has anyone seen this before? Do you know why the language coming out of the server is not what’s coming from the central?”
This may be more appropriate for the people at Espressif. They do pretty well with English, but it isn’t a straight shot.

Central makes the same gibberish whether the peripheral is broadcasting or not.

Do you see the gibberish in the Serial Monitor? If so, check the baud rate. You had a similar problem a while back with 9600 and 115200 trying to chat. Both need to be the same.

Check the code for multiple Serial.begin calls.

If you see this in the Bluetooth thingy, I’m afraid I have no idea, sorry.


Yeah, you saw a rare got-past-me. Everything is at 9600. The central script didn’t have a Serial.begin, so I added it.
Bugger! (That’s not a bad word here.) It had a 115200 buried up top.

Meaning it works now? Is the serial monitor thus also set to 9600 with monitor_speed = 9600 in the platformio.ini?

No, because it’s trying to add an Adafruit GFX library, even though it isn’t called for. I just went through and deleted all the pio folders, but it’s getting hung up on ‘Arduino’ again.

Verbose mode can be enabled via `-v, --verbose` option
PLATFORM: Espressif 32 (2.0.0) > WeMos D1 MINI ESP32
HARDWARE: ESP32 240MHz, 320KB RAM, 4MB Flash
DEBUG: Current (esp-prog) External (esp-prog, iot-bus-jtag, jlink, minimodule, olimex-arm-usb-ocd, olimex-arm-usb-ocd-h, olimex-arm-usb-tiny-h, olimex-jtag-tiny, tumpa)
 - framework-arduinoespressif32 3.10004.200129 (1.0.4)
 - tool-esptoolpy 1.20600.0 (2.6.0)
 - tool-mkspiffs 2.230.0 (2.30)
 - toolchain-xtensa32 2.50200.80 (5.2.0)
LDF: Library Dependency Finder ->
LDF Modes: Finder ~ chain, Compatibility ~ soft
Library Manager: Installing Arduino
Library Manager: Warning! More than one package has been found by Arduino requirements:
 - mbed-aluqard/arduino @ 0.0.0+sha.3b83fc30bbdf
 - mbed-eduardog26/Arduino @ 0.0.0-alpha+sha.abbc3308dfa1
 - mbed-thechrisyd/Arduino @ 0.0.0+sha.272d0276d474
 - mbed-gastonfeng/arduino @ 0.0.0-alpha+sha.b000674ff8b3
 - mbed-rahulsitaram/Arduino @ 0.0.0+sha.d0b32a4209f0
 - mbed-team2/Arduino @ 0.0.0+sha.d96590319bcf
Library Manager: Please specify detailed REQUIREMENTS using package owner and version (showed above) to avoid name conflicts
Library Manager: arduino @ 0.0.0+sha.3b83fc30bbdf has been installed!
Library Manager: Installing BLEDevice
Warning! Could not find the package with 'BLEDevice' requirements for your system 'windows_amd64'
Library Manager: Installing BLEScan
Warning! Could not find the package with 'BLEScan' requirements for your system 'windows_amd64'
Library Manager: Installing adafruit/Adafruit_GFX
KeyError: 'versions':
  File "C:\Users\joema\.platformio\penv\lib\site-packages\platformio\builder\", line 169:
  File "C:\Users\joema\.platformio\packages\tool-scons\scons-local-4.0.1\SCons\Script\", line 598:
    return _SConscript(self.fs, *files, **subst_kw)
  File "C:\Users\joema\.platformio\packages\tool-scons\scons-local-4.0.1\SCons\Script\", line 287:
    exec(compile(scriptdata, scriptname, 'exec'), call_stack[-1].globals)
  File "C:\Users\joema\.platformio\platforms\espressif32\builder\", line 223:
    target_elf = env.BuildProgram()
  File "C:\Users\joema\.platformio\packages\tool-scons\scons-local-4.0.1\SCons\", line 219:
    return self.method(*nargs, **kwargs)
  File "C:\Users\joema\.platformio\penv\lib\site-packages\platformio\builder\tools\", line 62:
  File "C:\Users\joema\.platformio\packages\tool-scons\scons-local-4.0.1\SCons\", line 219:
    return self.method(*nargs, **kwargs)
  File "C:\Users\joema\.platformio\penv\lib\site-packages\platformio\builder\tools\", line 140:
    project_lib_builder = env.ConfigureProjectLibBuilder()
  File "C:\Users\joema\.platformio\packages\tool-scons\scons-local-4.0.1\SCons\", line 219:
    return self.method(*nargs, **kwargs)
  File "C:\Users\joema\.platformio\penv\lib\site-packages\platformio\builder\tools\", line 1062:
  File "C:\Users\joema\.platformio\penv\lib\site-packages\platformio\builder\tools\", line 898:
  File "c:\users\joema\.platformio\penv\lib\site-packages\platformio\package\manager\", line 49:
    spec, silent=silent, skip_dependencies=skip_dependencies, force=force
  File "c:\users\joema\.platformio\penv\lib\site-packages\platformio\package\manager\", line 86:
  File "c:\users\joema\.platformio\penv\lib\site-packages\platformio\package\manager\", line 99:
    pkg = self.install_from_registry(spec, search_filters, silent=silent)
  File "c:\users\joema\.platformio\penv\lib\site-packages\platformio\package\manager\", line 86:
    version = self.pick_best_registry_version(package["versions"], spec)
==================================================================================== [FAILED] Took

The port is at 9600, and I included ‘monitor_speed = 9600’ in the .ini.
So I’m dying to see what happens, but Adafruit libraries are raising a lot of errors over here these days.


What platformio.ini do you have so that it attempts to install Arduino?

Operator error- GFX was an artifact in the .ini.

But this:
Library Manager: Installing BLEDevice
Warning! Could not find the package with ‘BLEDevice’ requirements for your system ‘windows_amd64’
Library Manager: Installing BLEScan
Warning! Could not find the package with ‘BLEScan’ requirements for your system ‘windows_amd64’

I uninstalled the original 32-bit VSCode and installed the 32-bit.
Why does it think it’s a 64? That’s incompatible with some things.

In case I haven’t done enough of it, I’m thanking y’all again. And you were here when it happened:
BLE Advertised Device found: Name: , Address: 63:25:ff:60:30:dc, manufacturer data: 4c001006031e589a5ac8, txPower: 7
BLE Advertised Device found: Name: , Address: f0:08:d1:cc:ec:42, serviceUUID: 4fafc201-1fb5-459e-8fcc-c5c9c331914b
Forming a connection to f0:08:d1:cc:ec:42

  • Created client
  • Connected to server
  • Found our service
    [E][BLERemoteCharacteristic.cpp:274] retrieveDescriptors(): esp_ble_gattc_get_all_descr: Unknown
  • Found our characteristic
    The characteristic value was: Hello World says Neil
    We are now connected to the BLE Server.

But now I need to display that Hello World on the 1306 OLED, which means wasting the day with versions unless I can use this new 1306 library written for WeMos.

It’s looking for the arduino library. You probably have just specified “arduino” in lib_deps. It found 6 arduino libraries and cannot pick one.

You need to choose one, copy the full name, and paste it into lib_deps instead of “arduino”. Assuming you actually need it of course.


I’ve been successful using the Git http: address in lib_deps. Pretty sure I’ve been omitting it from .ini and leaving it bracketed in .cpp.

It’s time to up the BLE game. I found a script that looks like I could paste in a few blocks and get up to the x characteristics I want to send.

Should be able to see it on a BLE scanner, but I really want to display received data on OLED, until I figure out the TFT.

What usually works didn’t work. There’s a serial print command, so I just copied it and changed ‘serial’ to ‘display’. I don’t understand the code they used to generate the data. Serial may handle something that OLED has to be told about. Now I have the working sensor pod, so I’ll spend the day shopping for a good BLE peripheral script. A beacon means I don’t have to connect. I’m sure it’s super easy to connect, but I want to do that when i can pay attention to it.

It would be awesome if the ESP32 peripheral script I found with a service and a paste-able characteristic works like I think it works.