Your advice on "remote" robot operation and Arduino interfacing


#1

Hi,

I would like to ask your advice on the most straightforward way to use an arduino (ESP32 or similar) to drive the robot to move different directions, sort of “remote” operation. I could make the “connection” using the robot’s input and a set of relay, which is connected to the arduino side. However, reading the input seems not able to provide precise movement. I mean one off/on/off relay state yields bunch of movement on the robot as it reads fast and I get 5-10 readings with one loop. I can slow down the reading with pause, but I could miss the relay and in any case the movement wont be smooth.

Do you think it is any way to do smooth movement with the input or I need to think with some ROS or TCPIP?

Thanks


#2

Hi whynot,
You can use the RP2040 W5100S-EVB-Pico board (approx 20$) with below CircuitPython script to send TCP commands to the Server port 29999: ( https://github.com/Dobot-Arm/TCP-IP-Protocol/blob/master/README-EN.md )

import board
import busio
import digitalio
import time
import adafruit_requests as requests
from adafruit_wiznet5k.adafruit_wiznet5k import WIZNET5K
import adafruit_wiznet5k.adafruit_wiznet5k_socket as socket

WIZnet Ethernet Hat on Raspberry Pi Pico [W]

cs = digitalio.DigitalInOut(board.GP17)
spi = busio.SPI(board.GP18, MOSI=board.GP19, MISO=board.GP16)
eth = WIZNET5K(spi, cs, mac=(0xDE, 0xAD, 0xBE, 0xEF, 0x06, 247), is_dhcp=True)

IP_ADDRESS = (192, 168, 2, 10)
SUBNET_MASK = (255, 255, 0, 0)
GATEWAY_ADDRESS = (192, 168, 2, 1)
DNS_SERVER = (8, 8, 8, 8)

#Set network configuration

pool = requests

CLIENT = eth.pretty_ip(eth.ip_address)
HOST = “192.168.2.6”
PORT = 29999
TIMEOUT = None
MAXBUF = 200
INTERVAL=2

print(f"WIZnet Client IP Address: {CLIENT}")

s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.settimeout(TIMEOUT)

print(“Create TCP Socket”)

while True:
print(“Connecting”)
s.connect((HOST, PORT))

dobot_input = input("Enter DobotRobot command:" )

size = s.send(b'{}'.format(dobot_input))
print("Sent", size, "bytes")

buf = s.recv(MAXBUF)
#buf = s.recv()
print('Received', buf)

s.close()

time.sleep(INTERVAL)