Problem with car robot

Hello,

I am a beginner in electronics and I wanted to create a remote controlled car, with 2 servomotors in front for the direction and 1 motor connected to the wheel axle.
I took a radio remote control wich controls the throttle and the direction.
I use a L293D for the motor, I tried to connect a 9v battery to the power circuit.
The problem is that the motor doesn’t turn fast, and very quickly it stopped and the 9v battery was now at 0v(new battery).It is the second time 9v battery does this to me.

I think it can be a problem of power supply…
I have a bigger battery and I was wondering if it was compatible.
It is a Zop Power Li-poly RC Battery 11.1v 20C 2200 mAh.
I could not find it on internet but it looks like that one :

Can someone help me please ? :slight_smile:

#include <Servo.h>
// code channel 1 direction droite gauche donc servo

int pinsServo1=6; // SERVO 1
int pinServo2=7;  // SERVO 2
Servo servo1;
Servo servo2;
int angleServo1;
int angleServo2;

//MOTEUR
int pin1Moteur=12;
int pin2Moteur=8;
int pinPMoteur=11;

void setup() {
  pinMode(3,INPUT);
  pinMode(pin1Moteur,OUTPUT);
  pinMode(pin2Moteur,OUTPUT);
  pinMode(pinPMoteur,OUTPUT);
  digitalWrite(pin1Moteur,LOW);
  digitalWrite(pin2Moteur,LOW);
  analogWrite(pinPMoteur,0);
  servo1.attach(6);
  servo2.attach(7);

  Serial.begin(9600);
  servo1.write(80);
  servo2.write(90);

  

}

void loop() {
  
  int v = pulseIn(3,HIGH,25000);
  int t = pulseIn(4,HIGH,25000);


  // POUR LE V DIRECTION SERVO CH1
  if(v<1480 && v>=1154)
  {
    //Serial.println("GAUCHE");
    angleServo1 = map(v,1479,1154,80,35);
    angleServo2 = map(v,1479,1154,90,53);
    servo1.write(angleServo1);
    servo2.write(angleServo2);   
  }
  if(v>1520 && v<=1877)
  {
    //Serial.println("DROITE"); //     DROITE
    angleServo1 = map(v,1521,1877,80,115);
    angleServo2 = map(v,1521,1877,90,135);  
    servo1.write(angleServo1);
    servo2.write(angleServo2);
  }
  if(v<=1505 && v>=1487)
  {
    //Serial.println("MILIEU"); 
    servo1.write(80);
    servo2.write(90);
  }

  // POUR LE T THROODLE CH 4
  if(t<=1130 && t>1050)
  {
    analogWrite(pinPMoteur,0);
    digitalWrite(pin1Moteur,LOW);
    digitalWrite(pin2Moteur,LOW);
  }
  if(t>=1131 && t<=1837)
  {
    digitalWrite(pin1Moteur,HIGH);
    digitalWrite(pin2Moteur,LOW);
    int etatPAnalog = map(t,1114,1837,0,255);    
    analogWrite(pinPMoteur,etatPAnalog);
    Serial.println(etatPAnalog);
  }
  delay(25);
  

}

Fritzing joined

If you are trying to use a 9v battery intended for smoke detectors, you will be disappointed. The have very little capacity.

Much better to use a larger capacity battery.
You did choose a larger capacity battery, but it is also higher voltage. I do not know the specs on your motor. Can it handle the higher voltage? You might need to manage that. Now the 293 does have a largish voltage drop, maybe 2 or 3V?

Do you have a charger that supports that 3s LiPo battery?

Thank you for your answer :slight_smile:

My engine can support up to 94V, and yes i have a charger for my 3s LiPo battery, but do you think the L293D can support the 2200mAh of the battery ?

I bet that your motor (NOT engine) cannot support 94V. But if you show us the specification we can tell for sure.

The capacity (mAh) of the battery only really affects how long it will run for. It has no other effect on the L293D.

But powering two servos from the Arduino 5V pin is a really bad idea.

Steve

You are looking at it wrong.
Compare the L293D's current capacity to what the motor is expected to draw.
The datasheet for the L293D says you have 600mA per channel.
Is the motor going to pull more than 600mA?

I believe you can parallel the half bridges to get double the capacity. 1.2A in this case.

My motor is : QK1-1288 RD845Z23 Q1
Ok so how can I power my servo please ? 1.5v batteries ?
Thank you :slight_smile:

Which servos? Various servos have various power requirements.
If it is a standard RC server, it can run on 4 AA batteries. Connect the ground to the arduino ground.

If I were powering the motor from a large LiPo, I would put a buck converter on to power the servos from the big battery.

vinceherman:
I believe you can parallel the half bridges to get double the capacity. 1.2A in this case.

So I do like if I had 2 motors except that I connect the wires of the first motor on the second if I understood ?

Sorry, no.
The L293 is a quad half bridge. It can drive 2 motors. Or you can hook up the outputs to the same motor and safely provide twice the current.

I connected L293D and motors like you said and it work :slight_smile: but now I have a program problem :confused:
With the 2 wires which are already connected to my motor it work (voltage) but the second parallel half bridges don’t work with my program (to get the double capacity 1.2A) I have tested the wires and 0v…
But when I try with a test program it work so I conclude that it is my first program which has a problem.
I couldn’t find this problem so I ask you where is the problem please ?

First real program :

#include <Servo.h>
// code channel 1 direction droite gauche donc servo
int pinsServo1=6; // SERVO 1
int pinServo2=7;  // SERVO 2
Servo servo1;
Servo servo2;
int angleServo1;
int angleServo2;

