Let’s Arduino Control Your SmartDriveDuo-60

If you wish to control your powerful SmartDriveDuo-60 using Arduino, this tutorial will guide you on setting mode, connection and basic program. Have a visit!

Last Updated on 25 January 2017


SmartDriveDuo-60 is a smart and powerful dual motor driver from Cytron Technologies. Even this motor driver is able to accept multiple types of input (RC, analog, PWM, serial), most of users choose RC mode to control a combat robot. Why? Because this mode is totally plug and play. In other words, users don’t need to have a programming knowledge to make their robot move. However, there still have users ask on how to control MDDS60 with Arduino. Maybe they want to make their robot smarter? Yes of course, and it is good. So this tutorial will guide you to get start.

MDDS60 Header Photo

First of all, we need to set mode for MDDS60 to determine what kind of program to be write in Arduino. So currently we have 3 modes which suitable for that:
1. PWM mode: Independent Both (0b10110100)
2. Serial Simplified: Set baudrate to 9600 (0b11001100)
3. Serial Packetized: Set ID to 0 (0b11100000)


PWM Mode: Independent Both

1. Program your Arduino with the following codes. Then disconnect Arduino from the USB.

/*
* This example shows how to control MDDS60 in PWM mode with Arduino.
* Set MDDS60 input mode to 0b10110100
*
* Reference Tutorial:
* - Let's Arduino Controlling Your SmartDriveDuo-60
*
* Related Products:
* - SmartDriveDuo-60: http://www.cytron.com.my/P-MDDS60
* - CT UNO: http://www.cytron.com.my/p-ct-uno
* - DC Brush Motors: http://www.cytron.com.my/c-84-dc-motor
* - LiPo Battery: http://www.cytron.com.my/c-87-power/c-97-lipo-rechargeable-battery-and-charger
*
* URL: http://www.cytron.com.my
*/
int DIG1 = 7; // Arduino pin 7 is connected to MDDS60 pin DIG1.
int DIG2 = 4; // Arduino pin 4 is connected to MDDS60 pin DIG2.
int AN1 = 6; // Arduino pin 6 is connected to MDDS60 pin AN1.
int AN2 = 5; // Arduino pin 5 is connected to MDDS60 pin AN2.
void setup()
{
pinMode(DIG1, OUTPUT); // Set Arduino pin 7 (DIG1) as output.
pinMode(DIG2, OUTPUT); // Set Arduino pin 4 (DIG2) as output.
pinMode(AN1, OUTPUT); // Set Arduino pin 6 (AN1) as output.
pinMode(AN2, OUTPUT); // Set Arduino pin 5 (AN2) as output.
delay(5000); // Delay for 5 seconds.
}
void loop()
{
// Controlling motor 1.
analogWrite(AN1, 100); // Set motor 1 speed less than half. Max is 255.
digitalWrite(DIG1, LOW); // Motor 1 start moving for 2s.
delay(2000);
digitalWrite(DIG1, HIGH); // Motor 1 move to another direction for 2s.
delay(2000);
analogWrite(AN1, 0); // Stop motor 1.
delay(1000); // Delay for 1s
// Controlling motor 2.
analogWrite(AN2, 100); // Set motor 2 speed less than half. Max is 255.
digitalWrite(DIG2, LOW); // Motor 1 start moving for 2s.
delay(2000);
digitalWrite(DIG2, HIGH); // Motor 1 move to another direction for 2s.
delay(2000);
analogWrite(AN2, 0); // Stop motor 2.
delay(1000); // Delay for 1s
}
view raw MDDS60PWM.ino hosted with ❤ by GitHub

2. Set switch mode on MDDS60 to 0b10110100.
3. Connect all the wires as shown below and last connect the battery.

CT-UNO PWM

*9V battery is only to show how to make a connection between MDDS60 and battery. Use a suitable battery for your application.
**Please make sure there only one 5V supply to Arduino board.

4. Once MDDS60 and CT UNO is powered up (and all connections is complete), both motor will start moving alternately.


Serial Simplified: Baudrate 9600

1. Program your Arduino with the following codes. Then disconnect Arduino from the USB.

/*
* This example shows how to control MDDS60 in Serial Simplified with Arduino.
* Set MDDS60 input mode to 0b11001100
*
* Serial data (8-bits): 0bMDSSSSSS
* M: Select motor, 0 for left, 1 for right.
* D: Direction, 0 for CW, 1 for CCW.
* SSSSSS: Motor speed.
*
* Example: Value in Decimal
* 0 or 64 - motor LEFT stop.
* 63 - motor LEFT full forward.
* 127 - motor LEFT full reverse.
* 128 or 192 - motor RIGHT stop.
* 191 - motor RIGHT full forward.
* 255 - motor RIGHT full reverse.
*
* Reference Tutorial:
* - Let's Arduino Control Your SmartDriveDuo-60
*
* Related Products:
* - SmartDriveDuo-60: http://www.cytron.com.my/P-MDDS60
* - CT UNO: http://www.cytron.com.my/p-ct-uno
* - DC Brush Motors: http://www.cytron.com.my/c-84-dc-motor
* - LiPo Battery: http://www.cytron.com.my/c-87-power/c-97-lipo-rechargeable-battery-and-charger
*
* URL: http://www.cytron.com.my
*/
#include <SoftwareSerial.h>
SoftwareSerial MDDS60Serial(2, 3); // RX (not use), TX
void setup()
{
MDDS60Serial.begin(9600); // Initialize serial
delay(5000); // Delay for 5 seconds.
}
void loop()
{
MDDS60Serial.write(32); // Motor left start moving with half speed for 2s.
delay(2000);
MDDS60Serial.write(32); // Motor left move to another direction with half speed for 2s.
delay(2000);
MDDS60Serial.write((byte)0); // Motor left stop.
delay(1000); // Delay for 1s.
MDDS60Serial.write(160); // Motor right start moving with half speed for 2s.
delay(2000);
MDDS60Serial.write(224); // Motor right move to another direction with half speed for 2s.
delay(2000);
MDDS60Serial.write(128); // Motor right stop.
delay(1000); // Delay for 1s.
}

2. Set switch mode on MDDS60 to 0b11001100.
3. Connect all the wires as shown below and connect the battery

CT-UNO Serial Simplified

*9V battery is only to show how to make a connection between MDDS60 and battery. Use a suitable battery for your application.
**Please make sure there only one 5V supply to Arduino board.

4. Once MDDS60 and CT UNO is powered up (and all connections is complete), both motor will start moving alternately.


Serial Packetized: ID is 0

1. Program your Arduino with the following codes. Then disconnect Arduino from the USB.

/*
* This example shows how to control MDDS60 in Serial Packetized with Arduino.
* Set MDDS60 input mode to 0b11100000
*
* Serial Packet:
* 1st byte: Header.
* 2nd byte: Channel & Address.
* 3rd byte: Speed & Direction.
* 4th byte: Checksum = 1st byte + 2nd byte + 3rd byte.
*
* For more information, please refer to MDDS60 User's Manual
* https://docs.google.com/document/d/15ICHc5CqQL8oXdU-n3ZL0_o8Vm4wQCnWOHHEfrEDDaI/view
*
* Reference Tutorial:
* - Let's Arduino Control Your SmartDriveDuo-60
*
* Related Products:
* - SmartDriveDuo-60: http://www.cytron.com.my/P-MDDS60
* - CT UNO: http://www.cytron.com.my/p-ct-uno
* - DC Brush Motors: http://www.cytron.com.my/c-84-dc-motor
* - LiPo Battery: http://www.cytron.com.my/c-87-power/c-97-lipo-rechargeable-battery-and-charger
*
* URL: http://www.cytron.com.my
*/
#include <SoftwareSerial.h>
SoftwareSerial MDDS60Serial(2, 3); // RX (not use), TX
void setup()
{
MDDS60Serial.begin(9600); // Initialize serial
delay(2000); // Delay for 2 seconds.
MDDS60Serial.write(85); // Dummy byte for auto baudrate.
delay(3000); // Delay for 3 seconds.
}
void loop()
{
// Controlling left motor, direction CW
MDDS60Serial.write(85); // 1st byte: Header.
MDDS60Serial.write((byte)0); // 2nd byte: Channel = left & Address = 0.
MDDS60Serial.write(63); // 3rd byte: Speed = half & Direction = CW.
MDDS60Serial.write(85 + 63); // 4th byte: Checksum = 1st byte + 2nd byte + 3rd byte.
delay(2000);
// Controlling left motor, direction CCW
MDDS60Serial.write(85); // 1st byte: Header.
MDDS60Serial.write((byte)0); // 2nd byte: Channel = left & Address = 0.
MDDS60Serial.write(192); // 3rd byte: Speed = half & Direction = CCW.
MDDS60Serial.write(85 + 192); // 4th byte: Checksum = 1st byte + 2nd byte + 3rd byte.
delay(2000);
// Stop left motor
MDDS60Serial.write(85); // 1st byte: Header.
MDDS60Serial.write((byte)0); // 2nd byte: Channel = left & Address = 0.
MDDS60Serial.write(127); // 3rd byte: Speed = 0.
MDDS60Serial.write(85 + 127); // 4th byte: Checksum = 1st byte + 2nd byte + 3rd byte.
delay(1000); // Delay for 1s.
// Controlling right motor, direction CW
MDDS60Serial.write(85); // 1st byte: Header.
MDDS60Serial.write(8); // 2nd byte: Channel = right & Address = 0.
MDDS60Serial.write(63); // 3rd byte: Speed = half & Direction = CW.
MDDS60Serial.write(85 + 8 + 63); // 4th byte: Checksum = 1st byte + 2nd byte + 3rd byte.
delay(2000);
// Controlling right motor, direction CCW
MDDS60Serial.write(85); // 1st byte: Header.
MDDS60Serial.write(8); // 2nd byte: Channel = right & Address = 0.
MDDS60Serial.write(192); // 3rd byte: Speed = half & Direction = CCW.
MDDS60Serial.write(85 + 8 + 192); // 4th byte: Checksum = 1st byte + 2nd byte + 3rd byte.
delay(2000);
// Stop right motor
MDDS60Serial.write(85); // 1st byte: Header.
MDDS60Serial.write(8); // 2nd byte: Channel = right & Address = 0.
MDDS60Serial.write(127); // 3rd byte: Speed = 0.
MDDS60Serial.write(85 + 8 + 127); // 4th byte: Checksum = 1st byte + 2nd byte + 3rd byte.
delay(1000); // Delay for 1s.
}

2. Set switch mode on MDDS60 to 0b11001100.
3. Connect all the wires as shown below and connect the battery

CT-UNO Serial Packetized

*9V battery is only to show how to make a connection between MDDS60 and battery. Use a suitable battery for your application.
**Please make sure there only one 5V supply to Arduino board.

4. Once MDDS60 and CT UNO is powered up (and all connections is complete), both motor will start moving alternately.


References

For more information, please refer to SmartDriveDuo-60 User’s Manual.

MDDS60 User's Manual

So, that’s all from me. Thanks for visit and I hope this tutorial helps. 🙂

Note: For further inquiry, kindly visit to Cytron Technical Forum as we seldom check the comment here.

3 thoughts on “Let’s Arduino Control Your SmartDriveDuo-60”

  1. What if I have my CT UNO powered from other source?

    Do I still have to connect the 5v and GND from the MDDS60 to my CT UNO?

    Can you please let me know?

    Thank you in advanced!

Leave a Comment

Your email address will not be published.

Share this Tutorial

Share on facebook
Share on whatsapp
Share on email
Share on print
Share on twitter
Share on pinterest
Share on facebook
Share on whatsapp
Share on email
Share on print
Share on twitter
Share on pinterest

Latest Tutorial

Smart Door Announcer with Raspberry Pi
Why Raspberry Pi is the future of computing devices?
Face Recognition Door Lock System Using OpenCV on Raspberry Pi
Send Data to Firebase Using Arduino Uno WiFi Rev2
Simple Alarm System Using Maker Nano
Scroll to Top