When we talk about IoT, two approaches are specifically mentioned: database-driven IoT and peer-to-peer (P2P) IoT. You properly heard about database-driven IoT, which big companies like Microsoft, Amazon and Google have talked about for years. P2P IoT can do many of the same things but has some essential difference.
Are you wondering which one is best for your devices? Read along and get the answer.
Data needs to flow from a device to an end user when you make your products internet accessible as IoT devices. A connection between the end user device and the IoT device has to be established for this to happen. The two dominant methods for this are a database-driven solution or a P2P solution.
Server-based or direct connection
Database-driven IoT is when data from the interaction between the client and the IoT device is stored in a cloud database on a server, i.e. the connection between the end user device and the IoT device is indirectly using a server.
Database-driven IoT is when data from the IoT device travels to a centralized server that stores and process the data in a cloud database, as you can see in the illustration above.
A use-case could be the current temperature from a thermostat. In this use-case, the thermostat measures the temperature via a sensor and sends the data to the server which then stores the data in its database. From here the client (normally a smartphone/tablet app) can collect this data and present it to the end user. If the client wants to issue a command to the device, for example, to adjust the temperature, this set-point is sent to the server, and then later the IoT enabled device downloads the commands which will usually happen together with the next scheduled data upload.
All the data is thereby kept at the server, both sensor data from the device and commands issued by the client. Data from other clients and devices of a similar kind from the same manufacturer is likewise stored centrally in this database.
Another approach for communication between client and device is a direct connection through P2P technology.
IoT data is shared directly between two ‘peers’ and the only use of a server is to create a direct connection in a P2P solution, as illustrated above.
This process is as follows: to establish the connection between the two peers, the device, a thermostat (let’s still use the example from before), makes a connection to a server. At the same time, the client, for example, a smartphone app, makes a connection to this server as well. The server then mediates a direct end-to-end encrypted connection between the app and the thermostat (how this happens is quite a complex process, that we won’t cover further in this blog post).
Once the direct connection is established, the server is taken out of the picture and each of the peers becomes its own server. This means that all data is stored directly on the thermostat and can be collected directly from the connected app/client device. So, let’s say you want to know the current temperature, then you collect the data directly from the thermostat to the client device, without going through a server.
Find what fits your customers’ needs
It is possible in a database-driven IoT solution to collect huge amounts of data from several IoT devices for analysis. This is specifically useful if you want to analyze data from across a large number of devices – e.g. in Big Data analysis, that covers a major process of collecting, storing and processing huge amounts of data. If you want to do this, a database-driven solution would be a great choice. The P2P IoT solution is more focused on a specific device and might be a better solution in the field of consumer products, where, for example, latency is important.
The type of device will also have a great impact on your choice of IoT communication platform.
If your device isn’t turned on most of the time but, for example, automatically turns on and off (or goes into sleep mode) throughout the day to save the battery, then a database-driven solution might be the best for you.
An example of this could be a wireless plant sensor that can measure the soil moisture level of a plant. A couple of times a day the plant sensor will turn on automatically and send data of the moisture measurements to the server and then turn off again. Whenever you want to check the soil moisture level, you can collect the data from the server on your smartphone. In this case, the device does not need to be turned on at all times and can save battery power, while also you don’t need to have direct access to the measuring device.
For a P2P IoT solution, this would be more complicated, as you need to be able to connect directly to the measuring device whenever you want to check moisture levels.
Lightning-fast low-latency connections with P2P
Because of the direct connection in P2P, the latency is quite low, which is a big plus. There is no server to cause delays, so everything gets done a bit faster – as it should in a real-time, direct connection. This can be a necessary feature to accomplish many use-cases with success – for example, if you have an IoT enabled door lock, then you want the lock to open as soon as you click the button on your app.
Communication latency in many database-driven IoT devices, on the other hand, can be easily more than five seconds (many times it is multiple minutes). This does not matter in certain situations, but in many (as in the example with the door lock) it is quite important. Studies even show that after only one second, users get impatient of waiting on a computer. Furthermore, after 0.1 seconds users stop feeling like their actions are making things happen after they click on something (read more about time scales in user experience here).
Using P2P technology with IoT devices enables you to get fast-traveling data between you as the client (your mobile, tablet, PC, etc.) and the device, which makes it possible to build remote control interfaces for your products. It is the same technology that is used in Internet products such as Skype and TeamViewer, where it is important to avoid long delays to get the best out of the communication, whatever it is voice, video or screen sharing.
Avoid problems with privacy
Another big plus in a P2P connection is that the level of security is high. The GDPR (General Data Protection Regulation) has made this a highly prioritized area because the data that is collected, stored, and shared in relation to IoT devices often can be of a (sensitive) personal nature.
There is no central server that collects all the data in P2P IoT – the data only gets shared with the device through the direct connection. This means that your data can maintain its privacy. As a bonus, it also means that it is harder for hackers to gain access.
It is not that the security is low in database-driven IoT, but this approach has less privacy than in a direct P2P connection. This is because all the data is stored on servers or in the cloud, which you might prefer to avoid – especially when we talk about personal information and have to take into account the GDPR.
The Nabto Platform in a nutshell
Nabto specializes in direct P2P communication for IoT devices that enables a secure connection between the client and an IoT device. The Nabto technology has a unique feature where it fits any embedded target, and can be integrated on devices with only a few kilobytes of memory.
We have so much more to say about Nabto’s P2P technology, so please do not hesitate to contact us if you want to know more.