Stepper Motor Controller
I had a project for my Digital Electronics Lab where we were tasked to control a stepper motor using an Altera UP2 boards. To control the speed and direction of the stepper motor we had to use the on-board DIP switches. Here is what we came up with:
After completing the project I realized how simple the solution was. During the creation of the block code, though, a lot was learned. I did work with a team of 2 other students on this project, but I did most of the schematic design. At first pretty much everyone on the class was stumped. Some of us tried to use VHDL instead of a graphical approach, which was really frustrating since we only had 1 or 2 lectures on CPLDs/FPGAs. I finally realized we needed to utilize shift registers to be able to cycle the coils on the motor in the proper order.
We took a clock signal that was already on the board, and using the counters we derived 2 different frequencies, “Fast” and “Slow”. Feeding both of the clock signals into the input on the mux gave us control over which frequency was sent out to the shift registers. For controlling the direction it is just a matter of shifting the bit to the left or to the right (and again going through a mux to allow selection of the output). We also decided to have to show characters on the built-in 7-segment displays, which reflected the speed and direction.
Here is a short video I shot:
The ICs seen on the breadboard are darlington transistor pairs for driving the stepper motor coils.
I was going to post the actual design file but unfortunately WordPress sees that as a security risk… So if you want to check it out shoot me an email and I’ll be happy to dig it out and send it over (although it would probably just be faster to recreate the schematic from scratch!).