Bluetooth with DK IoT Studio and NUCLEO-L476RG

This project will build off of the blink program for the NUCLEO-L476RG, and add a Bluetooth element which we can use with the DK IoT Studio mobile app. We will do this by adding an expansion board for the NUCLEO-L476RG which is the X-NUCLEO-IDB05A1 (BLUENRG). If you have never used DK IoT Studio with the NUCLEO-L476RG I suggest trying the blink project first to better understand the Studio and navigating it.

Be sure to have the IoT Agent which is a local application and runs on the system tray. It is used for programming hardware and acts as an intermediary between the computer’s connectivity protocol drivers and the browser running the DK IoT Studio. Visit IoT agent Setup for more info and to download on your platform.

Phase 1

First, you will need to either start a new project, or build from the blink project. If you need help with new project, follow phase 1 of the Blink project.

Once you have a new project we will need a GPIO Pin element.

image

Now instead of adding an interval element, we are going to replace with a Bluetooth element. Click on add element at the bottom of the element toolbox.

image

From there locate the BLUENRG either by scrolling through the list or search for it at the top. When located, toggle the enable selection so it changes to red.

image

From there click save. A new element appears within the element toolbox called BlueNRG BLE.

image

Click the BlueNRG BLE and it will add to the workspace. Adding the BlueNRG element will add in two more elements into the element toolbox. Select BLE GATT Characteristic.

image

At this point you should have 3 elements in your workspace. We will be connecting the BLECharacteristic to the GPIO Pin element. The BlueNRG will not be connected to anything.

image

Now we need to change the properties of the elements.

imageimage

imageimage

imageimage

Phase 2

In the 2nd phase we will work on the application portion of the project.

First, we will want to go to the application tab located next to the NUCLEO-L476RG tab.

image

The workspace is split with 2 different workspace displays. The box on the left shows the app view where you can control what shows on the Digi-key IoT app. The right is the element workspace we have worked with and will have the BLECharacteristic element already in it. The only element we need to add is the Toggle Button element from the toolbox. Connect the button to the BLECharacteristic element.

image

Here is what the properties should read:

imageimage

imageimage

With adding the toggle button, a toggle box will appear in the app view. From the app view you can change the size of the button, where it is located on the screen and what layer if you have multiple objects.

image

Once satisfied with positioning you can save (1) compile (2) and program firmware (3) in the NUCLEO-L476RG board section.

image
When you download firmware a bin file appears at the bottom of the screen. Click and drag the bin file over to the NODE_L476RG drive in the file explorer.

image

Phase 3

In the third phase we will now be configuring the Digi-key IoT app on your smart device. You can find the app in the app store by searching Digikey IoT. It will ask you to sign in which is the same as the credentials on the browser. Once logged in you will see a familiar screen. Select the devices tab in the toolbar on the left. Then select add device at the top, indicated by a cube with a plus.

image

From here if your devices Bluetooth is turned on and the program is downloaded on the NUCLEO-L476RG drive, a device will appear with name of the project.

image

Select the project and it should automatically start provisioning device. Once provisioning is complete it will bring you to the application section you created. The Bluetooth indicator at the bottom will flash on and off until it connects to the device and will stay solid black once found.

image

Now you can toggle the switch on and off and LD2 LED on the NUCLEO- L476RG will toggle with it.

This project will help you get started with DK IoT Studio and the Digikey IoT app and how to make them work together to create your projects and ideas.

If you have any further question feel free to ask, or post the question in Digi-key Techforum DK IoT Studio section.

If you need to login, register or get more information on how to get started with DK IoT Studio visit the Main Page at Digi-key where we provide video and links to jump start your projects. You can also visit the DK IoT Studio EEWiki page for more projects.

1 Like