Connecting to sources…

How to build Stack-chan: the whole process

171 steps to build Stack-chan, from buying parts, printing and assembly to software, calibration and training, with the bill of materials, shop links and the official…

Assembled M5StackChan US$99, US$125 with remote (M5Stack store); JP¥18,590 incl. tax at Switch Science. DIY reference: CoreS3 US$59.90 and StackChan Body US$55 (M5Stack store), SCS0009 servo JP¥1,738 (Switch Science); the repo puts SG90 at about JP¥500 and RS304MD at about JP¥3,000. Printing, PCB, battery and shipping excluded

Buy parts

  • Find the StackChan Accessories

    Open the M5Stack MakerWorld uploads page to find the listed StackChan accessories.

  • Prepare the case and electronics

    Prepare the 3D-printed Shell, Feet, Bracket, and Battery backpack, along with an M5Stack Core, Stack-chan board, two servos, a 3.7V battery with a PH 2-pin cable, and screws.

  • Buy a preassembled Stack-chan

    The standard M5StackChan AI Desktop Robot (K151) package is enough to get started; the joystick remote controller is optional.

Print and make

  • Get the Whole Device Size Drawing

    Download the StackChan whole-device model-size PDF to obtain the dimensions of the complete robot.

  • Get the Remote Controller Size Drawing

    Download the StackChan remote-controller model-size PDF to obtain the controller dimensions.

  • Download the Structure Files

    Download the StackChan structure files from the M5_Hardware GitHub directory for the robot structure.

  • Print the STL case files

    Print the STL files in each directory using the recommended orientation shown below.

Assemble

  • Install the Leg Servo Gear

    Insert the small cross-shaped gear_xl330 into the servo with id=1 and align the gear protrusions with the holes on the XL330.

  • Attach the Upper Foot

    Insert it into feet_top with the notched protrusion facing forward, then secure it from the back with M2.5x6mm tapping screws.

  • Slide the Bottom Foot

    Slide feet_bottom into place.

  • Install the Neck Servo Gear

    Like the leg servo, insert gear_xl330 into the servo with id=2.

  • Secure the Neck Servo

    Secure it with M2.5x6mm tapping screws.

  • Attach the Servo Horn

    Attach the horn.

  • Attach the Servo Cables

    Attach the servo cables.

  • Join Upper and Lower Servos

    Use bracket_XL330_f to combine the upper and lower servos.

  • Secure Upper and Lower Servos

    Use bracket_XL330_b to secure the upper and lower servos.

  • Connect the Board and Servos

    Connect the circuit board and servos with cables.

  • Slide the Horn into the Shell

    Slide the horn into the shell.

  • Secure the Board and Shell

    Secure the circuit board and shell at 4 points with 2x4mm pan tapping screws.

  • Insert the M5Stack Body

    Insert the M5Stack body.

  • Assemble the printed parts and electronics

    Assemble the robot using the printed Shell, Feet, Bracket, and Battery backpack, the M5Stack Core, Stack-chan board, two servos, 3.7V battery, and the specified screws.

  • Snap Servos Into Bracket

    Snap two servos into the bracket.

  • Insert Battery Into Backpack

    Insert the battery into the backpack.

  • Hook Battery Pack Into Bracket

    Insert the battery pack into the bracket by hooking the claws.

  • Fix Feet and Shell With Screws

    Fix the feet and shell using one M2-8mm screw for each.

  • Connect Servo and Battery Cables

    Connect the servo and battery cables to the board, and double-check that every connector is oriented correctly.

  • Assign Serial Servo Axes

    For serial servos, ID 1 is for the foot side on the pan axis, and ID 2 is for the face side on the tilt axis.

  • Connect SCS0009 Signal Line

    For the SCS0009, connect the signal line, shown as the white cable, to the write pin.

  • Fix Board Onto Robot

    Fix the board onto the robot using four M2-4mm screws.

  • Stack M5Stack On Robot

    Stack the M5Stack on the robot.

  • Optionally Fix M5Stack

    To fix the M5Stack, use the two lower holes and two M3-15mm screws to secure it in place.

  • Connect StackChan to the computer

    Connect the computer and StackChan with a USB-C cable. Both USB-C ports support data transfer, but the base port is recommended to avoid accidental movement.

  • Connect the M5Stack to your PC

    Connect the M5Stack to the PC using USB.

