Skip to content

Instantly share code, notes, and snippets.

@dkarchmer
Last active January 31, 2019 18:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dkarchmer/e8ac82f8bddf7cb91eaad0d1309a280b to your computer and use it in GitHub Desktop.
Save dkarchmer/e8ac82f8bddf7cb91eaad0d1309a280b to your computer and use it in GitHub Desktop.
IOTile Core Tools Tutorial

IOTile Core Tools

Basics

The public facing documentation for the IOTile Core Tools is https://coretools.readthedocs.io/en/latest/introduction.html, but things change a little when you have access to a real device.

With a BLED112 dongle, and access to the proper packages, you can communicate with a real device.

After installation, the iotile operations can be run from the OS command-line, or by using the IOTile Shell. As an example, you can get Help from the command line by typing:

iotile help

or you can do it from the shell:

iotile
(root) help

Scan

Command-line:

iotile hw --port=bled112 scan

Shell:

iotile
(root) hw --port=bled112
(HardwareManager) scan

You will see results like

{
    "connection_string": "88:6B:0F:30:51:E8",
    "expiration_time": "2018-01-11 21:55:46.299670",
    "low_voltage": false,
    "pending_data": false,
    "signal_strength": -76,
    "user_connected": false,
    "uuid": 420
}
{
    "connection_string": "DA:9C:D4:7F:56:FA",
    "expiration_time": "2018-01-11 21:55:46.196301",
    "low_voltage": false,
    "pending_data": true,
    "signal_strength": -91,
    "user_connected": false,
    "uuid": 229
}

Connecting to a device

In order to connect to a device, you need the IOTile Device ID. Your IOTile Device should have a sticker showing the ID. The ID will be of the form d--0000-0000-0000-00e5 which represents Device 229 (equivalent to HEX 0xe5).

shell:

iotile
(root) hw --port=bled112
(HardwareManager) connect 0xe5

After connecting, we can interact with the controller or with one of the IOTiles. Each IOTile is represented with an address. Address 11, for example, represents the GPIO IOTile on an IOTile POD-1G Device. But most interactions require the controller module.

Interact with Controller

Assuming you are connected to a device (as shown above):

(HardwareManager) controller
(NRF52832Controller) tile_name
NRF52 
(NRF52832Controller) hardware_version
btc1_v2
(NRF52832Controller) tile_version
[2, 9, 1]
(NRF52832Controller) status
{
    "hw_type": 29794,
    "name": "NRF52 ",
    "status": 3,
    "version": [
        2,
        9,
        1
    ]
}

We can also access the Sensor Graph using:

(NRF52832Controller) sensor_graph
(SensorGraph) highest_id
61859
(SensorGraph) count_readings
streaming: 41464
storage: 0
(SensorGraph) clear
(SensorGraph) count_readings
streaming: 1
storage: 0
(SensorGraph) query_streamer 1
SensorGraph Streamer
Last successful stream: 7449420
Last streaming attempt: 7449420
Last streaming result: 1
Last streaming error: 0
Backoff attempt number: 0
Current CommStream state: 0
Highest ACK received: 61835
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment