Overview:


Step 1: Format of Issued Commands by Client
Dobot communication instruction uses fixed frame format. Each frame of data has (2 + 4 * 10) = 42bytes and includes packet head(0xA5), packet end(0x5A) and ten parameters. All these parameters are act as Dobot single precision floating point types(32-bit), among this each parameter is formed into 4 bytes, except voice control commands, packet head(0xB5) and packet end(0x5B). Here are as follows:
Figure 2 instruction format
Two arrays are defined as follows: One is 42 bytes sent to Dobot, another includes 10 floating point types. Therefore, we can control Dobot movement mode, velocity and acceleration through the 10 variables. Details are as follows:
Step 2: Parameter Configuration
We need send out commands before controlling Dobot, which is used for configuration of motion parameters. Now we will configure parameters using defined arrays above. According to protocol, motion parameters are shown when state= 9, decribed as follows:
Figure 3 instruction of parameter configuration
For simplicity's sake, here we choose Axis=0, and only has a configuration of uniaxial jog velocity and uniaxial jog acceleration, the rest remains the default. Program examples follows:
//Set parameters of Dobot with state 9. void dobot_cmd_3(int mode= 0, int Joint_jog_speed=0, int Joint_jog_acc=0){ for(char i = 0; i < 10; i++ ){ cmd_str_10[i] = 0; } // refer to protocal file for detail cmd_str_10[0] = 9; cmd_str_10[1] = mode; cmd_str_10[2] = Joint_jog_speed; cmd_str_10[3] = Joint_jog_acc; cmd_str_42_send(); }
Step 3: Demo of Jog Mode
Parameters of Jog Mode below:
Figure 4 parameters instruction of jog mode
Figure 5 navigate hex file
Step 4: Demo of Save and Playback Mode
At the same time, we can set a series of coordinate motion about Dobot according to communication protocols, making it playback automatically . Here we use visiual motion mode 3, enabling Dobot move back and forth three times on Z- axis direction. Program examples as follows:/* ** demo that dobot controled by another Arduino MEGA 2560 ** with dobot firmware V1.2.0 ** ** connections: ** dobot side(Wireless port) | another Arduino side(UART1 port) ** GND ------ GND ** TX ------ TX1 ** RX ------ RX1 ** note: if another Arduino is self powered by USB or 12V, just connect above 3 lines is OK ** if another Arduino has no USB or 12V power, another connection between VCC ------ 5V is needed. ** ** 20160523 */ static float cmd_str_10[10]; static unsigned char cmd_str_42[42]; // Send a 42 byte data packet to the dobot according to the communication protocol. void cmd_str_42_send(){ cmd_str_42[0] = 0xA5; for( char i = 0; i < 10; i++ ){ *((float *)(cmd_str_42 + 1 + 4*i)) = float( cmd_str_10[i] ); } cmd_str_42[41] = 0x5A; for( char i = 0; i < 42; i++ ){ Serial1.write( cmd_str_42[i] ); } } //Set target moving mode with state 3. void dobot_cmd_3( float x = 260, float y = 0, float z = 0 ){ for( char i = 0; i < 10; i++ ){ cmd_str_10[i] = 0; } // Set the X/Y/Z coordinates of the end effector, please refer to protocal file for details. cmd_str_10[0] = 3; cmd_str_10[2] = x; //x cmd_str_10[3] = y; //y cmd_str_10[4] = z; //z cmd_str_10[7] = 2; //MOVL cmd_str_42_send(); } void setup() { // put your setup code here, to run once: // Serial1 connected with dobot Serial1.begin(9600); } void loop() { // put your main code here, to run repeatedly: // wait dobot init... delay( 2000 ); dobot_cmd_3( 260, 0, 30 ); // set the initial position of the end effector // repeat 3 times for( char i = 0; i < 3; i++ ){ dobot_cmd_3( 260, 0, 0 );//lower down the end effector // here just delay a few time between two cmd send simply // for better performance, next cmd can be send out if a new frame on rxd is received delay(500); dobot_cmd_3( 260, 0, 30 );// lift the end effector delay(500); } // end while(1); } *Please refer to this link for development effects: https://youtu.be/QGIbQJeDgCQYou must be logged in to post a comment.
I have been trying to use the codes provided on this page but I still can't seem to make it move according to the commands. Do I have to input anything else in the codes?
This is the tutorial just for Dobot Arm V1.0, which product do you buy? Dobot Magician?
I bought the Dobot arm V1.0 and I am trying to use the arduino to command it to move.
OK, could you kindly write to support@dobot.cc? They'll help you to solve it.