Loading files…
A two-wheeled self-balancing robot built around the Nordic nRF52840 and Zephyr RTOS, using nRF Connect SDK 2.8.0. The project includes the embedded control system, custom electronics and mechanical designs, a BLE desktop application, over-the-air firmware updates, and tools for modelling and controller development.
https://github.com/user-attachments/assets/bdc0d3e3-bf6b-4125-bade-0684ad42b085
🎥 See the robot in action! Check out the Lapun Embedded Control Lab on YouTube for more demonstrations.
[!NOTE] The default firmware configuration uses PID control. The LQR controller and on-device model-identification mode are implemented but disabled by default.
The Raspberry Pi web interface and the nRF7002 DK controller are legacy or experimental components and may require adaptation to the current binary BLE protocol.
The firmware uses a cascaded control structure. Distance and linear-speed controllers generate the balance-angle setpoint, while the balance and rotation controllers determine the wheel-speed setpoints. Separate wheel controllers then generate the motor PWM outputs.
The robot is based on:
Hardware design files are available in Schematic/.
3D render of the custom robot controller PCB.
Follow the environment setup guide before building the project.
From the repository root:
cd Sources/applications/app
west build -b nrf52840dongle_nrf52840 -p always
A successful build generates:
Sources/applications/app/build/merged.hex
Sources/applications/app/build/dfu_application.zip
The firmware can also be built through nRF Connect for VS Code. See Building and flashing for the complete GUI, terminal, SWD, and BLE DFU workflows.
After connecting an external SWD debugger:
cd Sources/applications/app
west flash --erase --skip-rebuild
Subsequent firmware versions can be installed over BLE using the desktop application or the command-line DFU tool.
The desktop application requires Python 3, PyQt6, Bleak, and PyQtGraph:
python3 -m pip install PyQt6 bleak pyqtgraph
python3 run_controller_app.py
The DFU workflow additionally requires
smpmgr. A Windows binary is included
in 3rdParty/smpmgr/; on Linux, smpmgr must be available
on PATH.
.
├── Sources/applications/app/ # Main nRF52840 robot firmware
├── Sources/applications/controller/ # Experimental nRF7002 DK controller
├── Sources/applications/controller_rpi/
│ # Raspberry Pi web interface
├── Sources/drivers/ # IMU, encoders, motors, BLE, DFU, battery
├── Sources/robot_control/ # Control loop, PID, LQR, state machines
├── robot_control_app/ # PyQt6 BLE desktop application
├── mathematical_model/ # Models, identification, and LQR tooling
├── Schematic/ # PCB, schematics, Gerbers, and CAD
├── docs/ # Setup and build documentation
└── dts/bindings/ # Custom Zephyr devicetree bindings
Commercial use is permitted under the terms of the respective licenses.
Updated
No comments yet. Be the first to ask about this board.