Using the PmodJSTK to control a Stepper Motor with the Basys 3

A few days ago I wrote a post about how to control a stepper motor with an FPGA, using the switches to control the direction and enable signal of the motor.

As excited as I was that I could now control a stepper motor with the Basys 3, controlling it with just switches wasn’t very realistic. Especially for the claw game, which is after all the end goal. Luckily I found a PmodJSTK in my desk. The PmodJSTK is an adorable little joystick module that also has LEDs and buttons.

The PmodJSTK.
The PmodJSTK. Adorable.

So I set out to get the PmodJSTK controlling two stepper motors, one for the X direction and one for the Y direction. I lucked out again when I discovered that someone long ago had written an FPGA module for the PmodJSTK. Unfortunately, it was written for the Nexys 3 using Xilinx ISE.

The code example section of the resource center for the PmodJSTK.
The code example section of the resource center for the PmodJSTK.

However, I was easily able to change it over to using the Basys 3 with Xilinx Vivado. By change the UCF file to an XDC file. If you’d like to learn more about that process, check out this previous blog post. Sometimes depending on how the module was written it doesn’t always directly transfer over, but this one did!

The blog post about converting from XDC to UCF file.
The blog post about converting from XDC to UCF file.

Now all I needed to do was disable the functionality of the LEDs and buttons on the PmodJSTK since I was only using the JSTK part. I also had to create a decoder to decode the information sent from the PmodJSTK into right, left, up and down signals.

You can see the full code and explanation of what I did in my Instructable, Using the PmodJSTK to Control Stepper Motors on the Basys 3.

The Instructable on how to make the PmodJSTK control stepper motors.
The Instructable on how to make the PmodJSTK control stepper motors.
Be the 1st to vote.

2 Comments on “Using the PmodJSTK to control a Stepper Motor with the Basys 3”

  1. I didn’t know about the reference section of digilent website. There is a lot of useful stuff over there!
    Any plans to add the files converted for Vivado over there?

    1. Hi Marco,
      Reference.Digilentinc.com is where all of the most up to date projects, examples and documentation are. I always check there first.

      There is no active plan to convert that I know of right now. The existing projects usually get converted as people use them in Vivado.

      If you have any projects up that are designed for ISE you can follow this blog post to convert them. Most projects will transfer over by following these steps.

      https://blog.digilentinc.com/index.php/converting-from-ucf-to-xdc-file/

      Kaitlyn

Leave a Reply

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