hasemthinking.blogg.se

L298n motor driver arduino function
L298n motor driver arduino function







Now you will need six digital output pins on your Arduino, two of which need to be PWM (pulse-width modulation) pins. Don’t forget to connect Arduino GND to pin 5 on the module as well to complete the circuit. This can be fed to your Arduino’s 5V pin to power it from the motors’ power supply. If you supply is up to 12V you can leave in the 12V jumper (point 3 in the image above) and 5V will be available from pin 6 on the module. Next, connect your power supply – the positive to pin 4 on the module and negative/GND to pin 5. Otherwise you may need to swap them over when you set both motors to forward and one goes backwards! If you’re using two motors for a robot (etc) ensure that the polarity of the motors is the same on both inputs. First connect each motor to the A and B connections on the L298N module. To control one or two DC motors is quite easy with the L298N H-bridge module. Connect to PWM output for DC motor speed control. Leave this in place when using a stepper motor.

l298n motor driver arduino function l298n motor driver arduino function

  • 5V output if 12V jumper in place, ideal for powering your Arduino (etc).
  • Connect your motor supply voltage here, maximum of 35V DC.
  • This enables power to the onboard 5V regulator
  • 12V jumper – remove this if using a supply voltage greater than 12V DC.
  • At this point, review the connections on the L298N H-bridge module.Ĭonsider the following image – match the numbers against the list below the image:

    L298N MOTOR DRIVER ARDUINO FUNCTION HOW TO

    With the module used in this tutorial, there is also an onboard 5V regulator, so if your supply voltage is up to 12V you can also source 5V from the board.įirst we’ll run through the connections, then explain how to control DC motors then a stepper motor.

    l298n motor driver arduino function

    The L298N H-bridge module can be used with motors that have a voltage of between 5 and 35V DC. After some hunting around we found a neat motor control module based on the L298N H-bridge IC that can allows you to control the speed and direction of two DC motors, or control one bipolar stepper motor with ease. You don’t have to spend a lot of money to control motors with an Arduino or compatible board. Learn how to use inexpensive L298N motor control modules to drive DC and stepper motors with Arduino.







    L298n motor driver arduino function