DC motors with a 9v battery that still won´t work... with a bluetooth controller

Hi there,
I´m trying to create a toy car that´s controlled by bluetooth. This is my first proyect.
I´ve have some issues trying to connect the arduino mega 2560 t my adafruit motor shield. Yes, I know (now :slight_smile: that there are better, cheapper, more efficient ways to connect the arduino to those DC motors. But for now, I´m trying to connect the whole thing using the motor shield (at least until I buy the other stuff, anyway… http://forum.arduino.cc/index.php?topic=176279.0).

I have some issues:
As the arduino doesn´t have enough power to move 2 DC motors, I´ve tried adding three AA batteries… that were not enough. So I´ve finally used a 9v battery. Which it doesn´t make any difference either: the DC motors are still not moving.

The commands works, but ony “sometimes”. How can that be? I think I have everything connected ok, because it worked at first, but now it doesn´t, and don´t undertand why.

This is the code that I´ve used, and I´ve atteched the schematics.
Thanks for your insight!!

#include <AFMotor.h>
//seteos iniciales de variables cada motor va conectado al M1 y M2 de la placa de control
AF_DCMotor motor1(1);
AF_DCMotor motor2(2);
int rojo1Bluetooth=22; 
int rojo2Bluetooth=30; 
int rojo3Bluetooth=38; 
int rojo4Bluetooth=46; 
int verdeBluetooth=52;
int ledPrueba=35;

void setup() {
  //seteamos los pines, si son input o output
  pinMode(rojo1Bluetooth,OUTPUT);
  pinMode(rojo2Bluetooth,OUTPUT);
  pinMode(rojo3Bluetooth,OUTPUT);
  pinMode(rojo4Bluetooth,OUTPUT);  
  pinMode(verdeBluetooth,OUTPUT);
  pinMode(ledPrueba,OUTPUT);
  Serial.begin(9600);
}
void loop() {
char c = Serial.read();  
  if (c == 'q'){
    digitalWrite(rojo1Bluetooth,HIGH);
    digitalWrite(rojo2Bluetooth,HIGH);
    digitalWrite(rojo3Bluetooth,HIGH);
    digitalWrite(rojo4Bluetooth,HIGH);
    motor1.setSpeed(20000);
    motor1.run(BACKWARD); //los motores están al revés, por lo que backward es para ir hacia adelante
    motor2.setSpeed(20000);
    motor2.run(BACKWARD);
    }
  if (c == 'w'){
  digitalWrite(verdeBluetooth,HIGH);
  digitalWrite(rojo1Bluetooth,LOW);
  digitalWrite(rojo2Bluetooth,LOW);
  digitalWrite(rojo3Bluetooth,LOW);
  digitalWrite(rojo4Bluetooth,LOW);
  motor1.setSpeed(0);
  motor1.run(RELEASE);
  motor2.setSpeed(0);
  motor2.run(RELEASE);
  }
  if (c == 'z') digitalWrite(ledPrueba,HIGH);
  if (c == 'x') digitalWrite(ledPrueba,LOW);
  delay(1000);
}//cerramos el loop

Thinking that maybe the bluetooth has a problem of some sort, I tried this simple test, using only one of the leds:

#include <AFMotor.h>
int ledPrueba=35;

void setup() {
  pinMode(ledPrueba,OUTPUT);
  Serial.begin(9600);
}
void loop() {
char c = Serial.read();  
  if (c == 'z') digitalWrite(ledPrueba,HIGH);
  if (c == 'x') digitalWrite(ledPrueba,LOW);
  delay(1000);
}//cerramos el loop

After that I tried using the S2 bluetooth android app to connect my tablet to the blotooth slave, but nothing happens when I type “z”. If I use the “Monitor Serial” that comes with the arduino software, it does light up.

Again, thanks for your help and insight!
Rosamunda

And how much current can your 9V battery provide?

If its a small "PP3" sized one then you have no hope, these batteries provide a small current only, they are designed for powering radios, not motors.

A pack of decent-spec AA rechargeables would be more like it. If the motor shield is darlington based (L293, L298) then you'll need about 7V or more to deal with the large voltage losses inherent in darlington drivers.

You should ensure to keep the motor wiring well away from the bluetooth section of the circuit BTW. Whenever running high-current wiring such as motor leads the wires are best twisted together (and shielded if possible) to reduce EMI.

Thanks for your reply!! Could I just put together the cable of the three AA batteries with the 9v battery? All inside EXT_PWR? Thanks for your help! Rosamunda

Well, I´ve tried putting the two together (the three AA batteries and the 9v battery) into the Extra Power slots of the motor shield... and nothing happened. I mean, nothing new. The motors still don´t move, they just make this buzzing, because they are "on", but without sufficient power...

I suspect you need to take a little time-out to study volts, amps and watts. I think you will make more progress when you have a better understanding of the fundamentals of electricity.

You don't say how you have the 3xAA and the 9v battery connected. How many volts does the the 3xAA batteries produce? How does that compare to the 9v battery? How many different ways can the batteries be connected? What do you expect to happen when you connect them in the different ways they can be connected?

You haven't said what sort of 9v battery you have even though an earlier reply suggested that a small 9v battery would be unsuitable.

...R

Yeah, I guess you´re right. I´ll read some more information about voltages first... Thanks!

Rosamunda:
Thanks for your reply!!
Could I just put together the cable of the three AA batteries with the 9v battery? All inside EXT_PWR?
Thanks for your help!
Rosamunda

No at all, the 9V battery cannot handle anything like the current for a motor. You need a set of high current cells
to power a motor - AA’s with a good spec are a minimum really. (the one’s sold cheap in bulk are always to be avoided).

Connecting dissimilar batteries together is an efficient way to destroy batteries - don’t do this.

Just use 6 AA's in series and you will be good. I am also beginner and made same mistake of using 9 volt battery.

Hi,
Did you write all your code at once and are now trying to debug it?

If you have motor drive problems, you need to write some code to control the motors and forget for the moment any hint of using BlueTooth.

Just a simple code to control your motors, then when you get it working, write another separate bit of code to get your BlueTooth communications working.
OPs diagram.
86d4870a7588a01913b9fc5ef3cf173921613604.png
The Adafruit shield and library will have some example code to start with that will help.

A picture of a hand drawn circuit in jpg, png would be easier to draw and label.

Tom… :slight_smile:

Guys. Before today the previous Post was in 2013

…R

Derrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr.... :o :o :o :o :o I need coffeeeeeeeeeeeeeeee...

Tom... :)