Controlling a Stepper Motor with an FPGA

6

For those of you that have been following my last few posts on state machines, you know that I’ve been working on Pmod interfaces for FPGA as part of making the claw game. The first one I delved into was using the PmodSTEP and Basys 3 to control a stepper motor.

Here is a video of it working:

As you can see in the video, if you flip switch 1 the motor turns on or off, and if you flip switch 0 it changes the direction of the motor.

Along  with writing the FPGA driver for the stepper motor I also created an Instructable so you can replicate the functionality in the video.

In the Instructable, I cover what you need.

The first step covers what you need. This includes the Basys3, PmodSTEP, stepper motor, and micro USB cable.

The first step covers what you need. This includes the Basys3, PmodSTEP, stepper motor, and micro USB cable.

Background info on stepper motors is also available.

Here I link to a video on stepper motors and describe stepper motors at the most basic level.

Here I link to a video on stepper motors and describe stepper motors at the most basic level.

But what’s the theory behind the code?

In this step I describe my state diagram and the idea behind how I coded this.

In this step I describe my state diagram and the idea behind how I coded this.

I talk about how to download, open, and program the project to the Basys3.

In a few steps I describe how to program the board.

In a few steps I describe how to program the board using Xilinx Vivado.

And lastly how to tie everything together.

The last step is to plug all of the pieces together.

The last step is to plug all of the pieces together.

To view the full Instructable, click here.

Share on FacebookTweet about this on TwitterShare on Google+Pin on PinterestShare on RedditShare on TumblrShare on LinkedInShare on StumbleUponEmail this to someone
Share.

About Author

6 Comments

  1. Miranda Hansen on

    Cool project! I was just wondering, what is the difference between a stepper and brushless motor? Are there more than just those two types of motors?

  2. Mirek Szymczyk on

    There are also AC motors. The AC motors can be divided into two main types:
    – synchronous motors
    – asynchronous (induction) motors.
    AC motors are not as easy to speed control as DC motors. Motor speed can be controlled by varying the voltage and frequency of the applied waveform (V/f control) or by wrapping a speed loop around a torque loop incorporating Field Oriented Control (FOC).

  3. I like the state machine diagram, it explains what the FPGA should do. A signal diagram showing how the coils need to be driven would make it even more understandable. And some more words about how the the actual FPGA code works would also be nice (in the code I find, apart from all the temporary files, just three Verilog modules, but do not see how they are wired together…)

    • Hi Hendrik,
      If you open the project in Vivado you will see that the top module is pmod_step_interface.v. Within that file the other two files are instantiated and the connections are shown.

      If you open those three .v files in a text editor I describe exactly the connections and where they go in comments. Comments are the text after the “//”. I did this in the code because it’s hard to explain without having the code right there.

      Give that a read and let me know what you think.

      Kaitlyn

Leave A Reply