This is a balena Block for interfacing with the Blues Wireless Notecard.
Add this block to your Balena fleet to easily send data to your cloud backend via a low-power cellular connection.
To add the Blues Block to your fleet you need to add Blues Wireless connectivity to all of your devices. To you will need to:
- Purchase a Notecard Raspberry Pi Kit.
- Create a Notehub account.
And if all of this is new to you, we’d recommend going through the Notecard quickstart tutorial before continuing.
To add the Blues Block, add this service in your docker-compose.yml
, as shown below.
notecard:
image: "bh.cr/blues_wireless/notecard-<architecture>"
devices:
- "/dev/i2c-1:/dev/i2c-1"
expose:
- "3434"
privileged: true
Use aarch64
on the architecture if you are using a Raspberry Pi 4.
Once you have everything deployed on your fleet, you can use the Notecard by POSTing JSON requests to http://notecard:3434
.
For example, the following code performs a hub.set
command on the Notecard.
import requests
req = {"req": "hub.set"}
req["product"] = "com.company.name:myproject"
req["mode"] = "continuous"
url = "http://notecard:3434"
headers = {"Content-Type": "application/json"}
result = requests.post(url, json=req, headers=headers)
NOTE: See the
example-python
folder for a full sample script.
Refer to the Notecard quickstart for more information on how to set up and use a Blues Wireless Notecard.