yahboom
HomeLearn
Solution
Blog
Online Store
About Us
EN/中文
24-channel Servo Drive Board📖
1.Introduction and tutorials
  • 24-Channel Servo Drive Board
  • PS2 Handle Description
2.Control servo board
  • 2.0 Raspberry Pi 5 control tutorial
  • 2.1 RPi_Jetson
  • 2.2 STM32
  • 2.3 C51
  • 2.4 Arduino
  • 2.5.MSPM0G3507
  • 2.6.MSPM0G3519
3.Download program
  • Download program
Download
  • Code
  • SCH_Other file
  • APP(Android/iOS)
Download ZIP

Welcome to 24-channel Servo Drive Board repository

24-Channel Servo Drive Board

24-Channel Servo Drive Board

24-Channel Servo Drive Board1.Hardware Preparation2.Hardware Introduction2.1 24-Channel Servo Drive Board2.2 2DOF PTZ2.3 Introduction to Bluetooth module2.4 Introduction to PS2 handle3.Experiment Purpose4.Experimental Steps4.1Schematic diagram4.2 Description of pPS2 handle control4.3 Description of mobile APP control4.4 Servo motion 5.Source code analysis6.Experiment summary7.Expand the characteristic functions of parts and boards7.1 Expansion part - control 270° servo2.Features

1.Hardware Preparation

* 24-channel steering gear control board * image-2022111800001

As shown below. image-2022111800011

* 2DOF steering gear PTZ *1 * image-2022111800002

* Bluetooth module *1 * image-2022111800003

* ps2 handle * image-2022111800004

* 7.4V battery *1 *

 

2.Hardware Introduction

2.1 24-Channel Servo Drive Board

The control chip used in this control board is STM32RCT6, with 32 * 128 OLED interface, Bluetooth 4.0 interface, PS2 handle interface and 24-channel PWM steering gear interface.

2.2 2DOF PTZ

PTZ is controlled up and down by a 180° servo, and left and right by a 270° servo. The voltage at which the two servo work normally is 6-7.4V.

2.3 Introduction to Bluetooth module

It has the following advantages

  • Support standard BLE protocol;
  • Support UART and I2C interfaces;
  • Support low power consumption mode;
  • Support Bluetooth Class1 and Class2 modes;
  • Industrial grade design;
  • Data encryption;
  • Built in PCB antenna;
  • Input voltage: 3V;

2.4 Introduction to PS2 handle

image-2022111800005 image-2022111800006

 

3.Experiment Purpose

The 24 channel steering gear control board controls the movement of the 2DOF servo PTZ, realizing the process of mobile phone APP Bluetooth control and PS2 handle control.

4.Experimental Steps

4.1Schematic diagram

image-2022111800007

From the schematic diagram, we can clearly understand how each pin of stm32 controls the 24 channel steering gear control board.

image-2022111800008

  • Serial port 5 communicates with Bluetooth
  • Serial port 3 is reserved for communication with raspberry pie and Jetson series.

4.2 Description of pPS2 handle control

Initialize the STM32 pin according to the schematic diagram Handle interface initialization: Input DI ->PA6 Output DO ->PA7 CS ->PA4 CLK ->PA5 Then according to the working principle of PS2 handle, write the relevant driver.

Handle control principle The handle control can only control 8-channel steering gear at one time, so this experiment divides the 24 channel steering gear into three groups, each group has 8-channel steering gear, and uses the key-1 on the board to switch the number of steering gear groups (value of key 1: 0 ->1 ->2 ->0), realizing the function of the handle control of 24-channel steering gear. Handle control phenomenon Each two buttons on the handle (one for increasing angle and one for decreasing angle) correspond to one way steering gear control. The keys correspond to the servo as follows:

Increase angleDecrease angleKey valueServo
SELECTSTART0S1 servo
L3R3 S2 servo
upDOWN S3 servo
RIGHTLEFT S4 servo
L2R2 S5 servo
L1R1 S6 servo
GREENBLUE S7 servo
REDPINK S8 servo
SELECTSTART1S9 servo
L3R3 S10 servo
upDOWN S11 servo
RIGHTLEFT S12 servo
L2R2 S13 servo
L1R1 S14 servo
GREENBLUE S15 servo
REDPINK S16 servo
SELECTSTART2S17 servo
L3R3 S18 servo
upDOWN S19 servo
RIGHTLEFT S20 servo
L2R2 S21 servo
L1R1 S22 servo
GREENBLUE S23 servo
REDPINK S24 servo

4.3 Description of mobile APP control

The mobile app communicates with the Bluetooth module on the 24 channel servo control board through Bluetooth, thus indirectly controlling the movement of the 2DOF steering gear PTZ. The communication protocol is as follows:

image-2022111800009

Install the APP provided by us and connect Bluetooth on the APP interface to achieve the goal of mobile app controlling the 2DOF PTZ. The QR code for downloading the app, as shown below.

image-2022111800015

After connecting Bluetooth on the APP interface, enter the servo control page image-2022111800016

4.4 Servo motion

This tutorial uses a timer to simulate PWM to realize the angle control of the steering gear. The main code is as follows: (Take a PWM servo as an example)

image-2022111800010

 

5.Source code analysis

