Building a Data Collection Platform for Smart Devices

Nathan (Lyric)
Nathan (Lyric)
/
Share on LinkedIn

Introduction

The Lyric is the result of a two-year project and the convergence of thinking of a distinguished team of world-leading experts, entrepreneurs and investors drawing on consumer research as well as experience working across some of the most iconic brands. The Lyric was developed to address unmet consumer needs spanning form, function and accessibility. Say goodbye to ugly, cumbersome, aggressive and heavy massage guns made only for elite athletes. The stylishly designed Lyric was created with everybody and every body in mind, delivering intuitive and easy-to-use technology at an affordable price. Now, you don’t have to sacrifice quality or make a tough choice between features when deciding on self-care. With the Lyric, you can have what you want and what your body needs. 

Data Needs

In order to better serve our customers, we need to collect and analyze usage data from the Lyric, gain insights from data and make product decisions based on them. For this, we decided to deploy a time series database (TSDB) TDengine made it extremely easy to get started and integrate with, with just a few lines of code, we are able to collect data immediately

Integration Details

Data collection is implemented by the integration of MQTT logging. It uses a secure connection to TDengine hosted servers.

The events currently logged are:

  • connect
  • disconnect
  • start
  • stop
  • level
  • ota 

Each message includes the device ID and software version. The ID is always redundant because it is used as the user ID for MQTT login. The version is redundant after the first time. Ideally it would only be included with the connect event.  (Minimizing message size is important as the on-device network transmit buffers can become full when connectivity is weak, requiring a connection reset.) 

The mosquitto_sub tool is a convenient way to monitor MQTT events. There are many ways to install mosquitto if you don’t have it already. To monitor all Lyric events on TDengine server,, use this command line:

The output looks like this:

{"event":"connect","id":"FDD3F6F0688784214A606AADDD01E336","version":"0.8.7"}
{"event":"start","title":"Calm","name":"Manual","level":1,"id"...
{"event":"stop","id"...
{"event":"start","title":"Calm","name":"Guided","level":1,"id"...
{"event":"level","level":2,"id"...
{"event":"level","level":3,"id"...
{"event":"level","level":1,"id"...
{"event":"stop","id"...
{"event":"disconnect","id"...

Visualization

Once these semi structured events are hosted on TDengine’s server, picking a visualization tool is easy as well, we picked Grafana as it is highly customizable. End results are simple to digest, actionable, real time usage data on the Lyric that we depend on everyday!

Summary 

We see these benefits of using TDengine

  • Easy integration, clear documentation, took us just a few lines of code to start collecting data
  • TDengine’s service is fast and reliable, with real time data ingestion and high availability
  • Highly customizable data visualization tooling, many integration possibilities