ROBOTC.net Blog  

ROBOTC News

Using the Cortex and a VICTOR 884 to Control a 12V DC Motor

No comments

As a continuation of our “Using the VEX Cortex and PIC to control cool stuff” series, this week we’re using the VEX Cortex to control a very powerful and very fast 12V DC motor. The standard VEX motors operate on roughly 5V DC, so in order for the Cortex or PIC to control a larger motor, a second power supply must be used. However, the VEX Cortex and PIC both regulate the voltage they provide the motors, so simply hooking up a larger power supply won’t work – and doing so would risk damaging the actual microcontroller.

To solve this problem, we can introduce an intermediary component – a VICTOR 884 Speed Controller. The VICTOR sits between the 12V power supply, VEX microcontroller, and 12V DC motor, isolating the microcontroller from the high voltage. The VICTOR connects to a MOTOR port on the Cortex or PIC using a male-to-male 3-pin wire, and accepts standard ROBOTC motor commands and motor powers. Based on commands from the microcontroller, the VICTOR then passes the appropriate amount of voltage from the power supply to the motor. For detailed instructions and procedures for creating your own setup, follow along with the Relay and PWM Lab from the VEX Curriculum 2.0.

Check out this video, where we use feedback from the potentiometer control the speed of the 12V DC motor.


ROBOTC Code:

#pragma config(Sensor, in1,    potentiometer,       sensorPotentiometer)
//*!!Code automatically generated by 'ROBOTC' configuration wizard               !!*//

task main()
{
while(true)
{
//If the potentiometer is turned less than half way...
if(SensorValue[potentiometer] < 2048)
motor[port2] = (SensorValue[potentiometer] - 2048)/16;  //...move in reverse.
else  //Else, the potentiometer is turned more than half way, so...
motor[port2] = (SensorValue[potentiometer] - 2048)/16;  //...move forward.
}
}

NOTE: DO NOT TRY THIS YOURSELF WITHOUT QUALIFIED SUPERVISION. Failure to follow correct procedures and setup can result in personal injury and/or damage to the electrical components.

Written by Jesse Flot

December 10th, 2010 at 4:12 pm

Posted in Cortex,PIC,VEX