myRIO Student Projects

cancel
Showing results for 
Search instead for 
Did you mean: 

Digilent Motor Adapter for myRIO Example Code

Digilent offers a Motor Adapter made just for myRIO.  They also offer it part of the myRIO Mechatronics Accessory Kit.  The motor adapter allows you to easily connect and control either one stepper motor, two DC motors, or two servos independently through the MXP connector on myRIO with no additional circuitry required.  Additionally, the motor adapter offers over-current protection.

myRIO with Motor Adapter.png

For more information on this motor adapter, check out the Digilent resource center.

Digilent Motor Adapter with a DC Motor

DC motors can be connected to the Digilent Motor Adapter using the two 6-pin connectors or using screw terminal connectors.  The board conveniently connects the motor outputs and encoder inputs to the proper pins on the myRIO MXP connector so that you can use the following express VIs in the myRIO pallette for either MXPA or MXPB:

  • The PWM express VI can be used to control the motor speed (Use PWM0 and PWM 1 for Motor0 and Motor1, respectively)
  • The Encoder express VI can be used to read the motor position for Motor0  (for Motor1, encoder readings can be read from MXP digital inputs 19 and 21)
  • The Digital Output express VI to toggle the motor direction.  MXP Pins 23 and 31 can be toggled to change the direction of Motor0 and Motor 1, respectively.

Motor Adapter with DC Motor Callouts.PNG

The Digilent Geared DC Motor is also part of the myRIO Mechatronics Accessory Kit.  It is terminated with the 6-pin connector.  Below and attached is example code for controlling speed and direction of the DC motor and reading encoder position and direction.

Motor Adapter Snippet.png IMG_2203.jpg

Download All
Comments
Member
Member
on

Hello Dayna,

Do you also have example code to control stepper motor?

Thanks.

Khoa

Trusted Enthusiast
Trusted Enthusiast
on

Hi! I've found example code to control stepper motor here - https://forum.digilentinc.com/topic/1133-digilent-motor-adapter-for-ni-myrio/#comment-5474

Member
Member
on

Hi,

Thank you very much!

Best regards,

Khoa

Member
Member
on
Hello guys, I can't use labview for a project and I have to code using C++. I was wondering if any of you have such an example but in C++ ? Thank you very much. Simon
Member
Member
on

I’d like to use analog input (AI0 to AI3).

How to use these ?

Member
Member
on

 Hello, I have a question, why is the motor speed and duty cycle inversely proportional when I use the following hardware?

IMG20180731105447.jpg

Contributors