int main(void)
{   
    u8 Dnum;
    u8 Doup;
    //Steering gear angle initialization
    for(Doup = 0;Doup <GROUP_NUM;Doup++)
    {  
        for(Dnum = 0;Dnum <DUOJI_NUM;Dnum++)
        {
            Angle_J[Doup][Dnum] = 90;
        }
        
    }
    
    bsp_init();//Perform hardware initialization again
    while (1)
    {
        dectect_beep();//Detection voltage
        void_jutce(); //Detect the total current of servo
        user_douji();   //Handle control
        if(Key1_State(1)==1)//Each click will only take effect once
        {
            grop++;
            if(grop>2)
            {
                grop = 0; 
            }
                
        }
    }
                                    
}
  • Angle_ J: It is a two-dimensional array that controls the angle of the steering gear

  • GROUP_ NUM: it defines how to divide the 24 way steering gear into several groups

  • DUOJI_ NUM: is the defined number of each group of steering gear -The timer controls the angle of the steering gear according to Angle_ J [0] [0] is a numerical value that controls the angle of the first steering gear, and the same is true for other steering gears.

  • bsp_ Init: This function is used to initialize the IO port according to the schematic diagram. See the source code for details.

  • dectect_ Beep: This function is used to detect whether the battery has a power supply of more than 6.5V. If the power supply is lower than 6.5V, an alarm will be given automatically (buzzer will sound). The alarm can only be removed by replacing a power supply of more than 6.5V.

  • void_ Jutce: This function detects whether the total current of the steering gear is greater than 16A. If it is, the steering gear is overloaded, and the buzzer will ring immediately.

  • user_ Douji: This function is a control to implement the handle. See the source code for details.

  • The mobile APP is controlled by serial port interrupt. The source code of interrupt processing is in BSP_ usart.

    C Content of serial port 5In All Header The h file also defines some peripheral switches. If you do not connect some peripheral devices, you can turn off these peripheral functions, reduce power consumption and memory, and improve speed. Especially if you do not connect the PS2 handle, you must turn off the functions of the handle, otherwise it will affect the judgment.

     

6.Experiment summary

Through experiments and source code analysis, it can be clearly understood that the working principle of the steering gear is as follows: Working principle of steering gear: the control signal enters the signal modulation chip from the channel of the receiver to obtain the DC bias voltage. There is a reference circuit inside it, which generates a reference signal with a period of 20ms and a width of 1.5ms. The DC bias voltage obtained is compared with the voltage of the potentiometer to obtain a voltage difference output. Finally, the positive and negative output of the voltage difference to the motor driver chip determines the positive and negative rotation of the motor. When the motor speed is fixed, this wheel drives the potentiometer to rotate through cascade deceleration, so that the voltage difference is 0 and the motor stops rotating. Steering gear control: generally, a time base pulse of about 20ms is required, and the high-level part of the pulse is generally the angle control pulse within the range of 0.5ms-2.5ms. The steering gear used in this experiment is a 180 degree servo, and the control relationship is as follows: 0.5ms ---------------- 0° 1.0ms ----------------- 45° 1.5ms ----------------- 90° 2.0ms ----------------- 135° 2.5ms ----------------- 180°

 

7.Expand the characteristic functions of parts and boards

7.1 Expansion part - control 270° servo

  • If you need to control 270° servo, BSP of source code_ Overwrite the interrupt function in timer. c file

    For example, if the first servo control is a 27° steering gear_ UP_ Rewrite the control formula of the first servo in IRQHandler() function.

xxxxxxxxxx
//Turn this formula (180°)
num <= (Angle_J[0][0] * 11 + 500)/times
//Change to 270°
num <= (Angle_J[0][0] * 8 + 500)/times

The range of control angle will change from 0-180° to 0-270° . The corresponding relationship, as shown below.

image-2022111800012

2.Features

  • The board has the function of detecting the current when the steering gear rotates, which has the function of protecting the board and alarming the current overload of the steering gear.

  • The serial port of the board can be directly connected with the serial port on the raspberry pie and the Jetson nano pin, which can largely avoid the cumbersome wiring and greatly improve the wiring efficiency. As shown below.

    image-2022111800013

    Wiring diagram between steering gear control panel and Raspbeery Pi If you encounter a program error, you can refer to the next tutorial document.

xxxxxxxxxx
#If the module cannot be found, you can use the following command to install it
sudo pip install serial
sudo pip install pyserial

image-2022111800014 Wiring diagram of servo control board and Jetson NANO.

  • In the folder of program source code, there are serial communication programs of Raspberry Pi, jetson nano and servo control board.

Procedural phenomenon Raspberry Pi/Jetson nano sends the letter 'H' continuously through the serial port, and the servo control board will immediately return the received information, that is, what is sent back to what is sent back.

PS2 Handle Description

COMPANY

  • About us
  • Team Style
  • Blog

LEARNING & EXPLORATION

  • Tutorials
  • Edge AI hardware
  • Educational robots
  • Embedded intelligent hardware

WHERE TO BUY

  • Yahboom Online Store
  • Amazon
  • Alibaba
  • AliExpress
  • Mercado

TECHNOLOGY SUPPORT

  • Email: support@yahboom.com

BE A DISTRIBUTOR

  • Email: sales@yahboom.com
QR Code

Copyright © 2017-2026 Yahboom. All Rights Reserved.

EN/中文