====== Motor Adapter for myRIO ====== {{:ni:motoradapter-600.png?200|}} ===== Overview ===== The Motor Adapter for NI myRIO allows you to easily connect and control either one stepper motor, two DC motors or two servos independently through the MXP connector on your myRIO. It has been designed so that no additional circuitry is required to drive motors. The board uses the [[http://www.allegromicro.com/en/Products/Motor-Driver-And-Interface-ICs/Brush-DC-Motor-Drivers/A4973.aspx|Allegro A4973]], a powerful full-bridge, bidirectional PWM motor controller - just supply power and you're on your way! Servo motors are connected via standard 3-pin headers while DC motors are connected via 6-pin or screw terminal connectors and stepper motors are connected using screw terminals. PWM signals from the standard myRIO FPGA personality are routed to the DC and servo motor inputs. Motor 0 Quadrature encoder inputs are routed to the myRIO encoder inputs and Motor 1 are routed to general purpose digital I/O. Filtered motor voltage and current are routed back to the myRIO analog inputs to enable real-time monitoring. Key Features: * Uses the myRIO Expansion Port (MXP) connector * Can be use to control 2 DC motors, 1 stepper motor, or 2 RC servos * Current/voltage sensing and control with over-current protection * 6V-16V input voltage using screw-terminal supply connections * 34-pin female breakout allowing direct user access to signal pins * Onboard quadature encoder interface to myRIO encoder inputs * Power LED indicator **Connector Pin-outs** __Motor PWR__ (J6) : DC Motor Power Screw-terminal Block ^ Pin# ^ Pin Name ^ Notes ^ | 1 | GND | Negative motor voltage | | 2 | 6...16VDC | Positive motor voltage, 6-16VDC | __Motor Encoders__ (J7, J13) : Encoder Signals Screw-terminal Block ^ Pin# ^ Pin Name ^ Notes ^ | 1 | ENCB | Encoder Phase B | | 2 | ENCA | Encoder Phase A | __Servos PWR__ (J8): Servo Motor Power Screw-terminal Block ^ Pin# ^ Pin Name ^ Description ^ | 1 | SVDC | Positive Servo Motor voltage, 4.8-6VDC nominal - check servo mfr spec | | 2 | GND | Servo Motor Power Ground | __Servo Motors__ (J10, J11): Hobby Servo Motor Headers ^ Pin# ^ Pin Name ^ Description ^ | 1 | PWMx | Servo Motor PWM Control Signal | | 2 | SVDC | Positive Servo Motor voltage | | 3 | GND | Servo Motor Ground | __Motor 1 and Motor 2__ (J3, J9): Digilent standard 6-pin motor/encoder connector (see [[http://www.digilentinc.com/Products/Detail.cfm?NavPath=2403625&Prod=MT-MOTOR|Digilent Gearmotor]]) ^ Pin# ^ Signal ^ Description ^ | 1 | EncB | Encoder phase B | | 2 | EncA | Encoder phase A | | 3 | GND | Ground | | 4 | +5V | Encoder Power | | 5 | M+ | Motor Positive Voltage | | 6 | M- | Motor Negative Voltage | **Using the Adapter with myRIO** ***DC Motors*** If using [[https://www.digilentinc.com/Products/Detail.cfm?NavPath=2,403,625&Prod=MT-MOTOR | Digilent gearmotors]] that are already terminated with the 6-pin connector, just plug in to connectors J3/J9 and motor/encoders will be connected to the proper terminals. Alternatively, connect your DC motor(s) to the screw terminals (J4 and/or J5) and if using encoders, wire signals to J7/J13. Connect motor power (16V max) to the Motor Power screw-terminals (J6). Motor direction is controlled by setting myRIO "DIR0" or "DIR1" pin HIGH or LOW and speed/torque is controlled by setting the duty cycle on the myRIO PWM0 and/or PWM1 pins. The A4973 driver has been configured for a 1.5A max current (at 100% duty cycle). Motor voltage and current can be monitored by reading the myRIO analog inputs according to this table: ^ MXP Pin# ^ Name ^ Motor Signal ^ | 3 | AI0 | Motor 0 Current | | 5 | AI1 | Motor 1 Current | | 7 | AI2 | Motor 0 Voltage | | 9 | AI3 | Motor 1 Voltage | ***Hobby Servo Motors*** J10 and J11 are standard 3-pin hobby servo motor connectors and will work with most popular servo motors with no modification. The PWM control signals are connected directly to the myRIO PWM pins on the MXP port, so no additional wiring is required other than providing external power to J8. ***Stepper Motors*** A single standard 4-wire (bipolar) stepper motor can be controlled by wiring each winding to one of the motor terminal blocks (J4 and J5). Typically, the two windings are controlled and coordinated using a variety of patterns from simple ON/OFF (100% duty cycle and 0%) in quadrature between the two windings (Full Step) to "Half-Step" control to help smooth transitions and increase positional resolution, to microstepping, where many levels of PWM are used to approach a sine/cosine control of the windings. There are many resources for help choosing the best control approach. This [[http://www.st.com/web/en/resource/technical/document/application_note/CD00003774.pdf | applications note]] from ST Micro is one example, and the [[http://www.allegromicro.com/en/Products/Motor-Driver-And-Interface-ICs/Brush-DC-Motor-Drivers/A4973.aspx | datasheet]] for the Allegro driver device used the board is also a good resource. Please visit the [[https://decibel.ni.com/content/community/academic/products_and_projects/myrio | myRIO Community Website]] for example code and project ideas.