In recent years, the advancement of artificial intelligence (AI) has propelled the development of intelligent systems across various industries. As a pivotal application of AI, the humanoid robot has garnered significant attention due to its potential to enhance efficiency and reduce labor costs. From a personal perspective, I have been deeply involved in a project focusing on the design and implementation of a humanoid robot based on the STM32 microcontroller. This humanoid robot, often referred to as an anthropomorphic robot, integrates multiple disciplines such as electronics, mechanics, biomimetics, and computer science, forming a comprehensive system that mirrors human form and function. The humanoid robot’s applications span military, industrial, healthcare, firefighting, and construction sectors, underscoring its versatility and economic impact. In this article, I will elaborate on the design process, covering mechanical structure, hardware selection, software development, and experimental results, while emphasizing the role of the STM32 in controlling multiple servos for complex movements.
The mechanical design of a humanoid robot is fundamental to its stability and functionality. A humanoid robot is a nonlinear multi-degree-of-freedom system, where the number and placement of servos directly influence performance stability and modeling. To achieve diverse motion sets, coordination among multiple degrees of freedom (servos) is essential. However, increasing degrees of freedom complicates control, which is why I opted for a 24-channel servo control board to manage multiple servos efficiently. The humanoid robot in this project comprises 17 servo motors driven by the servo control board. Key configurations include a 270° rotation range servo at the neck for enhanced head mobility, two 270° servos at each shoulder for extensive arm movement, and 180° servos at the hip, knee, and ankle joints to coordinate lower limb motions. The hip servos are oriented vertically downward to maintain the humanoid robot’s center of gravity. Specific servo allocations are summarized in the table below.
| Joint | Servo Type | Rotation Range | Quantity |
|---|---|---|---|
| Neck | LDX-227 | 270° | 1 |
| Shoulder | LDX-227 | 270° | 2 per arm |
| Hip | LDX-218 | 180° | 2 |
| Knee | LDX-218 | 180° (initial 45° offset) | 2 |
| Ankle | LDX-218 | 180° | 2 |
The choice of drive system is critical for the humanoid robot’s operation. After comparing various drive types such as hydraulic, pneumatic, DC motor, and solar drives, I selected servo motors due to their suitability for small-scale and walking robots. Servo motors, or simply servos, offer direct connectivity with electronic components, low production cost, and good reparability. The servos used are LDX-218 and LDX-227 models from Lobot, which operate on Pulse Width Modulation (PWM) signals. The servo angle is controlled by adjusting the duty cycle of the PWM signal, as expressed by the formula: $$ \theta = k \cdot D $$ where $\theta$ is the rotation angle, $D$ is the duty cycle, and $k$ is a proportionality constant. When no PWM signal is received, the servo remains idle. This mechanism enables precise positioning essential for the humanoid robot’s movements.
For controlling multiple servos, I employed a 24-channel servo control board (LSC-24) with the STM32F103RBT6 microcontroller as its core. This board features 64KB FLASH memory, 8 A/D conversion interfaces, 24 digital I/O ports, and 3 PWM expansion interfaces. The STM32 microcontroller, based on the ARM Cortex-M3 core, operates at up to 72MHz and includes peripherals like I2C, SPI, USART, USB, and CAN. Its specifications include 64KB of flash memory, 20KB of SRAM, and low-power modes (sleep, stop, standby). The servo control circuit integrates a voltage regulator to provide 6-8.4V for servo operation, as illustrated in the following schematic representation: $$ V_{out} = V_{in} \cdot \frac{R_2}{R_1 + R_2} $$ where $V_{in}$ is the input voltage and $V_{out}$ is the regulated output. This setup ensures stable power delivery to all servos in the humanoid robot.

