Shopping Cart 0

Your shopping cart is empty! Please select the model you want to purchase first.
Product Name Manufacturer Unit Price Quantity Total
Quantity: 0 Total: $0.0

Using MCU and DSP to realize the design of 4 stepper motor controller based on USB

Author: Release time:2020-04-23 Source: Font: Big Middle Small View count:192

The many conveniences of USB allow designers to use the bus for many applications. For example, the figure shows a USB-based 4 stepper motor controller built using off-the-shelf, inexpensive devices. This circuit uses MCU and DSP. It uses simple logic circuits and application software to control the selection of stepper motors, its clockwise / counterclockwise running direction, and three stepping amplitudes: full step, half step, and microstep.

The design is based on a USB-to-FIFO parallel interface module (IC1). This module called DLP-USB245M provides 8-bit bidirectional data bus and control signals such as WR, RD, RXF, and TXE. Use these signals to control the data flow of the PC and any external circuit using the USB protocol.

The use of this module eliminates the need to deal with the cumbersome USB interface. In addition, the module comes with driver software that can easily and quickly control module functions in a high-level language, eliminating the need to worry too much about the USB protocol.

The rest of the controller circuit includes general digital devices such as 8D flip-flops (74LS273), inverters (7416) and 3/8 decoders, and Darlington array drivers (ULN2003). The USB to FIFO module uses an external 5V power supply, and 5V is connected to pins 3, 10 and 11.

The working process is as follows: When the PC does not send data to the USB to FIFO module, the transmit buffer of IC1 is empty, and RXF keeps logic 1. This makes the RD and CLK of the D flip-flop (IC2) logic 0, so the output of IC2 remains unchanged. However, if the PC sends a byte to the USB-to-FIFO module receive buffer, RXF is pulled low, automatically indicating that at least 1 byte of data is available.

After a short delay, it sets the RD and CLK signals to 1, and the data byte output of the transmit buffer (appears in D0-D7) is latched at the output of IC2. Once the data transfer is complete and if the transmit buffer is empty, RXF returns to logic 1. This means that no more data is available. In this way, RD is set to logic 0, so that the data can be further transmitted.

The lower 4 bits of latched data (Q0-Q3 of IC2) drive the other 4 8D flip-flops (74LS273), and Q4 and Q5 control the 3/8 decoder (IC3). After the inversion, the output of the decoder (A ', B', C ', D') is used as the clock of IC4-IC7. Darlington array drivers (IC8-IC11) amplify the output of IC4-IC7 so that they can drive stepper motor coils. In this way, by writing a correct byte to IC1, the PC can select one of the four stepper motors and drive its motor coil as desired.

For example, when the PC sends data 0x0A to the USB-to-FIFO module, the stepper motor 1 is selected and its coil is powered in the mode of L1 L2 L3 L4 = 1 0 1 0. In order to make the stepper motor 1 go forward one step, the next byte sent by the PC is 0x09; if it is to be reversed, the PC sends 0x06.

Listed in the table are the byte values that control 4 stepper motors to run in full steps. With appropriate changes, users can control the motor in half and micro steps. The rate at which data bytes are written—that is, the interval at which continuous data is written—controls the speed of the stepper motor.

In addition to current amplifiers and USB-FIFO converters, discrete devices can be implemented with CPLD / FPGA. Motor control software can be developed in many ways. You can use C or VB or a graphical program like LabVIEW. If the VCP (virtual COM port) driver software (free download) provided with IC1 is used, the application will treat the USB stepper motor controller module as another COM port. However, the command to set the baud rate will be ignored and the data will be sent at the fastest speed (regardless of the applied baud rate setting). You can also use the D2XX direct drive provided by Windows, so that you can directly control various operations, such as "FIFO_write".

For basic testing of circuit functions, you can either use the provided DLPTEST application software or simply use serial programs such as Hyperterminal to continuously send the required bytes. The design shown here uses 12 and 5V external power supplies. Therefore, you must note that when the PC or USB hub (if used) is turned off, the current in the USB bus is also turned off.

Hot News