Data acquisition and control system design based on USB interface

Publisher:敬亭山人Latest update time:2009-12-23 Source: 中国国防科技网 Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

1 System Structure

The block diagram of the data acquisition and control system composed of ADuC845 single-chip data acquisition device and CH341 USB interface device is shown in Figure 1. ADuC845 completes analog data acquisition, switch input and output, control voltage and PWM control signal output, and CH341USB interface device completes data transmission between PC and ADuC845.



The data in ADuC845 is packaged and transmitted to the PC via the USB device. The data processing program of the PC is used to complete the data processing and analysis, and it is displayed on the designed system interface. At the same time, the control command is transmitted to ADuC845 through the USB interface to realize the control of the peripheral device.

2 USB communication interface circuit

The USB communication interface circuit uses the CH341 device, and Figure 2 is its circuit. In Figure 2, P3 is the USB port, and the USB bus includes a pair of 5 V power lines and a pair of data signal lines. Usually the +5 V power line is red, the ground line is black, the D+ signal line is green, and the D- signal line is white. The power current provided by the USB bus can reach up to 500 mA. CH341 and the low-power ADuC845 directly use the 5 V power provided by the USB bus.



The RXD pin and TXD pin of CH341 are connected to the RxD pin and TxD pin of ADuC845 respectively, because of data transmission. Crystal Y2, capacitors C13 and C14 are used for clock oscillation circuit. The frequency of Y2 is 12 MHz, C13 and C14 are monolithic or high-frequency ceramic capacitors with a capacity of 15 pF. VD1 is the working status indicator, and R3 is its current limiting resistor. R4 is a 0 Ω resistor (magnetic bead), which can achieve filtering and protection. C12 and C11 are monolithic or high-frequency ceramic capacitors. The capacity of C12 is 1 000 pF ~ 0.01 μF, which is used for decoupling the internal power supply node of CH341, and the capacity of C11 is 0.1 μF, which is used for decoupling the external power supply.

When designing the printed circuit board PCB, it is important to note that: the decoupling capacitors C11 and C12 should be placed as close to CH341 as possible; the D+ and D- signal lines should be laid parallel to each other, and ground wires or copper should be provided on both sides as much as possible to reduce external signal interference; the length of the signal lines related to the XI and XO pins should be shortened as much as possible. In order to reduce the interference of the high-frequency clock to the outside world, ground wires or copper can be placed around the relevant components. [page]

3 Data acquisition and control circuit design

The data acquisition and control circuit is based on ADuC845. The circuit is shown in Figure 3. The circuit provides 10 24-bit A/D converter input channels, and the input end is connected with a 1 kΩ resistor and a 0.1 μF filter capacitor. The 12-bit voltage output D/A converter is output after being buffered by the operational amplifier OP284; it can also provide dual 16-bit PWM output and 8-way switch input/output. The RxD pin and TxD pin of ADuC845 are connected to the RXD pin and TXD pin of CH341 respectively to realize data transmission. The crystal oscillator circuit uses 32.768 kHz crystal oscillator Y1, and capacitors C18 and C19 are adjusted and determined according to system needs. The power supply end of the digital circuit is connected to the ground with 0.1μF decoupling capacitors. The power supply end of the analog circuit is connected to the ground with 0.1μF and 10μF decoupling capacitors. The decoupling capacitor should be placed as close to the power supply as possible.



4 System Main Program Design

4.1 USB Communication Interface Circuit Driver

The USB port of the USB communication interface circuit is connected to the PC. For the PC, the data acquisition and control system is a functional component (or lower computer) with a USB interface. The PC directly transmits data to the lower computer through the virtual serial port device. The USB communication interface circuit driver code is as follows:

[CH341S98.9X. AddReg]; // Used to add the registry part

[page]

4.2 A/D sampling program

The following is part of the code of the A/D sampling program:



5 Conclusion

The data acquisition and control system uses ADuC845 as the core device, with high sampling resolution (20 bits), small system temperature drift (10 nV/℃), stable operation, and strong anti-interference ability; the USB interface is used as the communication interface of the system, which is flexible to install, fast in transmission speed, high in reliability, and easy to expand; the PC is used to complete data analysis and data processing. Therefore, the system design is suitable for data acquisition and control fields such as medical equipment and industrial control systems.

Reference address:Data acquisition and control system design based on USB interface

Previous article:Design of aging test system based on CAN bus
Next article:Design and research of cable continuity tester based on PC104

Latest Test Measurement 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号