Design of USB-Based Motion Control Platform and acquisition card:
1 Introduction
Base
Stepping Motor or digital servo motor's upper control unit in various bus of PC, bus form is diverse, high-speed bus can adopt ISA, PCI, USB and other bus technology. Generally
ISA bus and PCI bus. As the computer motherboard is updated, the ISA slots use fewer and fewer PCI bus motion control cards. However, PCI bus has some defects:
It is impossible to mount many devices due to the number of computer slots and resource interruptions. USB bus has the advantages of easy installation, high bandwidth, and easy expansion.
The standard has a transmission rate of up to 480 Mb/s, and has gradually become the mainstream of computer interfaces. In addition, the Universal Serial Bus USB provides great convenience for multi-point data collection.
Traditional data collection methods are more effective, more economical, and more data points are collected. USB data bus has been widely used in various computers and has become a standard computer device.
2. System Architecture
Base
The Motion Control Platform and Acquisition Card System of the USB bus are divided by function, which mainly includes three aspects: USB interface design, communication between PC and single chip microcomputer through the USB interface; Motor Drive, using
Motor driver chip UC3717A; data collection problems, data collection is designed to monitor external conditions, stepper motor operating environment such as temperature, and capture the motion track, etc., it is used by sensor Components
The sensor monitors the outside world and transmits the collected information to the single-chip microcomputer for analysis and display. The system architecture 1 is shown in.
Figure 1 System Architecture
System
The general operation process is a process of data collection and control of stepper motor operation. Each step requires the support of different groups. First, the temperature and pressure parameters are converted into analog signals by the sensor.
The A/D converter converts the digital signal that can be recognized by the single-chip microcomputer. After the single-chip microcomputer processes the digital signal, it can be sent to the LED display or sent to the USB interface chip. Then, the USB interface chip is required on the host.
The received data is always sent to the host for processing and display. The processing result is controlled by the USB bus and MCU.
3 system hardware circuit design
The hardware circuit structure of the USB data collection system mainly includes the following parts: USB communication circuit, data collection circuit, and stepper motor drive. All the functions of the module are implemented on the hardware platform with the core of ATmega16.
Design of USB communication circuit 3.1
USB
The function of the communication circuit is to realize the communication between the device and the host of the data collection system. This function is mainly implemented by the core microcontroller ATmega16 and the USB controller PDIUSBD12.
PDIUSBD12 is a chip compatible with the USB protocol. It serves as a bridge between devices and hosts in the USB communication circuit. Microcontroller ATmegal6 and USB controller
PDIUSBD12 communicates with each other through an eight-bit parallel bus. The eight-bit parallel bus must connect eight I/O ports at the ATmegal6 end. PDIUSBD12-bit integration of clock Multiplication
PLL, the crystal oscillator circuit uses a 6 MHz crystal oscillator and two capacitors from 2pF to 68pF. PDIUSBD12 signal output end D +/D-each string must be connected to an 18 euro matching resistance. Communication circuit
2.
Figure 2 USB communication circuit
3.2 Design of Data Collection Circuit
The function of the data collection circuit is to convert the field temperature, pressure, stress and other data into A suitable analog signal, and then transmit the analog signal to the/D conversion circuit. This module consists of the temperature acquisition module and the pressure acquisition module.
Wen
Degree Data Acquisition uses DS18B20, which is a digital temperature sensor produced by Dallas, the world's first temperature sensor that supports the "first-line bus" interface, which is used inside the Board
(ON-B0ARD) patented technology. All sensing elements and conversion circuits are integrated into an integrated circuit, such as a transistor. The measurement temperature range is-55 °C ~ + 125 °C. The field temperature is directly
Line bus digital transmission, greatly improving the system's anti-interference. The new-generation DS18B20 is smaller, more economical, and more flexible. Send the collected temperature to the ATmegal6 internal sampling and holding
Circuit, then the amplification, A/D conversion, and then the firmware program conversion to get the measurement temperature.
In this system, the measuring pressure device is a pressure transmitter produced by Guangzhou sennashi instrument Co., Ltd. Its range is 0.0 lMPa, and the output signal is 4 ~ 20mA of the current. When the pressure changes, the output current also changes.
A precise resistance is connected at the output end of the signal, and the voltage at both ends of the resistance is sampled and converted. After conversion by the firmware program, the measurement pressure can be obtained.
3.3 stepper motor drive circuit design
Step
An incoming motor is an execution mechanism that converts an electrical pulse into an angle displacement. When the stepper driver receives a pulse signal, it will drive the stepper motor to rotate a fixed angle (known as the "step angle") in the set direction.
The rotation is a step-by-step operation from a fixed angle. The angle displacement of a stepper motor is strictly proportional to the number of input pulses. It synchronizes time with the input pulse. You can control the number of pulses to control the angle displacement,
In order to achieve accurate positioning, and control the motor rotation speed and acceleration by controlling the pulse frequency, so as to achieve the purpose of speed control.
The motor driving circuit is mainly composed of the driving chip. The motor driving chip used in this system is UC3717A. The UC3717A chip is very easy to use. It uses three input pins (Phase,
I1 and I0) respectively figure single-chip microcomputer pin connection to receive input parameters, in two output pins (Aout and Bout) and motor connection output corresponding control signal. Since UC3717A contains
H Bridge, so the motor drive circuit has two pieces of UC3717A corresponding parts connected to form a complete drive circuit. Such as 3 micro-drive motor drive circuit diagram.
Figure 3 drive circuit of partially driven Motor
3.4 LED Display Circuit Design
4. The display of the system is a static display. The character of 74LS164 string entry and output is applied, the display code is sent to the 74LS164 serial port through the microcontroller to implement stable static display. The 74LS164 and the digital tube are connected to a 1 K resistor to limit the current.
Figure 4 display part of circuit design
4. System Software Design
USB
The data collection system is a multi-task system with complicated program structure. To improve the development rate, enhance the system stability, and reduce the development and maintenance costs, an embedded operating system is required as the system
Running platform. As a free embedded real-time operating system with open source code, μC/OS-Ⅱ has good stability and high reliability, in addition, μC/OS-Ⅱ is also portable, solidified, and cropped.
Point, which is very suitable for the development platform of the USB data collection system.
The software of the USB data collection system consists of three parts: USB device firmware program, USB device driver on the host PC, and client application on the host. The composition of the system software and the relationship between each part 5 is shown.
Figure 5 composition of system software
Set
The firmware preparation program can be divided into USB communication program, A/D Conversion Program and LED display program on the single chip microcomputer, and the control program of the Single Chip Microcomputer on the stepping motor driver chip, the USB communication program is an integer.
Firmware program. Its function is to enable USB device enumeration and data transmission. USB device enumeration is a process in which the host and the device are automatically configured after the USB device is plugged in.
Then, the USB interface can communicate with the host.
The device driver is the link between the device and the Host application. It provides the application access interface (API) Up, and implements
Access and management of specific devices. The driver is closely related to the hardware of the device and the upper-layer user program, and serves as an intermediary for Information Conversion and transmission between the USB system. When developing a USB device, the device
The design of the driver is a very important step, which directly affects the performance of the entire device system. This system uses Driverworks to develop drivers for wdm usb devices.
Ying
The main function of a program is to find a device in the device driver, exchange data with the device, and process and display the data sent by the device. Applications and drivers communicate through access to application interfaces.
(API) function implementation, so application development must be performed on a platform that can access API functions. Microsoft Visual Studio
. NET is a powerful programming tool that supports API functions. NET is developed for the platform. Its functions mainly include searching USB devices and USB devices.
Exchange data and dynamically display data curves.
5. Summary
The innovation of this article is to change the traditional communication port using microcomputer PCI, ISA, serial parallel port, and switching to high-speed
As a communication port, the USB interface facilitates the speed improvement and convenient use and carrying, providing room for future improvement and expansion. Secondly, the data collection function is integrated into the control card, it is also a feature of this Article
Point: In the process of motor movement, temperature data must be collected to monitor the operating environment of the driver. At the same time, data related to the motion track must be collected as the basis for interpolation and adjustment, and output the motor motion command
Combined with the timely return of the motor track status, a control platform and data collection module are formed. The data collection process is a real-time process that is synchronized during the motor movement; finally, the system is open.
Real-Time System. This project has created an economic benefit of RMB more than 0.6 million over the past six months.