Do you have a question about the SR518 and is the answer not in the manual?
Questions and answers
Summary of Contents for SpringRC SR518
Page 1
Spring Model Electronics Co.Ltd SR518 Robot Servo Manual www.springrc.com (v:1.0) TEL:+86-755-2974-9810 FAX:+86-755-2974-9779 Page 1 of 49...
Page 2
Spring Model Electronics Co.Ltd 1.Components In Brief 1.1 Product characteristics SR518 is mainly used for robots’joints, wheel,or caterpillar band, also can be used for simple position control. SR518 features: High torque:18Kgf Can be 360deg.continuous rotation • Support wide voltage range Bus connection,theoretically,254 units DC 6.0V~12V...
Page 3
Spring Model Electronics Co.Ltd 1.2 Diagram 1.3 Electrical connection 1.3.1 Pin Definition The following is the picture of SR518 electrical connection,Servos can be tandemed one by one via two groups of same pin definition terminals www.springrc.com (v:1.0) TEL:+86-755-2974-9810 FAX:+86-755-2974-9779 Page 3 of 49...
Page 4
SR518 can set for motor control mode or position control mode. In motor control mode, SR518 can be used as a DC decelerating motor with adjustable speed, In the position control mode, SR518 have 0-300 degrees of rotation, within the scope it has the exact position control performance with the adjustable speed.
Page 5
Model 1. through the debugger to control SR518 PC software through a serial send out a packet (accord with protocol format) , the debugger with serial interface transmitted to SR518. SR518 will execute the instruction of packet, and will return to respond the packet.
Page 6
Parameter1 ...Parameter N Check Sum 0XFF 0XFF This signal notifies the beginning of the packet It is the ID of SR518 which will receive Instruction Packet. It can use 254 IDs from 0 to 253 (0X00~0XFD). 0X00~0XFD。 converts to a hexadecimal number.
When the applied voltage is out of the range of operating Bit 0 Input Voltage Error voltage set in the Control Table 2.4 Instruction type This command gives an instruction to SR518 and has the following types.: Instruction/name Function value No.of parameters No execution.
Page 8
ACTION instruction is very important/useful in the control of many SR518s at the same time when control many independent SR518s, use ACTION instruction can make the first and last SR518 simultaneously execute their own actions, no delay.Send ACTION instructions to mutiple SR518s,broadcastID(0xFE)must be used,therefore,no return data frame。...
Page 9
0X00 0XFD 2.4.7 SYNC WRITE Function Control mutiple SR518s at the same time。 0XFE Length (L + 1) * N + 4 (L: the data length of every SR518 N: how many SR518) 指令 指令 指令 指令 0X83 Parameter1 the first address of data write section...
Page 10
Spring Model Electronics Co.Ltd parameter L+6 the second write data of the second SR518 … parameter2L+4 the Lth write data of the second SR518 …. Different from the REG WRITE + Action instruction is that it's much faster.one SYNC WRITE instruction can modify the control table content of mutiple SR518s at one time,but REG + Action must take several steps to finish this instruction.
Page 12
00(0x00) If the control parameters have "L" and "H" 2 different commands, the scope is 0x00 to 0x3ff; the command of Only one byte parameters, the scope is 0x00 to 0xff. www.springrc.com (v:1.0) TEL:+86-755-2974-9810 FAX:+86-755-2974-9779 Page 12 of 49...
Page 13
.If the goal angel value supass the range means that it equals to limit value, , , , and the Angle overscope symbol of servo SR518 status will be 1 。 。 。 。 0x0B The highest working temperature is 80 degree,users can’t change...
Page 14
If the bit is set as 1,unload when Input Voltage Error happened If all that happens at the same time,please follow the logic “or”principle BIT5 overload mark is invalid, when SR518 overload, torque force will automatically decline to a safety value without burning down/out, not completely unload 0x18: Torque output switch ,“1”...
Page 15
0x20~ ~ ~ ~ 0x21: Set the speed of target location servo runs to. When the location is set as1023,the corresponding maximum speed of SR518 is62RPM. under Position model,the minimum speed is 1, the maximum speed is 0 ,equivalent to 1023.
Page 16
~ ~ ~ 0x21: : : : BIT10 is direction bit,when it equals to 0,the servo rotates anti-clockwise,when is 1,servo rotates clockwise。BIT0~BIT9 r size bits。 Attention: : : : under Motor model,acceleration equals to deceleration,and set by 0x22 www.springrc.com (v:1.0) TEL:+86-755-2974-9810 FAX:+86-755-2974-9779 Page 16 of 49...
Page 17
Attention: except set the same ID address for multiple servos at the same time, servos need to be set ID No. one by one. The instruction packet is the control data that main controller or debugger sends to SR518 ,the status packet of the information SR518 refers to return.
Page 18
ACC as 4,Dcc as 6,the maximum value of ACC and Dcc as 255 Instruction = WRITE DATA;Address = 0X30;Data = 0X04, 0X06 Instruction packet:FF FF 00 05 03 30 04 06 BD Status packet:FF FF 00 02 00 FD State:no error www.springrc.com (v:1.0) TEL:+86-755-2974-9810 FAX:+86-755-2974-9779 Page 18 of 49...
AVR SCM (Single Chip Micyoco) 5.1 Schematic diagram In actual use of SR518 , you may need to develop your own controller to control the servo. Below is a brief schematic diagram of servo control card, you can refer to the diagram to design your own control.
Page 20
Following the development process. 5.21 Create engineering Run Eclipse,Choose“File”->”New”->”C Project” Menu item,new project,as following。 www.springrc.com (v:1.0) TEL:+86-755-2974-9810 FAX:+86-755-2974-9779 Page 20 of 49...
Page 21
Spring Model Electronics Co.Ltd In the popup dialog box type “Servo Control” in “Project Name” ,in“Project Type”listing, the item of “AVR Cross Target Application”,Choose“Empty Project”,click“Next”。 Pop-up the option configuration dialog as below,click“Next”。 www.springrc.com (v:1.0) TEL:+86-755-2974-9810 FAX:+86-755-2974-9779 Page 21 of 49...
Page 22
Spring Model Electronics Co.Ltd Pop-up target equipment attribute Settings dialog ,in“MCU Type”listing,pls choose“ATmega128”,and type “16000000”in“MCU Frequency” as below。 click“Finish” Return to Eclipse main window,in the left“Project Explorer”item, display“ServoControl”program as below: www.springrc.com (v:1.0) TEL:+86-755-2974-9810 FAX:+86-755-2974-9779 Page 22 of 49...
Page 23
Spring Model Electronics Co.Ltd Choose“File”->”New ”->”Source File”menu item,Construct new source code files as below: Pop-up setting dialogbox,type “main.c”in “Source File”as below,click“Finish” www.springrc.com (v:1.0) TEL:+86-755-2974-9810 FAX:+86-755-2974-9779 Page 23 of 49...
Page 24
Return to Eclipsemain window , main.c,documents to be automatically added to“ServoControl”and in editable form: Add main function in main.c window as below。The click start compiler.main function code is below: /********************************Copyright************************************** Beijing UPTECH Robotics Co.Ltd. yanfabu@126.com www.springrc.com (v:1.0) TEL:+86-755-2974-9810 FAX:+86-755-2974-9779 Page 24 of 49...
Page 25
** (Date Last Modified): 2010-3-25 ** (Last Version): ** (Description): **------------------------------------------------------------------------------------------------------------------- ---------- ** (Author): robot ** (Date Created): 2010-3-25 ** (Version): ** (Description): ******************************************************************************/ int main(void) while (1) Compile information appear in“Console”child window,double click“Console”tag maxmium www.springrc.com (v:1.0) TEL:+86-755-2974-9810 FAX:+86-755-2974-9779 Page 25 of 49...
Page 26
(Init general digital I/O port) ** (Input Variable): void ** (Return Value): void ** (Macro or constant used): None ** (Global variable used): None ** (Other function called): None ** (Author): robot ** (Date created): 2010-3-25 www.springrc.com (v:1.0) TEL:+86-755-2974-9810 FAX:+86-755-2974-9779 Page 26 of 49...
Page 27
#include <avr/io.h> #include <util/delay.h> Click keep main.c, then click recompile procedure, u can see the compilation result in the “Console“child window as below。 www.springrc.com (v:1.0) TEL:+86-755-2974-9810 FAX:+86-755-2974-9779 Page 27 of 49...
Page 28
DDRE &= ~_BV(PE0); // (Set default direction of RX to input mode) PORTE &= ~_BV(PE0); // (Set default state of RX to tri-state) DDRE |= _BV(PE1); // (Set default direction of TX to output mode) www.springrc.com (v:1.0) TEL:+86-755-2974-9810 FAX:+86-755-2974-9779 Page 28 of 49...
Page 29
SendUart0Byte in main.c The HTML code is as follows: /**********************************Function Info *********************** ** (Function Name): SendUart0Byte ** (Description): (Send one byte through UART0) ** (Input Variable): unsigned char data www.springrc.com (v:1.0) TEL:+86-755-2974-9810 FAX:+86-755-2974-9779 Page 29 of 49...
Page 30
UDR0 = data; Duplicate &paste the above code to main.c documents , click keep main.c , then recompile procedure,you can see the compilation results in the 在“Console“ child click window is shown below。 www.springrc.com (v:1.0) TEL:+86-755-2974-9810 FAX:+86-755-2974-9779 Page 30 of 49...
Page 31
Spring Model Electronics Co.Ltd SR518 series servos can be set in two modes: servo mode and motor mode. When servos come out of the factory, it is considered to be the default servo mode. The mode Settings can be realized by setting the minimum and maximum limit parameters. Here add a SetServoLimit function to set the servo mode, when program needs to change the actual operation mode, you can invoke this function, the code is below:...
Page 32
// (split 16 bits to 2 bytes) PORTA &= ~_BV(PA1); PORTA |= _BV(PA0); // (Set the bus to host transmit state) UCSR0A |= (1<<TXC0); // (Clear written flag of UART0) SendUart0Byte(0xFF); // (Send the start byte 0xff) www.springrc.com (v:1.0) TEL:+86-755-2974-9810 FAX:+86-755-2974-9779 Page 32 of 49...
Page 33
// to receive the answer, so here delays 2 ms.) Duplicate & paste the above code to main.c documents,click keep main.c,then click recompile procedure,u can see the compilation result in “Console“child window as below。 www.springrc.com (v:1.0) TEL:+86-755-2974-9810 FAX:+86-755-2974-9779 Page 33 of 49...
Page 34
** (Global variable used): None ** (Other function called): None ** (Author): robot ** (Date created): 2010-3-25 ** (Revised): ** (Date Revised): ************************************************************************/ void SetServoPosition(unsigned char id, unsigned short int position, unsigned short int velocity) www.springrc.com (v:1.0) TEL:+86-755-2974-9810 FAX:+86-755-2974-9779 Page 34 of 49...
Page 36
// to receive the answer, so here delays 2 ms.) keep main.c , then Duplicate & paste the above code to main.c documents,click click recompile procedure,u can see the compilation result in“Console“child window as below。 www.springrc.com (v:1.0) TEL:+86-755-2974-9810 FAX:+86-755-2974-9779 Page 36 of 49...
Page 37
None ** (Global variable used): None ** (Other function called): None ** (Author): robot ** (Date created): 2010-3-25 ** (Revised): ** (Date Revised): ************************************************************************/ void SetServoVelocity(unsigned char id, signed short int velocity) www.springrc.com (v:1.0) TEL:+86-755-2974-9810 FAX:+86-755-2974-9779 Page 37 of 49...
Page 38
PORTA |= _BV(PA0); // (Set the bus to host transmit state) UCSR0A |= (1<<TXC0); // (Clear written flag of UART0) SendUart0Byte(0xFF); // (Send the start byte 0xFF) SendUart0Byte(0xFF); // (Send the start byte 0xFF) www.springrc.com (v:1.0) TEL:+86-755-2974-9810 FAX:+86-755-2974-9779 Page 38 of 49...
Page 39
// to receive the answer, so here delays 2 ms. Duplicate & paste the abovecode to main.c documents , click keep main.c , then recompile procedure,u can see the compilation result in the 在“Console“ child click window as below。 www.springrc.com (v:1.0) TEL:+86-755-2974-9810 FAX:+86-755-2974-9779 Page 39 of 49...
Page 41
“Console“child window as below。After right compilation,,we can use thewayof ISP or IAPto download the procedure to the control card.Please refre to the detailed methodlogy 《EclipseForAVR program development》 。 www.springrc.com (v:1.0) TEL:+86-755-2974-9810 FAX:+86-755-2974-9779 Page 41 of 49...
Page 42
In order to make the logic clear, we can add four functions of left, right, forward and backward to invoke The function GetGpio code of read sensor data is below: /**********************************Function Info *********************** ** (Function Name): GetGpio www.springrc.com (v:1.0) TEL:+86-755-2974-9810 FAX:+86-755-2974-9779 Page 42 of 49...
Page 43
// (_BV is a macro to shift, _BV(0) means (1<<0) else temp_input_value &= ~_BV(0); if (PINE & _BV(PE4)) // (Get value of PE5) temp_input_value |= _BV(1); else temp_input_value &= ~_BV(1); *val = temp_input_value; www.springrc.com (v:1.0) TEL:+86-755-2974-9810 FAX:+86-755-2974-9779 Page 43 of 49...
Page 44
//with the velocity of 500) _delay_ms(time); //(Delay time ms) The code of TurnRight is below: /**********************************Function Info *********************** ** (Function Name): TurnRight ** (Description): (TurnRight) ** (Input Variable): unsigned short int time, ** (Return Value): void www.springrc.com (v:1.0) TEL:+86-755-2974-9810 FAX:+86-755-2974-9779 Page 44 of 49...
Page 45
** (Input Variable): unsigned short int time, ** (Return Value): void ** (Macro or constant used): None ** (Global variable used): None ** (Other function called): None ** (Author): robot ** (Date created): 2010-3-25 www.springrc.com (v:1.0) TEL:+86-755-2974-9810 FAX:+86-755-2974-9779 Page 45 of 49...
Page 46
SetServoVelocity(2, -500); // (Control the servo of ID 2 to rotate //with the velocity of -500) SetServoVelocity(3, 500); // (Control the servo of ID 3 to rotate //with the velocity of 500) www.springrc.com (v:1.0) TEL:+86-755-2974-9810 FAX:+86-755-2974-9779 Page 46 of 49...
Page 47
(Set the servo of ID 2 to motor mode) SetServoLimit(3,0,0); // (Set the servo of ID 3 to motor mode) SetServoLimit(4,0,0); //(Set the servo of ID 4 to motor mode) while (1) GetGpio(&temp_value); www.springrc.com (v:1.0) TEL:+86-755-2974-9810 FAX:+86-755-2974-9779 Page 47 of 49...
Page 48
After right compilation,you can use the way of ISP or IAP to download procedures to the control card。Please refer to the detailed methodlogy《EclipseForAVR program development》 。 www.springrc.com (v:1.0) TEL:+86-755-2974-9810 FAX:+86-755-2974-9779 Page 48 of 49...
Page 49
Spring Model Electronics Co.Ltd Appendix A. SR518 electric functional block diagram POWER System Protection Voltage Conversion Over heat Over voltage Over load Under voltage Bridge Angle Half duplex Signal Sensor UART www.springrc.com (v:1.0) TEL:+86-755-2974-9810 FAX:+86-755-2974-9779 Page 49 of 49...
Need help?
Do you have a question about the SR518 and is the answer not in the manual?
Questions and answers