github.com/simpleiot/simpleiot@v0.18.3/docs/ref/integration.md (about)

     1  # Integration
     2  
     3  This page discusses ways you can integration Simple IoT into your system. At
     4  [its core](architecture.md), SIOT is a distributed graph database optimized for
     5  storing, viewing, and synchronizing state/config in IoT systems. This makes it
     6  very useful for any system where you need distributed state/config.
     7  
     8  With SIOT, you run the same application in both the cloud and edge devices, so
     9  you can use any of the available integration points at either place.
    10  
    11  ![integration](../user/images/integration.png)
    12  
    13  ## The SIOT API
    14  
    15  This primary way to interact with Simple IoT is through a
    16  [NATS API](api.html#nats). You can add additional processes written in any
    17  language that has a [NATS client](https://nats.io/download/). Additionally, the
    18  [NATS wire protocol](https://docs.nats.io/reference/reference-protocols/nats-protocol)
    19  is fairly simple so could be implemented from scratch if needed. If your most of
    20  your system is written in C++, but you needed a distributed config/state store,
    21  then run SIOT along side your existing processes and add a NATs connection to
    22  SIOT. If you want easy scripting in your system, consider writing a Python
    23  application that can read/modify the SIOT store over NATS.
    24  
    25  ## SIOT Data Structures
    26  
    27  The SIOT data structures are very general (nodes and points) arranged in a
    28  graph, so you can easily add your own data to the SIOT store by defining new
    29  node and point types as needed. This makes SIOT very flexible and adaptable to
    30  about any purpose. You can use points in a node to represent maps and arrays. If
    31  you data needs more structure, then nested nodes can accomplish that. It is
    32  important with SIOT data to retain CRDT properties. These concepts are discussed
    33  more in [ADR-1](../adr/1-consider-changing-point-data-type.md).
    34  
    35  The requirement to only use nodes and points may seem restrictive at first, but
    36  can be viewed as a serialization format with CRDT properties that are convenient
    37  for synchronization. Any distributed database requires meta data around your
    38  data to assist with synchronization. With SIOT, we have chosen to make this
    39  metadata simple and accessible to the user. It is typical to convert this data
    40  to more convenient data structures in your application -- much the same way you
    41  would deserialize JSON.
    42  
    43  The [architecture page](architecture.md#simple-flexible-data-structures)
    44  discusses data structures in more detail.
    45  
    46  ## Time series data and Graphing
    47  
    48  If you need history and graphs, you can add
    49  [InfluxDB and Grafana](../user/graphing.md). This instantly gives you history
    50  and graphs of all state and configuration changes that happened in the system.
    51  
    52  ## Embedded Linux Systems
    53  
    54  Simple IoT was designed with Embedded Linux systems in mind, so it is very
    55  efficient -- a single, statically linked Go binary with all assets embedded that
    56  is ~20MB in size and uses ~20MB of memory. There are no other dependencies
    57  required such as a runtime, other libraries, etc. This makes SIOT extremely easy
    58  to deploy and update. An Embedded Linux system deployed at the edge can be
    59  synchronized with a cloud instance using an [sync](../user/sync.md) connection.
    60  
    61  ## Integration with MCU (Microcontroller) systems
    62  
    63  MCUs are processors designed for embedded control and are typically 32-bit CPUs
    64  that run bare-metal code or a small OS like FreeRTOS or Zephyr and don't have as
    65  [much memory as MPUs](http://bec-systems.com/site/1540/microcontroller-mcu-or-microprocessor-mpu).
    66  MCUs cannot run the full SIOT application or easily implement a full
    67  data-centric data store. However, you can still leverage the SIOT system by
    68  using the node/point data structures to describe configuration and state and
    69  interacting with a Simple IoT like any other NATS client.
    70  [nanopb](https://github.com/nanopb/nanopb) can be used on MCUs to encode and
    71  decode protobuf messages, which is the default encoding for SIOT messages.
    72  
    73  If your MCU supports MQTT, then it may make sense to use that to interact with
    74  Simple IoT as MQTT is very similar to NATS, and NATS includes a built-in MQTT
    75  server. The
    76  [NATS wire protocol](https://docs.nats.io/reference/reference-protocols/nats-protocol)
    77  is also fairly simple and can also be implemented on top of any TCP/IP stack.
    78  
    79  If your MCU interfaces with a local SIOT system using USB, serial, or CAN, then
    80  you can use the SIOT [serial adapter](serial.md).