The overall design parameters of the humanoid robot were derived from biomechanical studies to mimic human proportions. These parameters are crucial for achieving balance and natural movement. The table below outlines the key hardware data.
| Parameter | Value |
|---|---|
| Dimensions | 388mm × 476mm |
| Weight | 3kg |
| Body Material | Hard Aluminum Alloy |
| Battery | 7.4V |
| Endurance | 1.5 hours |
| Head Servos | 1 |
| Arm Servos | 4 |
| Torso Servos | 4 |
| Leg Servos | 8 |
On the software side, I utilized Arduino IDE for servo initialization and IAR Embedded Workbench for programming motion sequences. The humanoid robot’s actions, such as walking, turning, waving, bowing, and dancing to music, are implemented using C language arrays. Each motion is defined as a two-dimensional array representing servo angles over time. For instance, a walking cycle can be modeled as: $$ \Theta(t) = \begin{bmatrix} \theta_1(t) & \theta_2(t) & \cdots & \theta_{17}(t) \end{bmatrix} $$ where $\Theta(t)$ is the angle vector for all servos at time $t$. The sequence of arrays is executed iteratively to produce smooth movements. The control system uses a remote handle with an AS32-TTL-100 communication module based on LoRa technology. This module operates at 410-441MHz with 32 channels, enabling wireless control up to 3km. The handle sends commands via LoRa to the servo control board, which decodes them into PWM signals for the humanoid robot.
The experimental phase involved several challenges. For example, the humanoid robot’s balance was affected by surface irregularities and friction. To mitigate this, I added weights to the robot and attached plastic pads to its feet to increase traction. The motion linearity was improved by calibrating servo angles using online tools like “robot.py” through a serial interface. During testing, I observed that minor discrepancies in servo movement caused deviations in straight-line walking. This was addressed by implementing a feedback correction algorithm: $$ \Delta \theta = \alpha \cdot (d_{target} – d_{actual}) $$ where $\Delta \theta$ is the angle adjustment, $\alpha$ is a gain factor, $d_{target}$ is the desired distance, and $d_{actual}$ is the measured distance. Additionally, servo preprocessing was necessary to reset servos to initial positions using Arduino code, ensuring accuracy before assembly.
The integration of hardware and software culminated in a functional humanoid robot capable of diverse actions. The STM32 microcontroller, through the 24-channel control board, orchestrates servo movements in real-time. The humanoid robot’s performance was validated through repeated trials, demonstrating robust operation in indoor environments. The use of LoRa for wireless control enhanced flexibility, allowing remote operation without physical constraints. From this experience, I learned that designing a humanoid robot requires meticulous attention to mechanical alignment, power management, and software synchronization. The humanoid robot project not only showcased the potential of embedded systems in robotics but also highlighted avenues for future improvements, such as integrating sensors for autonomous navigation.
In summary, this project detailed the design of a humanoid robot based on STM32, focusing on multi-servo control and motion implementation. The humanoid robot’s mechanical structure, driven by carefully configured servos, enables human-like movements. The STM32 microcontroller, coupled with a 24-channel servo control board, forms the core of the control system, while LoRa-based wireless communication facilitates remote operation. Software development in C, utilizing arrays for motion sequences, allowed for precise control of the humanoid robot. Despite challenges in balance and calibration, solutions were devised through hardware modifications and algorithmic adjustments. This humanoid robot serves as a testament to the integration of electronics, mechanics, and computer science, paving the way for more advanced humanoid robots in various applications. The continuous evolution of humanoid robot technology promises to revolutionize industries by enhancing automation and efficiency.
To further elaborate on the technical aspects, the kinematics of the humanoid robot can be described using Denavit-Hartenberg parameters. For each joint, the transformation matrix is given by: $$ A_i = \begin{bmatrix} \cos\theta_i & -\sin\theta_i \cos\alpha_i & \sin\theta_i \sin\alpha_i & a_i \cos\theta_i \\ \sin\theta_i & \cos\theta_i \cos\alpha_i & -\cos\theta_i \sin\alpha_i & a_i \sin\theta_i \\ 0 & \sin\alpha_i & \cos\alpha_i & d_i \\ 0 & 0 & 0 & 1 \end{bmatrix} $$ where $\theta_i$ is the joint angle, $\alpha_i$ is the twist angle, $a_i$ is the link length, and $d_i$ is the link offset. The overall transformation for the humanoid robot’s end-effector is obtained by multiplying individual matrices: $$ T = A_1 \cdot A_2 \cdots A_n $$ This model aids in simulating and optimizing movements for the humanoid robot. Additionally, power consumption analysis is vital for endurance. The total current draw $I_{total}$ can be estimated as: $$ I_{total} = \sum_{i=1}^{n} I_{servo_i} + I_{MCU} + I_{comms} $$ where $I_{servo_i}$ is the current per servo, $I_{MCU}$ is the microcontroller current, and $I_{comms}$ is the communication module current. For the humanoid robot, with 17 servos drawing an average of 500mA each, the peak current reaches 8.5A, necessitating a robust battery system.
The control algorithm for the humanoid robot involves generating trajectories for each servo. A common approach is to use cubic splines for smooth motion: $$ \theta(t) = a + bt + ct^2 + dt^3 $$ where coefficients $a$, $b$, $c$, $d$ are determined from boundary conditions. This ensures that the humanoid robot moves without jerks, enhancing stability. Furthermore, the humanoid robot’s balance control can be modeled using an inverted pendulum approach. The equation of motion for a simplified model is: $$ I \ddot{\theta} = mgl \sin\theta – \tau $$ where $I$ is the moment of inertia, $m$ is mass, $g$ is gravity, $l$ is length, $\theta$ is the tilt angle, and $\tau$ is the torque applied by servos. Implementing a PID controller helps maintain upright posture: $$ \tau = K_p e + K_i \int e \, dt + K_d \frac{de}{dt} $$ where $e$ is the error from desired angle. This theoretical foundation supports the practical design of the humanoid robot.
In terms of software tools, I used Arduino IDE for its extensive library support and IAR for its debugging capabilities. The humanoid robot’s motion programs were written in C and stored in the STM32’s flash memory. The table below compares key features of these tools in the context of humanoid robot development.
| Software | Advantages | Disadvantages |
|---|---|---|
| Arduino IDE | Easy-to-use libraries, real-time compilation | Limited to basic servo control |
| IAR Embedded Workbench | Advanced debugging, efficient code optimization | Steeper learning curve |
The communication protocol between the handle and humanoid robot is based on serial data transmission. Each command packet includes a header, servo IDs, angle data, and checksum. The packet structure can be represented as: $$ \text{Packet} = [\text{Header}, \text{ID}_1, \theta_1, \text{ID}_2, \theta_2, \ldots, \text{Checksum}] $$ This ensures reliable control of the humanoid robot over wireless links. The AS32-TTL-100 module’s parameters, such as transmit power and baud rate, were configured to optimize range and data integrity for the humanoid robot operations.
Future enhancements for this humanoid robot could include integrating IMU sensors for dynamic balance, vision systems for object recognition, and AI algorithms for adaptive learning. The humanoid robot platform, built around STM32, offers scalability for such additions. In conclusion, the design and implementation of this humanoid robot have provided valuable insights into robotic systems, emphasizing the interplay between hardware and software. The humanoid robot stands as a prototype for more sophisticated machines that could transform everyday tasks through automation. As AI and robotics advance, the humanoid robot will undoubtedly play a pivotal role in shaping the future of technology.
Throughout this project, the term “humanoid robot” has been central, reflecting its anthropomorphic nature and functional goals. By leveraging STM32 and multi-servo control, this humanoid robot achieves a high degree of motion flexibility, setting a foundation for further research. The experience underscores the importance of interdisciplinary knowledge in developing effective humanoid robots. As I continue to explore robotics, the lessons from this humanoid robot project will inform future endeavors aimed at creating more autonomous and intelligent systems.
