Skip to main content
Share Your Experience: Take the 2024 Developer Survey
10 votes

L298 works only when touched

Your schematic does not show a connection from the ground line of the 12V battery to the GND connection on the Arduino. This is required.
jose can u c's user avatar
  • 6,974
4 votes
Accepted

`servo.attach()` paralyzing (one) motor on L298N

The Servo library uses Timer 1 to create the servo control signal. That means it can run the servo on any pin or combination of pins, and at the 50Hz speed that a servo likes best. However, pins 9 ...
Majenko's user avatar
  • 105k
3 votes

Beginner problem with DC motor

To analyze your problem: Switch two wires between two motors (and repeat this to get all combinations), to find out if the code/wiring until the motors is wrong, or there is a problem with the motors....
Michel Keijzers's user avatar
3 votes

DC Motor not running with the L298N (Green) card

First: The connection between the 5V pin of the L298N and Arduino Vin is not correct here. The L298N 5V pin is an output. You could use it to power the Arduino. But then you would have to connect it ...
chrisl's user avatar
  • 16.3k
2 votes
Accepted

How to control a Nema 17 stepper motor with an arduino? (too much current / heat)

The stepper motor does not directly control or limit its own current. When using the L298n for stepper control, the motor current control is performed by a PWM signal to the L298n ENABLE pin. If you ...
Dave Johnson's user avatar
2 votes

Arduino - stepper motor wrong steps number

You're driving the stepper too fast, unintentionally though. The while loop you use to delay is likely optimized out by the compiler: while (tmp2++<Speed); Easiest way to fix would be to declare ...
lornix's user avatar
  • 141
2 votes

I want to make my stepper motor work for 1 hour

The problem you have is you are treating minutes and hours separately. That won't work - they need to be combined. As it stands your "on" time is: Minutes greater than W, and Hours greater than X, ...
Majenko's user avatar
  • 105k
2 votes
Accepted

Controlling motors and servo with L298N

The comment you have found which is also on the Servo library page https://www.arduino.cc/en/Reference/servo and is the core of your problem. On an Uno, you will have to change the PWM pins to 3,5,6 ...
user85471's user avatar
  • 731
2 votes

Arduino RFID with motor and limit switches

C++ and C only reads function declarations and globals from top to bottom, it will not look ahead to see if any others were defined. You can put a declaration of the functions you want to use above ...
ratchet freak's user avatar
2 votes

Arduino 4wd rover

You need more power! The formula for power is Volts * Amps. A PP3 has about 500mAh, which means its can (in theory) output 9V at 500mA for an hour, which means you have about 4.5 watts. So what ...
Code Gorilla's user avatar
  • 5,637
2 votes
Accepted

L298N beeps and malfunctions when receiving certain analogWrite values

Ok, here is my theory what's happening: Every motor has an amount of friction at his rotor. You need to pass enough energy to overcome this friction, or the motor will not move. When you use ...
chrisl's user avatar
  • 16.3k
2 votes
Accepted

Motor isnt spinning when using L298N motor controller

You need two supply voltages for this board to work: motor supply, which goes directly to your motor (up to 35V for this L298N board, depends on what your motor needs), and logic supply of 5V, which ...
AnT stands with Russia's user avatar
2 votes

L298N Dual Motor Controller Enable Pin has power but motors not working

I found this thread for a similar problem, I realized that my scratch (taken from here) wasn't able to works.. After many and many tries, I found that: the scratch works only using Serial Plotter, and ...
Marco's user avatar
  • 21
2 votes

How to communicate between a webcam and an Arduino UNO and get the live feed on mobile using ESP8266?

As rightly pointed out by others and @JRobert, its very difficult or nearly impossible to live stream a video/audio through Arduino Uno which uses Atmega328 micro-controller which is mostly used for ...
Rajendra's user avatar
  • 156
2 votes
Accepted

How to communicate between a webcam and an Arduino UNO and get the live feed on mobile using ESP8266?

The Uno is a very limited platform, perhaps surprisingly, given its wide range of abilities and built-in hardware features. The two most glaring limitations for you application are its 16MHz clock ...
JRobert's user avatar
  • 15.3k
2 votes

Arduino Vin pin does not work, but Arduino 5v pin power works

The Vin pin on the Arduino Uno board is connected to the input of the 5V onboard voltage regulator of the Arduino board. This voltage regulator needs an input voltage that’s about 1.5V above its (...
StarCat's user avatar
  • 1,651
2 votes
Accepted

How to power Arduino Uno from L298N motor driver's 5v terminal?

Clearly, your design (last image) won't work, because as you expected, the Arduino won't have power. It is a feasible design however, if you use it while still developing and you have the USB cable ...
PMF's user avatar
  • 1,296
2 votes

are 4AA batteries (6V) power my arduino

I understand you situation completely as I had also previously experienced the same problem. 9 V batteries are not enough to get the job done. Therefore, I suggest you to use two 3.7 V Batteries. ...
vasantha raj's user avatar
1 vote

can i use L298N H bridge with 12v 7AH battery?

Yes, though at 2A you're at the top end of the L298N current limit. Expect excessive heating. You will have to manage your thermal environment appropriately. You should consider a more capable driver ...
Majenko's user avatar
  • 105k
1 vote

Power 5v from l298n to 5v pin arduino

Power the arduino from your batteries via the Vin (barrel Jack) use the arduino to supply the 5V to the L298 module and connect all the grounds together. That should do it.
Gil's user avatar
  • 1,833
1 vote

How to control DC motor speed with L298N and Node MCU?

That's because the l298n library are used for the arduino or other microcontroller that have hardware PWM in their systems. The library using hardware pwm by generating pulses and make variations of ...
user11249082's user avatar
1 vote

DC Motor Control L298N

const int p1=7;//pwm pin for motor 1 const int p2=8; //pwm pin for motor 2 PWM pins on a '168 are 3,5,6,9,10,11
CrossRoads's user avatar
  • 2,415
1 vote

Help me get my robotic car to work?

The ENA/ENB (enable A/B) pins have to be at HIGH level (either hardwired or set by an mcu). There exist lots of different driver boards (mostly based on the same ICs) which sometimes don't provide ...
Sim Son's user avatar
  • 1,869
1 vote

L298N motor driver issue

The specified minimum voltage for the motors is 2.5 volts higher than the logic supply. You need to use a separate supply for the motor that is higher than the logic power.
Rudy's user avatar
  • 993
1 vote

can I check if why my motor isn't working?

Well, your wiring is OK, but I think the 'digitalWrite(enB, HIGH); in the loop() code is causing your problem. You don't want to try to use the same pin for both digital and analog functions. I ...
starship15's user avatar
1 vote
Accepted

Not able to control DC motor speed with l298N & pwm pins

Modifying the library code file L298N.cpp. Insert 2 lines in setSpeed(): void L298N::setSpeed(unsigned short pwmVal) { _pwmVal = pwmVal; if (_ismoving == true) // +++ ...
gohigh's user avatar
  • 26
1 vote

Not able to control DC motor speed with l298N & pwm pins

Try to use this code, without the library, and be sure to connect every pin to the correct Arduino output. If everything is okay it should work. Check the tutorial here int IN3 = 5; int IN4 = 4; ...
imTDB's user avatar
  • 182
1 vote

DC motors not running using PWM and L298N motor driver

According to the Servo reference page it's not possible to use Servo library and PWM outputs on the pins 9 and 10. On boards other than the Mega, use of the library disables analogWrite() (PWM) ...
KIIV's user avatar
  • 4,752
1 vote

running a dc motor with a small L298N module and an arduino and the L298N library

PWM is used to control the duty cycle and not the voltage directly so your PWM will work directly on the input pins of motor driver and you will be able to control the speed. just use analogWrite on ...
Sudhanshu Shivam's user avatar

Only top scored, non community-wiki answers of a minimum length are eligible