With the birth of 5G communication, the network communication speed is faster, and colleagues in the Internet industry all around say that the next outlet may be the Internet of Things. Since the company’s products are currently hardware-oriented, I am also fortunate to have some knowledge of the Internet of Things. In this article, I want to share with you how the terminal equipment and software in the Internet of Things products communicate.
What is an IoT product
As we all know, the Internet of Things is a network of millions of devices connected to each other through a network. IoT is a product that combines hardware and software to measure real-world information. And connect to the network to provide value to users.
In fact, there are quite a lot of IoT products around us. Smart homes and smart door locks abound. There are also shared bicycles, shared charging treasures, and shared umbrellas hatched in the era of sharing economy, which can also be considered IoT products.
When we use a shared bicycle, we can scan the code with our mobile phone and click the “unlock” button to unlock the car. After we are done using it, lock the shared bicycle. Without having to operate on the mobile phone, the system can also judge that we have finished using the bicycle. These functions are mainly realized through the Internet of Things technology.
Let’s take a shared bicycle as an example to explain how the bicycle equipment and the software system communicate and how to transmit data to complete the business behavior.
What modules should the terminal device contain?
(1) IoT card
As an Internet of Things product, it will be connected to the Internet. At this time, an Internet of Things card is required. The Internet of Things card can be simply understood as a traffic card. Therefore, like our mobile phone to access the Internet, a SIM card needs to be inserted, but the Internet of Things The device is plugged into another network card. Only with traffic can the basic networking functions be implemented.
(2) Device communication module
The device communication module is a circuit board. This part is generally a piece of embedded code that is burned into the circuit board. It communicates with the cloud system through software programming, and parses the received instructions from the cloud system and converts them into something that the circuit board can recognize. binary to realize the control board part of the control device.
(3) Control the motherboard part
This part is mainly to receive the device communication code, and realize the business through some pulse signals or high-frequency and low-frequency voltage. For example, the device communication module tells the control board part to open the lock, then the lock on the shared bicycle will be controlled by the control board. Unlocking and locking of shared bicycles. Therefore, the control board part mainly performs the control of the lock.
How cloud systems should work
Let’s first look at a business flow chart, take the shared bicycle scanning code unlocking as an example:
Cloud systems are generally divided into business systems and equipment communication systems:
Business system: perform some business operations, such as receiving the user’s request to scan the code to unlock the lock, record the user’s identity information and vehicle information, etc., check the user’s data and vehicle status and location during use, create orders, etc., and do not directly communicate with the terminal. device communication.
Equipment communication system: This system is a system that communicates directly with the terminal, and realizes communication by accessing the relevant protocols agreed with the equipment communication module in the terminal equipment in advance.
The content of the agreement is agreed, just like a secret code. If the lock is to be unlocked, the data content sent by the device communication system must be A, and the device communication code will only unlock if the data content is A. When the device communication system sends other content, the device communication code will not be recognized. According to various business needs, the business system will tell the equipment communication system what response the terminal equipment needs to make. The equipment communication system translates the content of the business system into a data form that the equipment communication module can recognize through the protocol agreed with the equipment communication module.
How to transfer data
The terminal equipment and cloud system have been introduced before, so how to transfer data. Generally, the HTPP protocol or the TCP protocol will be used. Of course, this development is very familiar to the students.
If HTTP is used to send data, the general device connection system will wrap the command into an object and send it; while for TCP protocol communication, the command will generally be converted into binary or hexadecimal for transmission.
How to send commands to a specified device
We have so many devices, how to send the instructions of the cloud system to the specified device? In fact, there is another concept here, that is, the device communication code. As the name implies, it is a unique marker code for the communication between the terminal device and the cloud system. This code is similar to the MAC address in our PC or the IMEI number of the mobile phone. This device communication code is programmed in the device communication module, which is the unique mark of the device communication code, and also marks a unique terminal device in the system.
Therefore, when we transmit data, we will bring this unique tag, so that our data will be designated to be sent to a certain terminal device, and there will be no confusion.
In general, on the terminal device, the device is generally connected to the Internet through the Internet of Things card, and then there is a device communication module on the device, which receives the instructions of the cloud system and parses it into a data form that can be recognized by the hardware circuit board, and controls the motherboard. Or other mechanical parts will complete corresponding operations after receiving the information transmitted by the device communication code. The results of these operations will be returned to the business system layer by layer along the original path, and finally displayed to the user.
When I first came into contact, I always felt that terminal equipment and circuit boards were difficult. In fact, it was quite simple after slowly understanding the process and communication rules. The Internet of Things is not as high as we think, so I will simply share it with you, hoping to help students who are just entering the Internet of Things products.