What is the best way to filter BLE devices for VESC?

I’ve just updated the VESC Tool on a fork so that it only shows BLE devices which include UNITY in the name so that I can connect with mine. I have never been able to connect before. Each time I cannot find the correct device and since there are so many BLE devices the Unity goes out of view quickly. There seems to be a size limit as well so it is pushed out of the list quickly.

Normally with BLE the services can be used to filter to relevant devices. I will log out what shows up while scanning to see if that works. I have a spare unity updated to FW 5.1 and it is great that it at least shows the name for the Unity so I can filter that way.

Anyone have experience with Qt and QBluetoothDeviceInfo? I am going to try logging out more details to see if there is a way to filter to any VESC and keep all other devices out of this list.



Filtering to devices with names makes a short list. I see in the code there is a service id but it may not be used at all currently. This filter will work for now so that I can quickly select the Unity devices. And this should work with the VESC 6 and Flipski VESC I have here.


Nice. Whilst your at it any chance you can make it that new devices add to the bottom of that list?

Number of times I have selected a ble device then a new device is found and they order suddenly changes :unamused: It makes selecting and connecting on a group ride nearly impossible.


I wrote a few of those lines you modified in your fork; feel like I should know more about it :man_shrugging: . It was some time ago.

The best way to do this would be as you suggest to filter by the GATT service type. This makes it very easy to filter for all heart rate monitors (for example); the problem is that there’s no general spec for electronic speed controllers (let alone spec for VESC based controllers) so the NRF devices the VESC uses rely on a custom vendor spec. You could filter for these, but I’m guessing other devices may use this too.

Filtering by name isn’t such a bad idea. There can’t be that many… VESC, Unity, Stormcore, etc. Could be a little annoying if you gave your NRF device a custom name though and found that the VESC Tool would no longer find it.

Another thought was to send a simple request to each device (say the get firmware version request), and see if you get a reasonable response back. This would mean you’d have to connect to each device though and would likely slow down the scan quite a lot.

Nordic have a tool in the App Store that may help investigation.

1 Like

Currently it adds newly discovered devices to a list. I could see about using a sort to place the named devices first and then place the named ones first. I could also get a list of the 10 most common VESC devices and define a regex pattern for each of them and place those at the top of the named list.

For auto connect I could have the devices discovered with the scan also start the connection process just to discover services. And then any which support the service id which is already set I could continue with the connection or just disconnect and try the next one.

I do not work with Qt, so I am more inclined to build out a native UI. I’d love to build an app for Apple TV to do this instead. Then you can do all of this with your TV. And you could have an Apple TV in your shop to play YouTube videos and configure your VESC.

Is there a simple way to label our own BLE devices?

say k00k-kaly, k00k-race1, etc.???

The UI could support adding more custom names to use for filtering. I do not now if the service id is standard for all VESCs but that also requires connecting to discover services. The app could run it like a TV scans for digital channels on demand so you can then leave in known devices for connecting quickly. Most people won’t need to connect to many devices anyway. But adding custom names also requires that you know that name. Having them built into the VESC Tool would be better since generally can collect the names to include in this short list. I’d also like to be able to include a set of default settings based on the selected device. Like a Unity should be limited to 60 amps. And for a Kaly or Lacroix there could be defaults based on the motor and gear system. That way a lot of the settings could just use a default which simplifies it more.

I have Unity, VESC 6 and Flipsky VESC devices here. I could work on getting each of them to autoconnect with the VESC Tool.