MIDI over Bluetooth with ESP32

Winter time is DIY time - and this year I decided to explore the capabilities of the ESP32 platform.

There might be synergies with MIOS32, but I’m very sure that I won’t fully integrate this Microcontroller into the MIOS32 ecosystem — this hasn’t been considered 10 years ago when I started with the 32bit platform, and it would take too much time to make everything compatible (with many compromises - e.g. no native USB support, and we know that this is important for best performance!)

However, I think that ESP32 is a pretty good companion device to a STM32F4, hence potential candidate for future MIDIbox enhancements.

E.g. the NodeMCU ESP32 available at Reichelt for 10 EUR supports Dual-Core (!) @240 MHz with WiFi and Bluetooth, 512k RAM, 4MB external Flash, incl. USB programmer on PCB - compare this with a PIC18F*! :wink:

I started with Bluetooth, and the result can be found here: https://github.com/midibox/esp32-idf-blemidi

This so called “BLE MIDI” service should work with any OS which supports this protocol. So far only tested on MacOS and iOS… but it should also work with Linux and Win10.

This will be the basis for further experiments at my side - I’m able to communicate with the device via MIOS Studio. :slight_smile:

(however, application download has to be done with the ESP32 ecosystem - means: the appr. esptool.py based bootloader)

In future also a WiFi connections as demonstrated in Pedalino might be possible, but I’m not there yet - focus is on the application itself, knowing that the MIDI interface options won’t be so fast like known from the STM32F4 based platform.

E.g. how accurate can we control a Motorfader with the PWM LED outputs of a ESP32? 
If it works, it could be connected like a MBHP_MF_NG module via traditional UART based MIDI to a MIDIbox NG.

And will it be possible to control a SRIO chain?
Might be interesting for a future BLM16x16+X with (only) optional WiFi and Bluetooth connects.

Best Regards, Thorsten.

Very cool development, well done!
While the girls in the house insist on automatically shutting down the WiFi network at bedtime “so they can sleep better” :), i can see why wireless connections would be cool, maybe also in a ProgrammA context :).
Many greets,
Peter

Nice to see some new playground projects coming along! And more than useful, I think this could be a crucial extension which could bring new life to the community! I’m excited!

Capabilities and inside features are awesome!.. 512k RAM :slight_smile: hummm

Do you think you will be able to find the time, during this harsh winter, to migrate the mios32 bootloader to the HAL( F4 ;), so that this magnificent OS that we love so much will become almost eternal? Hihi

In any case thank you and have good time with DIY and experimentation… So good to read that! :slight_smile:

 

No, I won’t have the time for a fully adaption to MIOS32, especially considering incompatibilities, missing resources and last but not least, potential additional user support which I can’t give thereafter.

And concerning bootloader: the native solution of the ESP32 ecosystem is working well, no real need for an adaption.

Therefore I provide the projects “as is” and independent from MIOS32 - but you will find some things known from MIOS32 later, and the projects will be somehow integrated into the MIDIbox platform - but please don’t expect so much “flawless compatibility” that we know from MBHP_CORE_STM32/MBHP_CORE_LPC17/MBHP_CORE_STM32F4…

Times have changed, today powerful DIY platforms are already available, so that it makes sense to adapt to the workflow of the corresponding users - I’m flexible and see the possibility to reduce efforts at my side ;-)

Best Regards, Thorsten.

Hi all

Look promising

Especially if RTPM via wifi is implemented

Best

Zam

Should be possible -> https://github.com/lathoub/Arduino-AppleMIDI-Library

Good progress at my side: I’m now able to control motorfaders, and the accuracy is much better than ever before, because dedicated PWM outputs are used (which are normally intended to fade LEDs), clocked at non-audible 20kHz range.

Some work is still required to get it compatible with MBHP_MF_NG, but maybe I can show the difference in 1..2 days via video.

My test setup: a NodeMCU hooked on the MBHP_MF_NG board with a quick&dirty adapter board, communicating via Bluetooth (the MIDI sockets are currently not used - unfortunately ESP32 pins are not 5V tolerant)

Best Regards, Thorsten.

On 14/12/2019 at 8:23 PM, TK. said:

I’m now able to control motorfaders, and the accuracy is much better than ever before, because dedicated PWM outputs are used (which are normally intended to fade LEDs), clocked at non-audible 20kHz range

Hello Thorsten

That’s interesting, what is the max possible clock speed ?

Best

Zam

Hi Thorsten,
Is it possible to do not pair the two devices and create a network with it? If a device can broadcast to several others devices and also receive(merge) from them too?
Is there a kind of receiving state or meter, to be able to manage the distance between the devices?

Best
Bruno

3 hours ago, Zam said:

That’s interesting, what is the max possible clock speed ?

