chipKITTM Motor Shield Reference Manual Revision: April 16, 2013 Note: This document applies to REV D of the board. 1300 NE Henley Court, Suite 3 Pullman, WA 99163 (509) 334 6306 Voice | (509) 334 6300 Fax Overview The chipKITTM Motor Shield is an expansion board for use with the chipKIT Uno32 and chipKIT uC32. It provides additional circuitry and connectors for the Uno32 and uC32 to drive various motors types. The chipKIT Motor Shield is designed to drive DC motors, servo motors, and stepper motors. It also provides additional I/O via an I2C I/O extender. Features include: 2 DC motor driver channels, accessible with either a JST 6-pin connector or a terminal block 2 DC motor encoder input signals for each DC motor channel 4 servo motor channels I2C General purpose I/O expander with 4 LEDs 2 push buttons and 2 user settable jumpers 1 4-wire unipolar stepper motor channel Standard chipKIT Shield connectors Functional Description The chipKIT Motor Shield is designed to be used with the chipKIT Uno32 or chipKIT uC32 board. When used with these boards, the microcontroller and shield provide the necessary supporting hardware and connectors to control most types of small motors. The rest of this document will only reference the Uno32; however, the shield can also be used with the chipKIT uC32. The chipKIT Motor Shield has the following connectors: J1: Power Supply for the DC motor driver This connector provides power to the DVR8833RTY motor driver for the DC motors. Motor supply voltage range is 2.7-10.8 V. Doc: 502-262 page 1 of 8 Copyright Digilent, Inc. All rights reserved. Other product and company names mentioned may be trademarks of their respective owners. chipKIT Motor Shield Reference Manual J3 & J6: DC motor 6-pin JST connector These connections provide power and feedback signals for DC motors. The pin-outs are compatible with the Digilent DC gear-motors. J5 & J7: DC motor terminal block connector These connections provide the power supply pin-out for most two wire DC motors. J2: DC motor driver disable Shorting these two pins (or driving the NS signal pin low) will put the DC motor driver into sleep mode. This disables the motor driver and therefore reduces power consumption. This option is useful for low power applications. J4: DC motor driver fault indicator The NF signal will be driven low when there is a fault detected within the DC motor driver. Possible reasons for fault include overcurrent, overheat, and low voltage. J8 & J9: DC motor feedback signal headers Headers for connecting DC motor feedback signals. J10: Power Supply for Stepper motor This connector provides power for driving the stepper motor. J12 & J13: Stepper motor terminal block connectors These connections are used for driving a stepper motor. J14: Power Supply for servo motors This connector provides external power for driving the servo motors. If using this header remove JP6 to ensure that servo power supply is not shorted to the 5 Volt Uno32 power supply. J11 & J15: Digital Signal Pass-Through Connectors This connector passes the digital I/O pins on the Uno32 through to the chipKIT Motor Shield. J21: I2C #1 Daisy Chain Connector This is a 2x4 pin header connector that provides access to the I2C signals SDA and SCL as well as power from the 3.3V power bus and ground. This can be used to extend the I2C bus off of the board and to power external I2C devices. Digilent has cables and a selection of I2C peripheral modules that can be accessed using this connector. www.digilentinc.com page 2 of 8 Copyright Digilent, Inc. All rights reserved. Other product and company names mentioned may be trademarks of their respective owners. chipKIT Motor Shield Reference Manual J19: Analog Signal Pass-Through Connector This connector passes the analog input pins on the Uno32 through the chipKIT Motor Shield. J22: Power Pass-Through Connector This connector passes the power connector from the Uno32 through the chipKIT Motor Shield, and powers the chipKIT Motor Shield from the Uno32. DC Motor Controller The Motor Shield provides a means to control 2 independent DC motors via a DRV883 dual H-bridge motor driver. The motor driver must be powered via J1 to operate, voltages between 2.7 and 10.8 volts are acceptable. Each channel is controlled by an "enable" and "direction" signal. Uno32 Pin # 3 4 3/5 4/34 PIC32 Pin # 46 59 46/49 59/53 Signal Notes Enable1: OC1/RD0 Direction1: RF1 Enable2: OC1/RD0 or OC2/RD1 Direction2: RF1 or PMRD/CN14/RD5 Select with JP1 Select with JP2 Channel 2 can be set up for identical or independent operation from channel 1 using JP1 and JP2. PWM levels on enable pins will regulate the speed of the motors. Logic levels on direction pins will determine the motors rotation direction of the attached DC motors. The chipKIT Uno32 uses a demultiplexer and pull-down resistors on the inputs to the DRV8833 H-Bridge pins to ensure that the H-Bridge only works in fast decay mode. Table 1 lists the motor responses that result from various input combinations. DIR1 0 0 1 1 DIR2 0 0 1 1 EN1 0 1/PWM 0 1/PWM EN2 0 1/PWM 0 1/PWM Result Stop Forward Stop Reverse Result Stop Forward Stop Reverse Table 1: Motor Control The DRV8833 chip provides overcurrent protection on the motor drive circuits. Each internal drive FET is independently monitored for an overcurrent condition and will be shut down internally to protect the chip. When an overcurrent condition is sensed the chip will shut down the FET with the fault and then set the NFAULT pin low signaling a fault condition on the chip. The remaining FETs will continue to operate as normal. When the fault condition is over, the chip will self-reset and return the NFAULT logic level to logic high. (See Table 2 for connector descriptions.) www.digilentinc.com page 3 of 8 Copyright Digilent, Inc. All rights reserved. Other product and company names mentioned may be trademarks of their respective owners. chipKIT Motor Shield Reference Manual There are two Schmitt trigger buffered inputs on connectors J3, J6, J8 and J9 that bring motor speed feedback signals to the controlling system board. The Digilent motor and gearbox have hall-effect sensors arranged in a quadrature encoder format. These buffers have 5V tolerant inputs, when operated at 3.3V. The quadrature encoder signals are a pair of square waves whose frequency is proportional to motor rotation speed and with the pulses 90 out of phase. You can determine the motor speed with the frequency and motor rotation direction by the phase relationship between the two signals. Stepper Motor Controller The stepper motor controller has 4 output signals. It is composed of 4 open-drain transistor amplifiers. Uno32 Pin # 26 27 28 29 PIC32 Pin # 60 61 62 63 Signal Notes A: PMD0/RE0 B: PMD1/RE1 C: PMD2/RE2 D: PMD3/RE3 The stepper motor driver can be powered by either VIN, or an external power source connected to J10. If connecting an external power source, JP5 should be removed to prevent shorting the stepper motor voltages to the input voltage of the chipKIT board. Servo Motors The Motor Shield has 4 servo motor connections. They can be powered from VCC5V0 or an external power source connected to J14. If connecting an external power source, JP6 should be removed. The voltage of the power source can be measured on analog pin A11 via a resistor divider network (see the schematic for more details). Uno32 Pin # 30 31 32 33 PIC32 Pin # 64 1 2 3 Signal Notes Servo1: PMD4/RE4 Servo2: PMD5/RE5 Servo3: PMD6/RE6 Servo4: PMD7/RE7 J16 J17 J18 J20 I2C Bus and Connectors The Inter-Integrated Circuit (I2C) Interface provides a medium speed (100K or 400K bps) synchronous serial communications bus. The I2C interface provides master and slave operation using either 7 bit or 10 bit device addressing. Each device is given a unique address, and the protocol provides the ability to address packets to a specific device or to broadcast packets to all devices on the bus. Refer to the Microchip PIC32MX3XX data sheet and the PIC32 Family Reference Manual for detailed information on configuring and using the I2C interface. The PIC32MX320 microcontroller on the Uno32 provides for two independent I2C interfaces. The Motor Shield is designed to provide access to one of these interfaces, I2C #1 (SCL1, SDA1). I2C #1 is accessed through the standard chipKIT Wire library. Connector J21 provides access to I2C port #1. www.digilentinc.com page 4 of 8 Copyright Digilent, Inc. All rights reserved. Other product and company names mentioned may be trademarks of their respective owners. chipKIT Motor Shield Reference Manual Connector J21 can be used to extend the I2C bus off of the board to connect to external I2C devices. This is a standard 2x4 pin header connector with 0.100" spaced pins. It provides access to the I2C signals, SCL1 and SDA1, plus VCC3V3 and ground. The VCC3V3 can be used to power external I2C devices. The I2C bus uses open collector drivers to allow multiple devices to drive the bus signals. This means that pull-up resistors must be provided to supply the logic high state for the signals. The Motor Shield provides 2.2Kohm pull-up resistors on I2C #1. Generally, only one set of pull-ups are used on the bus. Jumpers JP7 and JP8 can be used to disable the on-board pull-ups on I2C #1 if a different value is needed or some other device on the bus is providing the pull-ups or if I2C #1 isn't being used and the pull-ups are interfering with the use of the pins. The on-board pull-ups are enabled by install shorting blocks on JP7 and JP8. Removing the shorting blocks disables the pull-ups. Digilent has several small I/O modules available that can be connected using the I2C connector. These include a 3-axis accelerometer, 4-channel, 12-bit A/D converter, serial character LCD panel, 3axis gyroscope, and a real-time clock/calendar. The on-board I/O expander is also controlled via I2C #1. I/O Expander The Motor Shield contains an I/O expander module that gives access to 4 LEDs, 2 pushbuttons, and 2 jumper-switches. The I/O expander is controlled via I2C #1. The outputs can be easily controlled using the Motor Shield MPIDE library. CHIPKIT and the CHIPKIT Logo are trademarks or registered trademarks of Microchip Technology Incorporated in the U.S. and other countries, and are used under license. www.digilentinc.com page 5 of 8 Copyright Digilent, Inc. All rights reserved. Other product and company names mentioned may be trademarks of their respective owners. chipKIT Motor Shield Reference Manual Appendix: chipKIT Motor Shield Pin-out Tables J1 Pins Uno32 Pin # PIC32 Pin # Pin J1-01 J1-02 Signal VM (motor driver power supply) GND Notes 2.7-10.8 V J2 Pins Uno32 Pin # PIC32 Pin # Pin J2-01 J2-02 Signal Motor Driver NSLEEP GND Notes Pull low to sleep J4 Pins Uno32 Pin # PIC32 Pin # Pin J4-01 J4-02 Signal Motor Driver NFAULT GND Notes Goes low on error J3 Pins Uno32 Pin # PIC32 Pin # Pin J3-01 J3-02 J3-03 J3-04 J3-05 J3-06 Signal Notes Signal Notes SB1-IN SA1-IN GND VCC3V3 M1+ M1- J6 Pins Uno32 Pin # PIC32 Pin # Pin J6-01 J6-02 J6-03 J6-04 J6-05 J6-06 www.digilentinc.com SB2-IN SA2-IN GND VCC3V3 M2+ M2- page 6 of 8 Copyright Digilent, Inc. All rights reserved. Other product and company names mentioned may be trademarks of their respective owners. chipKIT Motor Shield Reference Manual J5 Pins Uno32 Pin # PIC32 Pin # Pin J5-01 J5-02 Signal Notes Signal Notes Signal Notes M1+ M1+ J7 Pins Uno32 Pin # PIC32 Pin # Pin J7-01 J7-02 M2+ M2- J8 Pins Uno32 Pin # PIC32 Pin # 20/A6 13 Pin J8-01 J8-02 J8-03 J8-04 SA1-IN/ Jumper#3 SB1-IN/A6 GND VCC3V3 See JP3 J9 Pins Uno32 Pin # 7 37 PIC32 Pin # 43 55 Pin J9-01 J9-02 J9-03 J9-04 Signal Notes Signal Notes SA2-IN/IC2/INT2/RD9 SB1-IN/CN16/RD7 GND VCC3V3 JP3 Pins Uno32 Pin # 2 PIC32 Pin # 42 35 45 Pin JP3-01 JP3-02 JP3-03 www.digilentinc.com IC1/INT1/RD8 SB1-IN IC4/PMCS1/PMAI4/INT4/R11 Select with jumper page 7 of 8 Copyright Digilent, Inc. All rights reserved. Other product and company names mentioned may be trademarks of their respective owners. chipKIT Motor Shield Reference Manual J10 & J12 & J13 Pins (Stepper Motor Connections) Uno32 Pin # 26 27 28 29 PIC32 Pin # 60 61 62 63 Pin J10-01 J10-02 J12-01 J12-02 J13-01 J13-02 Signal External V+/VIN External V-/GND StepperA/PMD0/RE0 StepperB/PMD1/RE1 StepperC/PMD2/RE2 StepperD/PMD3/RE3 Notes Select with JP5 J14 & J16 & J17 & J18 & J20 Pins (Servo Motor Connections) Uno32 Pin # PIC32 Pin # 30 64 31 1 32 2 33 3 Pin J14-01 J14-02 J16-01 J16-02 J16-03 J17-01 J17-02 J17-03 J18-01 J18-02 J18-03 J19-01 J19-02 J19-03 Signal External Vs+/VCC5V0 GND PMD4/RE4 External Vs+/VCC5V0 GND PMD5/RE5 External Vs+/VCC5V0 GND PMD6/RE6 External Vs+/VCC5V0 GND PMD7/RE7 External Vs+/VCC5V0 GND Notes Select with JP6 J21 Pins (I2C) Uno32 Pin # 46 46 45 45 PIC32 Pin # 37 37 36 36 Pin J21-01 J21-02 J21-03 J21-04 J21-05 J21-06 J21-07 J21-08 www.digilentinc.com Signal Notes SCL1/RG2 SCL1/RG2 SDA1/RG3 SDA1/RG3 GND GND VCC3V3 VCC3V3 page 8 of 8 Copyright Digilent, Inc. All rights reserved. Other product and company names mentioned may be trademarks of their respective owners.