Clear all

Control 2 Stepper motor using Igus D1 drive

1 Posts
1 Users
New Member
Joined: 2 years ago
Posts: 1
Topic starter  

Hello everyone, I'm new here and also very excited to be here. I'm a mechanical engineer under-graduated student. I'm doing an internship in a company who's developing self driving car's technology. They hired me for design, build and program a rail robot. They've planed to put their Liddar on it to collect data at various combinations of distance, light incidence angle and reflection surfaces. Basically, I have to reproduce this the little video (example #8 at:

I don't have to much knowledge in programming (I just did the planned course in my university journey) and even less in ModbusTCP communication protocol. So I was hoping to find some good advise and maybe someone who was open to made my a little crash course to help me out.

I'm stuck in the programming part of my project. Fist of all I'm trying to connect with my Igus D1 dryve - Motor controller (, I think this is done. Now i think the next step is to send data to my server (the drive itself) with my computer (the client). I started it but not very sure how to send, I know I'm pretty sure that I have to use the .send() method in Python, but if I have to use .encode() or byte or anything else. Also, I'm not able to accept date from my client. I have so many other questions but starting with this will be enough for now I think

Here is my code, it is not much but I think the best for me at this point is to keep my code structure as simple as it can be; if you see anything or have any advice for me feel free. I'm open to everything.

Server file:
import socket
import ipaddress
from pyModbusTCP.server import ModbusServer

if __name__=='__main__':

#Setting values:
#set the server ip address and convert it into a string that could be read in the upcoming functions.
# "p" stand for port
ip = str(ipaddress.ip_address(''))
p = 502

# Creat a server socket; "s" stand for server
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)

#Connect to the server
s.connect((ip, p))

#What should I give as an argument to the .listen()
s.bind(('', 502))

while True:
clientsocket, address = s.accept()
print(f"Connection from {address} has been established.")
clientsocket.send(bytes("Welcome to the server", "utf-8"))
Client file:
import socket

# c stand for client
c = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
c.connect(('', 502))

msg = c.recv(1024)

Thanks in advance to all who will help me.  
This topic was modified 2 years ago by louisorecourt