Bluetooth micro-network wireless data acquisition and control system based on handheld terminal

1 Introduction In recent years, close-range digital intelligent data acquisition and control systems have been widely used. The popular structure is PC, notebook computer, industrial computer, etc. as the upper computer, with single-chip microcomputer and embedded system as the lower computer, through the string Data transmission is performed in various ways such as line communication, 488 bus, CAN bus, and Ethernet. These wired data transmission systems have disadvantages such as inconvenient wiring and easy damage to the communication cable.
With the maturity of wireless data communication technology, wireless automation has become the focus of attention in the field of industrial control, detection and measurement. There is an urgent need for low-cost, high-reliability, low-power wireless data transmission solutions instead of wired. system. As a cable replacement technology, Bluetooth can easily realize wireless connection between devices. It has the characteristics of low cost, low power consumption, high speed, strong anti-interference ability, flexible networking, etc. It is an ideal for short-range wireless data transmission. Select [1]. The current major Pocket PCs and Smartphones support the Bluetooth protocol.
At the same time, with the continuous enhancement of the processing power of the handheld terminal, it is possible to use the handheld terminal as the upper computer control center, and the handheld terminal is convenient to carry, especially suitable for field control in the field or in complex conditions.

This article refers to the address: http://

In this paper, based on the handheld intelligent terminal, the Bluetooth wireless control of the distributed data acquisition system is realized. The terminal device control and data communication based on different Bluetooth protocol stacks are realized on the mainstream operating system Windows Mobile of the handheld terminal, and the real-time wireless transmission of data is completed. It can set the data acquisition parameters of multiple collection terminals and recover data in real time to ensure real-time data collection, data reliability and software system stability. 2 Bluetooth micro-network wireless data acquisition system controlled by handheld terminal
2.1 System Structure As shown in Figure 1, multiple Bluetooth wireless data collectors form a Bluetooth piconet, which communicates with the handheld terminal via Bluetooth to control signaling and data communication. The handheld terminal identifies the data collector in the network, sends control commands and displays the recovered data in real time. The Bluetooth wireless data collector sets data acquisition parameters under the control of the handheld terminal, starts or stops data acquisition, collects the required live signals in real time, and wirelessly transmits the data back to the handheld system through the Bluetooth piconet.




Figure 1 Structure diagram of Bluetooth piconet wireless data acquisition system controlled by handheld terminal
2.2 Bluetooth wireless data collector Each data collector converts the target physical quantity into an electrical signal through distance, pressure, temperature and other sensors, and is converted into a digital signal by the A/D converter. The data acquisition device is equipped with a Bluetooth module, and is connected to the Bluetooth module through the UART, and the data is transmitted and received by reading and writing the UART register. The collector receives commands and acquisition parameters from the palm controller through the Bluetooth link, and organizes the data at each moment into a frame structure and transmits the data to the palm control terminal.
2.3 handheld intelligent control terminal system handheld terminal instead of PC, notebook computer, industrial computer, etc. as the host computer of the field data acquisition system, is the field data acquisition and control center and data receiving center, the main tasks include: Bluetooth data collector management and sensors Calibration, data collector parameter settings, data acquisition control, wireless data reception, real-time display and data storage, playback.
Based on the Bluetooth module embedded in the handheld smart terminal, the corresponding protocol stack library function is called to complete the Bluetooth related operation. The data collector management module is responsible for device search and device security authentication; the acquisition parameter shooting and control module sends work control commands to the collector; the wireless data receiving module receives the collector data in real time and provides graphical display; the data collected in real time is stored according to the agreed format. Provide historical data playback in the specified file and as needed.
2.4 Bluetooth piconet wireless data communication

Bluetooth is a short-range, low-power wireless transmission technology that operates in the 2.4 GHz ISM band [2]. The Bluetooth communication protocol stack is divided into four layers, wherein the core layer is the BaseBand Link Management Protocol (LMP), the Logical Link Control and Adaptation Protocol (L2CAP), and the Service Discovery Protocol (SDP). Cable Replacement Protocol (RFCOMM) and Telephony Control Protocol (TCS-Binary) [2]. The Bluetooth wireless transmission of the system works on the RFCOMM protocol, and the Bluetooth device is virtualized into a serial port device by using the Serial Port Profile, and the data transmission operation is the same as the serial port operation, and the development is convenient.