Depends on the desired resolution for the duty cycle. The timers are clocked at 80 MHz
Means: with 20 kHz we could have 4000 different “speed levels” (but actually I’m currently only using 64 speed levels, which is sufficient)

3 hours ago, Antichambre said:

Is it possible to do not pair the two devices and create a network with it? If a device can broadcast to several others devices and also receive(merge) from them too?
Is there a kind of receiving state or meter, to be able to manage the distance between the devices?

At least I know that MacOS and iOS don’t allow this. If I take the device with one computer, it appears as “offline” on the other (and vice versa). Seems to be intended, that only a point-to-point connection is allowed.

Yes, there should be some kind of meter available, here a link to the driver documentation: https://docs.espressif.com/projects/esp-idf/en/latest/api-reference/bluetooth/

Best Regards, Thorsten.

8 hours ago, TK. said:

Depends on the desired resolution for the duty cycle. The timers are clocked at 80 MHz
Means: with 20 kHz we could have 4000 different “speed levels” (but actually I’m currently only using 64 speed levels, which is sufficient)

Ok ! don’t know what is the agenda or if any major MFNG update is on the road (which I can help on by the way…)

I suggest to factor at least 10 the clock in case of hybrid system (analog close to or in the fader…)

let say 312.5kHz , which correspond to 256 speed level (you have room over 64…) also a value over 192kHz (HD audio)

I mean If it’s easy don’t hesitate to change this…

Best

Zam

19 hours ago, Zam said:

Ok ! don’t know what is the agenda or if any major MFNG update is on the road (which I can help on by the way…)

Good question! Currently it’s mainly a learning vehicle for me to explore a new microcontroller and corresponding software.

And now I’m also learning KiCad to enter the schematic (and maybe also the Adapter PCB) - currently only for my own interest.

If you would like to play with the project as well, you are welcome of course! :slight_smile:
I will bring it at least to a state that others can use an adapter board on their existing MBHP_MF_NG, can connect via traditional MIDI but also Bluetooth and maybe also (later) rtp MIDI, but I can’t promisse anything else.

And at this point in time it especially needs “real life testing” before it’s build by others.

19 hours ago, Zam said:

I suggest to factor at least 10 the clock in case of hybrid system (analog close to or in the fader…)

let say 312.5kHz , which correspond to 256 speed level (you have room over 64…) also a value over 192kHz (HD audio)

I mean If it’s easy don’t hesitate to change this…

Was worth a try: I used 200kHz and it works like 20kHz - don’t see a big difference on the motor handling itself - but probably in an analog system:

20 kHz:

200kHz:

The “noise” that we see here comes from the higher ADC resolution (faders are scanned at 12bit instead of 10bit) and messy ground on my vero board - this should become better with a PCB.

But it doesn’t impact the smooth movements.

Of course, most interesting would be if it works so smooth like your 89MotionN: 

http://discourse.midibox.org/t/topic/19881

 

At least I see a potential cost benefit :wink:

Best Regards, Thorsten.

Hello Thorsten

I have something like “MF_HD” in head since time but don’t start because of no more real need for me (I have my motor driver)

It’s hybrid, between MF_NG and My 89MotioN, in all aspect probably (cost, quality and performance)

 

Your two AD scan from fader servo seem to show improved noise at 200kHz.

 

Best

Zam

 

Thorsten,

Have a look at this:
https://www.synthtopia.com/content/2019/12/16/cme-debuts-widi-master-a-wireless-midi-over-bluetooth-adapter/

 

Best regards
Bruno

Cool, I like CME :slight_smile:

Best Regards, Thorsten.

Just now, TK. said:

Cool, I like CME :slight_smile:

Best Regards, Thorsten.

Yes you already own a small keyboard if I remember well. :wink:
 

I wanted to post this some time before but I’m not really sure if this is a helpfull information but I was thinking about if it’s possible to connect this one with the midi in/out pins of the core and feed it with 3,3v http://www.hobbytronics.co.uk/wireless/btmodule-bt05

I can’t recommend this solution; it only transfers via a serial protocol, which then has to be converted by a computer into MIDI messages - this is error prone.

Today we would prefer the BLE MIDI protocol, which is natively supported by many operating systems, and considers special MIDI features such as continuous SysEx streams.
And this is possible with a simple ESP32 controller, which is available for the same (or less) price - and on top of this WiFi should be possible as well.

Best Regards, Thorsten.

Allright, now I understand

My first KiCAD project - I don’t miss xcircuit and Eagle & I’m happy that other people can now edit the files with state-of-the-art open source SW as well :slight_smile:

Best Regards, Thorsten.

P.S.: ordered at OSHpark - let’s see if the circuit works like intended next year :slight_smile: