I am going begin a microcontroller based smart toy car project. The project will be in many parts, but the first part is the motor driver.
A vast range of motor driver chips and modules are used by hobbyists and makers in various projects all over the world. The cheap motor driver modules that are available on almost all webstores are the L293, L298, L9110, TB6612 and MX1508. My current pick is the MX1508 motor driver module. So, in this post I’m going to discuss it.
The MX1508 IC has an integrated two channel motor driver circuitry tailored with N-channel and P-channel power MOSFETs which are suitable for driving DC motors in battery-operated toy cars and other similar applications. This IC has a working voltage of 1.8V to 5V, but it can drive motors with operating voltages in 2V to 9.6V range.
Below is the typical application circuit of MX1508 IC which is borrowed from its Chinese datasheet. I did a little retouching on the original image to get rid of the obscurity.
The MX1408 motor driver module has a single DC voltage input option, that supposedly can happily accept 2V to 10VDC. The digital segment of the MX1508 IC in the module is powered through a 220Ω resistor with the ensuing voltage being set by a 5V zener diode.
The datasheet advises to use a 100nF capacitor across each motor output lines, but that’s not done on the module. Likewise, there are no freewheeling diodes employed, though it’s loosely recommended by the chip manufacturer.
Below you can see the key features and specifications of the MX1508 motor driver module. The MX1508 IC datasheet doesn’t specify a maximum switching frequency. However, 500Hz PWM seems to be fine (more will come later).
- Input Supply Voltage: 2V-10V DC
- Voltage output: 1.8V-7V DC
- Operating Current: 1.5A
- Peak Current: 2.5A
- Quiescent Current: < 0.1uA
The module consists of several pins, two of which are for powering up the module, four output pins are for two motors to run independently (two pins per channel), and four input pins to accept motor control signals coming from an external circuit (perhaps a microcontroller). The figure below depicts these pin assignments in a simple manner.
This table describes the control input logic of the first motor channel. This also applies to the second channel.
Note: The motor running directions may vary depending on the original motor wiring scheme implemented by you!
I have a set of low voltage N20 micro metal gear motors that I intend to use in my upcoming smart toy car and similar projects. Before I get into the actual tasks, I was anxious to try out some of them with this enticingly small MX1508 motor driver module.
The quick and dirty experiment was done using a Raspberry Pi Pico board, while the Thonny IDE installed on my Windows 10 (x64) computer supported it. Although the MX1508 module can drive two motors independently, my first test was with only one motor which is wired to the first channel (MOTOR-A). It’s intentional to make things as simple, fast, and safe as possible.
The connections are very easy as you can see in the diagram below. The proposed hardware setup needs some refinements.
The script below runs the motor cyclic in one direction for a while, and then runs in the reverse direction for the same length of time (a slight halt between the two directions would be nice to derogate the chances of possible spikes being brought forth while banging the motor into next direction).
from machine import Pin
motor1a = Pin(14, Pin.OUT)
motor1b = Pin(15, Pin.OUT)
print(‘Motor Run START’)
print(‘Motor Run STOP’)
for i in range(4):
print(‘Test ‘, i)
Below is a casual snap of my quick test setup.
To be honest, I did not expect it to work smoothly due to the potential logic-level incompatibility issues between a 5V motor driver and a 3.3V microcontroller. But it worked (maybe it’s held at a good time, ha ha)!
An Alternative Plan
Below you can see Waveshare’s Pico Motor Driver.
This I2C multichannel motor driver module for Raspberry Pi Pico can handle up to four motors (https://www.waveshare.com/wiki/Pico-Motor-Driver).
I haven’t had a chance to play with it yet, but hopefully I’ll find some time to do an article on it later!