Welcome to 24-channel Servo Drive Board repository
2.0 Raspberry Pi 5 control tutorial
Raspberry Pi 5 controls the servo of the servo board to rotate
Raspberry Pi 5 controls the servo of the servo board to rotate1.Raspberry Pi 5 controls the rotation of the servo board
1.Raspberry Pi 5 controls the rotation of the servo board
According to the schematic diagram of the servo board, it can be seen that the serial port 3 is specially used to communicate with the host computer. This section discusses how the Raspberry Pi controls the rotation of the servo on the servo board according to the communication protocol.
* Environment configuration *
Beforehand, configure the Raspberry Pi serial port, because the hard serial port of the Raspberry Pi is used for Bluetooth, and the mini serial port is unstable to use. This experiment uses the hard serial port.
First perform the following operations to map the serial port Enter sudo raspi-config in the terminal




After the configuration is completed, save and exit, and restart according to the prompts.
Start experimenting
The pin diagram of Raspberry Pi is as follows:

The wiring between Raspberry Pi and servo board is as shown in the figure

Transfer the Raspberry Pi source code (serial_pi_cor.py) of this routine to the Raspberry Pi You can use winScp software for file transfer Link:http://www.yahboom.net/study/raspberry4B

Run the following code in the Raspberry Pi 5 terminal:
xxxxxxxxxxpython3 serial_pi_cor.py#If you encounter an error that the module cannot be found, you can use the following command to install it.sudo pip install serialsudo pip install pyserialRefer to the 16-channel servo control board communication protocol

For example: if you want the servo of channel 4 to rotate to 100 degrees, enter D in the terminal first, press Enter, and then enter 100 degrees. That is, the desired result can be achieved.

Press ctrl+c to end the running program.