I cant understand why do my motors go with different velocity
I measured them and there is difference between voltage on board (these with pwm signals)
It can be that board is broken?
Is there something i can do more?
there is my code
int motor1pin1 = 2;
int motor1pin2 = 4;
int motor2pin1 = 7;
int motor2pin2 = 8;
int enA = 6;
int enB = 9;
void setup() {
// put your setup code here, to run once:
Serial.begin(9600);
pinMode(enA, OUTPUT);
pinMode(enB, OUTPUT);
pinMode(motor1pin1, OUTPUT);
pinMode(motor1pin2, OUTPUT);
pinMode(motor2pin1, OUTPUT);
pinMode(motor2pin2, OUTPUT);
}
void loop() {
analogWrite(enA, 70);
analogWrite(enB, 70);
digitalWrite(motor1pin1, LOW);
digitalWrite(motor1pin2, HIGH);
digitalWrite(motor2pin1, HIGH);
digitalWrite(motor2pin2, LOW );
}
it's that 9v battery. Totally inadequate for powering one motor(barely adequate for powering an Arduino, which is much less hungry).
And, if the Battery is just 'for the picture', then your text should clearly tell us what your real power source is, or your drawing should be revised.
According to the scheme used in the project, the robot above does not solve the maze, but rather moves according to programming commands
Delete
analogWrite(enA, 70);
analogWrite(enB, 70);
Place commands using the command
digitalWrite for each drive and direction
For a robot to solve the maze, a distance sensor must be installed.
I use now digitalWrite(enA,50) in my code as you mention, but i cant control now velocity of motors.
I want to slow down the default velocity of motors by at least half.
Two motors aren't necessarily going to rotate at the same speed just because the same voltage is applied. It would be like trying to control how fast your car is going by how far down you push the accelerator pedal... You have to watch the speedometer...
You can't reliably measure PWM with a multi-meter, but the same PWM should measure the same with the same meter, as long as the power supply voltage is "holding up".
I think you should let it be for now.
Measuring motor voltage is tricky.
Your motors are free running. That brings them in a state where the current they take is very sensitive to the speed of rotation and the speed of rotation is very dependent on the resistance of your gear box. If those are not exactly equal, you are likely to see substancial differences...
Brushes are slightly offset from being centered on the armature. This ensures there is an electrical connection to some segment when you try to start the motor. Use motors with the shaft extending on both sides of the motor, so they can turn your wheels at the same speed, the same direction.
Ah, I see. I also see yellow plastic gear boxes with drive shafts on both sides. So, there is a good chance the motors are turning the same direction, or certainly could be made that way. Has the OP run both motors from one connection controlling PWM?