Upload Sketch for BiBoard

This chapter is for Advanced users with programming experience.

1. Read the Quick Start Guide

The specific parameters of each functional module of BiBoard, please refer to Chapter 2 of the BiBoard Quick Start Guide.

2. Set up BiBoard

2.1 Prepare the ESP32 development environment

For details, please refer to Chapter 3.2.1 of the BiBoard Quick Start Guide.

2.2 Modify code file in the package

  • sdkconfig.h

  • For Windows:


  • for Mac:


Append a line of code at the end of the file:


2.3 Setup the options

Please refer to the option list to set up the board's upload speed, CPU frequency, etc.

There is a setting for the Flash Size and Partition Scheme among the options. For more information, refer to the next section.

2.4 Choose hardware partition

The BiBoard uses an ESP32 with a 16 M flash. To simplify, you can use the default 4 MB partition map without a problem. There's plenty of programming space for the standard OpenCatEsp32 firmware.

4 MB partition

You can use the default 4MB with spiffs. You can also use other partition schemes under the 4 MB flash limit, such as "No OTA" or "Huge APP".

16 MB partition

If you want to fully utilize the 16 MB flash of BiBoard (it's unnecessary and takes a longer uploading time), you can read the user manual for Add hardware partition configuration option in Arduino IDE.

2.5 Download the OpenCatEsp32 package

We keep updating the codes as an open-source project. You can star and follow our GitHub repository to get the newest features and bug fixes. You can also share your codes with worldwide OpenCatEsp32 users.

  • Download the ​OpenCatEsp32 repository from GitHub: https://github.com/PetoiCamp/OpenCatEsp32.It’s better if you utilize GitHub’s version control feature. Otherwise, make sure you download the WHOLE OpenCatEsp32 FOLDER every time. All the codes have to be the same version to work together.

  • If you download the Zip file of the codes, you will get an OpenCatEsp32-main folder after unzipping. You need to rename it to OpenCatEsp32 before opening the OpenCatEsp32.ino, so that the two names match.

No matter where you save the folder, the file structure should be:

  • There are several testX.ino codes in ModuleTests folder. You can upload them to test certain modules separately. Open any testX.ino sketch with prefix “test”. (I recommend using testBuzzer.ino as your first test sketch)

2.6 Connect to BiBoard via USB type-C data cable

Set the serial port in the Arduino IDE:

If you cannot find the serial port after connecting to your computer:

  • You may need to install the driver for the CP210x chip.

  • If the BiBoard is powered on by the battery, please long-press the button on the battery >=3s to power off the mainboard so that the board is only powered through the USB cable and only the blue LED is lit up.

2.7 Compile and upload the sketch

Modify the device type macro definition in BiBoard.ino according to the device type.

#define BITTLE    //Petoi 9 DOF robot dog: 1 on head + 8 on leg
//#define NYBBLE  //Petoi 11 DOF robot cat: 2 on head + 1 on tail + 8 on leg
//#define CUB

Modify the motherboard model macro definition in BiBoard.ino according to the motherboard version.

// #define BiBoard_V0_1  //ESP32 Board with 12 channels of built-in PWM for joints
#define BiBoard_V0_2

After the modification is completed, you can click the upload button to upload BiBoard.ino, and the changes in the program will be automatically saved.

2.8 Open the serial monitor and do a factory reset (Optional)

If you want a factory reset, please connect the BiBoard and the computer via USB type-C data cable, and open the serial monitor. You can find the button either under Tools, or at the top-right corner of the Arduino IDE.

Set the serial monitor as 115200 baud rate and no line ending.

Input the serial command '!' and press Enter in the serial monitor to start over. You will see several questions:

Reset the joints' calibration offsets? (Y/n): 

Input 'Y' to the question, which means resetting all servo corrections to zero.

If you want to keep the previous joint calibration data, please input 'n'.

- Calibrate the Inertial Measurement Unit (IMU)? (Y/n): 

Input 'Y' to the question, which means calibrating the MPU6050, i.e. the gyro/accelerometer sensor.

Put the BiBoard FLAT on the table, and don't touch it during calibration.

Sometimes, the program could halt at the connection stage. You can close the serial monitor and reopen it, or press the reset button on BiBoard, to restart the program.

The program starts calibration after playing the melody 6 times.

Run factory quality assurance program? (Y/n)        

Input 'n' and press Enter to continue.

The details of serial port printing information are as follows:

* Start *
Software version: B01_231206
Scanning I2C network...
- I2C device found at address 0x54  !
- I2C device found at address 0x68  !
- done
Set up the new board...
- Name the new robot as: Bittle2E
- Reset the joints' calibration offsets? (Y/n):   
Initializing MPU...
- Testing MPU connections...attempt 0
- MPU6050 connection successful
- Initializing DMP...
- Calibrate the Inertial Measurement Unit (IMU)? (Y/n):    

Put the robot FLAT on the table and don't touch it during calibration.
MPU offsets:
//           X Accel  Y Accel  Z Accel   X Gyro   Y Gyro   Z Gyro
//OFFSETS     1447,    -349,    1298,      89,      90,      16
- Enabling DMP...
- Enabling interrupt detection (Arduino external interrupt 26)...
- DMP ready! Waiting for the first interrupt...
Bluetooth name: Bittle2E
Waiting for a client connection to notify...
Bluetooth name: Bittle2E
The device is started, now you can pair it with bluetooth!
Setup ESP32 PWM servo driver...
Calibrated Zero Position
135 120 135 135 190 80 190 80 190 80 80 190
Build skill list...60
Run factory quality assurance program? (Y/n)
Init voice
Number of customized voice commands on the main board:

After the IMU calibration is completed, every time the robot is powered on, it will enter the regular power-on program.

The main program of Bittle judges whether it has been initialized by comparing the BIRTHMARK in the EEPROM, and will not enter the initialization process again when it is turned on next time.

2.9 Power on

  • long-press the button which is on the battery and boot up the robot with one side up, it will enter the calibration state automatically. The picture below shows the upper legs and lower legs installed after the robot enters the calibration state.

Please refer to chapter 5 🔌 Connect Wires and chapter 6 📐 Calibration for the complete calibration process.

  • If you power on the robot and it is upright (with its back upward), the robot will start from the "rest" posture (fold the legs and unlock the servos).

2.10 Standard mode and special modes

The default code runs the Standard mode (including the Voice command function). If you have some extensible modules, you may uncomment the definition of a specific module. It will disable the Gyro code to save some programming space and activate the demo of the module.

The behavior of the official modules is defined in separate header files in OpenCat/src/. You can find them in OpenCat/src/io.h -> readSignal(). The behavior of OTHER_MODULES is defined in OpenCat/OpenCat.ino -> otherModule(). You can study the example code to write your own functions.

3. Configuration with App

The BiBoard has built-in Bluetooth, and you can connect it with the new Android app:

App for BiBoard (Android 4.4+)

You can check the update history and added features in ChangeLog.md (BiBoard\ChangeLog.md)

Last updated

Change request #524: Add a demo in Melody Creation