Software

  • Write the Host Before MODs

    The host provides Stack-chan's basic operation, while a MOD is a user application installed after the host is complete.

  • Create Host and MOD Manifests

    Give the host and each MOD a manifest.json containing JavaScript module names and locations under `modules`, configurations under `config`, and any included manifests under `include`.

  • Flash the standard CoreS3 host

    Build and flash the standard M5StackChan CoreS3 host program without `sudo`. The host application is named `stack-chan-host`.

  • Verify the standard host build

    Run the build without flashing when you only want to verify that the standard build succeeds.

  • Select the firmware build mode

    The `build`, `flash`, and `deploy` scripts use release mode by default on every supported subplatform. Pass `--mode=debug` or `--mode=instrument` explicitly when either mode is required.

  • Locate generated firmware files

    Find the program under `firmware/dist/bin/` and the intermediate files under `firmware/dist/tmp/`.

  • Clean generated firmware files

    Remove all generated files under `firmware/dist/` with the clean script.

  • Bundle all target builds

    Keep every target build under `firmware/dist/`, stage validated target artifacts under `firmware/dist/bundle-targets/`, and write the assembled directory and ZIP under `firmware/host/app/`.

  • Select the board-specific subplatform

    Use each hardware variant’s board-specific npm script instead of a generic `--target=` command. The script selects `-p esp32:./host/platforms/<board>` and its matching app manifest automatically.

  • Configure the CoreS3 subplatform

    The M5StackChan CoreS3 manifest is `host/platforms/m5stackchan_cores3/manifest.json`. It uses the `m5stackchan` driver and serial TX6 / RX7, and the firmware locks the stored driver type to `m5stackchan`.

  • Configure the Stack-chan RT subplatform

    The Stack-chan RT manifest is `host/platforms/stackchan_rt/manifest.json`. It uses the `dynamixel` driver and serial TX7 / RX6, and the firmware locks the stored driver type to `dynamixel`.

  • Configure the Takao Core2 subplatform

    The Takao Core2 + SG90 manifest is `host/platforms/takao_core2_sg90/manifest.json`. It uses the `pwm` driver, with pan on PWM19 and tilt on PWM27.

  • Configure Per-Device Settings

    Put Wi-Fi credentials, API keys, and other per-device settings in the board's app manifest under "config".

  • Keep Secrets Local

    Do not commit secrets. Add Wi-Fi credentials, API keys, and other secret settings locally only.

  • Start the Moddable Debugger

    Start the selected host under the Moddable debugger. The command opens `xsbug` and connects it to the M5Stack.

  • Use the Matching Debug Script

    Use the board-specific debug script for Stack-chan RT or Takao Core2 + SG90.

  • Use a Release Build for USB

    On M5StackChan CoreS3 with Moddable SDK 9.0.0 or later, debug and instrument builds reserve the built-in USB Serial/JTAG CDC driver for Moddable even without `xsbug`. Use a normal release-mode build, flash, or deploy command when testing USB communication with Stackchan Dock or Codex Voice.

  • Inspect and Step Through Code

    Use `xsbug` to check logs, set breakpoints that temporarily pause the program at specific lines, and perform step-by-step execution.

  • Start the xsdb Debugger

    Start the terminal-based `xsdb` debugger with the debug command.

  • Select the Serial Device

    When multiple serial devices are connected, explicitly select the required port.

  • Erase the ESP32 flash

    Run the erase command to remove the written MOD and revert to the previous behavior. This erases the entire flash area, including Preferences settings, and the host must be written again afterward.

  • Install CoquiTTS

    Install CoquiTTS with pip install TTS. If installation does not work well on Windows, use a TTS-Server running on another Linux environment over the network.

  • Start the TTS-Server

    Start the TTS-Server on port 8080 with the tts_models/ja/kokoro/tacotron2-DDC model.

  • Configure server host and port

    Use --host for the TTS-Server hostname or IP address and --port for its port. These values are normally read from host/app/manifest_local.json, but command-line values take precedence; specify them in one of the two places.

  • Set the speech pitch shift

    Use --shift to set the pitch shift from 0.5 to 2, where 1 leaves the CoquiTTS output unchanged. If omitted, SynthProps.shift from the input file is used, or 1.5 if that is also undefined; an enabled shift produces a 44.1KHz output sampling rate.

  • Specify input and output paths

    Use --input for the input file; when omitted, speeches.js in the current directory is used if present, otherwise ./host/modules/audio/assets/sounds/speeches_ja.js. Use --output for the output directory; when omitted, an assets directory beside the input is used if present, otherwise the input file's directory.

  • Generate Coqui speech files

    Run generate-speech-coqui from the stack-chan/firmware directory with the example input and output paths. When specifying options, add -- after the command as shown.

  • Install and launch VOICEVOX

    Download and install the Windows, MAC, or Linux version from the VOICEVOX website. After installation, launch VOICEVOX so its running engine will be used for speech generation.

  • List VOICEVOX characters

    When no value is specified, all characters are displayed and the process exits. When a SpeakerId is specified, only the character with that Id is displayed.

  • Set the VOICEVOX host

    Specify the hostname or IP address of the VOICEVOX engine. If omitted, the default is 127.0.0.1.

  • Set the VOICEVOX port

    Specify the port number of the VOICEVOX engine. If omitted, the default is 50021.

  • Select a VOICEVOX character

    Specify the character to speak with its SpeakerId. If omitted, the default is SpeakerId:1 Zundamon (Amaama).

  • Set speaking speed

    Specify the speaking speed from 0.5 to 2. The default value when omitted is 1.

  • Adjust voice pitch

    Adjust the pitch of the voice from -0.15 to 0.15. The default value when omitted is 0.

  • Set voice intonation

    Specify the strength of the voice intonation from 0 to 2. The default value when omitted is 1.

  • Set audio sampling rate

    Specify the sampling rate of the output audio file. The default value when omitted is 11025 (11.025KHz).

  • Specify the speech input file

    Specify the input file name. If omitted, it defaults to speeches.js in the current directory when present; otherwise it defaults to ./host/modules/audio/assets/sounds/speeches_ja.js, assuming execution in the ~/stack-chan/firmware directory.

  • Specify the output directory

    Specify the output directory. If omitted, it defaults to the assets directory under the input file's directory when it exists; otherwise it defaults to the same directory as the input file.

  • Generate VOICEVOX speech files

    Run the example command in the ~/stack-chan/firmware directory to read the monologue speeches_monologue.js file and place the output in the monologue assets directory. When specifying options, add “ -- ” after the command as shown in the example.

  • Install the M5Stack USB driver

    Install the M5Stack USB driver so the PC can recognize the board.