//MOTEUR
int pin1Moteur=12;
int pin2Moteur=8;
int pinPMoteur=11;

int pin1Moteur2=9;
int pin2Moteur2=13;
int pinPMoteur2=10;

void setup() {
  pinMode(3,INPUT);
  pinMode(4,INPUT);
  
  pinMode(pin1Moteur,OUTPUT);
  pinMode(pin2Moteur,OUTPUT);
  pinMode(pinPMoteur,OUTPUT);
  
  pinMode(pin1Moteur2,OUTPUT);
  pinMode(pin2Moteur2,OUTPUT);
  pinMode(pinPMoteur2,OUTPUT);
  
  digitalWrite(pin1Moteur,LOW);
  digitalWrite(pin2Moteur,LOW);
  
  digitalWrite(pin1Moteur2,LOW);
  digitalWrite(pin2Moteur2,LOW);
  
  analogWrite(pinPMoteur,0);
  
  analogWrite(pinPMoteur2,0);
  
  servo1.attach(6);
  servo2.attach(7);

  Serial.begin(9600);
  servo1.write(80);
  servo2.write(90);

  

}

void loop() {
  
  int v = pulseIn(3,HIGH,25000);
  int t = pulseIn(4,HIGH,25000);


  // POUR LE V DIRECTION SERVO CH1
  if(v<1480 && v>=1154)
  {
    //Serial.println("GAUCHE");
    angleServo1 = map(v,1479,1154,80,35);
    angleServo2 = map(v,1479,1154,90,53);
    servo1.write(angleServo1);
    servo2.write(angleServo2);   
  }
  if(v>1520 && v<=1877)
  {
    //Serial.println("DROITE"); //     DROITE
    angleServo1 = map(v,1521,1877,80,115);
    angleServo2 = map(v,1521,1877,90,135);  
    servo1.write(angleServo1);
    servo2.write(angleServo2);
  }
  if(v<=1505 && v>=1487)
  {
    //Serial.println("MILIEU"); 
    servo1.write(80);
    servo2.write(90);
  }






  // POUR LE T THROODLE CH 4
  if(t<=1130 && t>1050)
  {
    analogWrite(pinPMoteur,0);
    digitalWrite(pin1Moteur,LOW);
    digitalWrite(pin2Moteur,LOW);
    //
    analogWrite(pinPMoteur2,0);
    digitalWrite(pin1Moteur2,LOW);
    digitalWrite(pin2Moteur2,LOW);
    //
  }
  if(t>=1131 && t<=1837)
  {
    digitalWrite(pin1Moteur,HIGH);
    digitalWrite(pin2Moteur,LOW);
    
    digitalWrite(pin1Moteur2,HIGH);
    digitalWrite(pin2Moteur2,LOW);
    
    int etatPAnalog = map(t,1114,1837,0,255);    
    analogWrite(pinPMoteur,etatPAnalog);
    
    analogWrite(pinPMoteur2,etatPAnalog);
    
    Serial.println(etatPAnalog);
  }
  delay(30);
  

}

Test program :

int pin1Moteur2=9;
int pin2Moteur2=13;
int pinPMoteur2=10;

    int pin1Moteur=12;
int pin2Moteur=8;
int pinPMoteur=11;


void setup() {
  pinMode(pin1Moteur2,OUTPUT);
  pinMode(pin2Moteur2,OUTPUT);
  pinMode(pinPMoteur2,OUTPUT);
  digitalWrite(pin1Moteur2,HIGH);
    digitalWrite(pin2Moteur2,LOW);
    analogWrite(pinPMoteur2,10);


pinMode(pin1Moteur,OUTPUT);
  pinMode(pin2Moteur,OUTPUT);
  pinMode(pinPMoteur,OUTPUT);
  digitalWrite(pin1Moteur,HIGH);
    digitalWrite(pin2Moteur,LOW);
    analogWrite(pinPMoteur,10);
    
}

void loop() {
  
delay(250);
}

Thank you :slight_smile:

I have never done this myself, so don't blame me if the magic smoke comes out. :slight_smile:

Really, if anyone has paralleled the output of a dual motor driver like the L293D, speak up.
But MY understanding is that you wire the inputs for both motors together.
And you wire the outputs together.
This thread gives exact pins to tie together.

Inputs
1,15 (jumpered)
7,10 (jumpered

outputs
3,14 (jumpered)
6,11 (jumpered)

If it were me, I would tie together the inputs and run a test program to run a motor. Since the inputs are tied together, both motors sides should be powered. Then I would use a DMM to test the output. I would want to KNOW which output was positive on both side, and then tie them together. I have no reason to doubt that 3 and 14 would have the same polarity. But I would check. (I am paranoid about smoke release)

I tried but the motor don't run and my arduino started to become hot :confused:
I counldn't test the polarity because it was 0v on the outpouts...
I don't know where the problem come from ...

Not good!

Can you show us how you have it wired up?
Posting a picture of a pencil and paper drawing is good enough.

Do you know that you need to go parallel? If it works on only on side, you might be good to go.
My guess is that you don't know, because you are likely doing bench testing with the motor unloaded.
Once you put a wheel on the motor and put it on the floor, the motor will be loaded and it will pull more current.

Edit: if all else fails, there are more modern motor drivers like the Pololu DRV 8838 for single motor drive

or 8835 dual motor driver

The have 1.2A per motor.

My drawing :slight_smile:
https://www.noelshack.com/2017-29-6-1500675391-carrobot.jpeg

Thank you for your help, my car robot works just with one side of the L293D but it works :smiley: