“The many conveniences of USB enable designers to use the bus for many applications. For example, the picture shows a USB-based 4-step motor controller built with off-the-shelf cheap devices. This circuit uses MCU and DSP. It uses simple logic circuits and application software to control the selection of the stepping motor, its clockwise/counterclockwise running direction and three stepping amplitudes: full step, half step and micro step.
The many conveniences of USB enable designers to use the bus for many applications. For example, the picture shows a USB-based 4-step motor controller built with off-the-shelf cheap devices. This circuit uses MCU and DSP. It uses simple logic circuits and application software to control the selection of the stepping motor, its clockwise/counterclockwise running direction and three stepping amplitudes: full step, half step and micro step.
The design is based on a USB to FIFO parallel interface module (IC1). This module named DLP-USB245M provides an 8-bit bidirectional data bus and control signals such as WR, RD, RXF and TXE. These signals are used 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 tedious USB interface work. In addition, the module has driver software that can easily and quickly control the module’s functions through a high-level language, so there is no need to worry too much about the USB protocol.
The rest of the controller circuit includes general-purpose 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.
Its working process is as follows: When the PC does not send data to the USB to FIFO module, the sending 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 receiving 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 (appearing 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 further data can be transmitted.
The lower 4 bits of the latched data (Q0-Q3 of IC2) drive the other 4 8D flip-flops (74LS273), while Q4 and Q5 control the 3/8 decoder (IC3). After the reverse, 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 4 stepper motors and drive its motor coils as desired.
For example, when the PC sends data 0x0A to the USB to FIFO module, 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 forward one step, the next byte sent by the PC is 0x09; if you want to reverse it, the PC sends 0x06.
Listed in the table are the byte values for controlling 4 stepping motors to run in full steps. With appropriate changes, the user can control the motor in half-step and micro-step. The rate at which data bytes are written—that is, the interval between consecutive data writes—controls the speed of the stepper motor.
In addition to current amplifiers and USB-FIFO converters, discrete devices can be implemented using CPLD/FPGA. Motor control software can be developed in a variety of ways. You can use C or VB or similar graphics programs such as LabVIEW. If the VCP (virtual COM port) driver software (free download) provided with IC1 is used, the application program will regard 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 as fast as possible (regardless of the applied baud rate setting). You can also use the D2XX direct driver provided by Windows, so that you can directly control various operations, such as “FIFO_write”.
In order to perform basic tests on circuit functions, you can either use the provided DLPTEST application software or simply use serial port programs such as Hyperterminal to continuously send the required bytes. The design shown here uses 12 and 5V external power supplies. Therefore, you must be aware that when the PC or USB hub (if used) is turned off, the current in the USB bus is also turned off.