USB Stepper Motor Driver using pic microcontoller

USB Stepper Motor Driver

In this project we are going to drive a unipolar Stepper motor (5 wire) using USB interface from a PC Computer. This project is an application of the USB Interface Board PIC18F4550 which was published here in the past. You can run other stepper motors too. It is simple and easy to make, we are going to use PIC18F4550 microcontroller which has an in built USB (USB 2.0) functionality which allows it 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.

USB Stepper Motor Driver– See more at: http://www.rakeshmondal.info/USB-Stepper-Motor-Driver#sthash.J5bNPjSy.dpuf

USB Stepper Motor Driver

USB Stepper Motor Driver

In this project we are going to drive a unipolar Stepper motor (5 wire) using USB interface from a PC Computer. This project is an application of the USB Interface Board PIC18F4550 which was published here in the past. You can run other stepper motors too. It is simple and easy to make, we are going to use PIC18F4550 microcontroller which has an in built USB (USB 2.0) functionality which allows it 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.

OLD METHOD: 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.

– See more at: http://www.rakeshmondal.info/USB-Stepper-Motor-Driver#sthash.J5bNPjSy.dpuf

Stepper Motor

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.

– See more at: http://www.rakeshmondal.info/USB-Stepper-Motor-Driver#sthash.J5bNPjSy.dpuf

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).

USB Stepper Motor Driver

USB Interface Board Schematic

First start with the USB interface board, which will require a firmware to be loaded in the microcontroller and later, a windows driver, after the board is ready. I strongly recommend making this board on PCB.

You can find a detailed tutorial and specifications for making this board alone in my previous USB Interface post. The firmware used here is the same firmware as in PIC18F4550 board with no modification. The components required are pretty much clear in the schematic or you are free to explore USB Interface Board post for detailed component list.

Firmware Download

After making this board, connect it with computer USB port and it would ask you for driver.

WIN XP driver
WIN 7 Driver

The only thing here different is the C# application, which is written for running the stepper motor.

– See more at: http://www.rakeshmondal.info/USB-Stepper-Motor-Driver#sthash.J5bNPjSy.dpuf

Connect two led across RD4 and RD5, which will display the status of the USB Board. IF the Communication between the computer and USB Board is successful then both the LED’s would blink alternatively.

The pins RD0-RD3 of the microcontroller is interfaced with 4 coils of the stepper motor, and the “Common wire” is interfaced the external 9V motor supply.

– See more at: http://www.rakeshmondal.info/USB-Stepper-Motor-Driver#sthash.J5bNPjSy.dpuf

For more detail: USB Stepper Motor Driver

About The Author

Ibrar Ayyub

I am an experienced technical writer holding a Master's degree in computer science from BZU Multan, Pakistan University. With a background spanning various industries, particularly in home automation and engineering, I have honed my skills in crafting clear and concise content. Proficient in leveraging infographics and diagrams, I strive to simplify complex concepts for readers. My strength lies in thorough research and presenting information in a structured and logical format.

Follow Us:
LinkedinTwitter

Leave a Comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.