np425 / pi-dobot-gui

Robot capable of moving objects
0 stars 0 forks source link

Connect Raspberry Pi to Dobot #38

Closed Dieterfu closed 3 months ago

Dieterfu commented 6 months ago

Hi,

I would like to use this project myself with a Dobot MG400. How do I connect the Raspberry Pi to the Dobot?

Andrew1415 commented 6 months ago

There are a couple of ways you can do it, we used gpio pins for simple comunication, but u can also use modbus protocol and slave master protocols to comunicate and control the Dobot MG400 from raspberry pi.

Andrew1415 commented 6 months ago

in the case of mg400 for communication via gpio pins its mostly igh/low signals, for eternet, u can program it using eth1 port, and eth2 is used for communication and sending instructions to the robot, you could find more help on this in forum.dobot.cc page.

Dieterfu commented 6 months ago

Hi Andrew,

thanks a lot for your help. If I use the communication via gpio pins and have a lua script, is there a possibility to send certain commands with coordinates from the raspberry pi to the dobot?

Kind Regards, Dieter

Andrew1415 commented 6 months ago

well it is "posible" but you would have to create a whole agorith to send data as high and low signals, because the robot only takes digital inputs, and you would have to create a way to get informaton in bits and then to decode them, i would sugest trying to create a modbus or a ethernet way to send cordinates, i have used similar methong, where i created a sistem for candy detection using NI Vision Builder, and sent cordinates to a dobot m1 pro robot via eternet protocol, that way is not so hard.

Andrew1415 commented 6 months ago

in the guide dobot mg400 guide from page 35 it show a sample code how to send and get data using TCP protocol, aka ethernet cable you would just need to create on the raspberry pi code that will send your cordinates via tcp protocol

np425 commented 6 months ago

The way our project is designed is the raspberry pi has 2 output GPIO pins for selecting a specific candy. The dobot robot waits for a signal from one of the 2 mentioned (this time input) pins, indicating a request for the robot to pick candy from one of the two groups (red or blue). image

For our project the boxes/rectangles in which the candies reside are designed with equal gaps/offsets between slots, allowing to use geometry to calculate the coordinates of nth candy in a group. Essentially the only information the algorithm requires is the coordinates of the center of first slot for each of the two groups, and the x, y offsets between the slots of the boxes. The coordinates are hard-coded in the dobot robot code for simplicity sake.