Testing the IMU, Motors and Controller

Check each part of the Open Duck Mini on its own before you ask it to walk, starting with the IMU, then the servos, then the Xbox controller

By Kevin McAleer,    4 Minutes

Page last updated November 24, 2026


Course Cover Image


It’s tempting to jump straight to walking. Don’t! A walking robot is many parts working at once, and when it fails it’s hard to tell which part let it down. So let’s test each one on its own first. When all three tests pass, you’ll know the hardware is good.

Log in to the Pi, go to the runtime folder and switch on the virtual environment before each session:

workon open-duck-mini-runtime
cd Open_Duck_Mini_Runtime

Test 1: is the IMU on the bus?

First, check the Pi can see the BNO055 on I2C:

i2cdetect -y 1

This prints a grid of I2C addresses. You’re looking for the BNO055, which usually shows up at 0x28 (that’s the common default address for this sensor). If the grid is empty, go back to the wiring table in lesson 7.


Test 2: raw IMU readings

Now read the IMU directly:

python3 mini_bdx_runtime/mini_bdx_runtime/raw_imu.py

Tilt the duck gently and watch the numbers change. If they move when you move the robot, the IMU is alive.


Test 3: IMU orientation, live

Numbers are hard to picture, so the runtime can show the IMU’s orientation on your computer. This needs two terminals.

On the robot:

python3 scripts/imu_server.py

On your computer (with the runtime cloned there too):

python3 scripts/imu_client.py --ip <robot ip>

Tilt the duck forward, back and to each side. The display on your computer should follow. While you’re here, make a note of how your IMU is mounted, flipped or not. You’ll set imu_upside_down to match in the next lesson.


Test 4: the motors

Next, check every servo answers on the bus:

python3 scripts/check_motors.py

Hold the duck safely while this runs, with its legs free to move. If a servo doesn’t respond, note its ID. The ID tells you exactly which joint to look at (see lesson 4). Because the servos are daisy-chained, if several in a row are missing, look for a loose cable just before the first missing one.


Test 5: the Xbox controller

The controller connects over Bluetooth. Put it into pairing mode, then on the Pi start the Bluetooth tool:

bluetoothctl

Inside bluetoothctl, scan for the controller and note its MAC address (it looks like AA:BB:CC:DD:EE:FF):

scan on

When it appears, pair, trust and connect, using its MAC address:

pair <MAC>
trust <MAC>
connect <MAC>

trust means it will reconnect by itself next time. Type exit to leave bluetoothctl, then test the controller:

python3 mini_bdx_runtime/mini_bdx_runtime/xbox_controller.py

Press buttons and move the sticks. You should see the values change.


Your test checklist

Test Passes when
i2cdetect -y 1 The BNO055 shows up, usually at 0x28
raw_imu.py The numbers change as you tilt the duck
imu_server.py and imu_client.py The display follows the duck’s tilt
check_motors.py All 14 servos answer
xbox_controller.py Buttons and sticks show up

Try it Yourself

  1. Unplug one servo’s daisy-chain cable and run check_motors.py again. Which IDs go missing? Plug it back in.
  2. With imu_client.py running, rotate the duck slowly through a full turn and watch the display.
  3. Turn the controller off and on again. Does it reconnect without pairing?

Common Issues

Problem: i2cdetect shows nothing. Solution: Check I2C is on in raspi-config, your user is in the i2c group, and the IMU wiring matches lesson 7. Why: The IMU is only visible once I2C is enabled and wired to pins 3 and 5.

Problem: check_motors.py can’t open the serial port. Solution: Check the servo board’s USB cable and that the battery is powering the servos. Why: The Pi needs the board to reach the servos, and the servos need power to answer.

Problem: The controller pairs but won’t connect next time. Solution: Make sure you ran trust <MAC> in bluetoothctl. Why: Only trusted devices reconnect by themselves.

< Previous Next >

Was this lesson helpful?

Course complete

Congratulations, you finished Build an Open Duck Mini Walking Robot!

That's all 16 lessons done. Let people know, it's a great way to inspire someone else to start.

Share card: I completed Build an Open Duck Mini Walking Robot on KevsRobots
Post Bluesky LinkedIn Facebook


What are you looking for?
Watch Videos Get Ideas Learn Something Read a Review Read the Blog Search
... Z Z z