USB Stepper Motor Driver
In this project we are going to drive a single unipolar Stepper motor M35SP-8 (5 wire) using USB interface from a PC Computer. This project is an application of the USB Interface circuit PIC18F4550 which was published here in the past. You can run other stepper motors too.It is quiet easy to make, we are going to use PIC18F4550 microcontroller which has an in built USB (USB 2.0) functionality which allows to connect with any computer with a USB port and Windows OS. We will try to provide as much as details we can for achieving this project.
The legacy (OLD) method was to use a parallel port (DB 9), which were far more easy with simple port control commands, which were good enough to glow few led directly connected to COMM pins of a parallel port, and with a simple loop written in VB it was easy to generate a pulse of blinking led for a stepper motor.
USB: However laptops and portable computers don’t come with those big D9 (parallel or printer) port anymore, as the USB ports – due to its excellent characteristics and small size has taken its replacement for almost for any external device. USB interface for this project is going to be little complex then the old parallel port method.
The microcontroller which will serve as the communication channel between the Computer and Stepper motor, the PIC18F4550 microcontroller, can work in two USB speed 12Mbps(full speed) and 1.2Mbps(low speed).
For our project we will run this microcontroller board in Full speed (12Mpbs). The project can be also achieved with a PIC18F2550 with little modification in the firmware, but since 18F4550 has more number of pins on a standard Dual Inline package (40 pins, 20 pins on each side), so we will go with that. PIC18F4550 is far more cheap and inexpensive then an Arduino board. In fact the stepper motor here costs more than the entire board and components used.
The stepper motor used here is a 5 wire Stepper motor (M35SP-8) which is going to be operated by an application written in C#, (visual studio) which will communicate with the microcontroller board via USB, and microcontroller will drive the Motor connected with it according to the output directed by the software written in C#. The entire project and its necessary project files with schematics can be found at the end of this page.
The M35SP-8 stepper motor has a step angle of 7.5 degree, with one Common wire and 4 control wires connected to each coils. Hence we need only 4 control links for generating the pulse which will drive this stepper motor. For information on the specification of MS35SP-8 refer the respective datasheet.
Stepper Motor Wiring
The Figure below shows the labeling of the Stepper motor used for this project. If you wish to use any other stepper motor then you have to follow wiring labels of that respective stepper motor.
Running other Stepper motors
The USB interface board we are using here has 6 control pins, it means you can control 6 LEDs (example) with this board. Out of which, only 4 pins are required to control our M35SP-8 Stepper motor, remaining 2 will be unused.
However you can run more kinds of stepper motor too. Since we have 6 control lines available hence the project can be easily modified to run other stepper motors too. Any stepper motor has one common ground wire and remaining are control wires, So technically with this USB interface board you can run a 5 wire, 6 wire and 7 wire stepper motor easily (6 control and one Common power).