Run the same motor through both drivers and learn why there is more than one. The L9110 takes two pins per motor and you PWM one of them. The L293D separates the jobs: direction on the input pins, speed on a dedicated enable pin, which is the arrangement most driver chips use and the one worth knowing. The L293D also accepts a much higher motor supply, so it is the one you reach for when the motor is bigger than this kit's. Both have flyback diodes built in — wire a motor straight to a GPIO pin without one and you damage the board.
Every item is in the kit — nothing extra to buy.
All 24 parts in one box, with this project and 15 more to build from them.
One of each part. Packs (resistor assortment, jumper wires) already hold more than a single build needs. Backorder parts ship once they arrive — the kit above has every part boxed today. Delivery is free on orders AED 150.00+.
Written for the board in the kit. Copy it into the Arduino IDE; change the pin numbers if you wire it differently.
/*
11 — Two drivers, one motor
Board: ESP32. Parts: DC motor, L293D module, L9110 module.
Same motor, two drivers, to see why there is more than one.
L9110: two pins per motor, PWM on one of them.
L293D module: direction on IN1/IN2, speed on a separate ENABLE pin. It supports a
wider motor-supply voltage range and separate enable control, while the L9110
module is simpler for small low-voltage motors like the one in this kit.
Both modules include motor-protection circuitry. A motor straight on a GPIO
can damage the board.
Wiring (move the motor between the two — only one driver at a time):
L9110: VCC -> VIN (5 V), GND -> GND, A-1A -> GPIO 16, A-1B -> GPIO 17, motor -> MOTOR A
L293D: VCC/+5 -> VIN, motor supply (VS / +12V terminal) -> VIN for this small motor,
GND -> GND, IN1 -> GPIO 25, IN2 -> GPIO 33, ENA -> GPIO 32, motor -> OUT1/OUT2
(some modules have ENA jumpered permanently HIGH — then remove the
jumper to control speed, or leave it and the ENA line does nothing)
Set DRIVER below to match where the motor is plugged in.
*/
#define DRIVER_L9110 1
#define DRIVER_L293D 2
#define DRIVER DRIVER_L9110 // <-- change to DRIVER_L293D for the second half
const int L9110_A1A = 16, L9110_A1B = 17;
const int L293D_IN1 = 25, L293D_IN2 = 33, L293D_ENA = 32;
void driveL9110(int speed) { // speed -255..255
if (speed >= 0) { analogWrite(L9110_A1A, speed); digitalWrite(L9110_A1B, LOW); }
else { digitalWrite(L9110_A1A, LOW); analogWrite(L9110_A1B, -speed); }
}
void driveL293D(int speed) { // direction on IN1/IN2, magnitude on ENA
digitalWrite(L293D_IN1, speed >= 0 ? HIGH : LOW);
digitalWrite(L293D_IN2, speed >= 0 ? LOW : HIGH);
analogWrite(L293D_ENA, abs(speed));
}
void drive(int speed) {
#if DRIVER == DRIVER_L9110
driveL9110(speed);
#else
driveL293D(speed);
#endif
}
void setup() {
Serial.begin(115200);
const int pins[] = {L9110_A1A, L9110_A1B, L293D_IN1, L293D_IN2, L293D_ENA};
for (int p : pins) { pinMode(p, OUTPUT); digitalWrite(p, LOW); }
Serial.println(DRIVER == DRIVER_L9110 ? "Driver: L9110" : "Driver: L293D");
}
void loop() {
// Ramp forward, pause, ramp backward, pause — the same pattern on either driver.
for (int s = 70; s <= 255; s += 5) { drive(s); delay(30); }
delay(800);
drive(0); delay(500);
for (int s = -70; s >= -255; s -= 5) { drive(s); delay(30); }
delay(800);
drive(0); delay(1500);
}
The SG90 holds a commanded angle rather than just spinning, which is what makes it useful for gates, dispensers and valves. You drive it with a PWM pulse whose width set…
Turn the knob, the motor changes speed. PWM switches power on and off faster than the motor can respond, so average voltage falls and so does speed. You also learn why a…
Mount the ultrasonic sensor on the servo, sweep it through its range, and record distance at each angle. You now have a set of angle-and-distance pairs — a crude map of…