3 Pocket Control System Workflow The main functions of the handheld control system include acquisition parameter settings, collector system self-test, sensor calibration, acquisition control, and data echo. The parameter setting module sets sampling parameters, save file path, engineering information and other parameters; the collector system self-test module starts the collector in a pre-acquisition manner to detect the working state of the whole system software and hardware; the sensor calibration module realizes zero drift correction of each sensor and The coefficient control is determined; the acquisition control module controls the data sampling start and end of the collector, receives and processes the data, and completes real-time display and saving of the data; the data echo module reads historical data from the file and displays it.

4 main function realization
4.1 Data frame In Bluetooth data communication, the command frame structure and data frame are as follows: The command frame consists of two command identifiers, four command parameters and two terminators. For example, IT0001ZZ, IT stands for the sampling interval command, and the 0001 convention is The sampling interval is 0.01ms, and ZZ is a uniform terminator. The data frame consists of two machine identification codes, two bits of data and a two-digit terminator, such as A1HLZZ; where H is the high bit of the hexadecimal data and L is the low bit.
Each time the transmission data is collected, the terminal collects and transmits 5 sets of data without intervals, and performs median filtering on the handheld control terminal to reduce the error.
4.2 Bluetooth device discovery and connection implementation
4.2.1 Bluetooth transmission based on Microsoft protocol stack is based on Microsoft's Bluetooth driver and is easy to develop. Communicate by using Socket.

The discovery device needs to use three Winsock APIs, namely WSALookupServiceBegin, WSALookupServiceNext and WSALookupServiceEnd. The header file is Winsock2.h and the library file is Ws2_32.lib.
The code found using the Socket device is as follows: WSALookupServiceBegin (&querySet, LUP_CONTAINERS, &hLookup); WSALookupServiceNext (hLookup, flags, &dwSize, pwsaResults) WSALookupServiceEnd(hLookup); use the Bluetooth physical address returned by pwsaResults and the GUID as the socket connection parameter, and the purpose The device is connected. code show as below:
SOCKET m_socketClient = socket (AF_BT, SOCK_STREAM,
BTHPROTO_RFCOMM); connect (m_socketClient, (SOCKADDR *)&sa, sizeof(sa)) for device connection. After the connection is successful, the following code can be used for data transmission and reception:
Recv(p->m_socketClient,buf,1024,0); send (m_socketClient, (char *)buf, nSize, 0);
4.2.2 Bluetooth transmission based on the widcomm protocol stack Use the following statement to start the query:
StartInquiry();
Void OnDeviceResponded (BD_ADDR bda, DEV_CLASS devClass, BD_NAME bdName, BOOL bConnected)
Bda is the return device address and bdName is the return device name. When the query time is over, in response to the query timer function, the service lookup thread is opened:
StartDiscovery(m_BdAddr, m_pServiceGuid) ;
Widcomm provides different connection methods for various protocols. The SPP connection code based on RFCOMM protocol is as follows:
CSppClient::CreateConnection(m_BdAddr,m_serviceName);
When the device is successfully connected, you can return to the relevant state:
Void OnClientStateChange(BD_ADDR bda, DEV_CLASS dev_class, BD_NAME name, short com_port, SPP_STATE_CODE state)
Use the com_port returned by the function to establish the serial port operation for the serial port number.
CreateFile (buff, GENERIC_READ | GENERIC_WRITE, 0, NULL, OPEN_EXISTING, 0, NULL ).
4.3 Equipment Safety Certification The wireless channel is open-ended, and any frequency-compliant receiver can capture the signal within an effective range. Therefore, the security of wireless data transmission is one of the key issues in system design. The system ensures the security of wireless data transmission in three ways.
One is to use the channel standard in the Bluetooth standard to guarantee. Bluetooth operates at 2.4 GHz and covers 79 channels (from 2.402 GHz to 2.480 GHz) separated by 1 MHz [2]. The data transmission technology uses short packets and uses frequency hopping spread spectrum technology with a frequency hopping frequency of 1600 times/second, which prevents eavesdropping and avoids interference from the physical layer. But this is not effective for eavesdropping and interference with Bluetooth devices.
The second is to use the PIN code in the Bluetooth system. If the transmission device does not have a PIN authentication, any Bluetooth device can connect to obtain the transmission of data. After setting the PIN code, only the device authenticated by the PIN code can connect and transfer data of the Bluetooth device.
The third is to implement the application layer security authentication through the authentication command. The mobile terminal initiates the device authentication command, waits for the Bluetooth data collector to return the ready status code, and the handheld terminal loads the generated authentication code A into the frame of the specific format and sends it to the collector. The authentication code B is obtained by the algorithm and returned to the transmission. If the authentication code is correct, the confirmation message is sent to each other and the device is authenticated.
4.4 Multi-threading of pseudo-synchronous and real-time synchronous transmission in polling mode The connection between the handheld terminal control system and the Bluetooth data collector can be implemented in two ways: a pseudo-synchronous mode based on the polling connection and a real-time synchronous connection transmission. The polling mode is a time-sharing connection between the handheld control terminal and each collector. The synchronous mode is that the handheld control terminal is connected with all the collectors at the same time to realize synchronous control and complete data transmission.
Both connection modes are implemented using the Windows multithreading mechanism. Open a separate thread for each data collector to complete the data processing. Both modes are controlled by an event mechanism. For the polling mode, all data acquisition processing threads are in a suspended state during initialization, and the main program sequentially triggers an event to wake up the corresponding thread for data collection and processing. When the synchronous mode works, the main program triggers all events at the same time, wakes up all processing threads for acquisition processing, and each time the data of one data collector is processed, all the threads are synchronized once, so that the data is synchronized in time.
In the case that the data to be collected changes slowly, such as monitoring temperature and humidity in the greenhouse, the sampling rate is low, and the polling mode can shorten the connection time, reduce the power consumption of the device, and prolong the working time. The synchronous mode is suitable for the case where the data changes relatively quickly and the synchronization requirements of the respective data collectors are high.

