L298 Dual H-Bridge Motor driver


The Funduino Tracking Maze also comes with a L298 Dual H-Bridge Motor driver to control the two wheels of the robot.  It’s designed to drive inductive loads, such as relays, solenoids, DC and stepping motors. It can also let us drive two independent DC motors, controlling the speed and direction of each one .

The connections on the board are fairly simple to understand:


Here we have several connectors for the motors (from left to right):

Motor A Power Motor B
VCC + GND VMS (vcc) + GND + 5v (external power) Vcc + GND
Note: To connect to arduino, we use VMS + GND. NOT 5v


The PINS connections,  we have 8 (From left to right):

  • 5v
  • GND
  • ENB ( Motor B enable PIN)
  • IN4 (Motor B direction 2 PIN)
  • IN3 (Motor B direction 1 PIN)
  • IN2 (Motor A direction 2 PIN)
  • IN1 (Motor A direction 1 PIN)
  • ENA (Motor A enable PIN)

So, here’s a small resume of directions and how to control them:

Enable Motor HIGH – Enable LOW – Disable Motor
Direction 1 IN1 – HIGH IN2 – LOW
Direction 2 IN1 – LOW IN2 – HIGH
Coasting IN1 – LOW IN2 – LOW
Break IN1 – HIGH IN2 – HIGH

Bellow is a small code to test both DC motors. Here is the connections:

Arduino PIN Dual H-Bridge L298
10 ENA
2 IN1
3 IN2
4 IN3
5 IN4


And now, a little program with some functions defined for directions:

One Reply to “L298 Dual H-Bridge Motor driver”

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.