I have earlier shown how to design motor controller with IR2110 MOSFET driver IC. This motor controller circuit is a diy alternative to motor controller shields like the L298N motor shield and L293D motor shield which is popularly used for RC cars and robotics. Here I have designed a motor controller circuit designed with IR2104 mosfet driver ICs.
The difference between IR2104 or IR2110 is the following. The IR2104 and IR2110 are both high- and low-side MOSFET half bridge driver ICs designed to drive N-channel MOSFETs in half-bridge or full-bridge configurations, but they differ significantly in features and applications. The IR2104 is a simpler and more compact driver that is typically used for basic half-bridge circuits and operates with a single input control logic for both high and low sides, with a built-in dead-time to prevent shoot-through. It is easier to use in basic motor control applications but offers less flexibility. In contrast, the IR2110 is a more advanced driver that provides independent inputs for the high-side and low-side MOSFETs, allowing for more flexible control schemes such as complementary PWM. The IR2110 also supports higher current drive capability (up to 2A), has better isolation, and is more suitable for high-performance applications like full-bridge inverters, class D amplifiers, or advanced motor drives. In summary, use the IR2104 for simpler, compact designs, and the IR2110 when you need full control, higher power handling, or more advanced timing coordination.
Circuit Diagram of IR2104 Motor Controller
Below is circuit diagram of motor controller designed with IR2104 and IRF540N driven by Arduino.
Circuit Operation
Arduino Program
// Pin Definitions
const int dir1Pin = 2; // Direction control button 1 (e.g., Forward)
const int dir2Pin = 3; // Direction control button 2 (e.g., Reverse)
const int enPin = 5; // IR2104 SD pin (active HIGH to enable)
const int pwmPinA = 9; // PWM signal for IR2104 #1 (High-side or Low-side)
const int pwmPinB = 10; // PWM signal for IR2104 #2 (High-side or Low-side)
const int potPin = A0; // Potentiometer for speed control
void setup() {
// Set direction control pins as input with pull-up
pinMode(dir1Pin, INPUT_PULLUP);
pinMode(dir2Pin, INPUT_PULLUP);
// Output pins to control IR2104 and motor
pinMode(enPin, OUTPUT);
pinMode(pwmPinA, OUTPUT);
pinMode(pwmPinB, OUTPUT);
// Enable both IR2104s (shared SD pin)
digitalWrite(enPin, HIGH);
}
void loop() {
// Read direction buttons
int dir1 = digitalRead(dir1Pin);
int dir2 = digitalRead(dir2Pin);
// Read potentiometer value (0–1023)
int potValue = analogRead(potPin);
// Map pot value to PWM range (0–255)
int pwmValue = map(potValue, 0, 1023, 0, 255);
// Motor direction logic
if (dir1 == LOW && dir2 == HIGH) {
// Forward: A = PWM, B = 0
analogWrite(pwmPinA, pwmValue);
analogWrite(pwmPinB, 0);
}
else if (dir1 == HIGH && dir2 == LOW) {
// Reverse: A = 0, B = PWM
analogWrite(pwmPinA, 0);
analogWrite(pwmPinB, pwmValue);
}
else {
// Stop: both inputs LOW or both HIGH
analogWrite(pwmPinA, 0);
analogWrite(pwmPinB, 0);
}
}