The Internet of Things is an extension of Internet applications and an emerging networking technology. Its core is the information communication and exchange between objects and the interactive control between objects and people. The Internet of Things technology mainly uses various sensor devices, such as wireless technology, radio frequency identification (RFID) technology, and various sensors and other technical devices to transmit various information in the physical world, such as temperature, light intensity, location, etc., through the network to achieve the purpose of information interaction between objects and between objects and people.
In order to enable people to easily access Internet of Things information, monitor and control various sensor nodes and electrical equipment, a friendly user interface is a prerequisite. The solution based on B/S architecture has become the first choice for building systems due to its client versatility. This paper will design and develop a universal IoT server based on the ARM processor platform and Linux embedded operating system. On the hardware platform, the UPTECH embedded development experiment box based on the XSCALEPXA270 processor, 51 single-chip microcomputer and various sensor control devices will be used. The ARM LinuX system is used on this embedded device, and the server is built under the embedded Linux system. The B/S architecture is adopted, and BOA is used as the WEB server. Remote information transmission and intelligent interaction are realized through CGI communication.
1. System architecture
In order to highlight the low power consumption, low cost, high service level and high processing efficiency of modern IoT server systems, the server will run on the UP-Tech embedded device based on the XSCALE PXA270 processor, and use the 51 single-chip microcomputer to connect various sensor control devices. The
ARM Linux operating system with the 2.6.28 kernel is ported to the UP-Tech embedded device. On the Linux system, a daemon is written to communicate with the 51 single-chip microcomputer, so as to communicate and control with various sensor control devices on the Linux system. The Boa WEB server is transplanted on Linux to build an interactive user access interface. Users can view or control various sensor control devices in real time by accessing the page through a browser. The
system architecture is shown in Figure 1.
Figure 1 System architecture
2. Design of IoT data acquisition and processing subsystem
2.1 Data acquisition system based on 51 single-chip microcomputer
In terms of IoT terminal devices, 51 single-chip microcomputer is used to connect with temperature sensors, humidity sensors, LED lights and other modules through its rich external expansion interface. The "C language + driver library" development model is adopted in software. Through this development model, it can not only improve development efficiency, but also complete the information collection and processing of multiple sensors. In terms of connecting to the ARM-Linux embedded platform, the UART virtual serial port is used to connect and communicate with the embedded platform. The
basic functions of this system are as follows:
(1) Connect each sensor module, obtain the information transmitted by the sensor through the input and output interface and record it;
(2) Set the timer to collect the information of each sensor device and control the status of the device within the specified unit time. The information and status of these data are combined into a data packet and sent through the virtual serial port;
(3) The virtual serial port communication is used to detect the control signal sent from the ARM-Linux platform at all times;
(4) The data packet transmitted from the serial port is analyzed to detect the source of the data to determine whether it is legal, and then the microcontroller and each control module are controlled according to the specific control code.
2.2 Data processing system based on the ARM-Linux platform
The ARM-Linux platform refers to the use of the open source Linux kernel after specific requirements are cut, and after cross-compilation, a Linux kernel that can run on the ARM processor is obtained. At the same time, a Linux root file system is customized. The capacity of the entire system is controlled between hundreds of KB and tens of MB. The system mainly consists of three parts: BootLoader, ARM-Linux kernel, and Linux root file system.
On embedded devices, the main data processing system is implemented by the daemon. The daemon is responsible for receiving and processing the information sent by the microcontroller on the one hand, and accepting the query control request from the WEB server on the other hand.
On the IoT server side, the request from the client is received and verified by the server, and the request query and control instructions are passed to the daemon. The daemon receives the request from the server and sends the request query and control instructions to the microcontroller after verification.
The communication process of the daemon is divided into two parts. The first part is that the daemon informs the CGI program on the server side of the update data, and the second part is that the CGI program on the server side sends a command control to the daemon, and the daemon monitors and executes the control program.
3. Human-computer interaction subsystem-WEB server design
Since the hardware resources of embedded devices are generally limited, they cannot handle requests from multiple users at the same time. Therefore, in the selection of WEB servers, some WEB servers developed specifically for embedded devices are selected. These servers have the advantages of low memory space, high processing efficiency, and high security, and are quite suitable for embedded application fields. On the other hand, in actual applications, due to the rapid development of the Internet and the arrival of 3G networks, everyone hopes to access and control their own IoT devices through handheld devices in their hands. Using a lightweight WEB server as an access control server can accomplish the task quite well.
3.1 Server working principle
The architecture of the embedded WEB server adopts the B/S architecture, which is composed of the server and the client. In this architecture, the following steps will be used to communicate with the WEB server.
(1) Enter the IP address of the WEB server in the client's browser;
(2) The client first initiates a connection request through TCP, and then the server immediately establishes a connection after the authentication confirms that the request is legitimate. In this process, the "three-way handshake" method of the TCP/IP protocol is used to establish the connection;
(3) After the connection is established through TCP/IP, the browser then uses the HTTP protocol to send an HTTP request;
(4) When the server receives the HTTP request, it parses it and performs other operations, and then performs corresponding return operations based on different processing results.
(5) After the client receives the return result from the server, it parses the HTML data packet and then displays it on the browser.
3.2 Transplantation of Boa WEB Server
Boa is a single-task WEB server. That is, it can only respond to another connection request after completing one request. Although it cannot achieve concurrent responses, it is enough to handle embedded application processing. In addition, Boa is also a very lightweight WEB server. The executable file obtained by cross-compilation is only about 60kB. Due to the simplicity of design and application requirements, Boa only supports CGI.
Download the source code of boa from WWW.boa.org. Complete its cross compilation through the following steps:
#tar—bxzf boa-0.94.1 3.tar. gz
#cd ./boa-0.94.13/src
#./configure
#vi./Makefile
Modify CC=gcc to CC=arm-unknownlinux-gcc, CPP=gcc -E to CPP=arm-unknownlinux-cpp -E, save and exit. Execute the following commands:
#make
#arm-linux-strip./boa
Get the executable file boa that can be used on the arm platform, the size is only 60KB
After downloading the executable file Boa to the embedded device, it still needs to be configured. First, you need to create a boa configuration file boa.conf in the /etc/boa directory. Table 1 is a partial configuration description of the Boa configuration file:
Table 1 Boa configuration file configuration parameter description
3.3 Common Gateway Interface CGI
CGI is the abbreviation of Common Gateway Interface. This interface defines the communication interface standard between the WEB server and other executable programs. Generally, we also refer to these executable programs as CGI programs. On the client browser, you can request to execute the CGI program and send parameters. When the server receives this request, it executes the corresponding CGI program and passes the transmission from the client to the CGI program. Between the server and the CGI program, they can use standard input and output to implement parameter transmission and information return.
In the design of this IoT server, the CGI program not only communicates with the WEB server, but also needs to communicate with the daemon. Since the daemon is responsible for connecting to and communicating with peripheral devices, it is possible to communicate with peripheral devices through the CGI program. Through this communication process, the interaction between the client and the IoT device terminal is realized. The communication process is as follows:
(1) The client uses the TCP/IP protocol to establish a connection with the WEB server;
(2) The client uses the HTTP protocol to send a request with a URL pointing to a CGI program;
(3) After receiving the request, the server executes the corresponding CGI program;
(4) The CGI application is executed and can obtain parameters from the client by reading standard input or environment variables (QUERY STRING);
(5) The application uses standard output to output the return results to the WEB server.
(6) The WEB server transmits the result to the client, completing the entire request return process.
3.4 Access and control of network applications
The access and control of the website uses JavaScript language, calls the jQuery library and uses AJAX technology to achieve the effect of dynamically displaying pages. The parameter transfer and CGI feedback of the page both use the JSON data format.
JSON is JavaScript Object Notation, which is a lightweight data exchange format. This design uses the collection of "name/value" pairs in the JSON data format as the basic data structure, which is used as the data format for parameter transfer and calculation result return between the page and the CGI program. The basic format is as follows:
{device: "value", model: "value", type: "value", data: "Value"}
Using the jQuery library, every 1 s through the request. /cgi-bin/web_cgi. Get the request result as the current state.
4. Summary
This paper implements the design of a general Internet of Things server based on the ARM-Linux platform. This design can provide users with real-time monitoring and control functions for data collection in the Internet of Things through WEB pages, which has good practical significance. The next step will be to continue to improve the system's functions, such as adding support for more sensors, how to more conveniently apply the system to different fields, etc. The security of the system also needs to be improved.
Previous article:About USE_STDPERIPH_DRIVER problem in STM32 MDK
Next article:arm assembly - ldr pseudo instruction
Recommended ReadingLatest update time:2024-11-23 21:28
- Naxin Micro and Xinxian jointly launched the NS800RT series of real-time control MCUs
- How to learn embedded systems based on ARM platform
- Summary of jffs2_scan_eraseblock issues
- Application of SPCOMM Control in Serial Communication of Delphi7.0
- Using TComm component to realize serial communication in Delphi environment
- Bar chart code for embedded development practices
- Embedded Development Learning (10)
- Embedded Development Learning (8)
- Embedded Development Learning (6)
Professor at Beihang University, dedicated to promoting microcontrollers and embedded systems for over 20 years.
- Intel promotes AI with multi-dimensional efforts in technology, application, and ecology
- ChinaJoy Qualcomm Snapdragon Theme Pavilion takes you to experience the new changes in digital entertainment in the 5G era
- Infineon's latest generation IGBT technology platform enables precise control of speed and position
- Two test methods for LED lighting life
- Don't Let Lightning Induced Surges Scare You
- Application of brushless motor controller ML4425/4426
- Easy identification of LED power supply quality
- World's first integrated photovoltaic solar system completed in Israel
- Sliding window mean filter for avr microcontroller AD conversion
- What does call mean in the detailed explanation of ABB robot programming instructions?
- STMicroelectronics discloses its 2027-2028 financial model and path to achieve its 2030 goals
- 2024 China Automotive Charging and Battery Swapping Ecosystem Conference held in Taiyuan
- State-owned enterprises team up to invest in solid-state battery giant
- The evolution of electronic and electrical architecture is accelerating
- The first! National Automotive Chip Quality Inspection Center established
- BYD releases self-developed automotive chip using 4nm process, with a running score of up to 1.15 million
- GEODNET launches GEO-PULSE, a car GPS navigation device
- Should Chinese car companies develop their own high-computing chips?
- Infineon and Siemens combine embedded automotive software platform with microcontrollers to provide the necessary functions for next-generation SDVs
- Continental launches invisible biometric sensor display to monitor passengers' vital signs
- Computer Acceleration Record
- TI Power Supply Learning and Growth Road: DC-DC/AC-DC Converter
- How to set up PCB routing like this?
- Using SRAM to simulate dual-port RAM in data acquisition system
- Dear bachelors, do you cook your dinner yourself or eat out?
- Program Name: Analog Circuit Design Technology-Section 2
- MOTOROLA 8-bit MCU Selection Guide (Part 1)
- [Free trial of Pingtouge Bluetooth Mesh Gateway Development Kit] + Development environment preparation and use
- lib file link mechanism
- Based on AM335X development board ARM Cortex-A8——NAND FLASH version core board usage instructions