The best tools to make your project dreams come true

Login or Signup

How To Use Bluetooth to Add a Device to the Digi-Key IoT Studio

8/14/2019 | By Maker.io Staff

Programming your device via the Atmosphere IoT Agent is great, but eventually, you will want to get your device connected to the cloud and integrate multiple devices together. In this How-To, we will learn how to get started with Bluetooth and add your Huzzah32 to the Digi-Key IoT Studio Platform to make it cloud ready!

BOM

Scheme-It

How To Use Bluetooth to Add a Device to the Digi-Key IoT Studio

Scheme-It

Get the Digi-Key IoT Studio App

The Atmosphere IoT Agent is a bridge that is installed onto your local machine and is what connects your device to the Digi-Key IoT Studio during programming. However, the device connected to the computer cannot be “claimed” by Digi-Key IoT Studio over this link (the link between your device and the Digi-Key IoT Cloud), and this device-claiming must be done over Bluetooth between a smartphone and your device (in our case, the Huzzah32). Therefore, the first step of claiming a device is to get the Digi-Key IoT Studio app from the Google Play store. When searching for the IoT agent, it is imperative that you do not select the Atmosphere IoT agent and instead select the Digi-Key IoT Agent. To find the correct app, search for “Digi-Key IoT”; the correct app is shown below:

How To Use Bluetooth to Add a Device to the Digi-Key IoT Studio

When the app is installed, you will need to launch it and log in. You will also need to ensure that your Bluetooth is enabled so that your device can be seen by your smartphone.

Atmosphere IoT Agent

There are a couple of features of the Atmosphere IoT Agent that should be understood before you get started. The first is the installer -- it doesn’t provide information or options when it is installing.

The second thing to understand is how to run the program. When the application is installed, it does not put a link into program files or onto the desktop, so it’s important to know where the program has actually been installed. If you need to run the agent so you can bridge the device to the IoT Studio, you can find it in the following directory:

C:\Users\\AppData\Local\atmosphereiotagent

In my case, the agent was found in C:\Users\Office\AppData\Local\atmosphereiotagent, and the image below shows the agent file that you need to launch.

How To Use Bluetooth to Add a Device to the Digi-Key IoT Studio

Bluetooth Element

To claim a device, we need to pair our Huzzah32 with our smartphone, so we need to ensure that the Bluetooth module on the Huzzah32 is functional. Therefore, in a new project (which we will call “Bluetooth”), we will add two elements: the BLEConnection element and the BLECharacteristicCustom element.

How To Use Bluetooth to Add a Device to the Digi-Key IoT Studio

The BLEConnection element allows us to configure our default Bluetooth settings as well as change them on the fly. For example, we can use the BLEConnection to define if our connection should use a passkey, and if so, if that key should be predetermined or random. In our example, we will set the Pairing type to “Just Works.”

How To Use Bluetooth to Add a Device to the Digi-Key IoT Studio

The BLECharacteristic element is used to read and write data over Bluetooth as well as subscribe and unsubscribe to characteristics. In our program, we have a simple example whereby an interval element causes a GPIO input value to be sent over Bluetooth (this is not important for us at this moment but is just an example of how it can be used).

How To Use Bluetooth to Add a Device to the Digi-Key IoT Studio

Compile the project and then download the project to the Huzzah32, which needs to be attached to the PC via a USB cable. Once downloaded, we can now add our device to the IoT studio!

Adding the Huzzah32

With the device programmed, open the Digi-Key IoT Studio app, and in the bar on the left, select the cube icon. This icon is used to add devices as well as view active projects on devices that are currently claimed.

How To Use Bluetooth to Add a Device to the Digi-Key IoT Studio

In the now-showing page, you will need to click the cube icon with the plus symbol near the top-right corner of the page. When you click this, a window will pop up that shows a list of devices in range of your device. Click the device that shows, and the project name “Bluetooth” should appear next to the device. Click “Add Device.”

How To Use Bluetooth to Add a Device to the Digi-Key IoT Studio

Seeing Information on your Device

Now that your device has been added, you can see information regarding the device by going back to the cube icon in the left pane and selecting your device/project (see below).

How To Use Bluetooth to Add a Device to the Digi-Key IoT Studio

Information that you can see, and change includes the cloud data storage use (10.49MB per device), the geolocation of the device, device IDs, names, user details, and even a dashboard that can demonstrate sensor readings and graphs.

How To Use Bluetooth to Add a Device to the Digi-Key IoT Studio