What is telemetric state?
Telemetric state is the collection of measurements or data that is associated with any process, machinery, or environment.
Telemetric state can be viewed as a discrete methodology for transforming a physical condition into a more quantifiable form in a digital environment in any instantaneous state.
For instance, hot water in a kettle can be rendered as TRUE (or 1) in a simple digital form that indicates hot as true and cold as zero.
Or it can be more precise to transform the temperature itself into digital form, such as 101.3 degrees Celsius.
IoT Device and Telemetric State
The device that measures the above example could be very likely an Internet of Things (IoT) device as long as it is connected (or has an intermediary to connect) to servers and communicates every piece of data it has back to the servers.
However, it is important to know that an IoT device can be a state-controlled device as well. For examples:
- switch to turn On/Off a lamp.
- digital output pins of an Integrated Circuit (IC).
There are also many instances where the device performs both functions.
In the physical device, the measurement of telemetry usually involves a probe or sensor that measures the parameters. While for a state-control device, it can be a digital pin or relay that controls the parameter that is being connected.
In IoT applications, these types of telemetry and state are very much what the application is all about.
Telemetric State in Software Presentation
It is crucial to design the digital representation of telemetry state in a meaningful and human-friendly (developer-friendly) form.
There are many formats that can be used to represent the information, but JSON kind of dominates the software world right now (at least in demoing some code).
Let’s see examples below of how to represent telemetric state in JSON.
Example 1: Integrated Circuit
Let’s take a look at a simple imaginary IC with 7 digital input pins and 7 digital output pins, where the pins correspond to 5V or 0V in the actual world and TRUE or FALSE in the digital world.
The telemetry state of the IC can be designed in JSON, such as below:
{ "digital": { "input": { "pin_0": true, "pin_1": false, "pin_2": true, "pin_3": true, "pin_4": false, "pin_5": true, "pin_6": true, }, "output": { "pin_0": true, "pin_1": false, "pin_2": false, "pin_3": true, "pin_4": false, "pin_5": true, "pin_6": false, } } }
Example 2: Energy Measurement Device
Now let’s take a look at energy sensors.
{ "active_power": { "phase_a": 1.322, "phase_b": 22.21, "phase_c": 2.19 }, "line_voltage": { "phase_a": 215.112, "phase_b": 214.889, "phase_c": 214.786 }, "power_factor": { "phase_a": 0.889, "phase_b": 0.992, "phase_c": 0.977 } }
Designing Telemetric State
It is critical to design the IoT application with the most accurate representation of the IoT device’s telemetry state.
The parameters of the telemetry state will have a lot of influence in designing the database and data modelling for both the backend and frontend systems.
One of the simplest designs is to use a document database with data indexed by device_id and timestamps and a column representing the telemetry state.
Such a design will reduce the code footprint in writing and reading the data.
device_id | timestamps | active_power.a | active_power.b | active_power.c |
---|---|---|---|---|
abc123 | 1/1/22 12:00am | 12.21 | 11.55 | 0.21 |
abc123 | 1/1/22 12:05am | 12.64 | 13.54 | 1.22 |
It also will be one of determining factor when upgrading to new version of system in future. It will be very practical and cost efficient if the a new version has least footprint on the telemetry state.
Neuko Ecosystem and Telemetric State
Neuko builds its ecosystem from the device’s SDK and the client’s API point of view based on the telemetry state.
Consider an example of a device with a below-state design.
{ "control": { "toggle": false }, "measurement": { "power": 12.3, "voltage": 215.12, } }
And now let’s consider the code to manage the device with upstream communication.
// create device instance const device = new Device(); // listen upstream request for toggle. If any the function listenToggleChangedRequest will be invoked device.useEffect(this, "control", "toggle", listenToggleChangedRequest); // a simple non-ended loop to keep measure the energy while() { measureConsumption(); delay(); } // if invoke, it will run mechanically the switch @ relay function listenToggleChangedRequest(payload) { if (payload.data) switchOnPlug(); // a request to turn on switch else switchOffPlug(); return true; } // measure function measureConsumption() { let data = runMeasurement(); // perform the actual measurement routine device.updateState("measurement", data); // ingest to cloud }
Conclusion
It is really important to understand, design, and implement telemetric states when building IoT applications. It is the main focal point of the whole system. The backend and frontend designs will be as similar as the design of the IoT device.