Except that I connected only 1 motor and my supply battery was 9v. The Arduino code is as shown below:
int enA = 9;
int in1 = 8;
int in2 = 7;
void setup() {
// put your setup code here, to run once:
pinMode(enA, OUTPUT);
pinMode(in1, OUTPUT);
pinMode(in2, OUTPUT);
digitalWrite(in1, LOW);
digitalWrite(in2, LOW);
}
void loop() {
// put your main code here, to run repeatedly:
digitalWrite(in1, HIGH);
digitalWrite(in2, LOW);
analogWrite(enA, 255);
delay(2000);
}
But the motor is not rotating just shaking(like small trembles) a bit but not rotating. Please help soon.
I am not sure of the motor rating as I did not buy it; I used one that was already available. It works when it is directly connected to 3v (2*1.5v) battery. I believe it is a 3-9V toy motor.
Dear Swetha,
I faced such situation years ago when I bought L298N from amazon and I surprised that same driver when bought from Robu.in worked. Sometime the problem of motor-drivers. I recoomemnd to check by connecting other L298N or L293D. best is to use Arduino L293D shield. I recently bought and it cost me Rs. 145/-.
@swethatsunil.mec It looks like you are giving the supply to the Arduino and Driver ckt from the same 9V battery. Have you tried giving the power to the Arduino from a separate source, say your PC/laptop or 9V adapter?? If not, then give it a try. Also, check if the yellow-grey wire pair is connected to appropriate terminals. If this works then alright otherwise try replacing the driver ckt.
But, the motor is still just shaking(trembling) not rotating when connected to the same circuit. So I believe that the circuit is working fine, it is something about the rating of the DC motor. Please help.
@akshaykumar.kumar198
Sir, I tried that too. When i give different supply to Arduino and driver circuit I can hear the motor rotating and its vibrations, but the shaft is not rotating.
@vinayak.joshi The motor is working when connected directly to 9V and also when directly connected to 3V. And I believe the circuit is working because the same circuit with single common 9V supply to both Arduino and driver circuit is working for a 12V fan as mentioned in
hey. wondering if its possible to build a dual axis solar tracker without Arduino or breadboard but using L298N motor driver? if so, I would appreciate a circuit diagram. thanks.
DC voltage control is the method to vary DC fan speed and this can be implemented by incorporating resistances in the supply wire. The voltage drop across the series resistor reduces the voltage reaching the fan supply pin, automatically slowing the speed of the fan. @swethatsunil.mec