Design of motion control platform and acquisition card based on USB

Publisher:心灵舞者Latest update time:2011-06-23 Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

1 Introduction

The upper control unit of the stepper motor or digital servo motor based on various buses of the PC has various bus forms, and the high-speed bus can adopt ISA, PCI, USB and other bus technologies. The ISA bus and PCI bus are usually used. Due to the upgrading of computer motherboards, the ISA slot is used less and less, and the motion control card of the PCI bus has become the mainstream. However, the PCI bus has some defects: it is easily affected by the environment in the chassis, and it is impossible to connect many devices due to the address and interrupt resource restrictions of the number of computer slots. The USB bus has the advantages of easy installation, high bandwidth, and easy expansion. Among them, the USB2.0 standard has a transmission rate of up to 480MB/s, and has gradually become the mainstream of computer interfaces. Moreover, the universal serial bus USB provides great convenience for multi-point data collection. Using USB can achieve more effective, economical and more point data collection than traditional methods. The USB data bus has been popularized on various computers and has become a standard device for computers.

2 System Architecture

The motion control platform and acquisition card system based on USB bus mainly include three aspects according to the functional division: USB interface design, which realizes the communication between PC and single-chip microcomputer through USB interface; motor drive, using motor drive chip UC3717 A; data acquisition problem, the purpose of data acquisition is to monitor the external situation, the working environment of the stepper motor such as temperature, and capture the motion trajectory, etc. It uses sensors to monitor the outside world through sensing components, and transmits the collected information to the single-chip microcomputer after analog-to-digital conversion, and the single-chip microcomputer sends it to the microcomputer for analysis and display. The system architecture is shown in Figure 1.

Figure 1 System architecture

The working process of the system is a process of data collection and control of the operation of the stepper motor, and each step requires the support of different groups. First, the temperature and pressure parameters are converted into analog signals by the sensor, and the analog signals are converted into digital signals that can be recognized by the microcontroller through A/D conversion; then the microcontroller processes the digital signals and sends them to the LED display or to the USB interface chip; then the USB interface chip sends the received data to the host through the USB bus for processing and display when the host needs it; finally, the processing results are used to control the operation of the stepper motor through the USB bus and the microcontroller.

3. Hardware circuit design of the system

The hardware circuit structure of the USB data acquisition system mainly includes the following parts: USB communication circuit part, data acquisition circuit part, stepper motor driver. The functions of the module are all realized on the hardware platform with ATmega16 as the core.

3.1 Design of USB communication circuit

The function of the USB communication circuit is to realize the communication between the device side and the host side of the data acquisition system. This function is mainly realized by the core microcontroller ATmega16 and the USB control device PDIUSBD12. Among them, PDIUSBD12 is a chip that complies with the USB1.1 protocol and plays the role of a bridge between the device and the host in the USB communication circuit. The microcontroller ATmegal6 and the USB controller PDIUSBD12 communicate through an 8-bit parallel bus, and the 8-bit parallel bus needs to connect 8 I/O ports on the ATmegal6 end. The PDIUSBD12 chip integrates a clock multiplication PLL, and the crystal oscillator circuit uses a 6MHZ crystal oscillator and two 2pF to 68pF capacitors. A matching resistor of 18 ohms should be connected in series to the signal output terminals D+/D- of PDIUSBD12. The communication circuit is shown in Figure 2.


Figure 2 USB communication circuit

3.2 Design of data acquisition circuit

The function of the data acquisition circuit is to convert the temperature, pressure, stress and other data on site into appropriate analog signals, and then transmit the analog signals to the A/D conversion circuit. This module includes two parts: the temperature acquisition module and the pressure acquisition module.

The temperature data acquisition uses DS18B20, which is a digital temperature sensor produced by Dallas, USA. It is the world's first temperature sensor that supports the "one-line bus" interface. The patented on-board (ON-BOARD) technology is used inside it. All sensor elements and conversion circuits are integrated in an integrated circuit shaped like a triode. The measurement temperature range is -55°C to +125°C. The field temperature is directly transmitted in a digital way of "one-line bus", which greatly improves the anti-interference ability of the system. The new generation of DS18B20 is smaller, more economical and more flexible. The collected temperature is sent to the sampling and holding circuit inside ATmegal6, and then amplified and A/D converted, and then converted by the firmware program to get the measured temperature.

In this system, the device used to measure pressure is a pressure transmitter produced by Guangzhou Senax Instrument Co., Ltd. Its range is 0.0lMPa and the output signal is 4~20mA current. When the pressure changes, the output current also changes accordingly.

