Development of Remote Data Acquisition and Control System Based on Windows CE

Publisher:TranquilOasisLatest update time:2011-11-15 Source: 电子产品世界 Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

With the rapid development of information technology, data acquisition systems have been widely used in the fields of industrial control, intelligent instruments, and instrument detection [1]. Traditional data acquisition systems are generally completed in two ways: (1) using data acquisition cards plus microcomputer systems; (2) using various single-chip integrated data acquisition systems. Although the former has powerful functions, it is costly, consumes a lot of power, and has poor popularity. Due to its limited resources, the latter cannot meet the requirements of multi-tasking, large capacity, high real-time performance, and high stability. In terms of remote control, the industry generally uses a control mode based on TCP/IP. Although this method introduces network technology and can transmit data quickly and stably, it is costly, has poor mobility, and is difficult to maintain. Therefore, this paper uses Windows CE5.0 as the operating system platform, S3C2440A based on the ARM9 core as the microcontroller, and introduces GPRS wireless technology to realize a remote data acquisition and control system that is friendly to human-computer interaction, has strong scalability, strong real-time performance, low power consumption, and low cost. This system can detect and control various physical quantities such as indoor temperature and humidity, and provide feedback as required; monitor several household appliances, such as appliance voltage, water heater flow, etc., so that users can find problems in time (for example, many solar water heaters are prone to bursting, etc.); in addition, a video acquisition and transmission expansion module can be added to send real-time image data through the MMS protocol module.
1 System Structure
The system uses S3C2440 as the controller and consists of a data acquisition module, a GPRS module, a remote control module, an alarm system module, a video acquisition and transmission module, and other expandable peripheral circuits. The system structure diagram is shown in Figure 1.

First, start the system. Users can send remote control commands to the system through the GPRS network at any time. For example, send the "start acquisition" command. The system will start to use the ADC module to collect analog quantities such as voltage, flow, temperature, humidity and touch screen coordinates, and convert them into corresponding digital quantities, and then display them on the human-machine interface. Once the collected data exceeds the given threshold, the system will send an alarm message to the user so that the user can take further control measures.
1.1 System hardware design
The hardware development platform of this system is based on Samsung S3C2440. S3C2440 is a 32-bit high-performance microcontroller with ARM920T as the core. It has high cost performance, low power consumption and rich expansion functions, so it is widely used. It has an MMU (memory management unit) that can run mainstream embedded operating systems such as Linux and WinCE[2]. The data acquisition module uses an 8-channel 10-bit A/D converter with a sample-and-hold function. It can realize two modes: independent conversion and touch screen position conversion. The maximum conversion rate can reach 500 KS/s[3]. The application interface circuit of the A/D module is shown in Figure 2. Among the 8 channels, except for the 5th and 7th channels which are used for touch screen input, the rest can be used. This article uses 4 channels to connect with the temperature acquisition sensor, humidity acquisition sensor, resistor and water flow sensor respectively, so that the 4 signals can be collected in parallel without interfering with each other.

The GPRS control module is a GPRS modem with Siemens TC35i as the core. GPRS technology is an improvement on the second-generation mobile communication technology, so it is also called 2.5G. Compared with GSM's circuit-switched data method, GPRS uses packet switching technology, which is superior to the former in terms of transmission cost, transmission rate and real-time performance. Even compared with the latest third-generation mobile communication technology, GPRS technology still has certain advantages in terms of cost, speed and cost performance. TC35i provides a standard 9-pin RS-232 interface, so it is necessary to add MAX232 for level conversion to achieve full-duplex communication with the serial port of S3C2440 [4]. Figure 3 shows the GPRS hardware interface circuit, in which the GSM baseband processor is the core component of TC35i, which is used to process serial port instructions, and J1 is the SIM card holder.

The peripheral alarm device is controlled by the PWM timer provided by S3C2440 and the general purpose input and output GPIO port.
1.2 System software design
1.2.1 AT command set

