Pisound and Bluetooth Midi

I am using an ESP32 to trigger a Pd patch running on the Pisound. The method for this is that the ESP32 connects as a Bluetooth Midi device, and sends a midi note via a button press.

This connection works great most of the time, but sometimes the ESP32 doesn’t connect to the Pisound. Restarting the ESP32 doesn’t solve the problem, so I assume that the issue might lie with the Pisound.

Is there a process that I can restart to see if this will instigate the Bluetooth Midi connection? Many thanks for your help with this in advance!

It’s not Pisound, but the Raspberry Pi providing the Bluetooth connectivity. :slight_smile: Any information you can find on Raspberry Pi and Raspbian on this is relevant to the Pisound and Patchbox OS systems too.

Some things to know - the systemd Bluetooth service is called ‘bluetooth’, it runs a process called bluetoothd, and it can be configured through sudo bluetoothctl comamnd. Just running the sudo bluetoothctl should indicate some of the Bluetooth activity, type help, to see what commands are available.

You may see Bluetooth service logs by running:

journalctl -u bluetooth
1 Like

This was super-helpful, and I was able to confirm that on the side of the Raspberry Pi (thank you for clearing up that everything related to Bluetooth connectivity is managed here) everything was set up correctly. I am now thinking that the ESP32 might be underpowered, as it’s running off 2 AA batteries. When powering the ESP32 via USB from the laptop it connects right away. Live and learn!

1 Like

I need the full Bluetooth 5/BLE feature set and the information I found says RPi4B doesn’t have that.

“BlueZ Bluetooth stack supports both Bluetooth Classic and BLE, but its support for BLE is more recent and there are some limitations and sometimes bugs. Bluetooth 5.0 support on the Raspberry Pi is limited to the mandatory features. The main one that is missing is the Long Range support, so if you were thinking of leveraging the Coded PHY for extra long-range, you won’t be able to. This feature is normally not found on combo Wi-Fi + Bluetooth chipsets.”

My current solution was to order a few Bluetooth/MIDI widgets from CME

Yes, this could be a problem :slight_smile: Nominally charged 2x AA batteries would provide only ~3.0V, while ESP32 needs stable 3.3V. If it manages to run on this low voltage, the batteries anyway would soon discharge towards 1V individually, and then drop off quickly. So you have to either use some voltage booster circuit capable of providing the required power amount to the powered circuit, or a possibly simpler solution - 9V battery with a 3.3V DC regulator. Or if it can be USB powered, a power bank may make sense. :slight_smile:

@Giedrius I can confirm that using a 9v battery solved the problem! It’s a bit scary to see how power-hungry the wireless functionality of the EPS32 is, so I ended up revising the code to wake up the processor with the push of a button, and send it back to sleep after a few seconds to converse energy :slight_smile:

@Rain Interesting to hear that RPi4 doesn’t support BLE, this explains the issues I’ve been having with my secondary RPi which is a v4 device! On the Pisound using a RPi3 I’ve been having great success with BLE on the EPS32, I just have to pair the device once from the RPi using the command line and then everything is good to go.

In case this is relevant to anybody in the future, the set of commands to pair a EPS32 from the RPi is as follows:

sudo bluetoothctl
scan on (find the MAC address of the EPS32 you want to connect to)
trust *MAC address*
pair *MAC address*

The RPi 4 does support Bluetooth LE, but possibly not in its full entirety. :slight_smile:

1 Like