Connecting to sources…

How to build SunFounder PiDog (V1 / V2): the whole process

55 steps to build SunFounder PiDog (V1 / V2), from buying parts, printing and assembly to software, calibration and training, with the bill of materials, shop links and …

$179.99 (SunFounder store, 2026‑10‑31, priced in USD, no discount); the page offers free shipping (extra in some areas) from China, leaves import duty to the buyer and does not say whether tax is included. Raspberry Pi, microSD card and charger are not included

Buy parts

  • Select and buy a compatible PiDog kit

    The Standard Version works with most Raspberry Pi models, but its servo motors and Robot HAT are not compatible with Raspberry Pi 5. The V2 Version supports Raspberry Pi 3/4/5 and Zero 2W.

  • Gather Tools and Parts

    Gather all the tools and parts needed before starting the assembly.

  • Obtain the sound direction module

    The module has 3 microphones for detecting sounds from all directions, while a TR16F064B processes sound signals and calculates the sound source direction.

Assemble

  • Verify All Parts and Components

    Before assembly, confirm that all parts and components are included. If anything is missing or damaged, contact [email protected] immediately.

  • Follow the PDF Assembly Instructions

    Download and read the linked PiDog component list and assembly instructions, then follow its assembly steps.

  • Watch the Complete PiDog V2 Assembly

    Watch the complete PiDog V2 assembly video for Raspberry Pi 4 and Raspberry Pi 5. If the video differs slightly from the printed instructions, prioritize the printed instructions and use the video for clarification.

  • Watch the PiDog V1 Assembly Video

    Watch the tutorial for assembling the PiDog V1 from scratch; it is compatible with Raspberry Pi 4, 3, and 1. If the video differs from the printed instructions, prioritize the printed instructions.

  • Assemble the Body and Four Legs

    Follow video 2 to assemble Pidog's body and four legs.

  • Assemble the Head and Calibrate

    Follow video 3 to assemble Pidog's head and perform the calibration.

  • Prioritize the Printed Instructions

    The assembly steps in the video may differ slightly from the printed instructions; follow the printed instructions first and use the video for clarification if any step is unclear.

  • Mount Raspberry Pi Zero 2W

    If the mainboard is a Raspberry Pi Zero 2W, install it on the PiDog by following video 4.

  • Continue Assembly from 2:28

    Afterward, continue following video 4 from 2:28 onwards to complete the assembly.

  • Reassemble the V1 Legs

    If the PiDog V1’s legs are incorrectly positioned after assembly, rerun the zeroing script to reset all servos to 0°, then reassemble the legs correctly.

  • Inspect GPIO Soldering

    Poor soldering on either side of the GPIO connection often causes the problem.

  • Connect using the pinout

    Connect the sound direction module to the main controller using the pinout shown in media 1, including the module's BUSY pin.

Software

  • Install system dependencies

    Install system dependencies such as git, python3-pip, python3-setuptools, and python3-smbus.

  • Clone and install robot-hat

    Clone and install robot-hat.

  • Clone and install vilib

    Clone and install vilib.

  • Clone and install pidog

    Clone and install pidog.

  • Run the audio setup script if needed

    Run the audio setup script if needed.

  • Install Tools

    Install git, python3-pip, python3-setuptools, and python3-smbus with apt.

  • Install the Robot-Hat Library

    Clone the robot-hat 2.5.x branch, enter its directory, and run the installation script.

  • Install the Vilib Library

    Clone the vilib repository, enter its directory, and run the installation script.

  • Install the Pidog Library

    Clone the pidog repository, then use pip3 to install the library from ~/pidog.

  • Run the i2samp Script

    Enter the ~/pidog directory and run i2samp.sh with sudo.

  • Install Robot HAT

    Clone the Robot HAT 2.5.x branch and run its installation script.

  • Install Vilib

    Clone the Vilib repository and run its installation script.

  • Install PiDog

    Clone the PiDog repository and install the package from the current directory with pip3.

  • Use 64-bit Raspberry Pi OS

    A piper-tts installation error means that 32-bit Raspberry Pi OS is being used. Reinstall the 64-bit version of Raspberry Pi OS, after which installation will succeed.

  • Prepare the Servo Zeroing Environment

    First install the Raspberry Pi OS, then install the required modules, and run the script that sets the angle of all PWM pins to 0.

  • Install Raspberry Pi OS

    First install the Raspberry Pi OS to perform the servo-zeroing steps.

  • Install Required Modules

    Install the modules required by the servo-zeroing script.

  • Implement BUSY handshake and reading

    Raise BUSY to begin direction monitoring; after BUSY becomes low, send 16-bit arbitrary data MSB first and receive 16-bit direction data, then raise BUSY again.