The GPRS module used in this system adopts the GSM07.05 specification, which stipulates the DTE-DCE interface standard of SMS, namely the AT command set. The AT (Attention AT) command set is sent from TE (Terminal Equipment) or DTE (Data Terminal Equipment) to TA (Terminal Adapter) or DCE (Data Circuit Terminating Equipment), and sends AT commands through TATE to control the functions of MS (Mobile Station) to achieve interaction with GSM network services. Users can control through AT commands [4]. This article mainly uses the AT command set related to short messages. For example, sending AT+CMGF=n, where n is 0, selects the PDU format, and n=1 selects the text mode. For example, sending AT+CSCA= to select the operator, string=+8613800270500; that is, select China Mobile. Send AT+CMGS=“string” (string) in text format as the other party’s mobile phone number. If successful, it will return “>” and then enter the content to be sent and end with “^Z”. The GPRS classes in this article all implement related functions by calling serial port drivers.
1.2.2 Driver Writing under Windows CE
Windows CE is an embedded real-time operating system launched by Microsoft. With its simplicity, ease of use and powerful functions, it is widely used in smart phones, PDAs and automotive electronics. Driver writing in this system is the core content of software design.
The two driver models based on Windows CE are stream interface driver and native driver model. The native driver model is part of the operating system itself, such as power management. These drivers are general drivers. Stream driver refers to a general driver with customizable interfaces and functions, and is a dedicated driver. All drivers in this article are stream drivers. Stream drivers operate external devices as files, so applications can easily use system API files for operations. The stream driver is implemented by a set of standard functions. There are 12 stream interface functions defined in Windows CE, including XXX_Init, XXX_Deinit, XXX_Open (the application calls CreateFile() to open the driver), XXX_ Close (the application calls CloseHandle() to close the driver), XXX_Read (the application calls ReadFile() to open the driver), XXX_Write (the application calls WriteFile() to open the driver), XXX_Seek, XXX_Power
Up, XXX_PowerDown, and XXX_IOControl. Among them, XXX is the device name of the driver [5].
The stream driver in this article needs to have three functions: (1) drive the data acquisition module; (2) drive the alarm circuit; and (3) drive the GPRS module.
1.2.3 Implementation of the stream driver
(1) Name the driver RDA (Remote Data Acquisition). Since the device needs to be called at the operating system level, the virtual address allocation of the hardware, especially the registers, should be completed first, which is implemented in the function RDA_Init(). Physical memory is accessed by calling VirtualAlloc() and VirtualCopy() provided by Windows CE, where the former is responsible for reserving virtual memory and the latter is responsible for binding physical memory and virtual memory. In fact, access to physical memory is ultimately completed by accessing virtual memory. The main part of the code is as follows:
v_pAdcPreg=(volatileADCreg*)VirtualAlloc(0,sizeof(ADCreg),MEM_RESERVE,PAGE_NOACCESS);
…if (!VirtualCopy((PVOID)v_pAdcPreg, (PVOID)(ADC_
BASE_PHY_ADD>>8),sizeof(ADCreg),PAGE_PHYSICAL| PAGE_
READWRITE | PAGE_NOCACHE))
v_pIOPregs=(volatile IOPreg*)VirtualAlloc(0,sizeof(IOPreg),MEM_RESERVE,PAGE_NOACCESS); …
Then the system calls the respective registers through v_pAdcPreg and v_pIOPregs to initialize, where ADC_BASE_PHY_ADD and IOP_BASE_PA are the hardware physical addresses.
Then complete RDA_IOControl(), this function is responsible for completing the function of modifying the device. For example, the data acquisition module in this article has 8 channels, so the channel needs to be converted each time sampling, and the sampling frequency can also be converted. All control codes are completed in the header file. Through the control code, the user can freely select the channel, which is completely consistent with the requirements of this article.
The most important is the read function RDA_Read(). The application communicates with the underlying driver through the read function, and the application reads the value of the ADC register through the ReadFile() function.
PUBLIC DWORD RDA_Read(DWORD Handle, LPVOID pBuffer, DWORD dwNumBytes)
Finally, when the driver is closed, the application calls RDA_Close () through the CloseHandle() function to close.
1.2.4 Implementation of the application
After the stream driver is written, compile it through PB, add registry information, and then customize the proprietary system, so that the driver can be called in the customized system. The steps for writing the application are as follows: first, use PB to generate the required SDK and install it, then write the interface to simulate it using the simulator, and finally connect the hardware and open the driver test program. All programs in this article have been written and implemented in EVC4.0.
This system needs to complete the functions of the touch screen, the video acquisition module, and the four-way data acquisition function defined by the user. Therefore, four sub-threads are added to the main thread of the form: ADC acquisition, touch screen control, video acquisition, and feedback module. Figure 4 is the basic flow chart of the application.
2 Experimental results
During the test, the system will control and display the collected data in real time according to the content of the SMS sent by the user. The electrical voltage, indoor temperature, humidity, and water heater flow collected by the system are completely consistent with the actual situation. The control function of the system is also well implemented. When the data collected by the system is greater than the threshold, for example, when the indoor temperature is too high, the humidity is too high, the flow is too large, and other abnormal conditions occur, the alarm information will be transmitted to the user's mobile phone by the remote system in real time; the video acquisition system is mainly controlled by the host, and the user can easily monitor through the system. Therefore, through actual testing, the system can realize the required functions and has a good human-computer interaction interface, which is very practical.
Based on the ARM9 kernel and Windows CE embedded operating system, this paper proposes a method of remote data acquisition and control in combination with GPRS technology. Taking advantage of the low power consumption, low cost, multi-tasking, high reliability and high real-time performance of the embedded system, an application system with remote data acquisition and control functions is implemented by designing and calling the core stream driver function. The system can be applied to more fields by expanding the corresponding peripheral devices. In the subsequent work, we will continue to study the use of another embedded system as a client to send real-time image data through the MMS protocol module, thereby enhancing the function of the system and further deepening its application in the fields of Internet of Things and smart home control.
References
[1] Ling Youzhu, Xu Xiaoguang, Pan Wei. Embedded remote real-time monitoring system based on WinCE [J]. Computer Technology and Development, 2007, 17(2): 204-206.
[2] Wang Liming, Chen Shuangqiao, Yan Xiaoling, et al. ARM9 embedded system development and practice [M]. Beijing: Beijing University of Aeronautics and Astronautics Press, 2008.
[3] Samsung Electronics. S3C2440A User Manual [Z]. 2004.
[4] TC35i AT Command Set [Z]. 2006
[5] Liu Yanfeng, Li Zheng. Differences between Windows CE and desktop Windows 2000/XP device driver development [J]. Electronic Technology Application, 2010, 36(3): 127-132.

Reference address:Development of Remote Data Acquisition and Control System Based on Windows CE

Previous article:Design and implementation of MP3 player based on ARM
Next article:Design of a new intelligent traffic light system based on ARM

Latest Industrial Control Articles
Change More Related Popular Components

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号