Society of Robots - Robot Forum

Electronics => Electronics => Topic started by: ccdjr106 on February 11, 2010, 07:36:57 PM

Title: motor controller {urgent}
Post by: ccdjr106 on February 11, 2010, 07:36:57 PM
http://www.robotshop.com/dfrobot-2wd-mobile-platform-for-arduino-4.html (http://www.robotshop.com/dfrobot-2wd-mobile-platform-for-arduino-4.html) i have this ...
the motor controller that i have spins the wheels but it doesnt give them enough power to go anywhere its a 2amp   one amp to each motor
http://www.robotshop.com/dfrobot-arduino-compatiable-motor-shield.html (http://www.robotshop.com/dfrobot-arduino-compatiable-motor-shield.html)

what is a motor controller that will work for me  i have a 2.2 pound weight limit on the robot  and i dont really have a budget for the motor controller just as long as its not too much over 100$$$ if it goes that high
Title: Re: motor controller
Post by: waltr on February 12, 2010, 08:55:02 AM
It may be that the motors are not powerful enough to move your robot.
How well does it move if you connect the battery directly to the motors without the motor controller? If it still doesn't have enough power to move the bot then you need to either get larger motors or reduce the weight on the bot.
Title: Re: motor controller
Post by: ccdjr106 on February 12, 2010, 04:46:03 PM
it moves fine with a 9v hooked up to it
Title: Re: motor controller
Post by: waltr on February 12, 2010, 05:03:39 PM
Ok, first test passed.
I was looking for a data sheet on your motor controller but didn't see one at the site you linked.