Calibrate and test

  • Verify the IO Expander Address

    Check that the robot body module uses I2C address 0x6F when ADD_SEL is low by default, or 0x71 when ADD_SEL is high.

  • Configure the wireless channel

    Tap Advanced to customize the Wi-Fi Channel and Receiver ID. These settings are used when StackChan operates as the receiver.

  • Set channel and receiver ID

    After powering on, short press BtnB to switch between Wi-Fi Channel and Receiver ID selection. Move the joystick up or down to increase or decrease the selected value.

  • Review StackChan mobile app settings

    In the mobile app Settings, review multi-device management, device name, AI Agent profile, MCP, conversation history, device unbinding, and other options.

  • Identify the StackChan device port

    Expand the M5Burner port list, disconnect StackChan, note which port disappears, and then reconnect the device.

  • Grant App Permissions

    Check that the StackChan World app has permission for Bluetooth access, then retry pairing.

  • Use a Supported Wi-Fi Network

    Connect StackChan to a 2.4 GHz Wi-Fi network. Do not use a 5 GHz network or a network that requires web-based login authentication.

  • Switch Networks

    If the top green LED does not light after waking, or speech is intermittent or choppy, switch to a different network and try again.

  • Set Local Firmware Configuration

    Edit `stack-chan/firmware/host/app/manifest_local.json` and place local settings under the `config` key. This file starts with an empty `config` object.

  • Select the Servo Driver

    If the hardware uses a different driver, set `config.driver.type` explicitly. Without local driver settings, the firmware uses the platform and app defaults, which may select the default serial servo driver on a generic bench build.

  • Choose the Stack-chan Voice

    On M5StackChan CoreS3, `stackchan-voice` uses the built-in offline voice. To use `sanotts`, build the opt-in host and install its model separately using the sanoTTS setup guide.

  • Include Additional Manifest Files

    Specify the paths of other manifest files as a list under the `include` key.

  • Check the M5StackChan pitch limits

    The default pitch range is 5–85°. In the Stack-chan rotation convention this is `rotation.p` from −85° to −5° in radians; a neutral `rotation.p = 0` request is clamped to the 5° lower limit, while the calibrated zero remains unchanged. Verify mechanical clearance before changing the defaults.

  • Check RT Serial Pins

    At boot, inspect the log for `[dynamixel] serial port=1 tx=7 rx=6 baud=1000000` to identify the RT serial pins in use.

  • Verify the Face Appears

    After startup, allow a few seconds for Stack-chan's face to appear.

  • Select the XL330 USB Connection

    Open Options and select the USB connected to the XL330.

  • Scan and Find the XL330

    Click Scan; the XL330 will appear on the left, ready for communication.

  • Select XL330 from the List

    Select XL330 from the list on the left.

  • Change ID and Baud Rate

    Click each ID and Baud Rate item, select '1000000bps' from the bottom-right dropdown, and press Save to apply the parameters.

  • Connect Servos One by One

    Connect the servos one by one when changing the ID, because multiple servos with the same ID cannot be connected.

  • Select the CoreS3-specific configuration

    Choose "M5StackChan CoreS3" when using its specific servo, power, and LED configuration.

  • Confirm flashing is complete

    The Stack-chan firmware is installed when flashing is complete.

  • Change settings for another servo

    To use a different type of servo, refer to the document about changing Stack-chan settings from the browser.

  • Test the development environment

    Run the doctor command and verify that the Moddable SDK version is displayed and that “esp32” appears under Supported target devices.

  • Run the simulator smoke test

    On Linux with the Moddable SDK and Xvfb, run the simulator smoke test from `firmware`. The test loads the example archive and checks for the trace emitted after the MOD shows the balloon.

  • Change Device Preferences

    Change the device preferences with the Stack-chan browser tools.

