speed = map(speed, 0, 255, 30, 255); analogWrite(ENB, constrain(speed, 0, 255));
| Function | Arduino Pin | HW-130 Label | Datasheet Mistake | |----------|-------------|--------------|--------------------| | Motor A Enable (PWM) | D10 | ENA | Often mislabeled as "PWM A" | | Motor A Input 1 | D9 | IN1 | Correct | | Motor A Input 2 | D8 | IN2 | Correct | | Motor B Enable (PWM) | D5 | ENB | Often mislabeled as "PWM B" | | Motor B Input 3 | D7 | IN3 | Correct | | Motor B Input 4 | D6 | IN4 | Correct | | Logic Supply (5V) | 5V pin | +5V | Some clones skip this | | GND | GND | GND | Correct | hw 130 motor control shield for arduino datasheet better
This article serves as the to the raw datasheet. We will dissect every technical specification, explain the actual circuit logic, provide corrected wiring diagrams, and show you how to maximize performance. By the end, you will know more about the HW-130 than any six-page datasheet could ever teach you. What Exactly is the HW-130? The HW-130 is an Arduino shield based on the L298N dual H-bridge driver IC . It is designed to control two DC motors (or one stepper motor) with direction and speed control. Unlike bare L298N modules, the HW-130 comes as a shield that stacks directly onto an Arduino Uno, Leonardo, or Mega 2560. speed = map(speed, 0, 255, 30, 255); analogWrite(ENB,
void motorA(int speed) // speed: -255 to 255 if (speed > 0) digitalWrite(IN1, HIGH); digitalWrite(IN2, LOW); else if (speed < 0) digitalWrite(IN1, LOW); digitalWrite(IN2, HIGH); speed = -speed; else digitalWrite(IN1, LOW); digitalWrite(IN2, LOW); What Exactly is the HW-130
The datasheet never mentions this, but the shield works fine for light stepper loads (NEMA 17 size max). If you found this article searching for a "better" solution, here's the honest verdict:
// HW-130 Motor Control Shield - Advanced Example // Pins based on actual shield mapping (better than generic L298N examples) #define ENA 10 #define IN1 9 #define IN2 8 #define ENB 5 #define IN3 7 #define IN4 6