Second test: Connect a smallish value, high Wattage (>2W) resistor in series with the battery and motor. Then measure the voltage drop across the resistor (about 1 Ohm, parallel several if you don't have any resistors values than small).  Do the measurement quickly as the resistor will dissipate some heat, paralleling several resistor will also increase the power capability. Divide the voltage drop by the resistor value to get the amount of current the motor is drawing (I = E/R). Is it greater than 1Amp?
Title: Re: motor controller
Post by: ccdjr106 on February 12, 2010, 06:34:21 PM
how do i measure the voltage drop ??? ??? ???
Title: Re: motor controller
Post by: ccdjr106 on February 12, 2010, 07:13:15 PM
i dunno if this helps
http://www.alibaba.com/product-gs/283999866/2WD_Mobile_Platform_for_Arduino.html (http://www.alibaba.com/product-gs/283999866/2WD_Mobile_Platform_for_Arduino.html)
it says no load current with 3v is 60ma and 6v is 71ma



Title: Re: motor controller
Post by: waltr on February 12, 2010, 07:32:35 PM
how do i measure the voltage drop ??? ??? ???
A voltage meter. A DMM (Digital MultiMeter) is a very handy instrument, when building electronic it is almost indispensable as it can measure voltage (both AC and DC), resistance and low currents. They can be purchased for under $20.

If the motor only draws 71mA @ 6V then the controller should be fine even at the stall current of 470mA.

But I still don't have any detailed information on that controller. What are the control lines from the processor to the controller?
Is the PWM duty a pulse train from the processor? Is so then what is the duty cycle?

My thinking is that the processor is set to output a very low duty cycle therefore the average motor current is too low.

What code is running on the processor?
Title: Re: motor controller
Post by: ccdjr106 on February 12, 2010, 07:43:54 PM
im pretty new at this stuff soo if u can try to explain things as simple as you can    i  have a analog multi meter

i just used the sample code from here http://www.robotshop.com/content/PDF/dfrobot-arduino-shields-manual.pdf (http://www.robotshop.com/content/PDF/dfrobot-arduino-shields-manual.pdf)
Title: Re: motor controller
Post by: waltr on February 12, 2010, 08:19:53 PM
An analog multimeter is just fine to measure the resistor's voltage drop.

The last link is helpful. It looks like controller uses an ST L298B motor drive chip but the data sheet doesn't match. Can you confirm the number on the 16 pin chip in the middle of the controller board.

I'll try to explain or at least keep asking you questions until I ask the one that makes the light bulb glow ( the light inside your head).

In the example code the is the function:
Code: [Select]
void Motor1(int pwm, boolean reverse) 
{
        analogWrite(EN1,pwm); //set pwm control, 0 for stop, and 255 for maximum speed
        if(reverse)
        {
             digitalWrite(IN1,HIGH);
        }
        else
        {
             digitalWrite(IN1,LOW);
        }
}

Note the line "analogWrite(EN1,pwm); //set pwm control, 0 for stop, and 255 for"
The comment give the range for the value 'pwm'.

The "int pwm" value is what sets the motor speed. Later in the code this function is called in the switch-case statement.
Code: [Select]
switch(val)
{
      case 'w'://Move ahead
            Motor1(100,true); //You can change the speed, such as Motor(50,true)
            Motor2(100,true);
            break;

This is the move forward command and the speed of the motors is set to 100 out of 255. This would be a duty of 100/255 = .39 or 39% of full speed (assuming that this value is linearly proportional to the pwm and motor speed which may not be the case).
Try increasing this value to 150 or more and see if the motors move the robot better.

And keep asking questions if you don't understand.
Title: Re: motor controller
Post by: ccdjr106 on February 12, 2010, 08:31:00 PM
ok i looked at the code a little its making a little sense now ill look at it more but the chip says l293b 99026 VW MYS 99 851
Title: Re: motor controller
Post by: ccdjr106 on February 12, 2010, 08:33:15 PM
i just realized that the motor controller has a pwr out and pwr in pin  if i hook up like 6v or soo will that give the motors more power or are these pins for something else

edit  I changed some of the values and the motors are spinning with more power but i cant really test it because only of of the motors are working i reversed the motors and it seems that only the one connected to motor 2 on the controller is working
Title: Re: motor controller
Post by: waltr on February 12, 2010, 08:58:56 PM
Ok, its a L293B so here is the data sheet.
http://www.st.com/stonline/books/pdf/docs/1328.pdf (http://www.st.com/stonline/books/pdf/docs/1328.pdf)
It may make sense to you a little later but save it and look it over.

I see the PWR IN connections Vin & grn. The manual doesn't seem to say anything about them.
Try to trace what the Vin pin is connected to. If it goes to pin 10 (Vs) of the L293 then you should connect the battery there. BUT BEFORE YOU DO, use you meter on an Ohm scale ( if there is a buzzer setting use that) and make sure the Vin pin does not connect to any of the other header pins marked 5V, 3.3. 6V could be a high enough voltage to burn out the processor

Do you have a schematic of the motor control board? That would help to know what is connected to what.

It could be that your 9V is being regulated down to 5V before going to the motors. Measure the voltage between the vin and grn on the PWR IN pins with the boards and motors hooked up the way you had them. What do you read?
Then measure the voltage from pin 10 to pin 20 on the L293. What is it?


Title: Re: motor controller
Post by: ccdjr106 on February 12, 2010, 09:04:07 PM
I changed some of the values and the motors are spinning with more power but i cant really test it because only of of the motors are working i reversed the motors and it seems that only the one connected to motor 2 on the controller is working
Title: Re: motor controller
Post by: ccdjr106 on February 22, 2010, 08:04:23 PM
i still cannot get the controller to work
it only spins 1 motor
i tested it on 2 diffrent chassis only one motor is spinning
so i bought a new one and im getting the same problem
im using the sample code from http://www.robotshop.com/content/PDF/dfrobot-arduino-shields-manual.pdf (http://www.robotshop.com/content/PDF/dfrobot-arduino-shields-manual.pdf)


int EN1 = 6;   
int EN2 = 9;
int IN1 = 7;
int IN2 = 8;     
 
void Motor1(int pwm, boolean reverse)
{
            analogWrite(EN1,pwm); //set pwm control, 0 for stop, and 255 for

         if(reverse)
         { 
          digitalWrite(IN1,HIGH);     
         }
        else
        {
          digitalWrite(IN1,LOW);     
         }
        }   
         
void Motor2(int pwm, boolean reverse)
        {
          analogWrite(EN2,pwm);
         if(reverse)
         { 
          digitalWrite(IN2,HIGH);     
         }
        else
        {
          digitalWrite(IN2,LOW);     
         }
        }   
         
void setup() 

    int i;
    for(i=6;i<=9;i++)
    pinMode(i, OUTPUT);  //set pin 6,7,8,9 to output mode
    Serial.begin(9600);   

 
 
void loop() 

  int x,delay_en;
  char val;
  while(1)
  {
    val = Serial.read();
    if(val!=-1)
       {
          switch(val)
           {
             case 'w'://Move ahead
                        Motor1(250,true);  //You can change the speed, such

                        Motor2(250,true);
                       
                         break;
             case 'x'://move back
                        Motor1(250,false);
                        Motor2(250,false);
                         break;
             case 'a'://turn left
                        Motor1(250,false);
                        Motor2(250,true);
break;
case 'd'://turn right
           Motor1(250,true);
                        Motor2(250,false);
                        break;   
               case 's'://stop
                        Motor1(0,false);
                        Motor2(0,false);
                         break;
                                   
           }     
         
       }
           
  }                           } 
Title: Re: motor controller
Post by: Pratheek on February 22, 2010, 10:31:00 PM
Try adding pull-up resistors for all the input and the enable  pins of the L293D or connect the input pins you are not using to Gnd.
Title: Re: motor controller
Post by: ccdjr106 on February 23, 2010, 05:47:51 AM
never mind i figured it out  i traced the wires and it was using pins 4,5,6,7 and not 6,7,8,9 like it said in the sample code
Title: Re: motor controller
Post by: ccdjr106 on March 11, 2010, 09:16:18 PM
i need more power and i traced the pwr in  pins and vin is connected to pin 8 (vs)  and its also connected to the 5v pin and gnd is connected to the gnd pin so would it be safe to connect 2 c batteries to the pwr in ???