Running Motors through DHB-10 motor controller using serial messages


I'm trying to run the motors ( with the DHB-10 ( using a raspberry pi 2 with python serial messages. I have the wires connected as shown in this post:, and my code is as follows:
import serial
import time

def readlineCR(port):
rv = ""
while True:
ch =
rv += ch
if ch == '\r' or ch == '':
return rv

port = serial.Serial(

port = "/dev/ttyAMA0",
baudrate = 19200,
parity = serial.PARITY_NONE,
stopbits = serial.STOPBITS_ONE,
timeout = 1



while True:
port.write("GOSPD 32 32\r".encode())
rcv = readlineCR(port)

This all seems to run fine, but the DHB-10 motor lights continue to flash orange and the motors do not move.

Any suggestions to why this is not working?


  • 1 Comment sorted by Date Added Votes
  • have you tried "\r\n" ?

    I am just another Code Monkey.
    A determined coder can write COBOL programs in any language. -- Author unknown.
    Press any key to continue, any other key to quit

    The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this post are to be interpreted as described in RFC 2119.
Sign In or Register to comment.