The mLink L9110 motor controller is a serial (I2C) 2 channel DC motor driver that is capable of driving up to two DC motors at a maximum current of 800mA per motor. It is capable of independently controlling the motors direction and speed with a resolution of 255 steps in each direction.
If control of more than 2 motors is required multiple modules can be linked together and controlled from the same I2C bus. The module includes screw terminals for convenient connector of the motors and external motor power.
Compatible with microcontrollers equipped with an I2C interface, including popular Arduino models, wireless ESP devices, and Raspberry Pi, this module offers versatile control options. As part of the mLink series, it seamlessly integrates with other mLink modules. This means you can easily daisy-chain multiple mLink modules, enabling centralised control through a single serial interface.
For Arduino users you can use the mLink library (see below for library and examples) to control any type of mLink module. Only one single instance of the library is needed to control multiple types of mLink modules resulting in very little resource overhead and therefore making it great for Arduinos with small amounts of memory and pin counts.
For Raspberry Pi users we have a Python module which can be installed via pip or downloaded and installed directly from our forum. Please see the mLink Python forum thread for requirements and download link here: viewtopic.php?f=131&t=3062&p=8592#p8592
Module code: HCMODU0199 Supply voltage (VDD): 3.3V to 5.5V Current consumption (idle): TBA 6mA I2C Interface speed: 400kbits/s (fast mode) I2C default address (HEX): 0h5D Maximum number of modules: 5 with pullups fitted, 112 with pullups removed* Motor supply voltage (via 1+ & 2+): 2.5V to 12V Motor max current (continuous): 800mA per channel Motor speed resolution: 256 steps in both forward and reverse directions Motor duty cycle time: 12.8ms Module dimensions ex headers (LxWxH): 41mm x 37mm x 13mm
*Note the maximum number of connected modules will depend on cable lengths and power requirements of each module. Do not exceed 5 mLink modules connected in series with I2C pullups fitted to all modules. For disconnecting pullups see forum post.
Arduino Connection Example:
- /*
- This sketch uses the mLink library to control the speed and direction
- of two DC motors connected to the modules two driver outputs.
- */
- #include "mLink.h" // Include the library
- mLink mLink; // Create an instance of the library
- #define I2C_ADD 0x5D // Default I2C address
- void setup()
- {
- mLink.init(); // Initialise the library
- // Stop both motors
- mLink.L9110_M1_Stop(I2C_ADD);
- mLink.L9110_M2_Stop(I2C_ADD);
- }
- void loop()
- {
- while(1);
- // MOTOR 1 FORWARD
- mLink.L9110_M1_Dir(I2C_ADD, FORWARD);
- mLink.L9110_M1_Speed(I2C_ADD, 128); delay(2000); // Half speed
- mLink.L9110_M1_Speed(I2C_ADD, 255); delay(2000); // Full speed
- mLink.L9110_M1_Speed(I2C_ADD, 128); delay(2000); // Half speed
- mLink.L9110_M1_Speed(I2C_ADD, 0); delay(2000); // Stop
- // MOTOR 1 REVERSE
- mLink.L9110_M1_Dir(I2C_ADD, REVERSE);
- mLink.L9110_M1_Speed(I2C_ADD, 128); delay(2000); // Half speed
- mLink.L9110_M1_Speed(I2C_ADD, 255); delay(2000); // Full speed
- mLink.L9110_M1_Speed(I2C_ADD, 128); delay(2000); // Half speed
- mLink.L9110_M1_Speed(I2C_ADD, 0); delay(2000); // Stop
- // MOTOR 2 FORWARD
- mLink.L9110_M2_Dir(I2C_ADD, FORWARD);
- mLink.L9110_M2_Speed(I2C_ADD, 127); delay(2000); // Half speed
- mLink.L9110_M2_Speed(I2C_ADD, 255); delay(2000); // Full speed
- mLink.L9110_M2_Speed(I2C_ADD, 127); delay(2000); // Half speed
- mLink.L9110_M2_Speed(I2C_ADD, 0); delay(2000); // Stop
- // MOTOR 2 REVERSE
- mLink.L9110_M2_Dir(I2C_ADD, REVERSE);
- mLink.L9110_M2_Speed(I2C_ADD, 128); delay(2000); // Half speed
- mLink.L9110_M2_Speed(I2C_ADD, 255); delay(2000); // Full speed
- mLink.L9110_M2_Speed(I2C_ADD, 128); delay(2000); // Half speed
- mLink.L9110_M2_Speed(I2C_ADD, 0); delay(2000); // Stop
- }
Raspberry Pi Connection Example:
Please note: when connecting to a Raspberry Pi the mLink modules I2C pullup resistors should be removed. See the 'Removing the modules I2C pullup resistors' section below for more information.
- # mLink L9110 DC motor controller example
- # This example requires the mLink module to be installed. Please see
- # library forum thread for more information:
- #
- # TBA
- from mLink import mLink # Import the mLink module
- import time
- ml = mLink.mLink(1) # Create an instance of the module
- I2C_ADD = 0x5D # Default I2C address is 0x52
- # Stop both motors
- ml.L9110_M1_Stop(I2C_ADD)
- ml.L9110_M2_Stop(I2C_ADD)
- while 1:
- # MOTOR 1 FORWARD
- ml.L9110_M1_Dir(I2C_ADD, ml.FORWARD)
- ml.L9110_M1_Speed(I2C_ADD, 128) # Half speed
- time.sleep(2)
- ml.L9110_M1_Speed(I2C_ADD, 255) # Full speed
- time.sleep(2)
- ml.L9110_M1_Speed(I2C_ADD, 128) # Half speed
- time.sleep(2)
- ml.L9110_M1_Speed(I2C_ADD, 0) # Stop
- time.sleep(2)
- # MOTOR 1 REVERSE
- ml.L9110_M1_Dir(I2C_ADD, ml.REVERSE)
- ml.L9110_M1_Speed(I2C_ADD, 128) # Half speed
- time.sleep(2)
- ml.L9110_M1_Speed(I2C_ADD, 255) # Full speed
- time.sleep(2)
- ml.L9110_M1_Speed(I2C_ADD, 128) # Half speed
- time.sleep(2)
- ml.L9110_M1_Speed(I2C_ADD, 0) # Stop
- time.sleep(2)
- # MOTOR 2 FORWARD
- ml.L9110_M2_Dir(I2C_ADD, ml.FORWARD)
- ml.L9110_M2_Speed(I2C_ADD, 128) # Half speed
- time.sleep(2)
- ml.L9110_M2_Speed(I2C_ADD, 255) # Full speed
- time.sleep(2)
- ml.L9110_M2_Speed(I2C_ADD, 128) # Half speed
- time.sleep(2)
- ml.L9110_M2_Speed(I2C_ADD, 0) # Stop
- time.sleep(2)
- # MOTOR 2 REVERSE
- ml.L9110_M2_Dir(I2C_ADD, ml.REVERSE)
- ml.L9110_M2_Speed(I2C_ADD, 128) # Half speed
- time.sleep(2)
- ml.L9110_M2_Speed(I2C_ADD, 255) # Full speed
- time.sleep(2)
- ml.L9110_M2_Speed(I2C_ADD, 128) # Half speed
- time.sleep(2)
- ml.L9110_M2_Speed(I2C_ADD, 0) # Stop
- time.sleep(2)
Other useful information:
Factory Reset:
Should you wish to restore the module back to its factory default configuration, this can be done by manually forcing a factory reset. All mLink modules include a set of pads labelled clear:
To perform a factory reset carefully link the two pads together with a piece of wire or with something conductive such as a paperclip. Whilst linked, connect power to the module via the VCC and GND connections. Wait a few seconds and then remove the short from the pads. The module's settings, including its I2C address, should now be restored back to factory defaults.
Removing I2C pullups:
If your development board already has pullups for its I2C interface fitted, or you wish to connect more than 5 mLink boards to the same I2C interface, then you can remove the pullups for the additional boards by cutting the tracks between the solder pads shown below.
mLink Arduino library
viewtopic.php?f=58&t=3001
Please note you will need at least V1.7.1 (20 Oct 2023) of the library to support this module. If you have an older version already installed please update it to the latest version.
mLink Raspberry Pi Python module
The mLink python module can be installed with the following terminal command:
- pip install hc-mlink
Alternatively the library can be manually installed by downloading it from the forum and unzipping it to your project folder. See the Python module forum thread for more information and download link:
viewtopic.php?f=131&t=3062&p=8592#p8592
Please note that in some cases there may be additional configuration required. If you have issues getting your Raspberry Pi to communicate with the mLink module then please see the Python module forum thread here: viewtopic.php?f=131&t=3062
mLink Specifications and Register Map
https://hobbycomponents.com/downloads/m ... er_Map.pdf
Libraries, example code, and diagrams are provided as an additional free service by Hobby Components and are not sold as part of this product. We do not provide any guarantees or warranties as to their accuracy or fitness for purpose.