All gateways should be pre-configured — it is unlikely you will need to make any changes. The following information is provided for reference or troubleshooting purposes.
Gateway settings can be updated or data can be retrieved using a USB drive. If you need to replace the removeable media drive, follow these steps:
hublink.json file in the root of the drive with the configuration:{
"secret_url": "https://hublink.cloud/<secret_url>",
"gateway_name": "Gateway1"
}
The secret URL is used to authenticate the gateway with the cloud service. The gateway name will automatically have a unique identifier appended to it based on the device's MAC address to make it easier to identify on the dashboard.
Use our Hublink Card Formatter tool to safely format SD cards for both nodes and gateways. Includes safety checks and automatic configuration.
Gateways will automatically enter offline mode if they are unable to connect to the cloud service. This is useful for situations where the gateway is in a remote location or behind a firewall. Data will be stored on the gateway until it is able to reconnect to the cloud service.
The Hublink node uses a meta.json file on the SD card to configure node behavior and store metadata. The file uses JSON format:
{
"hublink": {
"advertise": "HUBLINK",
"advertise_every": 300,
"advertise_for": 30,
"try_reconnect": true,
"reconnect_attempts": 3,
"reconnect_every": 30,
"upload_path": "/FED",
"append_path": "subject:id/experimenter:name",
"disable": false
},
"subject": {
"id": "mouse001",
"strain": "C57BL/6",
"strain_options": [
"C57BL/6",
"BALB/c",
"129S1/SvImJ",
"F344",
"Long Evans",
"Sprague Dawley"
],
"sex": "male",
"sex_options": [
"male",
"female"
]
},
"experimenter": {
"name": "john_doe"
},
"device": {
"id": "046"
},
"fed": {
"program": "Classic",
"program_options": [
"Classic",
"Intense",
"Minimal",
"Custom"
]
}
}
The settings below modify the Hublink node behavior. These settings take effect at hublink.begin() but can be overridden at runtime (refer to the HublinkAdvanced.ino sketch).
| Setting | Description | Default |
|---|---|---|
advertise |
Custom BLE advertising name | HUBLINK |
advertise_every |
Seconds between advertising periods | 300 |
advertise_for |
Duration of each advertising period in seconds | 30 |
try_reconnect |
Enable/disable automatic reconnection attempts | true |
reconnect_attempts |
Number of reconnection attempts if initial connection fails | 3 |
reconnect_every |
Seconds between reconnection attempts | 30 |
upload_path |
Base path for file uploads in S3 | /FED |
append_path |
Dynamic path segments using nested JSON values (e.g., "subject:id/experimenter:name") | subject:id/experimenter:name |
disable |
Disable Hublink functionality | false |
The device.id field provides a unique identifier for your node that appears in the dashboard. This helps distinguish between multiple nodes in your experiment.
You can add any additional JSON objects to track metadata about your experiment. The example above shows:
The Hublink library provides several key functions for managing BLE communication and file transfer:
Manages BLE advertising and connection cycles. Returns true if a connection was established.
temporaryConnectFor: Optional duration in seconds to override the default advertising periodPuts the ESP32 into light sleep mode for the specified duration to conserve battery.
Sets the battery level for the node characteristic. Range 0-255 (0 indicates not set).
Sets an alert message that will be synced to the cloud. The user must persist the alert in their sketch—it is automatically cleared after the hublink.sync() completes. Alerts can also be cleared in the dashboard by a user.
Hublink uses file name and file size to determine if a file needs to be uploaded (or re-uploaded) to the cloud. Some common issues to be aware of:
Files in Amazon S3 are organized according to the upload_path and optional
append_path settings. The resulting file structure is:
bucket_name/
├── upload_path/ # From hublink.upload_path
│ ├── append_path/ # From hublink.append_path reference
│ │ └── filename.csv # Actual files
│ └── another_path/
└── ...
The append_path field supports multiple nested JSON values separated by forward slashes. The path is constructed as follows:
upload_pathappend_path if it exists and is not emptyupload_path: "/FED"append_path: "subject:id"
bucket/
└── FED/
└── mouse001/
└── data.csv
upload_path: "/FED"append_path: "subject:id/experimenter:name"
bucket/
└── FED/
└── mouse001/
└── john_doe/
└── data.csv
append_path is missing or empty, that segment will be skipped. For example, if experimenter:name is missing in the path subject:id/experimenter:name, the final path would be /FED/mouse001 instead of /FED/mouse001/john_doe.