DC motor controlled by a MX1508 Dual Motor Driver Carrier ------------------------------------------------- ![ScreenShot dcmotor](https://github.com/gavinlyonsrepo/RpiMotorLib/blob/master/extra/images/RF310T11400.jpg) ![ScreenShot MX15083](https://github.com/gavinlyonsrepo/RpiMotorLib/blob/master/extra/images/MX15083.jpg) Hardware -------------------------------------------- The MX1508 Dual H-bridge is a basic, cheap & small device ideal for small and low voltage motors. It can control two DC motors or one stepper. Motor voltage 2-10 volts. Continuous current 1.5 Amps, peak current 2.5 Amps and Logic voltage of 1.8-7 volts. There is no input for logic voltage it is derived from the motor power. ![ScreenShot MX15081](https://github.com/gavinlyonsrepo/RpiMotorLib/blob/master/extra/images/MX15081.jpg) All 4 logic inputs IN1-IN4 must be PWM capable as per the truth table. In1 and In2 control motor 1. In3 and In4 control motor 2. Module pinout ![ScreenShot MX15082](https://github.com/gavinlyonsrepo/RpiMotorLib/blob/master/extra/images/MX15082.jpg) | Pin Label | Function | Notes| | ------ | ------ | ------ | | '+' | Motor voltage | PSU for the motors (2V to 10V) | | '-' |Ground | Connect all GNDs to common rail (RPI , Motor PSU and Module) | | In1/In2 | Input 1 for channels A | inputs direction for Motor A, connected to 2 * RPI GPIO | | IN3/In4| Input 2 for channels B| inputs direction for Motor B , connected to 2 * RPI GPIO | | Motor A | Output 1 for channels A| One of the two outputs to connect the motor A | | Motor B | Output 2 for channels B| One of the two outputs to connect the motor B | HW Connection (for two DC motors) for the example file(see software section below) are as follows, (you can pick any GPIO pin you want). 1. '+' to motor PSU (2-10 volts) tested at 5 2. '-' to GND connect all GND's to a common rail together with PSU and RPI 3. IN1 = 26 GPIO 4. IN2 = 19 GPIO 5. IN3 = 20 GPIO 6. IN4 = 21 GPIO 7. Motor A DC motor 1 + 8. Motor A DC motor 1 - 9. Motor B DC motor 2 + 10. Motor B DC motor 2 - Software ------------------------------------------- 1. forward = Drive motor forward, passed one argument = duty cycle % 2. backward = drive motor backward, passed one argument = duty cycle % 3. standby = put motor in standby/coast mode, passed one argument = duty cycle % 4. brake = brake motor, passed one argument = duty cycle % 5. cleanup = stop PWM and turn off GPIO pins used by motor. Passed a boolean: if False just stop and zero the motor pins, if True also run GPIO.cleanup() for all pins. 6. motor_stop = Intended for emergency/interrupt situations — immediately kills output. Does not destroy the PWM object — motor can be restarted. Call cleanup() for full teardown at end of program. Example: There is a detailed example test code is in the MC150X_DC_Test.py file in example subfolder of rpiMotorLib repository. To run this example file type **python3 MC150X_DC_Test.py** in a terminal.