This is a browser-based interface for connecting and interacting with a QiYi Smart Cube using JavaScript, HTML, and CSS. It communicates with the cube via Bluetooth Low Energy (BLE) and visualises the cube’s state in real time.
This project is inspired by Flying-Toast/qiyi_smartcube_protocol, which reverse-engineered the QiYi protocol and built a similar tool in Rust. This version reimplements key ideas using only web technologies for easier accessibility and demonstration.
- 📡 Connect to a QiYi Smart Cube via Web Bluetooth API
- 🧩 Live display of all 6 faces of the cube using emojis
- 🔄 Track moves and update cube state in real time
- 🔋 Display battery level
- 🧼 Reset cube to solved state
- 🔐 Encrypt/decrypt messages using AES-128 ECB (thanks to aes-js)
- Upon connecting, the app sends an
App Hello
message using the cube’s MAC address (reversed). - The cube responds with a
Cube Hello
message containing the initial state and battery info. - All communication is encrypted using AES-128 ECB with a fixed key.
- Cube states are parsed and displayed visually on the webpage using emojis.
- Move and state changes trigger updates and (sometimes) acknowledgements.
- A "Reset to Solved State" button sends a
Sync State
message to resynchronise the cube.
- A QiYi Bluetooth Smart Cube
- A modern browser with Web Bluetooth API support (e.g. Chrome)
- Permissions to use Bluetooth from the browser
-
Clone the repository:
git clone https://github.com/yourusername/qiyi-smartcube-web.git cd qiyi-smartcube-web
-
Open
index.html
in a compatible browser (you may need to serve it via a local web server for Bluetooth to work reliably). -
Click “Connect Cube”, enter the cube’s MAC address (e.g.
CC:A3:00:00:25:13
), and watch the cube’s state appear!
index.html
– Single-page app with embedded styles and scripts- No external backend – All logic is handled client-side
- Protocol details based on the excellent reverse engineering work by Flying-Toast/qiyi_smartcube_protocol
- AES encryption via aes-js
By default, the app prompts you to enter your cube's MAC address every time you connect.
To make development and use easier, you can hardcode a default value into the prompt by modifying this line in index.html
:
const macStr = prompt("Enter cube MAC address (e.g. CC:A3:00:00:25:13)\nIf you are using Google Chrome, you can find it at:\nchrome://bluetooth-internals/#devices");
Change it to:
const macStr = prompt("Enter cube MAC address (e.g. CC:A3:00:00:25:13)\nIf you are using Google Chrome, you can find it at:\nchrome://bluetooth-internals/#devices", "<YOUR MAC ADDRESS>");
This way, the MAC address will auto-fill in the prompt every time you connect.
MIT – feel free to use, modify, and build upon this project.