{"id":1088,"date":"2021-07-01T15:06:09","date_gmt":"2021-07-01T05:06:09","guid":{"rendered":"https:\/\/gonzos.net\/projects\/?page_id=1088"},"modified":"2025-07-27T22:05:37","modified_gmt":"2025-07-27T12:05:37","slug":"ble-midi-receiver","status":"publish","type":"page","link":"https:\/\/gonzos.net\/projects\/ble-midi-receiver\/","title":{"rendered":"BLE MIDI Receiver"},"content":{"rendered":"\n<p class=\"has-text-align-right\">Updated 7 July 2021<\/p>\n\n\n\n<p>I have a couple of the Yamaha UD-BT01 BLE MIDI transmitter adapters, and in the past I have used a Raspberry Pi computer to receive the transmitted MIDI and pass it on to a synth. This required the Rpi computer and an and a MIDI adapter. With the recent improvements in Arduino-style devices, it has become possible to make a very small BLE-to-DIN-Plug receiver. This document has details of the one I made with a ESP32 chip. Unfortunately a BLE to USB  device is not currently possible using an Arduino-style chip, as no-one has put BLE and USB MIDI into one package (that I am aware of).<\/p>\n\n\n\n<p>The device I used is a NodeMCU ESP 32S. It&#8217;s a simple-enough project that was pioneered by my German colleague Petra. I&#8217;ve had some requests for info about it so I thought I&#8217;d put this document together.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Basic Operation<\/h2>\n\n\n\n<p>The device looks like this:<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-large\"><a href=\"https:\/\/gonzos.net\/projects\/wp-content\/uploads\/2021\/07\/BLE-receiver-outside.jpg\"><img loading=\"lazy\" decoding=\"async\" width=\"800\" height=\"600\" src=\"https:\/\/gonzos.net\/projects\/wp-content\/uploads\/2021\/07\/BLE-receiver-outside.jpg\" alt=\"\" class=\"wp-image-1093\" srcset=\"https:\/\/gonzos.net\/projects\/wp-content\/uploads\/2021\/07\/BLE-receiver-outside.jpg 800w, https:\/\/gonzos.net\/projects\/wp-content\/uploads\/2021\/07\/BLE-receiver-outside-300x225.jpg 300w, https:\/\/gonzos.net\/projects\/wp-content\/uploads\/2021\/07\/BLE-receiver-outside-768x576.jpg 768w, https:\/\/gonzos.net\/projects\/wp-content\/uploads\/2021\/07\/BLE-receiver-outside-730x548.jpg 730w\" sizes=\"auto, (max-width: 800px) 100vw, 800px\" \/><\/a><figcaption>^ Outside view ^<\/figcaption><\/figure><\/div>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-large\"><a href=\"https:\/\/gonzos.net\/projects\/wp-content\/uploads\/2021\/07\/BLE-receiver-inside.jpg\"><img loading=\"lazy\" decoding=\"async\" width=\"800\" height=\"600\" src=\"https:\/\/gonzos.net\/projects\/wp-content\/uploads\/2021\/07\/BLE-receiver-inside.jpg\" alt=\"\" class=\"wp-image-1092\" srcset=\"https:\/\/gonzos.net\/projects\/wp-content\/uploads\/2021\/07\/BLE-receiver-inside.jpg 800w, https:\/\/gonzos.net\/projects\/wp-content\/uploads\/2021\/07\/BLE-receiver-inside-300x225.jpg 300w, https:\/\/gonzos.net\/projects\/wp-content\/uploads\/2021\/07\/BLE-receiver-inside-768x576.jpg 768w, https:\/\/gonzos.net\/projects\/wp-content\/uploads\/2021\/07\/BLE-receiver-inside-730x548.jpg 730w\" sizes=\"auto, (max-width: 800px) 100vw, 800px\" \/><\/a><figcaption>^ Inside view ^<\/figcaption><\/figure><\/div>\n\n\n\n<p>The device is set up so that it will:<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>Scan for BLE MIDI hosts<\/li><li>Connect to the first host it finds<\/li><li>Decode the MIDI bytes, assuming they are all 3-byte messages (it ignores running status messages)<\/li><li>Send the messges out to the DIN plug at 31250baud and 3.3V<\/li><li>Get power from a USB socket<\/li><li>Attempt to re-connect if the connection is broken<\/li><\/ul>\n\n\n\n<p>The program is based on the BLE client example from the ESP32 BLE Arduino library. The program is <a href=\"https:\/\/gonzos.net\/BLE\/BLE-Receiver.zip\">here<\/a>. I don&#8217;t guarantee that it will be the latest version.<\/p>\n\n\n\n<p>The wiring to the DIN plug is simply:<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>UART Tx pin (GPIO17) connected to DIN Pin 5 via a 10 ohm resistor<\/li><li>3V3 supply pin connected to DIN Pin 4 via a 33 ohm resistor.<\/li><\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">Latency<\/h2>\n\n\n\n<p>I did some tests with the original client example program, and found that the latency was 23msec longer than what I get with a USB cable to my synth. I did some investigating and found that the connection interval could be adjusted, although you have to add code to the client program. I set that to the minimum for BLE (7.5msec) and the latency  improved. I measured it as +14 msec over the USB cable, which is acceptable. The client program (link above) has been updated for the extra code.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Updated 7 July 2021 I have a couple of the Yamaha UD-BT01 BLE MIDI transmitter adapters, and in the past I have used a Raspberry Pi computer to receive the transmitted MIDI and pass it on to a synth. This required the Rpi computer and an and a MIDI adapter. With the recent improvements in [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"class_list":["post-1088","page","type-page","status-publish","hentry"],"blocksy_meta":{"page_structure_type":"type-3","styles_descriptor":{"styles":{"desktop":"","tablet":"","mobile":""},"google_fonts":[],"version":6}},"_links":{"self":[{"href":"https:\/\/gonzos.net\/projects\/wp-json\/wp\/v2\/pages\/1088","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/gonzos.net\/projects\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/gonzos.net\/projects\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/gonzos.net\/projects\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/gonzos.net\/projects\/wp-json\/wp\/v2\/comments?post=1088"}],"version-history":[{"count":1,"href":"https:\/\/gonzos.net\/projects\/wp-json\/wp\/v2\/pages\/1088\/revisions"}],"predecessor-version":[{"id":1109,"href":"https:\/\/gonzos.net\/projects\/wp-json\/wp\/v2\/pages\/1088\/revisions\/1109"}],"wp:attachment":[{"href":"https:\/\/gonzos.net\/projects\/wp-json\/wp\/v2\/media?parent=1088"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}