hi all....

I'm hoping someone can shed some light onto a project I'm working on.
I have an Mdrive 23 step motor that works with a serial terminal.

The whole serial terminal is new to me and I'm confused by what it means.

I have been able to make the motor work with screen program.
Now I need to be able to control it with Python and I started with the
PySerial module.

So far I've been able to connect to the motor but no commands have had any effect.

import serial

ser = serial.Serial('/dev/ttyUSB0', 19200)

ser.isOpen() # returns True

ser.write('ma 100000\r\n') # does nothing...

ser.inWaiting() # returns 0

ser.close()

I could use some help here...I'm at a lose...

TIA !
dw

Recommended Answers

All 3 Replies

I didn't set the variables below...I'm betting that's a problem...not sure
which parity to use, will research, stop bits and byte size also unknown at this time...

The MDrive 23 doesn't appear to have a lot of doc about this...
I didn't use ser.open() either, but I think it happens anyways when the Serial object
is contructed, since ser.isOpen() returned True.

parity=serial.PARITY_ODD,
stopbits=serial.STOPBITS_TWO,
bytesize=serial.SEVENBITS

If you are using a Linux system, then it should be /dev/ttyS0, etc. If it is a USB connection, try PyUSB

reading about PyUSB now...

This motor uses a ribbon connection to a box with an ethernet and USB ports on it. I'v been thinking of it
as a serial-to-USB but perhaps it isn't....

however, I see Arduino pple using PySerial and I'd bet this motor uses something Arudion-ish to make the programming interace so easy...

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.