How to build ElectronBot: the whole process
42 steps to build ElectronBot, from buying parts, printing and assembly to software, calibration and training, with the bill of materials, shop links and the official so…
No total for the original; the README puts nylon prints (JLC 3D) at about CN¥200–300. The community ESP32 AI version's docs estimate CN¥300–600 and its OSHWHub page about CN¥300. Tools and shipping excluded
Buy parts
- Obtain chip reference documents
The Docs directory provides related reference documents, including chip datasheets.
Print and make
- Prepare and fabricate circuit boards
The Hardware folder provides Altium Designer schematic and PCB source files together with Gerber files for direct fabrication by a manufacturer.
- Fabricate ElectronBot main board
ElectronBot is the head main-control board containing an STM32F405RGT6, a GC9A01 round display, a USB3300 USB-HS PHY chip, and an SD card.
- Fabricate SensorBoard sensor board
SensorBoard is the belly sensor board with a gesture sensor, USB-HUB chip, five I2C servo interfaces, an MPU6050 accelerometer and gyroscope, and others. The USB camera also connects to this board.
- Fabricate BaseConnector base board
BaseConnector contains the base USB Type-C socket and connects to SensorBoard with an 8-Pin FFC cable so the robot body can rotate.
- Fabricate ServoDrive board
ServoDrive is used to modify servos and replace the original servo-driver circuitry. It connects to SensorBoard and the head main controller through an I2C bus.
- Fabricate ServoDrive-DK debug board
ServoDrive-DK has the same role as ServoDrive but replaces the PCB contact interface with a connector for easier debugging. After debugging, download the code to the smaller ServoDrive board.
- Download robot CAD models
The CAD-Model folder contains structural drawings, universal `.step` files, and Fusion 360 `.f3d` source files. The `.step` files can be opened and edited in various software applications.
- FDM-print the storage box
The repository includes the storage box shown at the end of the video. It can be printed with FDM using 5% infill.
Assemble
- Follow robot assembly tutorials
Software
- Inspect minimal USB test project
The same folder also provides source code and firmware for the precompiled files. They form a minimal test project for inspecting code and debugging.
- Generate firmware project files
The firmware projects use STM32 HAL. Open each corresponding `.ioc` file in STM32CubeMX and generate the Keil or STM32IDE project files.
- Choose firmware by MCU space
`ServoDrive-fw` uses HAL, while `ServoDrive-fw-LL` uses the LL library and occupies less Flash, fitting a 16K MCU. Choose according to the target MCU.
- Configure CLion for building
CLion can also be used to build and download the firmware; the linked tutorial explains how to configure CLion as an STM32 IDE.
- Obtain ElectronStudio and SDK
The Software folder contains the ElectronStudio Unity host-project source, SDK libraries, and SDK source. The SDK layers are `ElectronBotSDK-LowLevel`, `ElectronBotSDK-Player`, `ElectronBotSDK-UnityBridge`, and `Electron-Studio`.
- Install BotDriver USB driver
In Device Manager, right-click and choose Update Driver, select the custom directory, and navigate to the BotDriver folder. Windows driver signature enforcement must be disabled; the method depends on the operating-system version.
- Place large dependency libraries
Large software dependencies are stored as archives in the `_LargeFiles` folder. Place the libraries in the corresponding project directories when building; see `_path.txt` for the exact paths.
- Rename expression file paths
Before using the expression animations, change the expression file names and paths to English.
- Connect to a New Wi-Fi Network
Turn on the robot and wait for it to create a hotspot named “xiaozhi-XXXX”. Connect a phone to the password-free hotspot, allow the web page to open automatically, then enter the home Wi-Fi name and password and submit.
- Bind the Xiaozhi Backend Account
Open xiaozhi.me in a browser, register an account, sign in, and add and bind the device as directed on the page. Configure the role, large-model type, and voice, then restart the device.
- Configure the Example Robot Role
- Connect to the Local WebSocket Service
Connect ElectronBot to WiFi, then connect from a device on the same local network to port 8080.
- List the Available MCP Tools
Send an MCP tools/list request through the WebSocket service to list the available tools.
Calibrate and test
- Operate the Six-Degree-of-Freedom Robot Safely
Operate the robot's six degrees of freedom while relying on the firmware to clip target angles and oscillation amplitude to the safe range.
- Check the Robot's Current Status
Call self.electron.get_status to check the robot's current status.
- Test the Robot's Hand Action
Call self.electron.hand_action; action 1 raises the hands, 2 lowers them, 3 waves, and 4 claps. Hand 1 selects the left hand, 2 the right hand, and 3 both hands.
- Test the Robot's Body Turn
Call self.electron.body_turn with direction 1 to turn left, 2 to turn right, or 3 to return to the center. Set the speed and angle arguments as required.
- Test USB communication and display
Flash the hex file from `6.Tests\TestDisplayUSB\_Released` to the STM32F4, then run `Sample.exe` on the computer. With working hardware, the screen displays the video in the folder.
- Test servo functions separately
Until all six servos have passed testing, do not use servo command transmission and reception in debugging code because the bus can block and freeze the program.
Use it
- Command the Robot's Hand Gestures
Use hand commands to raise both hands, wave, clap, or lower the arms.
- Command the Robot's Body Movement
Use body commands to turn left, turn right, or return the body to the center.
- Command the Robot's Head Movement
Use head commands to look up, look down, nod, or nod repeatedly.
- Command Combined Robot Gestures
Use combined commands to say goodbye with a wave, show agreement, or look around.
- Reset Held Robot Poses
Raising or lowering the hands, turning the body, looking up, and looking down do not reset automatically after completion. Return to the initial pose with the corresponding lower or center command, or explicitly call self.electron.home.
- Query Robot Status
Query the Electronbot status, IP address, and battery level through the self.electron and self.battery tools.
- Set the Robot Character
Use the six degrees of freedom and gestures to express emotions: nod, wave, raise a hand, lower or raise the head, and say goodbye.
- Sequence and Reset Servos
For complex expressions, arrange actions in segments with self.electron.servo_sequences, then call self.electron.home to reset.
- Power On and Check Battery
The power and charging port are at the rear of the robot base. Turn on the robot and check the battery display; it may be inaccurate, so charge it promptly to avoid unexpected power loss.
- Wake and Control the Robot
- Configure Unified Action Parameters
All actions use the same interface: action_type is the action type number from 1–19, steps is the repetition count from 1–100, and speed ranges from 500–3000, with smaller values producing faster motion. The amount specifies action amplitude and has a different range depending on the action type.
- Use the servo debugging tool
The servo debugging tool demonstrated in the video has been added to the repository for servo adjustment.
- Prepare expression animations
The CAD-Model directory includes expression animations with entry, loop, and exit segments. Entry and exit can connect seamlessly with other animations for code-driven use.
Common problems
- USB devices fail detection, driver installation, or transfers remain busy #122 #241 #120 #191 #130 #170
- LCD pixel format and configuration mismatch causes corrupted display #121
- Servo model mismatch requires address and PD parameter reconfiguration #131 #108
- STM32 include paths and C++ configuration conflicts cause build failures #118 #66
- Debugger or test board cannot detect chips, preventing firmware flashing #192 #231
- Missing or mismatched DLLs prevent Sample.exe from starting on Windows #142
- Unity cannot connect to the robot or synchronize servo movements #165 #158
- STEP and Fusion360 project files fail to open or appear blank #22 #73
Parts
- Original head board: STM32F405RGT6, GC9A01 round screen, USB3300 USB‑HS PHY, SD card
- SensorBoard: gesture sensor, USB hub, MPU6050, five I2C servo ports; the USB camera is soldered to it
- Six modified servos with ServoDrive boards (STM32F042P6 + FM116B, potentiometer ADC feedback and PID)
- Bearings 6×10×3 mm and 25×32×4 mm, M2×25 half-thread screws, a 31.5 mm watch crystal
- Community AI version: ESP32‑S3‑WROOM‑N16R8, servos SG90 ×1 + 2g ×4 + 4.3g ×1, 1.28-inch GC9A01, MAX98357A amp, ICS‑43434 mic, 103030 battery
Tools
- JLink/ST‑Link with an SH1.0 connector (servo boards expose only three pads)
- SMD soldering tools
- Resin or nylon printing (the README says FDM may lack precision)
- Hot glue and grease
Skills
- STM32 HAL/CubeMX and firmware builds
- Servo modification and I2C protocol debugging
- C++ SDK and the Unity (C#) host app
- Windows driver install (driver signature enforcement must be disabled)
Software
- ElectronBot‑fw and ServoDrive‑fw (HAL and LL builds)
- ElectronStudio (Unity) and ElectronBotSDK
- Community version: the electron-bot board in xiaozhi-esp32