Low voltage output from Arduino Motor Shield L298

Hi
I have a system of 2 motors(:LT25GA34-6V ,https://www.makeblock.cc/dc-motor-25-6v-185rpm),controled by a motor shield(http://www.4project.co.il/documents/doc_1580_2138.pdf the shield can handle 2A , and up to 12V ,with 2 channels)
and its all sits on a mega card.

My problem is that I have a a very low voltage passed from my Motor Shield to my 2 motors , far lower than the input voltage.
I have 8 batteries of 1.3V each what sums to sum 10.4V(I measured in shield terminals) , but my Motor Shield passes only 3.6V to the Motors (I checked with multimeter) , My code is correct , but to check myself I wrote a code , that each second rises the command I send to the motors , so I had voltage Vs time measurement , and I can see the voltage to the motors rises(in the motor terminals) from 0 t0 3.6V but no more!
I can't understand why I cant get the voltage I have in my batteries pack. Whats limiting the voltage?
any ideas?

thanks in advance

Have you a motor shield that uses L298 chips or have you just got bare L298s?

If you have a shield post a link to its datasheet.

In any case draw a diagram of how everything is connected and post a photo of the drawing.

Post the code you are using - and please use code tags (the # button) so it looks like this.

...R

Which motor shield ? Post link to sheild. I already have L298 datasheet. I need schematic of your shield.
Where did you connect the motor power supply battery pack ?
Where did you measure the voltage ?
That's why I need link to your shield to see what is going on.
There are about 30 different variations of L298 motor drivers out there.
[EDIT]
Most of them are not sheilds AFAIK.
The Arduino Motor Shield is an exception.
Is this the one you have ?

They are all external pcbs that do not plug into an UNO or a MEGA. If you have one that does I need to see the schematic so I need the vendor link.

arduino_MotorShield_Rev3-schematic.pdf (81.3 KB)

ok , you are right , some additional data
the engine shield is:http://arduino.cc/en/Main/ArduinoMotorShieldR3

some pics :
the project looks like that:
https://drive.google.com/file/d/0BwE-Ba3ePCwOYWNLVVlwRDhLTGs/edit?usp=sharing
a robot platforn build from makeblock parts , with arduino mega, engine shield and Bluetooth model.
the engines gets its power from 8 batteries of 1.3V each and the arduino gets its power from single 9V battery

the batteries pack:
https://drive.google.com/file/d/0BwE-Ba3ePCwOeW5iRGotQmZIMkU/edit?usp=sharing

the motor shield input/output
https://drive.google.com/file/d/0BwE-Ba3ePCwOMHVRRzlyMmVvTVU/edit?usp=sharing
the black and red wires(input voltage from bateries) gave 10.4V ,while the white wires of each engine(the output from the shield) gave only 3.6V at max from each channel

MY CODE IS HERE: its just some communication initialization of Bluetooth model HC05 and commands to the engines to increase velocity for X seconds(X is a value from user by Bluetooth serial port).

#include <Wire.h>


//Types
struct CallibratedValue 
{
  int motor_speed_A ;
  int motor_speed_B ;
} 
CallibratedValue;

int default_motor_speed = 0;


//------------------------PINS----------------------------


//Pins
int pwm_pin_A = 3;
int dir_pin_A = 12;
int brake_pin_A = 9;

int pwm_pin_B = 11;
int dir_pin_B = 13;
int brake_pin_B = 8;

int ledpin = 51;



//-------------------------------------------------------------SETUP------------------------------------------
void setup()
{

  //Motor Pins
  pinMode(dir_pin_A,OUTPUT);  
  pinMode(brake_pin_A,OUTPUT);  
  pinMode(dir_pin_B,OUTPUT);  
  pinMode(brake_pin_B,OUTPUT);

  //Communication Pins
  pinMode(ledpin,OUTPUT);

  //Buttons 


  digitalWrite(dir_pin_A,HIGH);
  digitalWrite(brake_pin_A,LOW);
  digitalWrite(dir_pin_B,LOW);
  digitalWrite(brake_pin_B,LOW);

  digitalWrite(ledpin,LOW);

  Serial1.begin(115200);
  Serial1.println("STARTING SETUP PHASE");
  Wire.begin();


  CallibratedValue.motor_speed_A = default_motor_speed;
  CallibratedValue.motor_speed_B = default_motor_speed;

  Serial1.println();
  Serial1.print("Storage:motor_speed_A: "); 
  Serial1.println(CallibratedValue.motor_speed_A);
  Serial1.print("Storage:motor_speed_B: "); 
  Serial1.println(CallibratedValue.motor_speed_B);   


}


int BluetoothData; // the data given from Computer

//---------------------------------------------------------------------MAIN------------------------------------------
void loop()
{


  //Bluietooth
  BluetoothData = -1;
  if (Serial1.available())
  {

    BluetoothData = Serial1.parseInt() ;
  }


  if (BluetoothData ==1)
  {

    Serial1.println("Insert Wanted Time Of Drive[sec]:");

    while (!Serial1.available())
    {
    }

    digitalWrite(ledpin,1); //led is on when driving
    BluetoothData = Serial1.parseInt() ;

    DriveForward(BluetoothData);
    digitalWrite(ledpin,0);
  }

}


void  DriveForward(int NumOfSeconds)

{
  unsigned long current_time,start_time,t,t_for_pereodic_printing,start_time_for_periodic_printing;
  String s;
  int  dt;
  int counter;

  Serial1.println("Driving Forward...");
  Serial1.print("Motor_speed_A "); 
  Serial1.print(CallibratedValue.motor_speed_A);
  Serial1.print(", Motor_speed_B: "); 
  Serial1.println(CallibratedValue.motor_speed_B);   
  Serial1.println("Report:counter,dt,motor_speed_A,motor_speed_B");

  start_time = millis();
  t = millis()-start_time;

  //for printing
  t_for_pereodic_printing = 0;
  start_time_for_periodic_printing = millis();
  //end printing

  dt = 0;
  counter = 1;
  while (t<NumOfSeconds*1000)  //driving NumOfSeconds forward
  {
    current_time = millis();
    s = "";
    s += counter;  
    s += " " ;      
    s += micros();
    s += " " ;      
	s += CallibratedValue.motor_speed_A;
    s += " " ;    
	s += CallibratedValue.motor_speed_B;
    s += " " ;    
    counter++;
    dt =  millis()-current_time;
    t = millis()-start_time;
    Serial1.println(s);

	t_for_pereodic_printing = millis()-start_time_for_periodic_printing;

	if (t_for_pereodic_printing>1000)  //every 1 second , increasing motor power
	{
	CallibratedValue.motor_speed_A = CallibratedValue.motor_speed_A + 15; //incresing motor power
    CallibratedValue.motor_speed_B = CallibratedValue.motor_speed_B + 15;

    analogWrite(pwm_pin_A,(int)CallibratedValue.motor_speed_A); //writing to motor pwm
    analogWrite(pwm_pin_B,(int)CallibratedValue.motor_speed_B);

	start_time_for_periodic_printing = millis();
	}

  }  

  CallibratedValue.motor_speed_A = 0; //engines off 
  CallibratedValue.motor_speed_B = 0;

  analogWrite(pwm_pin_A,CallibratedValue.motor_speed_A);
  analogWrite(pwm_pin_B,CallibratedValue.motor_speed_B);

}

May I repeat my request for a wiring diagram drawn directly from your project rather photos or diagrams from other projects. There might be a small difference that matters. Photos are next to useless.

Also, it would be much easier to help if you write the shortest possible sketch to make the motor run at, say, half speed and post that.

...R

Motor link
https://www.makeblock.cc/dc-motor-25-6v-185rpm

The most obvious explanation is that your batteries do not have a low enough internal resistance to supply the required current.
You are using dc motors and not stepper motors so you really do not need a motor shield or a uController to verify that the batteries can or cannot source the current. Simply connect the motor directly across the battery pack with a voltmeter across the motor and measure the motor voltage when you connect it to the battery pack directly. Repeat the test with the meter in series in current mode to measure the current. If the measured voltage and current match the specs on the motor vendor website and the motor turns then the problem is not the batteries. To eliminate the motor shield and motor as the source of the problem , connect a power resistor to simulate the motor to the motor shield.

Motor rated current : 650mA = 0.650 A
Motor rated voltage 6 V dc
Equivilent motor resistance = 6V /0.650 A = 9.2 ohms
Equivilent motor resistor power rating P (W) = I (A) x V (V) = 0.650 A x 6 V = 3.9 W
Equivilent motor resistor =9.2 ohms, 4W
25 ohm, 2W || 15 ohm , 2W = 9.3 ohm , 4 W (25 ohms parallel 15 ohms = 9.3 ohm, 4 W

If you the voltage across the resistors (measuring 9.3 ohms ) is about 6V when you run the code using the resistor in place of the motor then the motor shield is not the source of the problem.

Alternately , you can use 5 "D" size batteries in a 6 battery pack with a dummy #6 battery made out of wood used to press the wire against the 5th battery. (5*1.5V -7.5V which allows for a drop across the L298 transistors. If you cannot do this you can use 6 batteries.
You need at least 1.5 V more than the rated motor voltage because the transistors will drop some voltage across them.
"D" size batteries should be able to source 650mA for a short time. The ideal substitution test battery would be a 2S 2200mAh 25-30C Lipo battery which is capable of sourcing 25 * 2.2 A = 55A. (fully charged voltage = 8.4V dc, discharged voltage = 7.3V) (2 * 3.6V)
If the motor voltage was not at least 6V and the current at least 650 mA using this battery then you could rule out the battery as the source of the problem. Likewise, if you combine the power resistors with the Lipo battery you can determine if the motor shield is the problem because it should be able to generate at least 6 V across the power resistor 9.3 ohm dummy load at a current of at least 0.65 A. (650 mA)

I use Lab bench supplies for all my testing that have adjustable current and display both output voltage and current simultaneously.
When necessary I use a scope. I don't see the need for a scope (yet) for this problem.

raschemmel , thank you for the very detailed and understandable explanation
you were right!
I had a problem with my battery pack , but not the one that was connected to the motors threw motor shield ,but with the one connected to arduino board!
There I had one 9V battery , a very old and tiered one , its power was almost drained , and it couldn't deliver the current the arduino needed for the motor shield.
Only when I replaced it with 4X1.3 batteries, and checked the current and voltage on the motor terminals , I got 8V(2.4V lost on the shield) on the motors and almost 1.1A current under load (1.1A and not 0.65A I guess because I delivered 8V and not 6V as the motor nominal voltage should be) , now both engines act ok .
thank you all for your help and your time :smiley:

The L298 uses bipolar transistors which have a higher internal resistance that mosfets which causes the voltage drop in the motor shield.
(motor voltage < Motor power supply voltage). Using a 12V car or motorcycle battery as a motor power supply will show you how much of that voltage drop is caused by the 1.3V batteries you are currently using. If you substitute a motorcycle battery for the motor power supply you may see that you motor voltage across the motor is close to 12V. Unless you replace you motor power battery pack with a larger power source you will not know how much of the voltage drop is caused by the high internal resistance of your puny 1.3V batteris. A Tesla motor car uses the same kind of battery but has 3000 of them and so many of them are in parallel that the battery can source 340V at 220A. My point. ? Double your battery pack. Put a similar one in parallel with the one you have and you will see your motor voltage increase, almost guaranteed.