How a DIY Engineer Turned a Fixed‑Gear Bike into an Autonomous Machine

In a four‑month weekend project, creator Zhihui Peng transformed a simple fixed‑gear bicycle into a self‑balancing, obstacle‑avoiding autonomous vehicle by adding a momentum wheel, custom motor drivers, ESP32‑based control, a powerful Ascend 310 AI chip, and a suite of sensors, all documented with CAD models and code.

Programmer DD
Programmer DD
Programmer DD
How a DIY Engineer Turned a Fixed‑Gear Bike into an Autonomous Machine

The project, dubbed XUAN, was built over four months (mostly weekends) by Zhihui Peng, who turned a common fixed‑gear (dead‑fly) bicycle into a self‑balancing, autonomous vehicle.

Why Build XUAN?

Inspired by a fall while cycling and by research from Tsinghua University, Peng wanted to create a bike that could stay upright, avoid obstacles, and navigate autonomously.

Step‑by‑Step Transformation

The conversion was divided into three major phases:

Hardware Modification : Added a momentum wheel driven by a brushless motor to maintain balance, installed a second brushless motor for rear‑wheel propulsion, and used metal parts for sufficient rigidity.

Intelligence : Integrated a perception network of sensors (depth camera, LiDAR) and a powerful computing brain – the Ascend 310 AI chip – to process data and make decisions.

Software and Algorithms : Developed control and perception algorithms on an ESP32 microcontroller (running FreeRTOS) for low‑level motor control, and on the Ascend 310 using the Ascend AI stack and ROS for high‑level planning.

Balance is achieved by conserving angular momentum: a brushless motor spins a metal flywheel to generate a counter‑torque when the bike tilts. The flywheel is controlled by the ESP32, while another motor provides forward motion via friction.

The “brain” consists of an ESP32 handling real‑time sensor fusion and motor control, and an Ascend 310 chip performing heavy perception and planning tasks. Sensors include depth cameras and a LiDAR unit, enabling obstacle avoidance and path planning.

All control code contains over 50 tunable parameters (control periods, PID gains, filter cut‑offs, etc.) that must be carefully adjusted for stable operation.

Any individual component could be a bachelor’s thesis; the whole system is more than a master’s project.

Hardware Details

The bike’s “heart” is a custom dual‑channel brushless motor driver (Ctrl‑FOC) capable of >100 A per channel, originally developed for another project.

Cost and Availability

Peng estimates the total hardware cost at around 30,000 CNY, though the actual component cost is under 10,000 CNY; the rest is trial‑and‑error expense. All designs are open‑source on GitHub.

Community Reaction

The video attracted over 1.5 million views, with praise for its technical depth and novelty. Some viewers noted that using a momentum wheel for balance is a form of “cheating” compared to pure steering‑based solutions.

For more details, see the project repository and the accompanying video.

Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

AIHardwareRoboticsself-balancingautonomous bike
Programmer DD
Written by

Programmer DD

A tinkering programmer and author of "Spring Cloud Microservices in Action"

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.