loading

In the third step in my journey to recreate the claw game with the Basys3, I've connected two PmodSTEPs, two stepper motors, and the PmodJSTK to the Basys3 so that I can control each of the servos with the PmodJSTK.

To do this I connected the code from How to use the PmodJSTK with the Basys 3, and How to control a stepper motor with an FPGA, with a decoder to turn the data from the PmodJSTK into direction signals.

Step 1: Gather Your Materials

What You'll need:

- Have read and or completed my PmodJSTK and PmodSTEP tutorials

- Xilinx Vivado installed and licensed

- Basys 3

- 2 PmodSTEP

- PmodJSTK

- 2 Stepper Motors

- USB A to B micro

- 2 12 pin Pmod Cables

Step 2: Structure of the Code

To connect the two pieces of code I added a decoder, and used one PmodJSTK interface and two PmodSTEP drivers. You can see this structure in the diagram above. I modified the PmodJSTK interface so that it only receives data from the joystick and doesn't send data to the leds.

The decoder takes the data from the joystick and converts it into a direction signal that tells if the stepper motors should go left, right, or still. The stepper motors shouldn't move when the joystick is in the center.

Step 3: Download and Open the Vivado Project

Download the zip file attached to this step.

Unzip the file and open the vivado project. You can do this either by double clicking on the file or opening vivado and selecting open project. Note: I used Vivado 2015.4 to create this project. If you have a different version installed I would suggest creating a new project in your version, then adding each of the source files. You would need to add, jstksteptop.v, PmodJSTK_Demo.v, PmodJSTK.v, ssdCtrl.v, ClkDiv_5Hz.v, jstk_data_decoder.v, pmod_step_interface.v, clock_div.v, pmod_step_driver.v, and jstk_servo_constraints.xdc.

Step 4: Generate the Bit File and Program Your Board

Once the file is open you can generate the bit file and program the board.

To generate the bit file double click generate bitstream. To program the board open the hardware manager, open target and program the board.

Step 5: Plug All the Pieces Together

Plug the PmodJSTK into the top level of Pmod port JA, the PmodSTEPS into Pmod ports JB and JC, and plug the servos into the PmodSTEPs.

To enable the servos flip switch 1 and 0 on. Now you can move the joystick around to control the motion of the stepper motors.

To continue hearing about my progress on the Claw game and more cool projects stay tuned to the Digilent Blog.

About This Instructable

2,039views

17favorites

License:

More by Commanderfranz:Decoding VGA Signals With a Portable Logic Analyzer How to Use the Protocol Analyzer on the Discovery to Test Sensors Analog Discovery 2 Quick Start 
Add instructable to: