Page 1 of 1

MDDS 60 Serial Python Script

PostPosted: Fri Aug 02, 2019 5:39 am
by singh608
Dear All,

I am using Smart Drive Duo 60 MDDS 60 towards a 12 V DC motor control. I want to use serial communication through USB to TTL based device to control motor but no python script is available on GitHub towards using Cytron protocol for controlling direction and speed of the motor. Can someone direct me to the right portal/code towards this?

Please note that I will prefer the serial communication over PWM as my project desires the same.

Many Thanks

Re: MDDS 60 Serial Python Script

PostPosted: Fri Aug 02, 2019 12:22 pm
by Idris
Hi singh608,

Currently we don't have the sample code for this. Anyway you can start learn how to program serial port in python, then send the data to MDDS60 as describe in User's Manual.

Thanks.

Re: MDDS 60 Serial Python Script

PostPosted: Mon Aug 05, 2019 11:52 pm
by singh608
Hello,

I have made a serial script and its working with the Cytron Smart Drive Duo 60 motor controller

Here it is :

CODE: SELECT_ALL_CODE
import webiopi
from webiopi.devices.serial import Serial
from time import sleep

serial = Serial('ttyUSB0', 9600) #enter correct port for serial

    # write data to serial port
def motor_on_off():
    user_input = input("\n Type Fwd / Rev / Stop :")
    if user_input == "Fwd": #Running motor at full speed in forward direction
       print("M1 Fwd")
       sleep(6)
       serial.writeString("63")
       motor_on_off()
    elif user_input == "Rev": #Running motor at full speed in reverse direction
       print("M1 Rev")
       sleep(6)
       serial.writeString("127")
       motor_on_off()
    elif user_input == "Stop" or user_input == "s":
       print("M1 Stop")
       sleep(6)
       serial.writeString("0")
       serial.close()
    else:
       print("Invalid Input. Type Fwd / Rev / Stop. ")
       motor_on_off()

sleep(2) #Wait for serial connection to initialize

motor_on_off()


But the problem is that even when the script is executed, the motor doesn't stop even after closing the serial port i.e. serial.close()

Can you let me know any possible solution for it?

Re: MDDS 60 Serial Python Script

PostPosted: Fri Aug 09, 2019 4:58 pm
by Idris
Hi singh608,

Maybe you can try this tutorial - Control MDDS30 In Serial Simplified Mode Using Raspberry Pi.

Hope this helps.

Thank you.