I want to communicate with this Rhino DC servo motor with RPi4 B. I enable uart3 in RPi4 by modifying the /boot/config.txt file. In this file, I add dtoverlay=uart3 in the last. When I used
ls /dev/ttyAMA* , I got /dev/ttyAMA0 /dev/ttyAMA1 , So I think uart3 is enable in RPi4.
For uart3, TXD is at GPIO04 and RXD is at GPIO05. So, I connected RXD of RPi with TX of motor and vice-versa. In this servo motor, to rotate we have to give commands like G200, G300,, etc. To get the current position, we have to send P. This link explains it in detail.
I used the below code to communicate with motor and RPi4:
import time import serial ser = serial.Serial( port='/dev/ttyAMA1', baudrate = 9600, parity=serial.PARITY_NONE, stopbits=serial.STOPBITS_ONE, bytesize=serial.EIGHTBITS, timeout=2 ) #ser.write(str.encode(str('G600')+'\n')) ser.write('G600'.encode('utf-8')) val = ser.read('P') print(val) ser.close()
But there was no rotation of the motor (no error was there too). and I got value
b' ' using
I want to know, how to run this servo motor with RPi4?