6.0 HW‐130 Motor Driver – Arduino Integration Guide - SwollEngineAF/lipan GitHub Wiki

🔌 HW-130 Motor Driver – Arduino Integration Guide

This page documents how to wire, control, and integrate the HW-130 (L298N-based) Dual H-Bridge Motor Driver with an Arduino board, particularly for robotics applications like the Dua Lipan project.


📦 Overview

The HW-130 is a compact motor driver module capable of driving 2 DC motors or 1 stepper motor using standard 5–12V supply. It’s based on the L298N H-bridge chip and is ideal for Arduino-based motion control systems.


⚙️ Specifications

Feature | Details -- | -- Voltage Range | 5V – 12V Motor Channels | 2 DC motors (A & B) Max Current | 2A per channel (peak) Control Logic Level | 5V TTL (compatible with Arduino) PWM Control | Yes (ENA and ENB) Heat Sink | Yes 5V Regulator Output | Yes (Do not use for high current draw)

Same logic applies for IN3/IN4 and Motor B.


🚀 Example Arduino Code

cpp
CopyEdit
#include <Arduino.h> #define ENA 5 #define IN1 6 #define IN2 7 #define ENB 9 #define IN3 10 #define IN4 11 void setup() { pinMode(ENA, OUTPUT); pinMode(IN1, OUTPUT); pinMode(IN2, OUTPUT); pinMode(ENB, OUTPUT); pinMode(IN3, OUTPUT); pinMode(IN4, OUTPUT);

Serial.

begin(9600); } void loop() { if (Serial.available()) { char cmd = Serial.read(); if (cmd == 'F') { analogWrite(ENA, 180); digitalWrite(IN1, HIGH); digitalWrite(IN2, LOW); analogWrite(ENB, 180); digitalWrite(IN3, HIGH); digitalWrite(IN4, LOW); } else if (cmd == 'B') { analogWrite(ENA, 100); digitalWrite(IN1, LOW); digitalWrite(IN2, HIGH); analogWrite(ENB, 100); digitalWrite(IN3, LOW); digitalWrite(IN4, HIGH); } else if (cmd == 'S') { analogWrite(ENA, 0); analogWrite(ENB, 0); } } }

📎 Tips

  • For safe operation, add a 470µF capacitor across VCC and GND.

  • Use heatsink and airflow if driving motors at high current.

  • Double-check polarity before applying battery power.

⚠️ **GitHub.com Fallback** ⚠️