View unanswered posts | View active topics It is currently Thu Oct 02, 2014 12:03 pm






Reply to topic  [ 15 posts ] 
I can't get the DC motors working 
Author Message
Rookie

Joined: Tue Nov 01, 2011 10:17 pm
Posts: 8
Post 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;
}
}


Tue Nov 01, 2011 10:49 pm
Profile
Guru
User avatar

Joined: Sun Nov 15, 2009 5:46 am
Posts: 1347
Post 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.


Wed Nov 02, 2011 12:53 am
Profile
Rookie

Joined: Wed Jul 21, 2010 11:23 pm
Posts: 39
Post 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.


Wed Nov 02, 2011 10:35 am
Profile
Rookie

Joined: Tue Nov 01, 2011 10:17 pm
Posts: 8
Post Re: I can't get the DC motors working
I have done that, and am still not getting any responses from the motors.


Wed Nov 02, 2011 10:48 am
Profile
Rookie

Joined: Wed Jul 21, 2010 11:23 pm
Posts: 39
Post 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);


Wed Nov 02, 2011 12:59 pm
Profile
Rookie

Joined: Tue Nov 01, 2011 10:17 pm
Posts: 8
Post 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.


Wed Nov 02, 2011 8:28 pm
Profile
Guru
User avatar

Joined: Sun Nov 15, 2009 5:46 am
Posts: 1347
Post Re: I can't get the DC motors working
Is it possible you have a defective motor controller?


Wed Nov 02, 2011 8:48 pm
Profile
Rookie

Joined: Tue Nov 01, 2011 10:17 pm
Posts: 8
Post 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.


Wed Nov 02, 2011 9:08 pm
Profile
Guru
User avatar

Joined: Sun Nov 15, 2009 5:46 am
Posts: 1347
Post Re: I can't get the DC motors working
Don't you have a second motor controller that you can swap out and try?


Wed Nov 02, 2011 10:22 pm
Profile
Rookie

Joined: Tue Nov 01, 2011 10:17 pm
Posts: 8
Post Re: I can't get the DC motors working
No I don't actually. I just started my robotics team earlier this year.


Thu Nov 03, 2011 12:30 am
Profile
Rookie

Joined: Wed Jul 21, 2010 11:23 pm
Posts: 39
Post 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?


Thu Nov 03, 2011 3:06 pm
Profile
Rookie

Joined: Tue Nov 01, 2011 10:17 pm
Posts: 8
Post 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.


Thu Nov 03, 2011 5:18 pm
Profile
Guru
User avatar

Joined: Sun Nov 15, 2009 5:46 am
Posts: 1347
Post 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.


Thu Nov 03, 2011 5:22 pm
Profile
Expert

Joined: Mon Oct 27, 2008 9:59 pm
Posts: 137
Post 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.


Fri Nov 04, 2011 8:37 am
Profile
Rookie
User avatar

Joined: Mon Feb 23, 2009 12:40 pm
Posts: 27
Post 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.


Mon Nov 07, 2011 10:14 am
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 15 posts ] 

Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  



Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by ST Software for PTF.