MDDS 60 Serial Python Script

Autonomous Robot, Manual Robot, DC Motor Driver, Stepper Motor Driver, Servo, Multi PWM chip.....

MDDS 60 Serial Python Script

Postby singh608 » Fri Aug 02, 2019 5:39 am

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
singh608
Greenhorn
 
Posts: 2
Joined: Fri Aug 02, 2019 5:04 am

Re: MDDS 60 Serial Python Script

Postby Idris » Fri Aug 02, 2019 12:22 pm

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.
Cytron Technologies invest time and resources providing tutorial, training and support for STEM education and maker movement. We need your support by purchasing products from Cytron Technologies. Thanks.
http://www.cytron.com.my
User avatar
Idris
Moderator
 
Posts: 409
Joined: Thu Mar 22, 2012 5:28 pm
Location: Pulau Pinang

Re: MDDS 60 Serial Python Script

Postby singh608 » Mon Aug 05, 2019 11:52 pm

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?
singh608
Greenhorn
 
Posts: 2
Joined: Fri Aug 02, 2019 5:04 am

Re: MDDS 60 Serial Python Script

Postby Idris » Fri Aug 09, 2019 4:58 pm

Hi singh608,

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

Hope this helps.

Thank you.
Cytron Technologies invest time and resources providing tutorial, training and support for STEM education and maker movement. We need your support by purchasing products from Cytron Technologies. Thanks.
http://www.cytron.com.my
User avatar
Idris
Moderator
 
Posts: 409
Joined: Thu Mar 22, 2012 5:28 pm
Location: Pulau Pinang


Return to Robot Controller

Who is online

Users browsing this forum: No registered users and 11 guests

cron