Bluetooth seems to work but not properly?

Hello,

I have an arduino uno connected up to a HC-05 bluetooth module and some motors that are connected to a driver. I have been able to connect to the module but for some reason when I send a command to the module the motors only move very slightly and stop instead of constantly rotating. When connected via cable everything works perfectly. I currently have it connected to a 9V battery and have tried using 2 9V batteries to no avail. I have not seen this problem anywhere and would really appreciate some help. I have attached my code. I'm also using Tera Term if that makes a difference.

Thank you

char t;
 
void setup() {
pinMode(13,OUTPUT);   
pinMode(12,OUTPUT);   
pinMode(11,OUTPUT);   
pinMode(10,OUTPUT);   
Serial.begin(9600);
 
}
 
void loop() {
 if(Serial.available()){
  t = Serial.read();
  Serial.println(t);
}
 
if(t == 'u'){            
  digitalWrite(13,HIGH);
  digitalWrite(11,HIGH);
}
if (t =='s') {
  digitalWrite(13, LOW);
  digitalWrite(11, LOW);
}


delay(100);
}

Welcome to the forum

Please don't do that

Please follow the advice given in the link below when posting code, in particular the section entitled 'Posting code and common code problems'

Use [color = red]code tags[/color] (the </> icon above the compose window) to make it easier to read and copy for examination

Please post a schematic. Written descriptions are always more ambiguous than a drawing. Hand drawn, photographed and posted is fine. Include all pin names/numbers, components, their part numbers and/or values and power supplies. Include technical data for the components.

My set up is the same as this minus the light and with a 9V battery. I am also using these motors motors.

If you mean that you are using a PP3 battery then no wonder you have problems because they are not designed to provide the require current

How much current is necessary?

The motors are going to take the most current. Do you have a specification for them ?

The Uno, by itself, needs about 50mA.
What is the stall current of the motors? The stall current can be several times the running current. The stall current will be drawn, briefly, every time that the motor is started. The stall current should be listed in the motor data sheet.

You will need a supply that can provide for the Uno plus the stall current of 4 motors.

The motors specify 3.2V with rated current 200mA with rated load current of 1750 mA. This is the link to them Motors.

How many volts are you supplying them with ?

Let's call that 2 Amps to make things easy

You have 4 motors so they need to supply about 8 Amps when they are stalled as they are when they start up

No wonder a PP3 won't cut the mustard

That ancient technology L298 driver is not really the best (OK, it is nearly the worst) motor driver for use with a battery powered project. It will drop 2V to over 4V of the motor power supply and dissipate that power as heat.

Pololu has a good line of modern motor drivers. Choose the motor driver based on the stall current of the motor and the motor supply voltage.

Great! Thank you for the help, it is much appreciated!

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.