@giuliomoro I've been looking into options for BLE remote control of a Bela audio processor. That of course involves getting the Bela to work as a BLE peripheral. Most of the options I see out there are not C/C++ based. I could use Bluez itself, but as far as I can tell this might be painful as the documentation is apparently not good. I've seen a blog on getting things working via a Python example (https://github.com/Jumperr-labs/python-gatt-server) and a Go example (https://godoc.org/github.com/paypal/gatt) and a node.js example (https://github.com/noble/bleno). Of these languages/environments, I have experience with Python only.

In principle, the BLE peripheral doesn't have to be in the same language or process as the Bela Audio Processing, as long as a socket connection can be set up.

What I don't know is whether any of these approaches is feasible or would offer any advantages over trying to deal with Bluez directly. My limited Linux experience doesn't help much either.

Any advice on related matters would be appreciated.

I don't know much about BLE, and I never used it on Linux. I see that the documentation for Bluez does not say it is supported on ARM, which I find a bit surprising, especially considering that the python example actually uses it and is meant to run on an ARM board. As you say, in principle it is not a problem to have a python or node server: you would just need a socket connection (e.g.: UDP, using Bela's UdpClient/UdpServer classes) between the server and the Bela application.

So I'd recommend you try out the python example and see if you can get it to work for your purposes. It seems to come with a decent documentation, so you should be able to get started. Note that to run the commands listed in the README, you'd have to log onto the board via ssh:

  • bring up a terminal (like the Terminal app on Mac, or Putty or Mingw on Windows)
  • type ssh root@192.168.7.2 (or ssh root@192.168.6.2 on Windows) and you will be logged into the board.

Furthermore, to run the sudo apt-get commands (and possibly more) you need the board to be connected to the internet (I see here that you are sorted with that).

So I'd say try out the python option. If that works out fine, then we can help you to have it communicate it with a Bela program.

a month later

I'm just now finding time to get back to this, and realized in re-reading the your post @giuliomoro that I don't know which BLE python example you are referring to. Do you have a link?

@giuliomoro Actually, I think I discovered a pretty slick way to do the BLE. I've written BLE firmware for the Nordic platform, so I asked on the forum about how to bypass all this bluez stuff. It turns out they have a working example for their 52840 dongle what implements a UART protocol over the USB port. There is even an iOS test app in the app store. So all I will have to do is talk to a COM port from Bela. WAY EASIER!

If others want to use this solution (I'll share my code) then they will just need to buy a $10 Nordic USB BLE dongle and away they go.

I'll be pursuing this course. This is probably the last thing I need to put in place in order to dive into Bela with gusto. I'm anxious to get off the iOS platform for audio processing and onto the HW appliance track.

Very excited!

  • Andy
5 months later

Hej Andy

This is exactly what I need, i.e. to send parameter updates to BELA from a smartphone through Bluetooth while it is running. Does this solution also allow for streaming stereo to BELA? Will it be able to work like a Bluetooth headset, where the audio received during a phone call can be sent to BELA, for example?

Any c/c++ code for reading from the BBB or Pocket Beagles USB port would be much appreciated.

Thanks in advance for sharing this! :-)

Gladgrif

    Gladgrif My application was not for audio streaming, it was for control purposes. BLE itself is not really suited for this. The BT spec you want to use for stereo is called A2DP, and traditionally it is not low latency. There have been some recent developments in this area that I haven't followed super closely, as I no longer work for a company that works in that area. But in any case, I think that the only form of BT that Apple supports for anything other than a huge strategic partner is BLE.

    What are you trying to build?

    I am using BELA as a signal processing unit on an ordinary analogue headphone, to add effects to the audio being played in the headphone. Right now I input a stereo signal to the BELA audio input through a minijack, and control settings through the USB interface to the BELA. Ideally I would like to get rid of the cables and send both the audio and the control parameters wirelessly from a smartphone. If I can only solve one of these challenges, that would also be progress. :-)

    I understand your solution (with the Nordic USB BLE dongle) to be a candidate for sending settings (parameters) through BLE. If I can do that, at least it wouldn't be necessary to be attached to a computer for changing parameters. I have quite a lot of parameters, which is why I would like to use an app, instead of a few buttons, for example.

    I realise that your solution would not support audio streaming, but I just thought that it would be nice if it was possible to send stereo audio through an "ordinary" A2DP Bluetooth dongle on the BBB/Pocket Beagle.

    Thanks again for your help, Andy.