Demand Peripherals     Robotics and Automation Made Easy

DC2: Dual DC Motor Controller

The DC2 peripheral controls the speed and direction of two brushed DC motors using the D7HB H-Bridge card. The motor speed signals are pulse width modulated (PWM) signals with a programmable PWM frequency and a duty cycle between 0 and 100 percent.

 

Hardware:

The DC2 peripheral requires the D7HB dual H-Bridge card,

 

Resources:

Resources let you control each motor as well as set the PWM frequency. A watchdog timer can shutdown both motors if the host stops writing to the peripheral.

mode0, mode1 : mode of operation for the motor.
The mode is encoded as a single character with the codes assigned as follows:
     b -- brake (power on default)
     f -- forward
     r -- reverse
     c -- coast

power0, power1 : PWM 'ON' time as a percentage.
The speed resolution is 10 bits for PWM frequencies below 20 KHz. The speed resolution is 8 bits for a PWM frequency of 78 KHz. Reading this give the _current_ speed. Writing it sets the _target_ speed. Current speed is subject to the constraints of slow start and slow stop so the current speed and the target speed might not be the same. That is, when you read the speed you might not immediately get back what you wrote to it.

pwm_frequency : PWM frequency in Hertz.
The driver tries to assign a frequency as close as possible to the one specified. For example, a requested frequency of 12510 Hertz might result in an actual PWM frequency of 12500 Hertz. The PWM frequency is the same for both motors. The default PWM frequency is 20000 Hertz.

watchdog : Timeout in milliseconds.
As a safety feature, the FPGA hardware can turn both motors off if there is no speed or mode update within the specified time. The time is specified in milliseconds and has a maximum value of 1500 milliseconds. The resolution of the watchdog timer is 100 milliseconds, and a value of zero turns off the timer. The default value is 300 milliseconds.

 

Examples:

Set the PWM frequency to 20KHz, put both motors into forward mode, set the watchdog timer to 500 ms, and set the PWM percentage to both motors to 65 percent.

     dpset dc2 pwm_frequency 20000
     dpset dc2 watchdog 500
     dpset dc2 mode0 f
     dpset dc2 mode1 f
     dpset dc2 power0 65
     dpset dc2 power1 65

 

FPGA Defined Peripherals
User Interface
FPGA Configuration
FPGA Buttons & LEDs
Host Tx/Rx Interface
AVR Interface
Stereo Audio Amplifier
Text LCD and Keypad
Quad WS2812 Interface
Quad Slide Pot
IR Recv/Xmit
6 Digit LCD
RC Decoder
Keyfob RF Decoder
Rotary Encoder Interface
Quad Touch Interface
Motion Control
Dual DC Motor Controller
Dual Quadrature Decoder
Quad 13 Bit Servo
Bipolar Stepper Controller
Unipolar Stepper Controller
Simple Input / Output
Quad Binary Output
Quad Binary Input
Quad GPIO
Octal Input/Output
32 Channel Binary Output
32 Channel Binary Input
Quad Serial Output
Octal Serial Output
Sensors
Octal 12-bit ADC
Quad Ping))) Interface
Pololu QTR Interface
Octal SRF04 Interface
Instrumentation
Generic I2C
Generic SPI
Octal 8-Bit DAC
Quad Digital Potentiometer
Quad PWM Output
Quad PWM Input
Quad Event Counter
Real Time Clock
Dual Pulse Generator
  

Interface Cards
Control Cards
FPGA Card
MEGA88 AVR Card
User Interface
Stereo Audio Amplifier
IR Recv/xmit
Six Digit LCD Display
Keyfob RF Receiver
Rotary Encoder
Quad Switch Card
Text LCD / keypad
Quad Slide Pot
Quad Touch Interface
Motion Control
Dual 7-amp H-bridge
Quad Open Drain Driver
Quad 10 Amp Relay Card
Input / Output
Octal 8-Bit DAC
Quad Digital Potentiometer
Octal 12-bit ADC
Octal SRF04
Quad GPIO
I2C Prototyping
SPI Prototyping
USB 2.0 Hub
Real Time Clock
Octal Input/Output
32 Channel Input
32 Channel Output
Accessories
Power Distribution Card
15 Amp Power Distribution
5 Volt Switching Regulator
ATX Power Break-Out Card
Disk Drive Power Break-Out
MP43 Aluminum Mounting Plate
WW4 Large Prototyping Card
WW2 Prototyping Card
WW1 Small Prototyping Card
SMP SMD Prototyping Card