Calibrate and test

  • Fix Missing Sound

    If there is no sound, enter the robot-hat directory and run i2samp.sh; repeat it if needed.

  • Run the First Demo

    Enter the examples directory and run 1_wake_up.py. PiDog will wake up, sit down, and wag its tail.

  • Calibrate PiDog Servos

    Both V1 and V2 versions require servo calibration to ensure stable movement and prevent damage.

  • Use the V2 Zeroing Button

    Press the zeroing button on the V2 Robot HAT to automatically set all servos to 0° without running a script.

  • Fix V2 Leg Position

    If the PiDog V2’s legs are incorrectly positioned after assembly, such as servos at strange angles or the robot unable to stand, use the zeroing button to fix them.

  • Run the V1 Servo Zeroing Script

    The V1 version uses a script to set all servos to 0°. Run the listed command.

  • Zero V1 Before Installation

    Perform the zeroing before installation so that each servo starts from the correct zero position.

  • Check Raspberry Pi–HAT Connection

    If the zeroing button moves all servos normally but the calibration script cannot control them, the likely cause is a hardware connection issue between the Raspberry Pi and the Robot HAT.

  • Identify the Calibration Ruler

    The PiDog kit includes either a 90° or 60° calibration ruler. The video uses the 90° ruler, and the 60° calibration process is very similar.

  • Watch the Calibration Tutorial

    Refer to the full calibration tutorial video, which demonstrates how to accurately calibrate PiDog step by step.

  • Run PiDog Calibration

    Place PiDog as shown, change to the examples directory, and run the calibration script.

  • Calibrate With the 60° Ruler

    If you are using the 60° calibration ruler, complete the calibration by following the 60° illustrated guide.

  • Calibrate With the 90° Ruler

    If you are using the 90° calibration ruler, complete the calibration by following the 90° illustrated guide.

  • Save Calibrated Servo Settings

    After calibration, record the servo angles or export the configuration file to avoid recalibrating in the future and restore settings quickly next time.

  • Connect the Servo Wire and Zero It

    After completing those preparations, plug in the servo wire to zero the servo before fixing the servo in place.

  • Run the Servo-Zeroing Script

    Run the script to set the angle of all PWM pins to 0.

  • Connect and Zero the Servo

    Then plug in the servo wire to zero the servo; do this before fixing each servo.

  • Confirm the examples location

    If the documentation was followed, examples are likely under ~/pidog/examples/.

  • Adjust assumptions to the local environment

    Use the default system Python and confirm that pip3 install . made import pidog work; if actual paths or import names differ, confirm the local layout first.

  • Verify the direction data range

    Record the direction values returned by the module and confirm that the range is 0~360 with a minimum recognition unit of 20 degrees.

Use it

  • Try Built-in Actions and Sounds

    Run the function demonstration script, then enter numbers to trigger actions.

  • Use the angle to locate sound

    During operation, read the module's 16-bit direction data and use it as the direction of the sound source relative to the module.

Common problems

  • Raspberry Pi compatibility and dependency conflicts hinder setup #3 #5
  • Incorrect I2C debug setting breaks PiDog example programs #1
  • Custom action Save command provides no visible feedback #4
  • ALSA underrun crashes the app and disconnects the robot #10
  • Faulty PWM pins cause servos to stop working #11

Parts

  • Your own Raspberry Pi: 5, 4, 3B+/3 or Zero 2W (V1 does not support the Pi 5); a microSD card of at least 16 GB, 32 GB recommended
  • 12 metal-gear servos on an aluminium-alloy frame
  • Robot HAT: V5 on V2 (12 PWM channels, I2S audio with a 2030 chamber speaker, MEMS microphone, 6.0–8.4V power input, USB‑C charging, servo zeroing button); V4 on V1 (7–12V input)
  • OV5647 camera, ultrasonic module, dual TTP223 touch, SH3001 6-axis IMU, TR16F064B sound direction sensor, an 11-LED RGB board driven by an SLED1735
  • The battery charges through the Robot HAT's USB‑C port with a 5V 3A charger you supply, and the robot runs while charging

Tools

  • Assemble from the printed instructions (the docs say they take precedence; the assembly videos supplement them)
  • A computer to reach the Pi over SSH (the docs include OpenSSH, FileZilla and remote desktop guides)
  • A Zero 2W needs its 40-pin header soldered on (FAQ)

Skills

  • Installing Raspberry Pi OS (64-bit, since piper-tts ships prebuilt wheels for 64-bit only) and using the command line
  • Servo zeroing and calibration: press the zeroing button on V2, run servo_zeroing.py on V1
  • Python examples with OpenCV / MediaPipe vision
  • Setting up LLM API keys and local Ollama models

Software

  • pidog Python library 1.4.0 (SH3001 IMU calibration added 2026‑09; LICENSE is GPL‑2.0 while the pyproject classifier says GPLv3)
  • robot-hat (GPL‑3.0, 2.5.x branch) and the vilib vision library (GPL‑2.0)
  • Examples: wake up, patrol, face tracking, push-ups, howling, balance, ball tracking, keyboard and app control
  • AI: Espeak, Pico2Wave, Piper and OpenAI TTS, Vosk offline recognition, Ollama and online LLMs, an OpenClaw skill

Documents