Zhongling Technology 24-channel steering gear controller usage tutorial and six-legged robot development (1) - User manual reading and analysis

zero,

A core issue: to drive a six-legged robot, it can be divided into an action group and a control group (expandable communication group).
The action group only needs to be debugged through the visualization software [Zide]. After debugging, it is stored in the register. When the program requires the device to move, the relevant action group can be directly called through the serial port command, which is simple and convenient.
The control group can either directly use the host computer software provided by the manufacturer to send instructions, or it can expand and use microcontrollers such as STM32 and ARDUINO to send serial port instructions for control.


1. Introduction to the control panel

The ZL-IS2 24-channel servo control board is a graphical programming used to control action groups and is used with other microcontroller control panels. IS2 solves the problems related to multi-server control and graphical editing of action groups. , the robot action group can be easily programmed through ZIde. Visual action group programming is more accurate and easier to view than programming where the robot movement cannot be seen in real time.
Let’s take a look at the overview picture first:
insert image description here
[Power terminal]: The servo and CPU share a power supply with a supply voltage of 5~8.4V . The power supply power can be matched according to the number of servos. For example, when using five or six servos, the rated current must be above 3A. , when fifteen or six servos are used, the rated current must reach more than 8A. Since not every servo works at the same time, the more servos there are, the speed of current growth can be appropriately reduced. For example, when twenty-four servos are used When the current is about 10A, it is enough.
[Controller switch]: turn on-ON/turn off-OFF.
[USB debugging port]: Mainly used to communicate with the host computer. It can debug action groups, configure controller handles, infrared remote controls and other functions .
[Execution button]: In non-programming mode, short press the execution button once (the buzzer will sound once and the programming light flashes slowly) to execute the action group once. Press and hold the execution button (the buzzer will sound twice and not exceed five seconds). If the programming light flashes quickly), the action group will be executed in a loop. If
the execution button is pressed during the execution, the execution will be suspended. If it is pressed again, the execution will continue. If the execution button is long pressed (more than five seconds, the buzzer will sound one long time), it will be cleared. A stored action group; pressing the execute button in programming mode will exit programming mode.
[Programming button]: In non-execution mode, press and hold the programming button (the buzzer beeps twice) to enter the programming mode. At this time, the programming light lights up. Press the programming button in programming mode to record the current servo status once. A series of actions can be formed by recording multiple groups of servo statuses in sequence; in programming mode, press the execution button to exit the programming function, and the programming light will go out.
[Secondary development communication interface]: This is the wireless module interface, used to connect to the wireless synchronization module or used as a communication serial port during secondary development.
[Bluetooth interface]: Mainly connected to the Bluetooth module for use with mini programs.
[Buzzer]: Mainly used for sound prompts.
[Infrared interface]: It can be connected to an infrared receiver and used with infrared remote control to control bus execution equipment or be used as other trigger sources.
[Bus communication interface]: The 2 sets of yellow terminals are the bus communication interface, which are mainly connected to the Arduino expansion board bus interface, bus WIFI and other devices used to input instructions to the controller.
[Controller Interface]: It can be connected to the PS2 controller receiver with a 6P cable and used with the controller remote control to control bus execution devices or be used as other trigger sources.
[Bus servo interface]: The 6 sets of white terminals are the bus execution interface, which are mainly connected to execution devices, such as bus servos, bus MP3, bus motors and other bus devices. In theory, 255 devices can be connected in series on each line. Due to the For carrying capacity, it is recommended that no more than 5 devices be connected in series on each line.
[PWM servo interface]: Used to connect PWM servo, white pin - signal interface, red pin - positive electrode of servo power supply, black pin - negative electrode of servo power supply, a total of 24 channels of PWM servo can be connected.
[Power light]: Red, the red light is always on after power is supplied.
[Work light]: Green. When the power is supplied, the controller works normally. The work light flashes once every 1S. Otherwise, the controller is abnormal.
[Programming light]: Blue, always on in programming mode, off when exiting programming mode, flashing slowly when executing an action group once, flashing quickly when executing actions in a loop

2. What is the power supply for the control board?

insert image description here
As shown in the picture, a 7.4V aircraft model battery is connected to the input terminal of the voltage stabilizing module, and the output terminal outputs a voltage of about 5V to the control board to drive the servo.

3. PWM control steering gear

PWM (Pulse Width Modulation) control of the servo is a common control method that changes the position of the servo by adjusting the pulse width of the PWM signal. Specific steps are as follows:

