Blecon Modem Firmware on the NRF52840-DK

Introduction

This guide covers getting started using the Blecon Modem Firmware on the Nordic NRF52840-DK.

The Blecon Modem Firmware is a pre-compiled binary specifically designed for the NRF52840-DK. By flashing this firmware onto the NRF52840-DK, it will function as a Blecon Modem. With this firmware, the NRF52840-DK provides a serial connection over the USB interface, allowing you to conveniently test and interact with the modem directly from your computer.

The aim of this getting started guide is to showcase the functionality of the Blecon Modem, specifically in the context of building a device where the Blecon Modem is controlled by a microcontroller.

Set up your modem using the NRF52840-DK

Installing the Blecon CLI

Follow the instructions on The Blecon CLI page.

Flashing the NRF52840-DK with the Blecon Modem Firmware

Flash the above firmware to the NRF52840-DK using the Programmer from the nRF Development Tools.

There is a known bug within the nRF Programmer app which will give you a "part of the HEX regions are out of the device memory size" warning when programming our modem image. This can be safely ignored.

Testing your connection to the Blecon Modem

Connect a USB cable from your computer to the MCU USB port on the NRF52840-DK. This will allow you to access the modem's serial interface.

To establish the connection, follow the instructions in Identifying the serial connection to your modem.

To test your connection, run something like

 ./blecon-cli --port <PORT> ping

You should get a 'pong' back from the modem. If not, check the previous steps including the Blecon CLI instructions.

Set up your network and cloud integration

Introduction

Blecon connects Bluetooth devices to a cloud application.

An example of the functionality your cloud application needs to provide for a Blecon request is as follows:

  1. Accept HTTP requests on a URL you specify

  2. Verify authentication of Blecon request

  3. Determine the type of device and request

  4. Handle the request, storing data as appropriate for your application

  5. Send the response back to Blecon

Blecon supports any cloud, any web framework and any language, so how you perform the above is up to you.

Creating a request handler

For this tutorial, we will use a simple service designed to show incoming requests called https://webhook.site/. It will create a unique URL for handling device requests.

Head over to https://webhook.site/ now and get your own URL. It should look something like this:

https://webhook.site/3564ce84-4bed-44d1-9854-ca8de453eff6

Ensure you configure the response correctly for Blecon.

Click Edit at the top of webhook.site and configure the response as follows. Don't forget to set the Content-Type also.

{
   "response_data":{
      "payload":"48656c6c6f204d6f64656d21"
   }
}

Creating a Blecon Network

Blecon Devices are connected to a Blecon Network. A Blecon Network defines a relationship between devices and your web application. Click Create Network in the Blecon Console and then give your network a name.

Installing the Blecon App

Blecon uses access points to connect your devices. You can choose either software (the Blecon App) or physical gateways. For this walkthrough we'll use the Blecon App.

On your mobile device, head over to https://blecon.app and install the app. The Blecon App creates coverage for Blecon Devices with any phone it is installed on.

Using your Blecon Network

Connecting your modem to your network

In the Blecon Console, open the Network URL you see on the network details page. You should then see a screen like the one below.

This is the Device Connection Service. You can use it to build a custom production onboarding experience for your products. Here, it's operating in the default developer mode, allowing us to easily connect a device.

To connect your modem, first, we need the modem's Device URL. To obtain this, we can use the Blecon CLI.

 ./blecon-cli --port <PORT> get-device-url

Open this URL in your browser, and you should be able to follow the prompts to connect this modem to your network.

Making a request using the Blecon Modem

To make your first request, run the following.

./blecon-cli --port <PORT> request 48656c6c6f20426c65636f6e21

If you have completed the previous steps correctly, you should see:

Response: 48656c6c6f204d6f64656d21

Summary

With Blecon, you can send any binary data from Bluetooth devices to your Cloud integration.

In this getting started guide, you have learned how to securely communicate over Bluetooth Low Energy to the cloud and back.

To explore Blecon further, book a technical meeting or email us at support@blecon.net

Last updated