NURC Robot motor driver board This board provides control of up to 4 big DC motors, 6 servos and two switched 12V devices from a vEx PWM signal and a 48V power source. It is optimized for low cost, flexibility and high performance. A programmable logic device (xilinx CPLD) allows reconfiguration for custom requirements. Features * Powered from 48V at 10Amps to allow use with a lightweight, low cost 16 gauge tether cable * Powers and provides bidirectional speed control for up to four 10Amp, 12V motors * Powers external 12V devices up to 2A total current * Provides six decoded R/C servo outputs with 5V motor power Power and signals DC power input: 48V at 12A maximum on two Faston tabs. Control input: One or two vEx PWM signals on a 4-pin Molex header. DC power outputs: 12V at up to 2.5A total current on four 2-pin Mini-fit Jr. connectors. Motor outputs: Four 10 Amp PWM motor speed controllers on 2-pin screw terminals. Servo outputs: Six vEx PWM channels on 3 pin PWM servo headers. Total servo power available: 1 Amp at 5VDC (shared with 12V power). Relay outputs: Two 12V switched power outputs, up to 2A total power (shared with unswitched 12V power). 2-pin Mini-fit Jr. connectors. Design philosophy Motor drive This H bridge 48V 10A motor driver board converts PWM signals from R/C receiver to run four 12V, 10A DC brushed motors from a 48V bus. The goal is to use a duty cycle of less than 25% to achieve full motor power. This will allow us to drive four motors, each in its own 25 KHz PWM time slot, to draw less than 10A from the 48V battery. Experimentation has been done to test the PWM duty cycle vs load and current. The PWM duty cycle for a given current and therefore flow rate appears to scale linearly, perhaps with a bit of a win at higher voltages. A quantitative test with the thrust meter is needed to be sure. Since the supply voltage is 4x the rated motor voltage, a 25% duty cycle will produce full motor power as it makes the full 12V-equivalent current in the motor. There is a common part called a half-bridge driver IC that drives the gates of one set of high and low side MOSFETs. It requires a 12VDC power source and accepts two TTL gate enable signals. We need to sense motor current to ensure that the motor doesn't burn out if stalled. A sense resistor on each low side switch source develops voltage proportional to current, 0.02 ohm gives 0.2V for 10A current. A pair of comparators in the LM393 monitor the voltage across the two resistors. If either comparator detects an overcurrent condition, it pulls its output low. The comparators are wire-ORed together. The comparator reference is an adjustable voltage divider driven by the 3.3V supply. The adjustment range is 0 to 0.2 volt for a 0 to 10 Amp current limit range using a 0.02 ohm resistor. It's 0 to 0.2V for 0-2 Amps with a 0.1 ohm resistor. The current limit signal tells the FPGA to turn off the current to the motor in question until it drops to a safe level. Controller The controller is implemented in a CPLD. This device was chosen because it can be configured to do just about anything. A microcontroller is limited in speed and suffers from code complexity when trying to decode a PWM input while simultaneously generating four PWM outputs. We could write that code, but it would cost a lot more in time and aggravation and debugging than the $16 CPLD cost. The Xilinx XPLA3 series is old enough to be 3.3V useable and new enough to still be made. We get 256 registers, 120 I/O lines and a big PLA routing array in a smallish 19x19mm 144 pin TQFP with 0.5mm lead pitch, scary-looking but quite solderable with a standard soldering iron and some tricks. The FPGA motor controller contains the following modules: RC input pulse decoder: The control system sends a standard six-channel R/C pulse train with seven sequential pulses representing sync and four motor speeds and two on/off switches. The signal from the Vex controller is inverted and open-collector. A 1.1ms long pulse signals full reverse, a 1.5ms pulse is zero motion, and a 1.9ms pulse is full forward. The sync pulse is 9ms long. The above pulse times include the 400us "off" time. The pulses are decoded by the input pulse timer circuits. A 14 bit counter with two sections, usec(10 bits) and msec(4 bits), running at 1 MHz, is reset when the RC input rises. It counts up at all other times. The time counts and RC input values determine the next state of a state machine. A channel counter is set to 0 by the end of the start pulse, then increments on every falling edge of RC in. Channels are 1 through 6. Channel 7 is an error. When the RC input falls, an integer msec value of 1 is considered a valid command. The speed and direction values are copied to that channel's output register. Bit 9 of usec is the motor direction. The speed value is inverted on the way to the channel's speed register if direction is negative. If phase ever reaches a timeout time greater than the longest possible valid start pulse width, the framing error state is entered. The state machine starts in a search mode to detect five good frames with zero control input, then starts responding to input data. This is done with a good-frame counter. An out-of-spec pulse time sends the machine to the search mode and stops the motors. Four PWM motor drivers: Each motor driver converts an 8 bit speed command to a 25 kHz PWM stream whose duty cycle ranges of 0 to 25%. This is done with a down counter. The direction bit steers the pulses to the proper H bridge driver inputs as shown below. There's one dead clock cycle while switching the drivers over from active to inactive and back. direction active phase inactive phase Forward A hi, B low A low, B low Reverse A low, B hi A low, B low A channel sequencer issues sequential start commands each 10 microsecond time slice, allowing each motor to run for up to 10 microseconds out of 40, for a 25% maximum duty cycle. The PWM downcounter runs at 25 MHz for up to 255 counts. Channel number increments every 10 microseconds. Two up/down channels The Vex transmitter has two up/down buttons for landing gear or whatever. We can bring these out as up/down or on/off relay contacts. A mode switch will choose up/down vs on/off mode for each of the two channels. Driving the servo for the camera platform The camera tilts with a standard RC servo. Since it's inconvenient to hold the vEx joystick in the desired position, the joystick will function as a speed controller for the servo. This is done by integrating the joystick command into a position counter that counts up or down at a rate proportional to the joystick command. It might be as simple as up/down/stop commands, such as come out of the rear button pairs. Lighting and power supplies The 12V power supply is made with a Simple Switcher chip from National. Each board has a 3A 12V switching regulator to power its internal 12V needs and to provide power to external devices and the two relay outputs. Each controller board will have two relay outputs. These are implemented with an N-channel MOSFET to make the 12V output turn on and off. It's the same part we use for the PWM switches. The load has + and - terminals that are both floating from ground. The control for each is one pair of on/off buttons on the rear of the vEx transmitter.