Data and training

  • Capture benchmark statistics

Use it

  • Navigate the main menu

    Swipe left or right to switch between function icons, then tap an icon to enter its function.

  • Open status bar or Home

    Swipe inward from the top edge to reveal network, time, and battery status, or from the bottom edge to reveal the Home button and return to the main menu.

  • Wake the AI Agent

    Say “Hi, StackChan” to wake the device, or tap the screen to wake it and start a conversation.

  • Read interaction status

    Read the upper-left RGB LED: green means the device is listening, blue means it is speaking, and off means voice interaction is idle.

  • Issue common voice commands

    Give commands such as “What time is it now?”, “What will the weather be like in New York tomorrow?”, “Tell me a joke.”, “Introduce Isaac Newton.”, or “Remind me to drink water in ten minutes.”

  • Control device features by voice

    Control the speaker volume, motor head direction, built-in RGB light, camera, and battery, or control bedroom lights and an air conditioner set to 25 degrees.

  • Trigger robot expressions

    While idle, StackChan may blink or move its head. Swipe vertically on the top touch area for a happy expression and motion, shake the device for a dizzy expression, and wait for inactivity for a sleeping expression.

  • Keep StackChan in Avatar mode

    Use Avatar mode when using or switching between Avatar, Monitoring Camera, Motion, and Dance features in the mobile app.

  • Control the monitoring camera

    Enter the Monitoring Camera feature and use the on-screen joystick to move StackChan to different angles.

  • Control motion and expressions

    Enter the Motion feature to control head movement and on-screen expressions. Enable Rotate for continuous horizontal rotation.

  • Choreograph a Wi-Fi dance

    Enter the Dance feature and select Network (Wi-Fi mode) in the top-right corner. Set the music, movement rotation angles, and lighting colors.

  • Choose the ESP-NOW role

    Enter the remote control feature and select Receiver or Sender for the default control mode.

  • Mirror head movement wirelessly

    Use StackChan as the sender and manually rotate its head. The receiver will rotate to the same angle.

  • Power the controller on or off

    Press and hold the left power button for 2 seconds to power on the controller. Press and hold it for 6 seconds to power off.

  • Select the control mode

    Short press BtnA to enter joystick control mode. Press again for IMU attitude control mode, and once more to return to the Wi-Fi Channel and Receiver ID settings.

  • Enter AI Agent Mode

    Confirm that StackChan has entered AI Agent mode before troubleshooting voice wake-up.

  • Improve Voice Wake-up

    Move closer to StackChan, refer to the demonstration for the correct pronunciation, and increase the volume to attempt wake-up.

  • Tap to Wake StackChan

    Tap the screen once to wake the device. The top LED will light up green when the device wakes normally.

  • Avoid Continuous Screen Taps

    Do not tap the screen continuously because this may accidentally exit wake-up mode.

  • Try a MOD in the gallery

    Choose a MOD from the MOD Gallery, then try it in the simulator or on the M5StackChan device.

  • Use the robot context APIs

    Use the capability-oriented context APIs to control faces, motion, input, audio, camera, and connectivity.

  • Choose a supported motor configuration

    Run Stack-chan with Feetech, FUTABA, DYNAMIXEL, or PWM servo motor configurations.

  • Select a speech service

    Generate Stack-chan speech through Stack-chan Voice, VOICEVOX, ElevenLabs, or OpenAI.

  • Use the native WebRTC backend

    The native WebRTC conversation backend is available in standard CoreS3 and M5StackChan CoreS3 builds. Follow the linked activation and acceptance document.

  • Open the browser-based robot tools

    Use the browser to access firmware installation, BLE preferences, the MOD Gallery, block editor, face editor, and WebAssembly simulator.

  • Select the interface language

    Use the firmware and web interface in Japanese, English, or Simplified Chinese.

  • Test the A Button

    Press the A button; on CoreS3, use the bottom-left area of the screen. Stack-chan looks in a random direction every 5 seconds.

  • Test the B Button

    Press the B button; on CoreS3, use the bottom-center area of the screen. Stack-chan looks left, right, down, and up.

  • Test the C Button

    Press the C button; on CoreS3, use the bottom-right area of the screen. The color of Stack-chan's face inverts.

  • Browse the MOD Gallery

    Find published MODs and mini apps in the MOD Gallery.

  • Run or Install a MOD

    Choose a MOD, then run it in the simulator or install it on a device.

