“In various industries of industrial production and scientific and technological research, PC or industrial computer is often used to collect various data. There are many places where various data need to be collected, such as liquid level, temperature, pressure, frequency, etc. Now the commonly used acquisition method is through data acquisition boards, commonly used A/D cards and 422, 485 and other bus boards. The use of boards is not only troublesome to install and susceptible to interference from the environment in the chassis, but also because it is limited by the number of computer slots, addresses, and interrupt resources, it is impossible to connect many devices.And the emergence of Universal Serial Bus (Universal Aerial Bus, referred to as USB), a good solution
In various industries of industrial production and scientific and technological research, PC or industrial computer is often used to collect various data. There are many places where various data need to be collected, such as liquid level, temperature, pressure, frequency, etc. Now the commonly used acquisition method is through data acquisition boards, commonly used A/D cards and 422, 485 and other bus boards. The use of boards is not only troublesome to install and susceptible to interference from the environment in the chassis, but also because it is limited by the number of computer slots, addresses, and interrupt resources, it is impossible to connect many devices. The emergence of the Universal Serial Bus (Universal Aerial Bus, referred to as USB) has solved the above conflicts well, and it is easy to realize low-cost, high-reliability, and multi-point data acquisition.
1 Introduction to USB
USB is a serial communication standard developed by some major PC manufacturers, such as Microsoft and Intel, in order to solve the contradiction between the increasing number of PC peripherals and the limited motherboard slots and ports. It has appeared on Comdex since 1995. Since then, it has been widely supported by various PC manufacturers. Almost all PCs produced now are equipped with USB interfaces. Microsft’s Windows98, NT, and popular operating systems such as MacOS, Linux, and FreeBSD have all added support for USB.
1.1 Configuration of USB System
The USB system mainly consists of the host controller (Host CONTROLler), USB Hub and USB peripherals (Peripherals Node) to form the system topology, as shown in Figure 1.
1.2 The main advantages of USB
·high speed. USB has high-speed and low-speed modes. The main mode is high-speed mode with a rate of 12Mbps. In addition, in order to adapt to some devices that do not require large throughput and high real-time performance, such as mice, USB also provides low-speed mode with a rate of 1.5 Mb/s.
・Easy equipment installation and configuration. You don’t need to open the case to install USB devices, and you don’t need to shut down the computer to add or subtract installed devices. All USB devices support hot-plugging, and the system automatically configures them, completely abandoning the jumper and DIP switch settings in the past.
・Easy to expand. Up to 127 peripherals can be dialed in by using Hub expansion. Standard USB cable length is 3m (5m low speed). The peripheral distance can be up to 30m through the Hub or repeater.
・Bus-powered can be used. The USB bus provides up to 5V, 500mA.
・Flexible use. USB has four transfer modes: control transfer (CONTROL), synchronization transfer (Synchronization), interrupt transfer (interrupt), bulk transfer (bulk), to meet the needs of different devices.
2 Data acquisition equipment using USB transmission
2.1 Hardware Composition
The design of the A/D and digital I/O of the system can follow the traditional design method, select the appropriate chip according to the acquisition accuracy, speed, number of channels and other elements, and fully pay attention to the anti-interference performance when designing, especially for A/ D acquisition is even more so.
There are two ways to choose the microcontroller and the USB interface, one is to use a common microcontroller plus a dedicated USB communication chip. Among the current special-purpose chips, USBN9602 from NATIONAL semiconductor company and SL11 from ScanLogic company are more popular. The author once used Atmel’s 89c51 microcontroller and USBN9602 chip to form a system, and achieved good results. The design and debugging of this kind of scheme are troublesome, and the cost is relatively high.
Another solution is to use a microcontroller with USB communication capabilities. With the increasingly wide application of USB, chip manufacturers such as Intel, SGS-Tomson, CYPRESS, PHILIPS have introduced microcontrollers with USB communication interface. These single-chip microcomputers have strong processing capabilities, and some of them have multi-channel A/D. The circuit that constitutes the system is simple, the debugging is convenient, and the electromagnetic compatibility is good. Therefore, using a single-chip microcomputer with a USB interface is a better solution to form a USB data acquisition system. However, due to the USB interface, these chips are usually incompatible with the past development system, and a new development system needs to be purchased, and the investment is relatively high.
One of the great things about USB is that it can provide power. The power consumption in data acquisition equipment is usually not large, so it can be designed as a bus-powered device.
2.2 Software Composition
Windows98 provides a variety of drivers for USB devices, but none of them seem to be dedicated to data acquisition systems, so drivers must be compiled for specific devices. Although the system has provided a lot of standard interface functions, programming the driver is still the most difficult thing in USB development, which is usually realized by Windows DDK. At present, there are many third-party software vendors that provide a variety of generating tools, such as Compuware’s driver works, Blue Waters’ Driver Wizard, etc., which can easily generate high-quality USB drivers within minutes.
The programming of the single-chip microcomputer in the device is equally difficult, and none of the manufacturers provide tools for automatic generation. Compiling a stable and perfect MCU program is directly related to the performance of the equipment and must be given full attention.
The above two programs are what developers care about, and users don’t care much. What users care about is how to operate the device efficiently through the mouse, and how to process and analyze the large amount of data collected, so high-quality user software is also necessary. The user software must have a friendly interface, powerful data analysis and processing capabilities, and an interface for redevelopment for users.
3. Realize USB long-distance collection data transmission
The transmission distance is an obstacle that limits the application of USB in the industrial field. Even if a relay or hub is added, the USB transmission distance is usually not more than tens of meters, which is obviously too short for the industrial field.
At present, there are a large number of acquisition devices that use RS-485 to transmit data in the industrial field. RS-485 has its inherent advantages, that is, its transmission distance can reach more than 1200 meters, and multiple devices can be connected. The disadvantage is that the transmission speed is slow, the bus method is used, the devices interact with each other, the reliability is poor, the support of the board is required, the cost is high, and the installation is troublesome. These shortcomings of RS-485 can just be made up by USB, and the limitation of USB transmission distance is just the advantage of RS-485. If the two can be combined with complementary advantages, a fast, reliable and low-cost long-distance data acquisition system can be produced.
The basic idea of this system is: in the collection site, after the analog quantity collected by the sensor is digitized, the RS-485 protocol is used to upload the data. There is a bidirectional RS-485-USB conversion interface on the PC side, and the data of 485 is received by this interface and transmitted to the PC for analysis and processing through the USB interface. The process of sending data from the host to the device is just the opposite: the host sends data to the USB port, and the data is converted to the 485 protocol through the 485-USB conversion port and sent to the remote end, as shown in Figure 3.
In the scheme of Figure 3, the key device is the 485-USB converter. Such devices are already on the market at home and abroad. The author also used the USBN9602+89c51+MAX485 of NATIONAL SEMICONDUCTOR Company to realize this function, and achieved good results in practical application.
It should be noted that in the 485-USB converter, the function of the 485 interface is exactly the same as the interface performance (speed, drive capability, etc.) of the 485 card usually used, that is to say, a 485-USB converter can completely replace A 485 card is much lower in cost, and has the advantages of easy installation, not limited by the number of slots, and no external power supply, providing a convenient, cheap and effective way for industrial and scientific research data collection.
4 Realization of a comprehensive data collection and transmission system
Today’s data acquisition systems usually have two types: distributed and bus. Using USB interface is easy to realize distributed, and 485 interface is easy to realize bus type. If the two are combined, a comprehensive data acquisition system can be realized. The realization method is: still use the USB-485 converter mentioned above to realize the conversion of the two protocols. Since the data transfer rate of USB is much higher than that of 485, multiple devices can still be attached to each 485 bus, forming the structure shown in Figure 4, where D represents a device.
This transmission system is suitable for some occasions where there are multiple relatively dispersed work points in space, and each work point has multiple data to be collected and transmitted. Each granary needs to collect a series of data such as temperature, humidity, and carbon dioxide concentration. In this case, each granary can be assigned a 485 bus, and the acquisition equipment of temperature, humidity, carbon dioxide concentration, etc. is connected to the 485 bus, and then each granary is transmitted to the monitoring center through the 485 bus, and converted For USB protocol transmission to PC, the transmission data of multiple granaries can be connected to a PC through the Hub after being converted to USB protocol. Since the real-time requirements of various data monitoring of the granary are not very high, this method can complete all the monitoring work of a large granary with one PC.
The application of USB devices is currently in a high-speed development stage in foreign countries, and the application in China has already started. We have achieved certain results in the fields of USB data acquisition and USB industrial control, and have been successfully applied in reality.
The upcoming USB2.0 protocol has a data transfer rate of up to 480Mbps. Such a high transfer rate can be used in places where the transfer rate of 1.0 cannot be met, such as industrial equipment control with high real-time requirements, and real-time transmission of dynamic images. With the progress of the times and the development of technology, USB is bound to get deeper applications in a wider field.
The Links: QM100DY-H EPCS16SI8N