First, choose a control board or microcontroller that supports PWM output. Common ones include Arduino, Raspberry Pi, etc.
Connect the signal wire of the servo to the PWM output pin of the control board or microcontroller.
Set the frequency and pulse width range of the PWM output in the code. The frequency is generally 50Hz, and the pulse width range is generally 1ms to 2ms, where 1ms corresponds to the minimum angle of the servo, and 2ms corresponds to the maximum angle of the servo.
Use code to control the pulse width of the PWM output pin to control the position of the servo. Generally speaking, an increase in pulse width will cause the servo to rotate counterclockwise, and a decrease in pulse width will cause the servo to rotate clockwise.

I won’t elaborate on the specific principles. It’s actually very simple and this is not the point.

4. Focus: Carry out secondary development

My purpose is to use STM32 to send serial port commands to the servo control board to control the robot to perform action groups. In this way, more functions can be developed based on stm32 and are no longer limited by the servo control board.
insert image description here

As you can see, the serial port is used for communication here.

1. Call instructions to control

Let’s first look at the official secondary development routines for stm32 and adruino:

int main(void) {
    
    	
	rcc_init();				//主频设置72M
	tb_usart_init();		//初始化串口
	tb_interrupt_open();	//总中断打开
	while(1) {
    
    	
		uart1_send_str((u8 *)"$DGT:0-4,1!");	//串口1 调用 0到4 动作,执行1次 其他命令参照控制器指令
		zx_uart_send_str((u8 *)"$DGT:0-4,1!");	//总线口 调用 0到4 动作,执行1次 其他命令参照控制器指令
		delay_ms(10000);						//延时10秒	
	}
}
SoftwareSerial mySerial(A4,A5); //创建一个软串口的类,模拟引脚4,5分别代表 RX, TX引脚 AR多功能板
//SoftwareSerial mySerial(10,2);  //创建一个软串口的类,模拟引脚4,5分别代表 RX, TX引脚 AR扩展版
    
void setup() {
    
    
    Serial.begin(115200);           //硬件串口
    mySerial.begin(115200);         //设置软串口波特率
}

void loop() {
    
    
    Serial.print("$DGT:0-4,1!");    //串口1 调用 0到4 动作,执行1次 其他命令参照控制器指令
    mySerial.print("$DGT:0-4,1!");  //总线口 调用 0到4 动作,执行1次 其他命令参照控制器指令
    delay(10000);                              //延时10秒 
}

It can be seen that both basically initialize a communication serial port, and then send an instruction to the servo control board to drive the servo to complete the corresponding instruction. Read the development manual and you can find the instruction set:

serial number Steering gear operation instructions Instruction explanation Remark
1 #IndexPpwmTtime! For a single servo command, Index is 3 digits, 000-254; pwm is 4 digits, 0500-2500; time is 4 digits, 0000-9999, in milliseconds, a total of 15 digits of data, and the missing digits are filled with 0
2 {#000P1500T1000!#001P0900T1000!} For multiple servo instructions, put multiple single servo instructions together and seal them with {}
3 $DGS:0! Call action G0000, provided that action G0000 has been stored focus
4 $DGT:0-10.1! Call the action group G0000~G0010 once. If it is 0 times, it means loop execution. focus
5 $CGP:1-10! Get action groups 1~10 and print them out from USB
6 #005PSCK+010! Set the deviation of No. 5 servo to 10, and the maximum absolute value of the deviation is 500
7 $DST! All servos stop at the current position focus
8 $DST:x! Servo number x stops at the current position focus
9 $DKT:1,5! Perform Combo Set 1 5 times focus

In fact, the most important thing is to master the fourth command, which is how many times our main control board serial port sends this command to start and execute a certain action group.

2. Official PC learning

Since the action group can be controlled by serial port instructions, how to store the action group into the register of the servo control board is a more important issue. Open the official host computer Zide.
insert image description here
There are a total of 380 action groups. Here I take the ground fast forward as an example:
you can see that its corresponding numbers are G00005-G00008, a total of four servo commands.
insert image description here
If I want the action of low fast forward to be executed 4 times in a loop, that is, when walking 4 steps forward, I can use the serial port to send the following command:

uart1_send_str((u8 *)"$DGT:5-8,4!");	//串口1 调用 5到8 动作,执行4次 其他命令参照控制器指令

The same goes for other actions. This is very good. The official host computer has written down the PWM levels of all 24-channel servos. We don’t need to worry about it. We just need to call it and that’s it. For me, I only need to go forward and backward. , left turn, right turn, U-turn and other action groups, then when carrying out secondary development, I only need to focus on writing and issuing serial port instructions on the STM32 side.

Summarize

The official host computer is very user-friendly. In the next section, I will start writing the STM32 code. The biggest problem here is: I need to connect the STM32 with the servo control board using wires. Then if I want to send specific instructions through remote control, What approach should be taken? Obviously, either Bluetooth, wifi, or a wireless transceiver module.

Guess you like

Origin blog.csdn.net/qq_53092944/article/details/132476120