Parts

  • M5Stack controller: CoreS3 is standard; release firmware also supports M5Stack Basic and Core2
  • Two servos: SG90 (PWM), or Feetech SCS0009 or RS30X (serial, case v0); case v1.0 uses two DYNAMIXEL XL330
  • Stack-chan board: two PWM or two serial servo channels, PortB, external 5V and battery charging
  • 3.7V Li-Po with PH 2‑pin lead (400 and 640 mAh tested) and M2 screws
  • 3D-printed shell, feet, bracket and battery backpack (STEP/STL published)
  • Assembled M5StackChan: CoreS3 plus body (550 mAh battery, two feedback servos for 360° continuous pan and 90° tilt, 12 RGB LEDs, IR, three-zone touch, NFC)

Tools

  • 3D printer or a printing service (JLCPCB and DMM.make given as examples)
  • Chrome or Edge and a data-capable USB cable (web flashing)
  • Serial servo ID setup: Feetech URT1 (listed as discontinued at Switch Science) or ROBOTIS U2D2 + SMPS2Dynamixel + 5V supply

Skills

  • Blockly or JavaScript/TypeScript (Moddable) for MODs
  • Serial servo ID and centre-angle setup
  • Optional: Arduino, UiFlow2, PlatformIO, ESP-IDF (M5StackChan factory route)

Software

  • stack-chan firmware v2.0.1 (Moddable SDK 10.0.2) and the MOD Gallery
  • Browser tools: installer, preferences, Blockly editor, face editor, simulator, MediaPipe BLE tracking
  • M5Stack factory firmware (AI Agent powered by XiaoZhi) and the StackChan World app
  • Community AI Stack-chan 2 (MIT): VOICEVOX speech with Google Cloud STT or OpenAI Whisper; not updated since 2024

Documents