smallembedded

【Training Camp】Bionic Quadruped Robot Dog

 
Overview

Project Introduction



Open Source Link : Bionic Quadruped Robot Dog

A four-legged robot dog based on Chuanzhi Hi3861 module. The legs are composed of a total of 8 mg90s servos, each leg has two degrees of freedom. Based on the inverse solution of kinematics, it can realize rich action modes. Bluetooth remote control and preliminary verification of face following functions have been added.
imgTitle.jpg

References

The original project and tutorials come from the Lichuang open source community, and the self-made version has been open sourced to the above platforms.

circuit design

Main component selection

  • Main control: Hi3861 module
image1.png
  • Servo drive IC: pca9685
image2.png
  • Power supply: 7.4V 2s battery power supply, with 3P charging interface
  • Power management: 5v step-down dcdc or LDO (LM1084) + AMS1117-3.3
  • IO interface: 16 servo interfaces
  • Expand IO: mpu6050+ultrasonic sensor+Bluetooth serial port
  • TypeC+CH340 serial port download circuit
  • switch
  • Power Indicator
  • Diode power isolation
  • Servo: mg90s 180 degrees, 8 pcs
Connection pin assignment
Servo drive IIC
GPIO10 --> SDA
GPIO9 --> SCL

ultrasonic sensor

GPIO07 -->trig

GPIO08 -->echo



All the remaining IOs are led out, and the 3.3V and 5V power interfaces are led out at the same time to facilitate the power supply of external modules.

PCB design

  • 3D preview
    image3.png
Design files can be found in Lichuang EDA project files.

structural design

See attachment for solidworks modeling files硬件部分/hardware/structure
image5.png
img11.jpg

Structural optimization

  • The volume of the sole of the foot is expanded to increase friction.
  • Added side and bottom slots to reduce overall weight and facilitate expansion module installation

Fastener selection

  • M2 screw nut
  • M2.5 10 nut
  • M2.5 16 screw nut
  • M3 15 double-pass copper pillar
  • M3 40 double-pass copper pillar
  • M3 nut

3D printing

Use the light-curing printing provided by Jialichuang 3D Monkey, the material is SLA photosensitive resin
img6.jpg

software design

motion planning

Parameter calibration

  • Servo position record
    image7.png
  • Servo number definition
    The above picture is the position number provided in the tutorial. Since the video was not referenced when designing the circuit, the actual connection method is inconsistent with the picture. The corresponding number is given according to the following definition:
//leg redefine
// left front leg
#defineLF_A 12
#defineLF_B 13
// left back leg
#defineLB_A 2
#defineLB_B 3
// right front leg
#defineRF_A 11
#defineRF_B 10
// right back leg
#defineRB_A 5
#define RB_B 4
  • Leg parameter length measurements (to the right is the positive direction, with the right front leg as the standard)
    The actual leg length measurement after installation is inconsistent with the software default length and needs to be modified based on the actual situation.
    image8.png

Inverse solution algorithm verification

The inverse solution code is provided in the open source project file, and the core function is the dog_leg_move() function. It is necessary to modify the corresponding parameters according to the actual design situation. Extract the inverse solution operation code and run the test in dec c++. According to the actual test results, adjust the algorithm. On the one hand, the alpha and beta positions need to be exchanged, and the beta angle output differs by 180 degrees. On the other hand, the angle output result must be modified. , the final verification situation is as shown below, and the inverse solution result is very accurate. The modified code has been placed in the attachment and can be viewed by yourself.
image9.png

gait design

Use the above-mentioned adapted inverse solution algorithm to plan the motion path. The input data of each motion path is the end coordinate set. After solution, it will be passed to the steering gear to execute the corresponding angle.
  • step on
    The designed motion position coordinates are (0, 60) --> (0, 70), set a certain periodic cyclic motion, and the stepping speed is determined by this period. Design a simple gait: move diagonally at the same time, up and down on the same side.
  • locomotion gait
    Use the gait simulator to set up and export the two-dimensional array of the end trajectory, and execute it in a loop. Because what you get is coordinate data, you need to choose to export path trajectory data instead of path point data.
    • Forward and backward: diagonal movement is performed simultaneously, and backward movement is in the opposite direction.
    • Left and right steering: The movement method is the same as the front and rear direction, but the left and right gait distance is adjusted, similar to differential steering.
    • Entertainment action design:
      • wave
      • (pee...)

Hongmeng Development Environment

  • Main compilation directives
hb set //Initialize the development environment and operate the source code once
hb clean //Clear compilation
hb build //compile
  • Development Notes
    Based on Hongmeng lightweight system kernel LiteOS-M, it can adopt development methods under various subsystems and real-time operating system frameworks.
    A task thread was created during development, and all functions are implemented in this thread. For usage, please refer to the main control board information provided at the beginning of the article.
Official development document reference: OpenAtom OpenHarmony

Hi3861 serial port driver development

It was planned to use the serial port to realize the circuit connection with the module, but the actual debugging could not be completed. The following information is for reference only.
  • Use serial port 1 and connect:
GPIO6--UART1_TX
GPIO5--UART1_RX

K210 identification and following


K210 is an AI processing chip with superior performance. It is equipped with Canaan’s self-developed KPU neural network processor and supports various mainstream network models. In the test, the K210 maix M1n module designed by sipeed was selected and developed using the MicroPython-based MaixPy IDE, which is relatively easy to get started.

Run the face detection model

The face detection model is based on the yoloV2 framework. After burning the model and running the recognition program, the measured detection frame rate can reach 10+fps, and the effect is remarkable.
k210.jpg
  • Serial communication program
    Connect
GPIO8--TX
GPIO21--RX

Serial port output result: (151, 135, 24, 33) (x, y, w, h) x: horizontal axis, y: vertical axis

Since the Hi3861 serial communication debugging was unsuccessful, the IO port level was used to transmit data instead.
k210--Hi3861
08--05
21--06
07--14
15--11
  • IO communication mode
    Control port p15, 3 IO ports: p07 p21 p08, a total of eight identification statuses can be transmitted

ESP32 Bluetooth remote control program

  • ESP32 program
    Developed based on the Arduino environment, it receives control instructions sent by the mobile phone and passes them to the main control chip through the IO port control.
  • The mobile phone connects to the ESP32 via Bluetooth and sends control instructions with the help of a customized Bluetooth assistant.
    img10.jpg

Submit code instructions

  • Main control code
    The Hi3861 part is developed using genkipi open source firmware. The following two files are modified (note the file path). See the attachment `software part/software/final_code/app`
    image11.png
  • ESP32 code
    see attached软件部分/software/esp32_control
  • K210 code
    see attached软件部分/software/k210
  • Can directly burn firmware
    A total of 11 versions of the debugger firmware are recorded, see软件部分/software/bin
  • Inverse kinematics solution test code
    Compile using devcpp environment and run directly, see attachment软件部分/software/inverse_test

参考设计图片
×
 
 
Search Datasheet?

Supported by EEWorld Datasheet

Forum More
Update:2025-06-19 21:28:57

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
community

Robot
development
community

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号