When we started talking about building Bluetooth devices at Golioth, I got so excited. While I’ve used chipsets with Bluetooth onboard in the past, I’ve never had the ability to do a full end-to-end application because of all the elements involved. I figured I would need 2 to 3 other people to help me out. Hardware, firmware, software, cloud, app development…there really is a lot to do!
Golioth Connectivity makes it easier with a couple of predefined elements that will get you started, and you will be able to make Bluetooth devices do amazing things…all on your own. We’re going to walk through each piece required to do a fully encrypted end-to-end demo. Tomorrow, we’re going to do a livestream where we walk through each step.
Join the livestream at 2 pm ET / 11 am PT on August 29th
Step 1 – Cloud control
This step is exceedingly easy, and you’ve surely already completed it: get yourself a Golioth account. This takes care of the cloud side of the equation: no setting up databases or creating IAM profiles and hoping you don’t give the wrong people the right access.
Step 2 – App / Gateway control
Another easy step! This one replaces the need to learn how to design an app. Instead, you can download a binary that goes onto one of these 3 development boards:
- NXP FRDM-RW612
- Nordic Thingy: 91X
- Nordic nRF9160-DK
Follow the instructions on the repository to download the pre-compiled binary, create a device on your Golioth console, and assign credentials to the gateway. Bingo, you have a bluetooth-to-cloud gateway.
Step 3 – Bluetooth node control
This is the bulk of the activity we’ll be focusing on during the livestream tomorrow, since the Bluetooth nodes in your fleet contain the smarts (firmware) and the credentials to talk through the gateway up to the cloud.
First, you need to look at our Pouch repository, which has a ble_gatt
example. This is the basis for sending up a packet that has been encrypted with the cloud but is still allowed to traverse the gateway.
Unstated in the directions is how to create a Zephyr workspace. If you are working from a fresh environment, it might look like this:
Install the Python virtual environment (recommended)
cd ~ mkdir pouch-test cd pouch-test python -m venv .venv source .venv/bin/activate pip install wheel west ecdsa
Use west to initialize and Install
west init -m [email protected]:golioth/pouch.git . west update --narrow -o=--depth=1 west zephyr-export pip install -r zephyr/scripts/requirements.txt pip install -r pouch/requirements.txt
From here, you would build against the board you’re looking to try out. The pouch repository was extensively tested against nrf52840dk/nrf52840
:
west build -p -b nrf52840dk/nrf52840 pouch/examples/ble_gatt west flash
We also have been testing a range of other vendor hardware that is supported in Zephyr. Check out the new Bluetooth section on our forum to try chips from different vendors and see what you might need to do differently (and ask questions about each, as needed).
Step 3a – Using certificates
One of the biggest differences everyday Golioth users might notice is that Bluetooth nodes must use certificates in order to connect to the cloud (through a gateway). This is explained in our introduction video for Golioth Connectivity and we’ll continue to publish about the role of security in our new paradigm of indirectly connected devices.
The example application we just built has a “Little Filesystem” (littlefs
or lfs
) included with it. That allows us to push certificates onto the device using some standard SMP tooling. You will first need to generate your own certificates using openssl; follow the Public Key Infrastructure (PKI) docs page to do so.
Step 4 – Put it all together
Once your gateway is booted up and your Bluetooth node connects through the gateway to the cloud, you will see both devices on your console. If you create a node with a brand new Certificate ID, that node will be created on your project account the first time it connects (allowing zero-touch provisioning). Add a new device setting LED
as a boolean, and that will be passed down over the gateway to the node and will toggle the LED. The node will also publish a simulated temperature every 20 seconds (the pre-defined advertising interval). We’ll show all of this in action in the Livestream on the 29th.
See it in action right now
Yesterday we posted a video of a Bluetooth device talking using Pouch through a standard gateway up to the Cloud to complete an Over-The-Air firmware update. This is a preview of Golioth Connectivity in action. Want to learn how to do it yourself? Sign up for the livestream on August 29th at 2 pm ET / 11 am PT…or watch it on demand!
No comments yet! Start the discussion at forum.golioth.io