DC Motor Control with Arduino and L9110S Driver Tutorial

Added:

Limitations of Software-Interrupt Brushed DC Control vs. Dedicated Hardware and BLDC Systems

While the Arduino and L9110S setup is excellent for beginners, it has significant limitations in professional and high-performance applications. The L9110S is an inefficient, older bipolar junction transistor (BJT) driver that suffers from high voltage drops, excessive heat generation, and lacks modern safety features like thermal shutdown or overcurrent protection. Furthermore, relying on CPU interrupts on an 8-bit microcontroller (like the Arduino Uno) for rotary encoder decoding can easily overwhelm the processor at high motor speeds, leading to missed steps and system instability. For robust, high-efficiency applications, industry standards favor Brushless DC (BLDC) motors controlled via Field-Oriented Control (FOC) or dedicated hardware motion controllers (such as Trinamic chips). These hardware-offloaded systems handle commutation and encoder feedback independently of the main microcontroller, ensuring precise speed and position control without exhausting CPU resources.

Basic Arduino programming and familiarity with the IDE, including setup, loop, and digital/analog I/O functions.
Fundamental DC motor concepts, including why microcontrollers require an external driver to handle high-current loads.
The concept of Pulse Width Modulation (PWM) and how it is used to control analog-like behavior such as motor speed.
The operational theory of an H-bridge circuit for reversing motor current and direction.
The basic concept of hardware interrupts and why they are necessary for capturing high-frequency signals from rotary encoders.
Implementing a PID (Proportional-Integral-Derivative) control loop to achieve precise closed-loop speed and position regulation.
Exploring high-power motor drivers (such as TB6612FNG or BTS7960) and transitioning to Brushless DC (BLDC) or stepper motor control.
Integrating the dual-motor control system into a differential-drive mobile robot utilizing odometry-based navigation.
Designing finite state machines (FSM) in software to coordinate complex motion profiles and safety limits.
Interfacing the Arduino motor controller with a primary microcomputer (like Raspberry Pi) using serial, I2C, or ROS (Robot Operating System).
108.4K views446likes12:01@BrainybitsCanadaOriginal Release: 2015-01-27

This tutorial demonstrates how to control a DC motor's speed and direction using a rotary encoder and L9110S motor driver with Arduino. The rotary encoder provides continuous rotation input that is read via interrupt on pin 2, allowing the code to efficiently detect rotation changes without blocking other operations. The encoder's clock pin triggers an interrupt when the rotor position changes, enabling real-time speed and direction control. The motor driver uses PWM signals on pins 10 and 11 to control motor speed, while the direction pin determines rotation direction. A switch integrated in the encoder can reset the motor position to zero. The code maps encoder position values to motor speed, with positions between 0-11 resulting in no movement, 10-20 producing slow forward speed, and 90-100 producing full forward speed.