I set up this circuit which uses L293D motor driver IC to control two DC motors.
+6V input is connected to unregulated power supply. It's current rating is 500 mA.
There is a connection between Arduino's ground line and power supplies ground line. There is a parallel 0.1 uF capacitor connected between motor terminal pins.
There is a wheel at the end of the motors but they don't have a gearbox. The wheels are suspended so that they can rotate freely.
The source code of the software is as follows.
#include <Arduino.h>
unsigned int firstMotorPositive = 8;
unsigned int firstMotorNegative = 7;
unsigned int enableFirstMotor = 9;
unsigned int secondMotorPositive = 5;
unsigned int secondMotorNegative = 4;
unsigned int enableSecondMotor = 3;
void setup()
{
pinMode(firstMotorPositive, OUTPUT);
pinMode(secondMotorPositive, OUTPUT);
pinMode(enableFirstMotor, OUTPUT);
pinMode(secondMotorPositive, OUTPUT);
pinMode(secondMotorNegative, OUTPUT);
pinMode(enableSecondMotor, OUTPUT);
// All motors are off
digitalWrite(firstMotorPositive, LOW);
digitalWrite(firstMotorNegative, LOW);
digitalWrite(secondMotorPositive, LOW);
digitalWrite(secondMotorNegative, LOW);
}
void speedControl()
{
digitalWrite(firstMotorPositive, HIGH);
digitalWrite(firstMotorNegative, LOW);
digitalWrite(secondMotorPositive, HIGH);
digitalWrite(secondMotorNegative, LOW);
for (int i = 0; i < 10; ++i)
{
for (int i = 200; i < 255; ++i)
{
analogWrite(enableFirstMotor, i);
analogWrite(enableSecondMotor, i);
delay(20);
}
}
// All motors are off
digitalWrite(firstMotorPositive, LOW);
digitalWrite(firstMotorNegative, LOW);
digitalWrite(secondMotorPositive, LOW);
digitalWrite(secondMotorNegative, LOW);
}
void loop()
{
speedControl();
delay(1000);
}
The problem is they need help to start rotating. They will only start rotating if I physically twist the shaft with my fingers first.
As far as I know the motors used in this circuit are two 6 volt DC motors.
When I measure the maximum voltage between motor terminals I read about 0.5 volts. If I twist the shaft I read about 4.5 volts.
It is interesting that, if I connect a small 1.5 volt battery between motor terminals they spin.