mLink L9110 DC motor controller (HCMODU0199)

mLink serial I2C modules
Post Reply
admin
Site Admin
Posts: 867
Joined: Sun Aug 05, 2012 4:02 pm

mLink L9110 DC motor controller (HCMODU0199)

Post by admin » Thu Jan 18, 2024 4:39 pm

Image




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



Image

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:

Image


Image


  1. /*
  2. This sketch uses the mLink library to control the speed and direction
  3. of two DC motors connected to the modules two driver outputs.
  4. */
  5.  
  6.  
  7. #include "mLink.h"                          // Include the library
  8.  
  9. mLink mLink;                                // Create an instance of the library
  10.  
  11. #define I2C_ADD 0x5D                        // Default I2C address
  12.  
  13.  
  14. void setup()
  15. {
  16.   mLink.init();                             // Initialise the library
  17.  
  18.   // Stop both motors
  19.   mLink.L9110_M1_Stop(I2C_ADD);
  20.   mLink.L9110_M2_Stop(I2C_ADD);
  21. }
  22.  
  23.  
  24. void loop()
  25. {
  26. while(1);
  27.   // MOTOR 1 FORWARD
  28.   mLink.L9110_M1_Dir(I2C_ADD, FORWARD);
  29.   mLink.L9110_M1_Speed(I2C_ADD, 128); delay(2000);  // Half speed
  30.   mLink.L9110_M1_Speed(I2C_ADD, 255); delay(2000);  // Full speed
  31.   mLink.L9110_M1_Speed(I2C_ADD, 128); delay(2000);  // Half speed
  32.   mLink.L9110_M1_Speed(I2C_ADD, 0);   delay(2000);  // Stop
  33.  
  34.   // MOTOR 1 REVERSE
  35.   mLink.L9110_M1_Dir(I2C_ADD, REVERSE);
  36.   mLink.L9110_M1_Speed(I2C_ADD, 128); delay(2000);  // Half speed
  37.   mLink.L9110_M1_Speed(I2C_ADD, 255); delay(2000);  // Full speed
  38.   mLink.L9110_M1_Speed(I2C_ADD, 128); delay(2000);  // Half speed
  39.   mLink.L9110_M1_Speed(I2C_ADD, 0);   delay(2000);  // Stop
  40.  
  41.   // MOTOR 2 FORWARD
  42.   mLink.L9110_M2_Dir(I2C_ADD, FORWARD);
  43.   mLink.L9110_M2_Speed(I2C_ADD, 127); delay(2000);  // Half speed
  44.   mLink.L9110_M2_Speed(I2C_ADD, 255); delay(2000);  // Full speed
  45.   mLink.L9110_M2_Speed(I2C_ADD, 127); delay(2000);  // Half speed
  46.   mLink.L9110_M2_Speed(I2C_ADD, 0);   delay(2000);  // Stop
  47.  
  48.   // MOTOR 2 REVERSE
  49.   mLink.L9110_M2_Dir(I2C_ADD, REVERSE);
  50.   mLink.L9110_M2_Speed(I2C_ADD, 128); delay(2000);  // Half speed
  51.   mLink.L9110_M2_Speed(I2C_ADD, 255); delay(2000);  // Full speed
  52.   mLink.L9110_M2_Speed(I2C_ADD, 128); delay(2000);  // Half speed
  53.   mLink.L9110_M2_Speed(I2C_ADD, 0);   delay(2000);  // Stop
  54. }




Raspberry Pi Connection Example:

Image

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.


  1. # mLink L9110 DC motor controller example
  2. # This example requires the mLink module to be installed. Please see
  3. # library forum thread for more information:
  4. #
  5. # TBA
  6.  
  7. from mLink import mLink                     # Import the mLink module
  8. import time
  9.  
  10. ml = mLink.mLink(1)                         # Create an instance of the module
  11.  
  12. I2C_ADD = 0x5D                              # Default I2C address is 0x52
  13.  
  14. # Stop both motors
  15. ml.L9110_M1_Stop(I2C_ADD)
  16. ml.L9110_M2_Stop(I2C_ADD)
  17.  
  18. while 1:
  19.     # MOTOR 1 FORWARD
  20.     ml.L9110_M1_Dir(I2C_ADD, ml.FORWARD)
  21.     ml.L9110_M1_Speed(I2C_ADD, 128)         # Half speed
  22.     time.sleep(2)
  23.     ml.L9110_M1_Speed(I2C_ADD, 255)         # Full speed
  24.     time.sleep(2)
  25.     ml.L9110_M1_Speed(I2C_ADD, 128)         # Half speed
  26.     time.sleep(2)
  27.     ml.L9110_M1_Speed(I2C_ADD, 0)           # Stop
  28.     time.sleep(2)
  29.  
  30.     # MOTOR 1 REVERSE
  31.     ml.L9110_M1_Dir(I2C_ADD, ml.REVERSE)
  32.     ml.L9110_M1_Speed(I2C_ADD, 128)         # Half speed
  33.     time.sleep(2)
  34.     ml.L9110_M1_Speed(I2C_ADD, 255)         # Full speed
  35.     time.sleep(2)
  36.     ml.L9110_M1_Speed(I2C_ADD, 128)         # Half speed
  37.     time.sleep(2)
  38.     ml.L9110_M1_Speed(I2C_ADD, 0)           # Stop
  39.     time.sleep(2)
  40.    
  41.     # MOTOR 2 FORWARD
  42.     ml.L9110_M2_Dir(I2C_ADD, ml.FORWARD)
  43.     ml.L9110_M2_Speed(I2C_ADD, 128)         # Half speed
  44.     time.sleep(2)
  45.     ml.L9110_M2_Speed(I2C_ADD, 255)         # Full speed
  46.     time.sleep(2)
  47.     ml.L9110_M2_Speed(I2C_ADD, 128)         # Half speed
  48.     time.sleep(2)
  49.     ml.L9110_M2_Speed(I2C_ADD, 0)           # Stop
  50.     time.sleep(2)
  51.    
  52.     # MOTOR 2 REVERSE
  53.     ml.L9110_M2_Dir(I2C_ADD, ml.REVERSE)
  54.     ml.L9110_M2_Speed(I2C_ADD, 128)         # Half speed
  55.     time.sleep(2)
  56.     ml.L9110_M2_Speed(I2C_ADD, 255)         # Full speed
  57.     time.sleep(2)
  58.     ml.L9110_M2_Speed(I2C_ADD, 128)         # Half speed
  59.     time.sleep(2)
  60.     ml.L9110_M2_Speed(I2C_ADD, 0)           # Stop
  61.     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:

Image

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.

Image





Image

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:

  1. 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.

Post Reply

Return to “mLink”