For school Internet of Things(IoT) projects, I needed a robust field gateway for uploading telemetry data from a number of "cheap n cheerful" sensor nodes.
The distances involved were modest 5M (indoors) to 600M (outdoors) so a mix of Low & high power nRF24L01 wireless modules looked like a suitable choice.
After looking at several Cloud IoT Services AdaFruit.IO looked like it had sufficient flexibility and a reasonable pricing model. The security model (Feb 2018) with a shared API Key will have some challenges in wider scale deployments
Initially, I was going to use the Adafruit.IO MQTT interface but have found that getting an HTTP endpoint (fine for telemetry) white-listed in a school environment is easier.
While reading the AdaFruit.IO API documents I noticed that they have published a swagger definition of the API so I used NSwag to generate a C# client. I added a partial class with a single method to put an HTTP Header with the AdaFruit.IO API Key (see AdaFruit.IO.Swagger\APIKey.cs for details) on every request.
The field gateway hardware is Raspberry PI 2/3 based with an "off the shelf" shield (with some simple modifications).
The Field Gateway configuration is stored in a JSON file (a sample file is provided in the Github repo).
Edit [2018-03-10] application now generates an empty configuration file when first run so the one on GitHub is no longer required.
{
"AdaFruitIOUserName": "User Name here",
"AdaFruitIOApiKey": "API Key here",
"AdaFruitIOGroupName": "Group Name Here",
"RF24Address": "Base1",
"RF24Channel": 15,
"RF24DataRate": "DR250Kbps",
"RF24PowerLevel": "High",
"RF24AutoAcknowledge": true,
"RF24DynamicAcknowledge": false,
"RF24DynamicPayload": true
}
Part 2The UserName, APIKey & GroupName fields need to be updated then the file uploaded to the LocalState directory in application folder.
User Folders\LocalAppData\ AdaFruitIO.IoTCore.FieldGateway.NRF24L01-uwp_1.0.0.0_arm__nmn3tag1rpsaw\LocalState\
I use the device portal "Apps\File Explorer".
WARNING: Pay attention to the case of your settings.
https://io.adafruit.com/UserNameHere/feeds/GroupNameHere.5c-86-4a-00-c4-13h
The Windows 10 IoT Core device logs useful information via Realtime ETW Tracing which can be viewed in the Device Portal Debug\ETW after enabling the "Microsoft-Windows-Diagnostics-LoggingChannel" provider.
Once the application is configured and tested you can use the Device Portal\Apps Manager to set the program to run on device startup.
I have created several sample sensor nodes which use the same SeeedStudio Grove temperature and humidity sensor:
For an enclosure I use an off the shelf box from a local electrical supplies wholesaler.
The JSON configuration file has the following settings
- AdaFruitIOUserName - from "View AIO Key" on homepage of AdaFruit.IO portal
- AdaFruitIOApiKey - from "View AIO Key" on homepage of AdaFruit.IO portal
- AdaFruitIOGroupName - from the "Feeds" page of the AdaFruit.IO portal
- RF24Address - 3 to 5 characters long
- RF24Channel - 0 - 127
- RF24DataRate options
DR1Mbps
DR2Mbps
DR250Kbps
RF24PowerLevel options
Minimum
Low
High
Max
RF24AutoAcknowledge
True
False
RF24DynamicAcknowledge
True
False
RF24DynamicPayload
True
False
Adafruit have produced a series of videos about how to configure Adafruit.IO devices, feeds, groups and dashboards.
Comments