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 ?
#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