A precision resistor is connected to the signal output end, and the voltage across the resistor is sampled and converted. The measured pressure can be obtained after conversion by the firmware program.

3.3 Stepper motor drive circuit design

A stepper motor is an actuator that converts electrical pulses into angular displacement. When the stepper driver receives a pulse signal, it drives the stepper motor to rotate a fixed angle (called the "step angle") in the set direction. Its rotation is performed step by step at a fixed angle. The angular displacement of the stepper motor is strictly proportional to the number of input pulses and is synchronized with the input pulses in time. The angular displacement can be controlled by controlling the number of pulses to achieve accurate positioning; at the same time, the speed and acceleration of the motor can be controlled by controlling the pulse frequency to achieve speed regulation.

The motor drive circuit is mainly composed of a drive chip. The motor drive chip used in this system is UC3717 A. The UC3717A chip is very simple to use. It receives input parameters through three input pins (Phase, I1 and I0) connected to the microcontroller pins, and outputs corresponding control signals through two output pins (Aout and Bout) connected to the motor. Since UC3717A contains an H bridge, the motor drive circuit has two UC3717A chips connected to form a complete drive circuit. As shown in the 3 micro-partial drive motor drive circuit diagram.

Figure 3 Part of the drive motor drive circuit

3.4 LED display circuit design

As shown in Figure 4, the display of this system is a static display. By using the serial input and parallel output characteristics of 74LS164, the display code is sent to 74LS164 through the serial port of the microcontroller for latching to achieve a stable static display. A 1K resistor is connected in series between 74LS164 and the digital tube to limit the current and play a protective role.


Figure 4 shows part of the circuit design

4. System software design

The USB data acquisition system is a multi-tasking system, and the program structure is relatively complex. In order to improve the development rate, enhance the stability of the system, and reduce the development and maintenance costs, an embedded operating system is needed as a platform for system development and operation. μC/OS-Ⅱ is a free embedded real-time operating system with open source code. It has good stability and high reliability. In addition, μC/OS-Ⅱ has the characteristics of good portability, curability, and tailorability, making it very suitable as a development platform for USB data acquisition systems.

The software of the USB data acquisition system consists of three parts: the USB device firmware program, the USB device driver on the host PC, and the client application on the host. The composition of the system software and the relationship between the parts are shown in Figure 5.

Figure 5 System software components

The device firmware program can be divided into USB communication program, A/D conversion program and LED display program on the microcontroller, and microcontroller control program for stepper motor driver chip. The USB communication program is the main part of the entire firmware program, and its function is to realize USB device enumeration and data transmission. USB device enumeration is the process of exchanging information and automatically configuring the host and device after the USB device is plugged in. After the enumeration is successful, 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) upward and implements the access and management functions of specific devices downward. The driver is closely related to the device hardware and the upper user program, and plays an intermediary role in information conversion and transmission in the middle of the USB system. When developing USB devices, the design of the device driver is a very important link, which directly affects the performance of the entire device system. This system uses Driverworks to develop WDM USB device drivers

The main functions of the application are to find the device in the device driver, exchange data with the device, and process and display the data sent by the device. The communication between the application and the driver is achieved by accessing the application program interface (API) function, so the application development must be carried out on a platform that can access the API function. Visual Studio .NET provided by Microsoft is a powerful programming tool that supports API functions. The host application of this design is developed based on the .NET platform. Its main functions include finding USB devices, exchanging data with USB devices, and dynamically displaying data curves.

5 Conclusion

The innovation of this paper is to change the traditional use of microcomputer PCI, ISA, serial and parallel ports as communication ports, and use high-speed USB interface as communication port, which is conducive to speed improvement, convenient use and portability, and provides room for future improvement and expansion; secondly, the data acquisition function is integrated into the control card, which is also a feature of this paper: during the motor movement, in order to monitor the working environment of the driver, temperature data needs to be collected; at the same time, the relevant data of the motion trajectory is collected as the basis for interpolation and adjustment, and the output motor motion command is combined with the timely return of the motor trajectory status, forming a module integrating control platform and data acquisition. The data acquisition process is a real-time process, which is completed synchronously during the motor movement; finally, this system is an open real-time system. Since the implementation of this project for half a year, it has created economic benefits of more than 600,000 yuan.

Reference address:Design of motion control platform and acquisition card based on USB

Previous article:Development of Internet-based Intelligent Controller for Industrial Air Conditioners
Next article:Fuzzy Control Constant Pressure Water Supply System Based on Virtual Instrument

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号