Getting Bluetooth work in a Nerves application with BlueZ/DBus

I am using Bluex to communicate with a BLE device from an Elixir application. It works great on a Linux host with a Bluetooth dongle, but I have troubles to get it work on a Raspberry Pi with the same dongle.

So far, I have built a custom Nerves system, including Bluetooth support in the Kernel and bluez-utils. Using the CLI utils, I am able to scan and view my device, so the system is OK. Now, the issue is that Bluex is not finding the DBus socket. There is effectively no /run/dbus/system_bus_socket.

Is there something I can do to have the DBus socket present? As Nerves systems are really minimalistic, I assume nothing is started apart from the BEAM, so I should start DBus and bluetoothd myself, isn’t it? If you have hints on how I should do that properly, I’m all ears!


Great to see some bluetooth love.

You are on the right track. You will have to start dbus and bluetoothd manually as part of your supervision tree. Check out muontrap


Yes, I am writing a tiny app to test that a BLE device works properly, and Elixir is a great language to get things done quickly.

Thanks for the tip, I’ll check muontrap and see what I can do from that.


Ooo, this looks awesome, many uses for it! Deserves it’s own post!

I believe it was announced on the forum here a while back. Its really useful for this kind of thing.

1 Like

Hmm, I checked the forum via a quick search and there was no result, did a bigger google search on the site and no result, so not yet. :slight_smile:

hm maybe i made that up then. I’ll poke Frank :slight_smile:

1 Like