BALA2 Getting Started Guide

M5Bala2 is calibrated at the factory. Follow the steps below if you need to recalibrate.

  1. Place BALA2 on a level tabletop and ensure it is powered off.

  2. Press and hold the middle button (ButtonB) and the left red button simultaneously. Release them as soon as the screen lights up. IMU data will be acquired during this process. Do not touch during this period.

  1. After the data is acquired, it will automatically enter calibration mode. Pressing the A/C button can increase or decrease the correction value. When adjusted to the desired value, press the B button to save the parameters.
  1. Reboot BALA2, and it will run with the saved parameters.

Development Environment

Arduino IDE Editing

Arduino IDE Editing

  1. [Mac Users] Refer to this tutorial to configure Arduino IDE [Windows Users] Refer to this tutorial to configure Arduino IDE

  2. Download Example Program

  3. Open the example program in Arduino.

  4. Connect BALA2 to the computer. Click on Tools -> Port to select the serial port used by the device.

  5. Select the M5Stack-Core-ESP32 board in the Board option.

  6. Compile and upload the code.

Servo Usage

Bala::SetServoAngle(uint8_t pos, uint8_t angle)

uint8_t pos: Servo number (1 - 8), where servos 5 - 8 are inside the BALA base.

uint8_t angle: Servo angle.

Bala::SetServoPulse(uint8_t pos, uint16_t width)

uint8_t pos: Servo number (1 - 8), where servos 5 - 8 are inside the BALA base.

uint16_t width: Pulse width.

For M5Stack usage, please refer to M5Stack GRAY

On This Page