Skip to content

README.md

Machine-translated by Robotheca from the original in Chinese (opens in a new tab). License: AGPL-3.0-only (opens in a new tab).

DengFOC Balancing Robot Project

The DengFOC Balancing Robot Project is based on the open-source SimpleFOC balancing robot project (opens in a new tab). It has undergone structural improvements and performance optimizations to be used with my open-source DengFOC (opens in a new tab) dual-channel brushless motor driver.

balancebot_gif

get_down

The project is fully open-source. You can build it yourself using the content from this GitHub repository, or support my hard work by purchasing the DengFOC balancing robot kit from my Taobao store for a one-stop solution.

DengFOC High-Agility Self-Balancing Robot Kit – Click to View (Available in the "All Items" section after entering the store) (opens in a new tab)

1. Installation Process

1. Required Components

  1. DengsFOC V3 (You can search for "灯哥开源" on Taobao to purchase it, or make it yourself based on the open-source materials from the DengFOC repository)
  2. 2 × 2204 gimbal motors
  3. 2 × AS5600 encoders
  4. 1 × MPU6050 gyroscope

2. Wiring Process

ComponentWiring Location
2204 Gimbal MotorDengFoc M0 Position
2204 Gimbal MotorDengFoc M1 Position
AS5600SDA0, SCL0, 3V3, GND
AS5600SDA1, SCL1, 3V3, GND
MPU6050SDA1, SCL1, 3V3, GND
Battery and Power Switch WiresDengFoc Power Terminal

Matching Wiring Materials:

  • AS5600 Encoder Wiring Kit: One end is a Dupont connector with a black GND wire, a red VCC wire, a green SDA wire, and a yellow SCL wire; the other end is a 4P connector.
  • MPU6050 Wiring Terminal Kit: Both ends are 4P connectors with a black GND wire, a red VCC wire, a green SDA wire, and a yellow SCL wire.
  • Power Switch Wiring

3. Assembly Steps

  • The red wire of the AS5600 encoder represents VCC, the black wire represents GND, the yellow wire represents SCL, and the green wire represents SDA. Connect one end of the 4P terminal to the corresponding terminal on the AS5600. At the same time, connect the other end of the terminal block to the corresponding interface on the DengFoc pin header.
  • The red wire of the MPU6050 gyroscope terminal block represents VCC, the black wire represents GND, the yellow wire represents SCL, and the green wire represents SDA. One end of the terminal block is connected to the MPU6050, and the other end is connected to the AS5600 encoder.
  • Motor 1's three wires are connected to the DengFoc M0 port, rotating clockwise (cw). Motor 2 is connected to the DengFoc M1 port, rotating counterclockwise (ccw). You can check the rotation direction via the serial port. If the rotation direction is incorrect, you can swap any two phases of the motor wires.

For detailed installation, you can watch the installation video, which includes detailed steps for assembling and wiring each part of the robot.

II. Debugging Process

  • Flash the self-balancing car code example. After powering on, wait for the gyroscope calibration and motor calibration.
  • Check whether the self-balancing car can stabilize itself.
  • Scan the QR code below with WeChat to enter the mini-program.
  • Once on the mini-program page, check whether the Bluetooth connection is successful. A screenshot of the mini-program page is shown below.
  • Next, move the joystick to verify that the functions work properly.
  • If you want to DIY the car’s speed control, you can modify the car control parameters in the example code.

Files by @ToanTech, at commit e8ae0bf, read from GitHub in your browser. Hardware license: AGPL-3.0-only; software license: AGPL-3.0-only. Robotheca doesn't review code: read it before running it.