Bluetooth Device GUI

You have a cool BLE Nano or some other Nordic nRF5-based device and you want to give it a graphical user interface without wasting any time–druid can help!

Step 1: Design your Interface

The first step is to decide which controls, inputs, commands and graphs you’ll provide. Head to the Druid Builder and click the design tab.

Here you can choose inputs, submenus, controls, tracked states etc from the buttons at the top, and place them within the interface as you prefer.

Once you’re all set, head to the Code tab, give your project a name and select “Bluetooth Nordic (nRF5)” from the list of platforms.

Generate the code by clicking the wizard button. It will take a few moments to create the custom source code and test it.

Once it’s done, just download the zip file from the resulting report. This file contains a complete Arduino project.

Good to get down to business on the desktop, now.

Step 2: Setup the Arduino IDE

SerialUI, the library under the hood that provides druid with all the GUI goodness, relies on Sandeep Mistry‘s most excellent Arduino-nRF5 platform to talk to a whole bunch of Nordic based boards, including the BBC micro:bit, BLE Nano and other RedBear boards, TinyBLE and many more.

nRF5 Board

If you haven’t used this board before, head to the Arduino IDE Preferences and, in the “Additional Boards Manager URLs“, add

https://sandeepmistry.github.io/arduino-nRF5/package_nRF5_boards_index.json 

With that line added, Tools -> Board -> Boards Manager… will allow you to search for “nRF5” and install “Nordic Semiconductor nRF5 Boards by Sandeep Mistry“.

Required Libraries

Final step for the setup, we also need Sandeep’s BLEPeripheral library and SerialUI . You can get both through the Arduino IDE at Sketch -> Include Library -> Manage Libraries… and filtering the search with each library’s name.

Step 3: Burn the firmware

Unzip the project file produced by builder, into your Arduino sketches folder, and open it up in the IDE.

Before you compile it all, go to Tools -> Boards and scroll down to the “Nordic Semiconductor nRF5 Boards” section and select the correct entry for your platform.

Once that’s done, verify the rest of the settings — especially “Softdevice” which needs to be set to something other than “None” to build (and ideally to the right version for your device 😉 )

Finally, you can hit upload and see that everything went well.

Troubleshooting


If things aren’t working out, there are a number of possible issues.

The first thing is to restart the app and try again. No go? Now eliminate some variables. One of your best friends, here, is Nordic Semiconductor‘s great nRF Connect app.

That app will let you scan and play with BLE devices in a bunch of cool ways.

So backup and try one of the BLEPeripheral library’s examples, from the File -> Examples -> BLEPeripheral folder in the Arduino IDE. If that’s not working, then you’ve likely got an issue with the softdevice version or something basic like that.

The SoftDevice section on the Arduino-nRF5 page is a good place to start.

If the BLEPeripheral example is working fine, re-build and burn the druid project, and scan to see if you can pickup the device (it should broadcast with the same name as your project).

You can then use nRF Connect, or the nRF UART app to simplify things, and send a string of “\n?\n” to the rx characteristic. You should get a bunch of notifications on the tx characteristic. If not, it means druid isn’t able to communicate and things aren’t going to work out… more digging involved.

If so, it might be a druid app bug, please get in touch with details about the platform, issue and what you’ve tried so far.