5 Test Results The handheld system can wirelessly connect and control 4 data acquisition terminals to receive and display the data of each data collector in real time. While receiving and drawing the data curve in real time, the data echo function can be executed at any time to realize curve scaling.
The handheld terminal adopts the ASUS A626. Based on the built-in Bluetooth module, the communication distance with the Bluetooth data collector is up to 10 m. If the data acquisition module Bluetooth chip is changed to Class 3, the transmission distance can reach 100 m. The system transmits a small amount of data, and the system communication rate is 9.6 kbps, which can better utilize the power saving mode of Bluetooth. When four Bluetooth data collectors are connected, and each collector transmits a time interval of 10 ms, the handheld control terminal receives no packet loss at the same time. 6 Conclusion Based on the handheld terminal, the Bluetooth wireless control system for on-site data acquisition is developed, which solves the key problems of Bluetooth piconet connection, security authentication, and synchronous processing and reception, and realizes the mobilization and portability of the host computer. It overcomes the shortcomings of wired data acquisition and control system, such as inconvenient connection and complicated installation. It can be widely used in industrial field control, medical monitoring, smart home and other places that are not suitable for wiring. The author's innovation point: using mobile terminal as the upper computer, Simultaneously control multiple lower computers through Bluetooth piconet technology and other key technologies, and process, store and display received data in real time.

references
[1] He Wei, Li Xiaoan, Duan Junjun, Design and Implementation of Bluetooth-based Mobile Data Acquisition and Processing System[J], Computer Application Research, 2006, No.11
[2] Bluetooth SIG, Bluetooth Protocol Core Version 2.0+EDR[S].2004
[3] Chen Li, Qian Dongping, Zhao Dongjie, Application of Bluetooth Technology in Groundwater Monitoring System[J], Microcomputer Information, 2007, 26
[4] Wu Jian, Design and Development of Universal Industrial Data Acquisition Platform [J], Microcomputer Information, Vol. 24, No. 3-3, 2008
[5] Wang Hong, Wireless Data Transmission Solution for Local Area Monitoring and Control System[J], Computer Applications and Software, 2008, 2

Smt Feeder, original and new or used one, in stock.

Material: Stainless steel

Feeder can be divided into tape feeder, tube feeder, tray feeder or stick feeder.

Feeder can be divided into original feeder and replacement feeder.

All the feeders shall be maintained during the use time


Yamaha SMT Feeder

Yamaha Feeder

Smt Machineyamahafeeder

Smt Feeder For Yamaha

Smt Feeder For Siemens

Smt Machine Siemens Feeder

Siemens Smt Feeder

Siemens Feeder

Samsung Smt Feeder

Smt Machine Samsung Feeder



SMT Feeder

Smt Feeder,Smt Tape Feeder,Feeder For Smt Machine,Smt Machine Feeder

Shenzhen Srisung Technology Co.,Limited , http://www.sr-smt.com