ROBOTC.net forums
http://robotc.net/forums/

I can't get the DC motors working
http://robotc.net/forums/viewtopic.php?f=52&t=3669
Page 1 of 1

Author:  eWilde [ Tue Nov 01, 2011 10:49 pm ]
Post subject:  I can't get the DC motors working

I have been working through the different tutorials on youtube and supplied with the FTC kit of parts.
I still can't get the DC 12V motors working. All the lights are lighting up, the batteries are fully charged.
Here is the code for the test program:
Code:
#pragma config(Hubs,  S1, HTMotor,  none,     none,     none)
#pragma config(Sensor, S2,     touch,               sensorTouch)
#pragma config(Motor, mtr_S1_C1_1, , tmotorNormal, openLoop, encoder)
#pragma config(Motor, mtr_S1_C1_2, , tmotorNormal, openLoop, reversed, encoder)
//*!!Code automatically generated by 'ROBOTC' configuration wizard               !!*//
/**
Name: DC Motor Controller Test
Author: Evan
Date: 10-26-11
**/
task main()
{
  while(true){
    //set both motors to 100%
    motor[mtr_S1_C1_1] = 100;
    motor[mtr_S1_C1_2] = 100;
}
}

Author:  MHTS [ Wed Nov 02, 2011 12:53 am ]
Post subject:  Re: I can't get the DC motors working

The code is too simple to be wrong. So you must not connect things correctly. First make sure the sensor port S1 is connected to the motor controller. Make sure it's a motor controller and not a servo controller. If the motor controller has the red LED on, power must be connected correctly. Make sure motor 1 and motor 2 wires are hooked up to the motors correctly. I am assuming you did successfully compile and download the code to the NXT brick.

Author:  ronmcrae [ Wed Nov 02, 2011 10:35 am ]
Post subject:  Re: I can't get the DC motors working

Also make sure the cable from the NXT goes into the left side of the motor controller (the 'in' side is under the H of HiTechnic.) The other connector is the 'out' side for the next controller in the daisy-chain.

Author:  eWilde [ Wed Nov 02, 2011 10:48 am ]
Post subject:  Re: I can't get the DC motors working

I have done that, and am still not getting any responses from the motors.

Author:  ronmcrae [ Wed Nov 02, 2011 12:59 pm ]
Post subject:  Re: I can't get the DC motors working

Try adding the following lines within the while loop. If you see the battery voltage displayed correctly on the NXT screen then it definitely means you are talking to the motor controller.


float Tetrix_Battery;
Tetrix_Battery = (float)externalBatteryAvg/1000;
nxtDisplayTextLine(2, "%2.2f", Tetrix_Battery);

Author:  eWilde [ Wed Nov 02, 2011 8:28 pm ]
Post subject:  Re: I can't get the DC motors working

The red light is illuminated, but I am getting -0.00 showing up on the screen.

Author:  MHTS [ Wed Nov 02, 2011 8:48 pm ]
Post subject:  Re: I can't get the DC motors working

Is it possible you have a defective motor controller?

Author:  eWilde [ Wed Nov 02, 2011 9:08 pm ]
Post subject:  Re: I can't get the DC motors working

Could be. I just wanted to see if there were any ideas before going to the customer service. Thank you for your help.

Author:  MHTS [ Wed Nov 02, 2011 10:22 pm ]
Post subject:  Re: I can't get the DC motors working

Don't you have a second motor controller that you can swap out and try?

Author:  eWilde [ Thu Nov 03, 2011 12:30 am ]
Post subject:  Re: I can't get the DC motors working

No I don't actually. I just started my robotics team earlier this year.

Author:  ronmcrae [ Thu Nov 03, 2011 3:06 pm ]
Post subject:  Re: I can't get the DC motors working

Are you absolutely absolutely certain the external 12V battery is fully charged?

I ask because we had a situation last week, very similar to yours, where nothing external to the NXT would work, yet the red lights were fully illuminated on the motor controllers. Like you are seeing, the battery voltage was reported as zero but we didn't actually believe that as the code had just been added to the program!

Turned out that the external battery drops to a critical voltage very suddenly, and at that point everything essentially quits working even though the red lights still light on the controllers. Once we recharged the battery everything was back to normal and the voltage was also displayed correctly on the NXT screen.

Try checking the battery voltage with a volt meter - maybe your charger isn't charging it?

Author:  eWilde [ Thu Nov 03, 2011 5:18 pm ]
Post subject:  Re: I can't get the DC motors working

I was able to get the servo controller to work fine though. The light on the charger turned green and the DC 12V controller still didn't work. I have also directly attached a motor to the battery and the motor worked just fine.

Author:  MHTS [ Thu Nov 03, 2011 5:22 pm ]
Post subject:  Re: I can't get the DC motors working

Assuming all connections to the motor controller are correct, it sounds like the motor controller could be defective.

Author:  l0jec [ Fri Nov 04, 2011 8:37 am ]
Post subject:  Re: I can't get the DC motors working

I agree that you may have a defective motor controller. Are there any other FTC teams near you? If so, you may want to try reaching out to one of them for a quick test using one of their motor controllers (or taking your questionable one up to them to switch out & test).

Just another idea if you want to be sure it is bad before going to tech support or purchasing a new one.

Author:  SSI [ Mon Nov 07, 2011 10:14 am ]
Post subject:  Re: I can't get the DC motors working

Actually it looks like you have a very simple problem in your code. In the config line for the motors, you have not named your motors.
Your config lines should look something like this...

Code:
#pragma config(Motor, mtr_S1_C1_1, LeftMotor , tmotorNormal, openLoop, encoder)
#pragma config(Motor, mtr_S1_C1_2, RightMotor , tmotorNormal, openLoop, reversed, encoder)


And the code to move the motors should look something like this...

Code:
    motor[LeftMotor] = 100;
    motor[RightMotor] = 100;


Give that a try and let us know how it works.

Page 1 of 1 All times are UTC - 5 hours [ DST ]
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/