Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
📚➡️🤖
This is the Petoi robot product documentation hub. We constantly iterate on our models and codes to bring bionic robotic pets to the world. Please read the notes regarding versions carefully before configuring your robot.
If you need help, please write to [email protected] or post on our forum at petoi.camp.
You can use the find (Cmd+K/Ctrl+K) feature on this site. It supports Lens, a ChatGPT-based service.
This page gets you started with building/playing/coding with your Petoi robots
Hi, thanks for getting a Petoi robot.
If you have a construction kit, you can follow the following instructions to build it.
If you have a Bittle X V2 kit(as indicated on the package barcode label)
pay attention to
select BiBoard V1 during the firmware upload process with
Note that the robot is suitable for working on smooth surfaces. When walking on a carpet, the movement may not be smooth.
Play with the default actions
Play with
Add to the controller panel
Play with to make your robot perform multiple actions in sequence
(for Bittle X or any robot with the voice command module)
If the robot doesn’t respond to your voice commands, please see .
You can (for example: in a public space, or in a classroom setting requiring quiet periods) to avoid accidentally triggering voice responses and robot reactions.
If you've bought a Bittle X+Arm, please see .
Do some coding
Follow to
some new robotics skills with
Follow to code some Petoi robotics moves in C++
For Bittle/Bittle X, you may to make your robot not run around while you program it.
Work on some
Question: I am confused by the product packaging and unsure if you sent me the right robot.
Answer: We reuse the packaging for Bittle and BIttle X. If you order a Bittle but receive a package with “Bittle X” marking, or vice versa, you can check the text label with the barcode. That text identifies what’s inside the packaging.
Check on our official website or in the Petoi Doc Center.
A servo plug has three wires. Plug it in the right direction or you may burn the chip. The color of wires may vary for different models. However, the darkest-colored (Black or Brown) wire (GND for ground) is always the GND wire as a convention. The GND wire should be plugged closest to the board.
The index number of the joint servo has no corresponding relationship with the PWM pin number on the main board. You don't even need to read the pin numbers on the PCB board.
A servo plug has three wires. Plug it in the right direction or you may burn the chip. The color of wires may vary for different models. However, the darkest-colored (Black or Brown) wire (GND for ground) is always the GND wire as a convention. The GND wire should be plugged closest to the board.
The index number of the joint servo has no corresponding relationship with the PWM pin number on the main board. You don't even need to read the pin numbers on the PCB board.
A servo plug has three wires. Plug it in the right direction or you may burn the chip. The color of wires may vary for different models. However, the darkest-colored (Black or Brown) wire (GND for ground) is always the GND wire as a convention. The GND wire should be plugged closest to the board.
The index number of the joint servo has no corresponding relationship with the PWM pin number on the main board. You don't even need to read the pin numbers on the PCB board.
The joint calibration interface for Bittle X+Arm which uses BiBoard V1 in the Petoi Desktop App is as follows:
If you want to use Joint Calibrator, Skill Composer in the Petoi Desktop App, or a coding block in Mind+ via computer Bluetooth, you need to pair the mainboard's Bluetooth with the computer first.
To run the Skill Composer, you can use the following methods to connect the robot's mainboard to the computer:
Wired connection: The kit includes a USB Type-C data cable connecting the robot's mainboard to the computer.
Wireless connection(Bluetooth): The motherboard's built-in Bluetooth communication module allows you to establish a wireless connection between the robot's mainboard and the computer.
At present, There are three kinds of interface for the Petoi robots:
Nybble
Bittle / Bittle X
Bittle X+Arm
The interface for each kind of product, please refer to the following subpages:
The calibrator interface for Nybble is as following:
After the robot enter the calibration state, install the head, legs and tail as the calibration posture.
Use the included L-shaped tool as a reference
When we map those joints to a specific robot, the indexing becomes more practical. The ordering for the joint servo pins on NyBoard is like below:
The joint calibration interface for Bittle X (BiBoard V0) in the Petoi Desktop App is as follows:
The joint calibration interface for Bittle X (BiBoard V1) in the Petoi Desktop App is as follows:
The joint calibration interface for Nybble in the Petoi Desktop App is as follows:
After entering the calibration state, , with all servos rotated to their zero angles, attach the head, tail, and legs prepared in the previous section to the body. They are generally perpendicular to their linked body frames. The calibration pose is shown below:
Install the servo-related components according to the picture above and try to ensure that they are perpendicular to each other (the upper leg is perpendicular to the torso, and the lower leg is perpendicular to the upper leg).
Use the included L-shaped tool as a reference during calibration. According to the index numbers of the joints shown at the top of the interface (when calibrating the servos, adjust the upper leg first, then adjust the lower leg). Drag the corresponding slider (below the index number), or click the blank part of the slider track to fine-tune the joint to right angles.
Use the USB Type-C data cable for BiBoard V1.
The uploading options and the Factory reset process are the same as BiBoard V0.
The interface for Bittle X+Arm:
A servo plug has three wires. Plug it in the right direction or you may burn the chip. The color of wires may vary for different models. However, the darkest-colored (Black or Brown) wire (GND for ground) is always the GND wire as a convention. The GND wire should be plugged closest to the board.
The index number of the joint servo has no corresponding relationship with the PWM pin number on the main board. You don't even need to read the pin numbers on the PCB board.
A servo plug has three wires. Plug it in the right direction or you may burn the chip. The color of wires may vary for different models. However, the darkest-colored (Black or Brown) wire (GND for ground) is always the GND wire as a convention. The GND wire should be plugged closest to the board.
The index number of the joint servo has no corresponding relationship with the PWM pin number on the main board. You don't even need to read the pin numbers on the PCB board.
You need to turn on Linux on the Chromebook to access the Linux environment via the terminal app.
Then, follow the following steps to install Mind+.
Use the following command to check the processor architecture in the terminal:
uname -m
The output will be similar to "i686", "x86_64" or "armv7":
i686 (or similar) - 32-bit Intel/AMD processor (common in older computers).
x86_64 (or similar) - 64-bit Intel/AMD processors (modern laptops, desktops, and most Chromebooks).
armv7 (or higher) - ARM processor. (Mobile phones, tablets, 2nd and 3rd generation Raspberry Pis running Ubuntu Mate, and some Chromebooks. Most are 32-bit now)
According to different architectures to download different versions:https://mindplus.dfrobot.com/linux
Use the following command in the terminal to install it (Replace ***** with the file name of the installation package):
sudo dpkg -i *****.deb
sudo apt-get -f install
After installed, you can start the Mind+ app in the Chromebook launcher:
Now, you can proceed to the Mind+ tutorial.
Currently, connection via Bluetooth is not supported.
At present, there are 3 versions of NyBoard: NyBoard V1_0, NyBoard V1_1 and NyBoard V1_2.
There are just a few differences between NyBoard V1_1 and NyBoard V1_2:
V1_2 has one NeoPixel LED attached to Pin D10.
V1_2 supports both ATmega328p AU (bigger) and MU (smaller) chips.
Although the BiBoard V1 has only 12 pins, the joint index numbers are configured in the same order as the NyBoard. The ordering for the joint servo pins on BiBoard V1 is like below:
The joint calibration interface for Bittle (NyBoard) in the Petoi Desktop App is as follows:
A servo plug has three wires. Plug it in the right direction or you may burn the chip. The color of wires may vary for different models. However, the darkest-colored (Black or Brown) wire (GND for ground) is always the GND wire as a convention. The GND wire should be plugged closest to the board.
The index number of the joint servo has no corresponding relationship with the PWM pin number on the main board. You don't even need to read the pin numbers on the PCB board.
The calibrator interface for Bittle is as following:
After the robot enter the calibration state, do the following steps:
In the calibration state, place the head as close to the central axis as possible and insert its servo shaft into the servo arm of the neck.
Press down on the head so it is firmly attached to the neck.
Install upper leg and lower leg components to the output teeth of the servos when the Bittle is powered on and in the calibration state. Please keep the torso, upper leg, and lower leg installed vertically as much as possible, and do not install the lower leg backward, as shown in the picture.
Use the included L-shaped tool as a reference
When you use a USB type-C data cable to upload the firmware for the mainboard BiBoard V1.
[picture of USB data connection]
On Windows, if there is no serial port in the port list of Device Manager:
On Mac, open the Terminal program under the Applications-Utilities folder and type the following commands. If no serial device name starting with "tty.wchusbserial" or "cu.wchusbserial" is found:
Windows:
Mac:
For the macOS(from the version Sequoia 15.1), after installing the driver, you need to enable the driver, as follows:
Settings -> General -> Login Items & Extensions -> Driver Extensions
The subpages mention the joint calibration interface for Bittle / Bittle X in the Petoi Desktop App.
After entering the calibration state, with all servos rotated to their zero angles, attach the head, and legs prepared in the previous section to the body. They are generally perpendicular to their linked body frames. The calibration pose is shown below:
Install the servo-related components according to the picture above and try to ensure that they are perpendicular to each other (the upper leg is perpendicular to the torso, and the lower leg is perpendicular to the upper leg).
In the calibration state, place the head as close to the central axis as possible and insert its servo shaft into the servo arm of the neck.
Press down on the head so it is firmly attached to the neck.
Install upper leg and lower leg components to the output teeth of the servos after the Bittle is powered on and in the calibrated neutral position. Please keep the torso, upper leg, and lower leg installed vertically as much as possible, and do not install the lower leg backward, as shown in the picture.
Use the included L-shaped tool as a reference during calibration. According to the index numbers of the joints shown at the top of the interface (when calibrating the servos, adjust the upper leg first, then adjust the lower leg). Drag the corresponding slider (below the index number), or click the blank part of the slider track to fine-tune the joint to right angles.
The subpages mention the joint calibration interface for Bittle X+Arm, which uses BiBoard V0 and BiBoard V1 in the Petoi Desktop App.
This robotic arm is already fully assembled.
For the construction kit Install the short wire servo in the servo slot on the robotic arm with two M2*5 self-tapping screws. [robotic arm installation image 0]
For the pre-assembled kit
You only need to install the servo with the neck structure in the servo slot with two M2*5 self-tapping screws.
For the construction kit, after entering the calibration state, please install the legs and robotic arm as follows:
The process is the same as .
Place the robotic arm as close to the central axis as possible and insert its servo shaft into the servo arm of the neck.
[robotic arm installation image 1]
Press down on the robotic arm so it is firmly attached to the neck.
[robotic arm installation image 2]
The process of fine-tuning the legs and the Servo 0 is the same as that of Bittle / Bittle Xegs process is the same as .
Please click the blank part of the slider track and follow the calibration posture below to fine-tune Servo 1 on the robotic arm.
Please click the Auto button to fine-tune the claw (Servo 2) on the robotic arm.
You can also manually click the blank part of the corresponding slider track and adjust the gear on the servo output shaft to the position shown in the figure above.
Although the BiBoard V0 has only 12 pins, the joint index numbers are configured in the same order as the NyBoard. The ordering for the joint servo pins on BiBoard V0 is like below:
You must use the USB data cable to do firmware uploading.
Some USB cables are just for charging and do not have data transfer capability. Using the original data cable in the kit is better for making the uploading successful.
Some new laptops only have USB-C ports, so users use a hub to connect standard USB-B to their computers. However, the intervening hubs prevent the app from recognizing the serial port. The solution was to connect the USB-C cable DIRECTLY to the computer using EITHER a USB-C to USB-C cable OR a tiny C to B adaptor (not a hub).
There are two methods to Upload the firmware to the robot:
The simplest method is to use the . No programming is involved. You can play with some preset modes.
If you have some programming experience, you can use the You will be able to modify the open-source codes for your new projects.
If you are using NyBoard, please refer to .
If you are using BiBoard, please refer to .
If you have a NyBoard(with Bittle and Nybble), we highly recommend using the green USB programmer to upload the firmware. The Bluetooth dongle is not as stable and may cause the mainboard's bootloader to crash if interrupted in the middle.
For BiBoard(with Bittile X), the USB/Bluetooth connections are built on the board already.
For products (such as and ), there is no need to modify any software code. By default, all functional blocks in Mind+ are supported.
Wired connection: The kit includes a USB Type-C data cable connecting the robot's mainboard to the computer.
Wireless connection(Bluetooth): The motherboard's communication module allows you to establish a wireless connection between the robot's mainboard and the computer.
To run the Skill Composer, you can use the following methods to connect the robot's mainboard to the computer:
Wired connection: The kit includes a connecting the robot's mainboard to the computer.
Wireless connection(Bluetooth): The kit includes a connecting the robot's mainboard to the computer.
Plug in the battery and long-press the battery button to power on the robot.
For NyBoard, please ensure you have uploaded the OpenCat firmware before calibrating.
You must connect the and USB data cable or to the computer.
You can join multiple serial commands as one task queue:
The token is T_TASK_QUEUE. ('q')
Use 'q' to start the sequence.
Add a sub token followed by the subcommand.
Use ':' to add the delay time (mandatory)
Add '>' to end the sub-command
Example: qk sit:1000>m 8 0 8 -30 8 0:500>
will make the robot sit and then move the shoulder joint.
JointAngle[index]= FunctionOf(amplitude, midpoint, freq, phase, resolution, frame)
The token is T_SIGNAL_GEN. ('o')
The command format is:o resolution speed,jointIdx1 midpoint amplitude frequency phase,jointIdx2 midpoint amplitude frequency phase,...
For example: o 1 0, 0 40 -20 4 0, 1 -30 20 4 30, 8 -70 10 4 60, 12 -10 10 4 0, 15 10 0 4 0
It doesn't matter if you use ',' or space ' ' to separate the numbers. However, using ',' to group can clarify one joint's parameters.
The motion's iterator loops from 0 to 360.
The resolution is how it increases to 360: t += resolution.
The speed defines the transition speed. It will move by [1~125] degrees towards the target angle. 0 is the maximum speed possible.
frequency defines how many cycles the joint can oscillate in one loop.
phase is defined as -120 to 120. So phase = 30 means shifting by Pi/2. 120 is one entire period.
For example, the head’s pan/tilt angles can be bound to form the Lissajous Figure.
Pan+tilt:
qksit:100>o 1 8, 0 0 30 4 0, 1 -30 30 4 30:100>o 1 0, 0 0 30 4 0, 1 -30 30 4 15:100>o 1 0, 0 0 30 4 0, 1 -30 30 8 30:100>o 1 8, 0 0 30 8 0, 1 -30 30 4 30:100>o 1 8, 0 0 30 4 0, 1 -30 30 16 30:100>o 1 0, 0 0 30 32 0, 1 -30 30 8 0:100>Wash face:qksit:100>i0 20 1 0 8 -70 12 0 15 10:0>o1 0, 0 40 -20 4 0, 1 -30 20 4 30, 8 -70 10 4 60, 12 -10 10 4 0, 15 10 0 4 0:100>m0 0 1 -20 2 0:0>ksit:0
After downloading the compressed file(.zip), please unzip it first.
Do NOT move the UI.exe to another location in Windows.
From version 1.2.1, the Petoi Desktop App has included a new module - Tools. This module provides convenient tools to fix your robot's frequent problems.
It is used to reset the , simplifying its If the voice module does not respond to your voice, you can use this tool to reset it. It's pretty simple to use: click the Reset voice module button.
Follow the instructions in the message box.
If the problem persists, please email [email protected].
It is used to calibrate the gyroscope sensor on the mainboard. If you notice that the robot cannot maintain balance while performing skill movements (such as sitting down) and its body keeps shaking, you need to recalibrate the gyroscope. To calibrate the gyroscope, click the Calibrate gyroscope button.
Follow the instructions in the message box:
If the problem persists, please email [email protected].
When you use a to upload the firmware for the NyBoard, if there is no serial port in the port list of Device Manager.
Please download and install the USB driver:
Mac:
Windows:
Linux:
Please connect the corresponding pins of the Raspberry Pi and the as follows:
5V power --> 5V
Ground --> GND
GPIO 14 (TXD) --> RX2
GPIO 15 (RXD) --> TX2
Dial the switch on the BiBoard extension hat to the UART2 side.
To ensure a good connection, you may need to solder the wires.
The and are the same as BiBoard V1.
Operate the GPIO port of BiBoard
There is no separate GPIO port on BiBoard, but the multiplexed serial port 2 (pin 16, 17) or the PWM pin of the unused PWM servo interface can be used as GPIO port. The GPIO port is also relatively simple to use. After configuring the input and output mode, the usage is exactly the same as that of Arduino UNO. You can use any IO control program of Arduino UNO, just change the number of IO .
Application of ADC which is variable gain on BiBoard (ESP32)
The instructions of ADC on BiBoard
The 34, 35, 36 and 39 pins of the ESP32 module support input only. We configure it as an analog input port on BiBoard, which makes it convenient for developers to connect 4 foot sensors.
The usage of analog input analog-to-digital converter (ADC) on BiBoard is the same as the basic Arduino UNO, but the accuracy is higher (12 bits, UNO is 10 bits), and a programmable gain amplifier is added to make the ADC work in the best range.
When a 1V voltage signal is input, if 12bit access is used according to the normal configuration, the reference voltage is equal to the power supply voltage (3.3V): the corresponding output is 0~1241, a large part of the ADC range will be wasted, resulting in inaccurate data. When we configure the programmable gain, we can make the 1V input signal fill almost the entire ADC range, and the accuracy and resolution are greatly improved.
This demo uses 4 inputs, respectively configured as: 0/2.5/6/11 decibel amplification gain, it should be noted that the default configuration of ESP32 Arduino is 11 decibel amplification gain.
We use "analogSetPinAttenuation(PIN_NAME, attenuation)" to configure the gain of a single input pin, or use "analogSetAttenuation(attenuation)" to configure the gain of all analog input pins.
In the actual test, when the 1V standard voltage is input, the ADC values are: 3850/2890/2025/1050. In future productions, the ADC range can be changed by changing the ADC gain without the replacement of the reference voltage source.
You can solder a 5-pin socket on BiBoard V1 to plug in a Raspberry Pi.
The white can be 3D printed.
You can 3D print a new that fits the Raspberry Pi socket, as follows:
After plug in the Raspberry Pi board , power on the BiBoard via USB data cable or Battery.
Open the , and send serial command XS to enable the working mode.
The interface for Bittle / Bittle X :
A servo plug has three wires. Plug it in the right direction or you may burn the chip. The color of wires may vary for different models. However, the darkest-colored (Black or Brown) wire (GND for ground) is always the GND wire as a convention. The GND wire should be plugged closest to the board.
The index number of the joint servo has no corresponding relationship with the PWM pin number on the main board. You don't even need to read the pin numbers on the PCB board.
When you use a USB type-C data cable to upload the firmware for the BiBoard V0, if there is no serial port in the port list of Device Manager.
Please download and install the USB driver:
For more details, please refer to the .
/* In this demo, we use TX2, RX2 as general purpose IO
* TX2 : IO17
* RX2 : IO16
*/
void setup() {
// initialize digital pin 16 & 17 as an output.
pinMode(16, OUTPUT);
pinMode(17, OUTPUT);
}
// the loop function runs over and over again forever
void loop() {
digitalWrite(16, HIGH); // GPIO 16 & 17 HIGH
digitalWrite(17, HIGH);
delay(1000); // wait for a second
digitalWrite(16, LOW); // GPIO 16 & 17 LOW
digitalWrite(17, LOW);
delay(1000); // wait for a second
}
// Ain 34 - 0dB Gain - ADC_0db
analogSetPinAttenuation(34, ADC_0db);
// Ain 35 - 2.5dB Gain - ADC_2_5db
analogSetPinAttenuation(35, ADC_2_5db);
// Ain 36 - 6dB Gain - ADC_6db
analogSetPinAttenuation(36, ADC_6db);
// Ain 39 - 11dB Gain - ADC_11db (default)
analogSetPinAttenuation(39, ADC_11db);
Since the ESP8266 can be used as a regular Arduino board, we can write a simple Arduino code to open the serial port and send the serial commands to control the robot. It's like a stand-alone serial commander written in C and can go with the robot. You may write hundreds of pre-defined tasks without worrying about the memory limits on the main controller.
You can find a short test8266Master in OpenCat/ModuleTest:
void setup() {
// put your setup code here, to run once:
Serial.begin(115200);
Serial.setTimeout(5);
bool connected = false;
while (!connected) {
Serial.print("b 20 8 22 8 24 8");
for (byte t = 0; t < 100; t++) {
if (Serial.available())
if (Serial.read() == 'b') {
connected = true;
while (Serial.available() && Serial.read())
;
break;
}
delay(10);
}
delay(1000);
}
}
void sendCMD(const char cmd[], int wait = 0) {
Serial.print(cmd);
while (true) {
if (Serial.available() && toLowerCase(Serial.read()) == cmd[0]) {
delay(10);
while (Serial.available() && Serial.read())
;
break;
}
delay(2);
}
delay(wait);
}
void loop() {
sendCMD("d", 500); //rest and wait 0.5 seconds 趴下并等待0.5秒
sendCMD("khi"); //greetings 打招呼
sendCMD("kpu"); //pushups 俯卧撑
sendCMD("kvtF", 1000); //stepping 原地踏步
sendCMD("G"); //Turn off the gyro 关闭陀螺仪
sendCMD("kwkF", 1500); //walk 行走
sendCMD("kck"); //check 观察
sendCMD("kpu1"); //push ups with on hand 单手俯卧撑
sendCMD("kvtR", 2000); //spin 旋转
sendCMD("G", 100); //turn on the gyro 打开陀螺仪
sendCMD("ktrF", 1500); //trot 跑步
sendCMD("kjy", 0); //joy 加油
sendCMD("i 0 45 8 -90 9 -90", 1000); //rotate the head and arm joints 伸手转头
sendCMD("ksit", 1000); //sit 坐下
}
There are 2 serial ports,which are separately located on 2 expansion sockets (P16, P17) ,on BiBoard.
The serial port 1 on the P16 can be connected to the USB downloader and the external serial device. Please do not use the downloader and the external serial device at the same time. The serial port voltage division will lead to communication errors.
In the Arduino demo, Serial represents the serial port 0, Serial1 represents the serial port 1.Serial and Serial1 send to each other.
/* In this demo, we use Serial and Serial1
* Serial and Serial1 send to each other
*/
void setup() {
// initialize both serial ports:
Serial.begin(115200);
Serial1.begin(115200);
}
void loop() {
// read from port 1, send to port 0:
if (Serial1.available()) {
int inByte = Serial1.read();
Serial.write(inByte);
}
// read from port 0, send to port 1:
if (Serial.available()) {
int inByte = Serial.read();
Serial1.write(inByte);
}
}
The usage of DAC
The purpose of the DAC is the opposite of that of the ADC. The DAC converts a digital signal into an analog signal for output.
Remember the music when NyBoard is turned on? It is using PWM to make music sound which uses high-speed switching to adjust the duty cycle to output voltage.
Compared with PWM, the DAC will directly output the voltage without calculating the duty cycle. ESP32 integrates a 2-channel 8-bit DAC with a value of 0-255. The voltage range is 0-3.3V. Therefore, the formula for calculating the output voltage of the DAC is as follows:
The demo is as follows:
#define DAC1 25
void setup() {
}
void loop() {
// 8bit DAC, 255 = 3.3V, 0 = 0.0V
for(int i = 0; i < 255; i++){
dacWrite(DAC1, i);
delay(10);
}
}
cd /dev
ls
for (int t = 0; t < 360; t += resolution)
angle = midpoint +
round(amp * sin(2.0 * M_PI * ((t + phase * 3 / freq) / (360.0 / freq))));
Power on the mainboard via the battery (plug in the battery to the mainboard, and long-press the battery button > 3 seconds); after powering on, the mainboard's blue LED and yellow LED should be on.
For Windows, Open the Bluetooth & other devices setting page, and turn on the Bluetooth button as follows:
Add the BiBoard Bluetooth for the first time as follows:
Select the one with the name Bittle**_BLE:
After paired successfully, it shows:
Check the outgoing serial port, which we will use later in the Mind+ or Petoi Desktop App in the More Bluetooth options:
Don't add the one with the name Bittle**_SSP that auto-generates a PIN code: Click the button Cancel to quit.
Test in Mind+:
We humans and many other legged animals have many joints. They give us the freedom to move in many ways. Though it's difficult to reproduce those complex motions on a robot, we can simplify all those joints to limited numbers of actuators.
When controlling so many joints, the first thing is to index them. We can define an order according to their distance from the torso. For example, the shoulder joint is closer to the torso than the elbow joint, and the joint that let us look around is closer to the torso than the joint that let us nod. If we had tails, it would be as close as the head compared to the shoulder joints.
So we can order the joints in this way: head panning, head tilting, tail panning, tail tilting, 4x shoulder (or hip) roll, 4x shoulder (or hip) pitch, 4x elbows (or knees). For the joints in the same distance group, we can index them clockwise from the front-left corner if the body is looked at from behind.
The rotation angle range of the joint servo is between [-125~125]. For the leg servo, when viewed from the left side of the robot, when the leg rotates counterclockwise from the 0-degree position around the joint center point (the screw fixing position), the angle is a positive value; clockwise rotation, the angle is a negative value; viewed from the right side of the robot, the leg rotation angle is mirror-symmetrical to the left side (when rotating clockwise from the 0-degree position around the joint center point, the angle is a positive value; Rotate counterclockwise, the angle is negative). For the robot's neck servo, looking down from the top of the robot's head, when the neck rotates counterclockwise from the position of 0 degrees around the joint center point (the position where the screw is fixed), the angle is a positive value; when it rotates clockwise, the angle is a negative value.
Use the USB Type-C data cable for BiBoard V0.
You can find the board version number on the BiBoard V0:
Factory Reset After upgrading the firmware, the board will enter the initialization startup mode and ask whether to clear the joint calibration parameters and calibrate the IMU.
Upgrade the Firmware It will upgrade the firmware, skip the clear joint calibration parameters, calibrate the IMU steps (Send serial command "n"), and automatically enter the regular startup mode.
Update the Mode Only It has the same function as the Upgrade the Firmware at present.
After clicking the Factory Reset button, the uploading process will start immediately. The board will enter the initialization startup mode after uploading the firmware. Some message windows will pop up in sequence for you to confirm or cancel:
Reset joint offsets? (Y/N)
Select Yes, and the program will reset all servo calibration parameters to zero. The status bar will update the corresponding process and result in real time.
Select No to preserve the calibration value(so that you don't need to calibrate again if you have already done so).
Calibrate IMU? (Y/N)
Select Yes, and the program will calibrate the gyroscope (IMU) to balance the robot correctly. The status bar will update the corresponding process and result in real time.
Select No, and the program will skip this step.
After that, the board will enter the regular startup mode.
Note:
Ensure the mainboard is positioned horizontally for IMU calibration before clicking the "Yes" button.
If you are familiar with the Petoi coding blocks and Python language, you can change to the Code mode in Mind+ as follows:
The Code mode is a Python3 development environment. You can write any Python script in it and call all the API interfaces of the PetoiRobot library imported by Mind+.
You can find the PetoiRobot library in the following directory. There are all the definitions of API interfaces in the PetoiRobot.py
Windows C:\Users\{username}\AppData\Local\DFScratch\extensions\petoi-robot-thirdex\python\libraries\PetoiRobot.py
MacOS /Users/{username}/Library/DFScratch/extensions/petoi-robot-thirdex/python/libraries/PetoiRobot.py
Here is a sample code :
# The code starts here
from PetoiRobot import * # must import the PetoiRobot library
# enter the code below
# auto connect serial ports
autoConnect()
# call the APIs to control the Petoi robot
sendSkillStr('ksit', 0.5)
sendCmdStr('T', 0.5)
loadSkill("skillFileName", 0.2)
# close the serial port
closePort()
You can also copy the code in the Auto Generate area in the Blocks mode and then paste it into the code file in the Code mode. Then you can edit and run the code.
BiBoard is equipped with an infrared sensor, which is connected to the 23rd pin. The use of infrared is exactly the same as which is on Arduino UNO based on AVR.
First download the 2.6.1 version of the IRremote library, you need to manually select the 2.6.1 version. Because the infrared-related codes have changed in later versions, if you use the 3.X version, the commands will not be translated. In order to be compatible with our previous products, we decided to use the 2.6.1 version after testing.
When using NyBoard, in order to ensure that the code can be compiled smoothly, we need to remove unnecessary code in the IRremote library, that is, remove the encoder/decoder that we don't use, and only keep the NEC_DECODER, which is the 38KHz signal decoder in NEC format.
Due to the flash memory capacity of BiBoard is “huge”, we don’t need to remove unnecessary code in the IRremote library.
Finally, a demo is attached, which accepts infrared signals and prints via the serial port. You can also use official demo for testing.
#include <Arduino.h>
#include <IRremote.h>
int RECV_PIN = 23;
IRrecv irrecv(RECV_PIN);
decode_results results;
void setup() {
Serial.begin(115200);
irrecv.enableIRIn();
Serial.println("IR Receiver ready");
}
void loop() {
if (irrecv.decode(&results)) {
Serial.println(results.value, HEX);
Serial.print(" - ");
irrecv.resume(); // Receive the next value
}
delay(300);
}
MPU6050 is the most widely used 6-axis gyroscope, which can not only measure 3-axis angular velocity and 3-axis acceleration more accurately, but also use the built-in digital motion processor (DMP) for hardware based attitude fusion calculation. So novices can use it very conveniently. For this reason, we also use MPU6050 gyroscope.
There are many demos of MPU6050 on Arduino UNO, the most famous is jrowberg's I2Cdev and MPU6050DMP library:
Unfortunately, this library cannot be run directly on BiBoard based on ESP32. We found the ported library on Github, which is easy to use. This library adds the definition of PGMSpace for the ARM and ESP series, adds the calibration function, and removes the FIFO overflow processing function (friends who are interested can use Beyond Compare for code comparison). The library contains I2Cdev and MPU6050, the address and compressed package are as follows:
After the download is complete, create a MPU6050 folder under Documents/Arduino/library, and copy the library files in the compressed package into it. The library of this modified MPU6050 is also compatible with ARM and AVR, so if you have the original I2Cdev and MPU6050 libraries in your computer, you can delete them.
We can use the official MPU6050_DMP6 demo.
NyBoard is equivalent to a generic Arduino Uno board with rich peripherals. Besides the native Arduino IDE, you can also program it using Mind+ blocks. But be aware that if you use this mode, the original OpenCat firmware will be over-written, and you will need to re-upload the firmware later to resume the default robot animal function.
Setting up the coding environment is as easy as the following steps.
Petoi Desktop App provides a neat graphical user interface to configure the firmware, calibrate the robot, and design customized motions for your robot. The major function modules are the , , and .
You can download the of the desktop App and unzip it.
Before running the app, you must use the included USB adapter or the Bluetooth dongle to connect to a Petoi robot. You may need to for USB connection.
Run the UI.exe in the unzipped folder. Do NOT move the UI.exe to another location in Windows.
After downloading the Mac version, you must drag it into the Application folder.
If you see the error message that "Petoi Desktop App" cannot be opened because the developer cannot be verified, you can right-click the icon, hold the Shift key and click Open.
Please see the next chapter to run the app from a terminal
In the case of compatibility issues, or if you want to modify the source and test, you can also run the code from the Terminal.
The Terminal is a built-in interface on Mac or Linux machines. The equivalent environment on Windows machines is called the Command-Line Tool (CMD). It's recommended that you install to manage your Python environment. It can also provide the Powershell as a Terminal for older Windows machines.
Depending on your existing Python configuration, you may need to upgrade to Python3 and install the following libraries:
pyserial
pillow
You can install them by entering pip3 install pyserial pillow
in the Terminal or use the package manager in Anaconda.
To run the code:
In the Terminal, use the cd
command to navigate to the OpenCat/pyUI/
folder. You can use the Tab key to auto-complete the path name.
After entering the pyUI/ folder, enter ls
and ensure you can see the UI.py and other python source codes listed.
Enter python3 UI.py
.
The source code is written with Tkinker in Python3 and is.
UI.py is the general entry for all the modules:
UI.py
-> FirmwareUploader.py
-> Calibrator.py
-> SkillComposer.py
-> translate.py provides multi-language support for the UI. You may help to translate the UI into your language.
There are two ways to establish a serial port connection:
Connect the USB adapter to the mainboard and select the correct serial port. Refer to the section in the USB Adapter(Uploader) Module for specific steps.
Please refer to the in the Dual-Mode Bluetooth Module for the specific steps.
On Mac, the Bluetooth may lose connection after several uploads. In that case, delete the connection and reconnect to resume the functionality.
The Bluetooth dongle is not included in the kit sold by Seeed Studio or its partners. Please write to [email protected] for more information.
Select the port in the (recommend version 1.8.19).
Open the serial monitor.
You can choose the "Serial Monitor" in the Tools menu bar or click the button to open the serial monitor window:
Config the parameter of the serial monitor.
In the serial monitor, set "No line ending" and the baud rate to 115200.
With the USB adapter / Bluetooth module connecting NyBoard and computer, you have the ultimate interface - Serial Monitor to communicate with NyBoard and change every byte on it(via sending the serial commands based on the ).
There are two ways to establish a serial port connection:
and computer using a USB type-C data cable(you should use the original one in the kit).
Connect the mainboard with a / via Bluetooth.
The setup steps in the Arduino IDE are identical to those .
📱🤖
Thanks for choosing Petoi's robot, Bittle or Nybble. This guide will help you set up your robot buddy and provide a simpler UI to calibrate the joints, control the robot, and program it. For advanced users, we recommend you keep the robot updated with the on Github for the best compatibility and the newest features.
The app works on both Android and iOS devices.
You can also download the Android APK and install it on your phone. You need to unzip it before installation.
If the Bluetooth dongle blinks while the connection panel within the App shows a blank Bluetooth connection list, first check if you have given the Bluetooth and location permission to the App. If it still shows a blank list, you may try to install the previous stable version.
The v8a version of the app mainly supports most of the current new mobile phone models
The v7a version of the app is compatible with older mobile phone models
You need to plug the into the 6-pin socket on the NyBoard. Pay attention to the Bluetooth dongle's pin order. Long-press the button on the battery to turn on the robot's power.
If the buzzer beeps repetitively after bootup or during use, the battery is low. Please charge it in time. The charging port is on one end of the battery.
The LED on the Bluetooth dongle should blink, waiting for a connection. Open the app and scan available Bluetooth devices. Don't connect the robot with the phone's system-wide Bluetooth settings! Connect the device with the name Bittle, Petoi, or OpenCat. Remember to open the Bluetooth service and grant the app access to the service. On some devices, you may also need to allow the location service for the app, though we are not using any of that information.
The app will send a greeting to the Bluetooth device and expects a response from the OpenCat firmware. You must install the full OpenCat code on your robot before connecting to the app. Otherwise, the app will consider it's "not a Petoi device". A pre-assembled robot should already have the firmware installed. Otherwise, you must configure it with Arduino IDE or the Desktop app.
If Bluetooth is connected, its LED will light steadily. The robot will play a three-tone melody. If the robot doesn't respond or malfunctions later, press the reset button on the NyBoard to restart the program on the NyBoard.
The App should automatically detect Nybble or Bittle with the latest OpenCat firmware. Otherwise, it will show the selections for Nybble or Bittle. The option "Select a robot" also can be re-visited in the control panel.
The usage of EEPROM is the same as Arduino UNO, there are two operations: read and write.
Read:
I2C address of EEPROM
The internal address of EEPROM (the address for storing data)
Read data
Write:
I2C address of EEPROM
The internal address of EEPROM (the address for storing data)
Write data
In the BiBoard demo, the address of EEPROM on the I2C bus is 0x54, and the capacity is 8192Bytes (64Kbit). We sequentially write a total of 16 values from 0 to 15 in the EEPROM from the first address, and then read them for comparison. Theoretically, the data written in EEPROM and the data read from the corresponding address should be the same.
In the NyBoard factory test, we also use this method, but it is more complicated. We will use a fixed list to fill the EEPROM and read it out for comparison.
Note: the EEPROM operations, especially write operations, are generally not put into the loop() loop. Although the EEPROM is resistant to erasing (100,000 times), if a certain block is frequently written in the loop, It will cause the EEPROM to malfunction.
After on the Chromebook, you can access the Linux environment via the terminal app.
Please follow the following steps to install the Arduino IDE:
Open the website () and download the corresponding type of Legacy Arduino IDE:
After downloading complete, set the folder Downloads in the file browser to share with Linux, as mentioned above. Use the following commands to install the Arduino IDE, e.g., arduino-1.8.19-linux64.tar.xz is the downloading file.
You can open the Arduino IDE as follows:
For more details, please refer to .
After using the USB uploader and USB data cable to connect the NyBoard and Chromebook, you will see a prompt: Please click Connect to Linux.
and check in the Settings interface, and it should be enabled as follows:
For more details, please refer to .
After using the USB data cable to connect the BiBoard and Chromebook, you will see a prompt: Please click Connect to Linux.
and check in the Settings interface, and it should be enabled as follows:
Use the following commands to install the library pyserial for uploading the sketch for BiBoard
We introduced the position feedback feature for servos manufactured after March 2024. This feature utilizes the same PWM signal wire to return the servo's actual position, opening up a new control interface for the robot.
This feature should be present on all servos with labels or laser marks after May 2024. If the labels are missing, they may still have it. However, the feature is only available on ESP32-based BiBoards (not NyBoards).
To check it, you need to upgrade your robot's firmware. Enter the serial command 'f' in or the . If the monitor keeps printing values that change when you move the servos, they are position feedback. The number of columns corresponds to the number of servos with feedback.
The servos have to be all feedback servos to perform the following features:
Serial Monitor: Send serial command "c16". The robot will enter its resting posture. Push the robot down flat onto the table, move its head straight forward, and send a space character(‘ ’) in the serial monitor. The robot will automatically set the calibration values of all its joints. Some joints can still be off and require standard calibration, but it saves most of the time.
Mobile app: Create called "Auto calibrate"(customizable) and use the code: c16
. The robot will enter its resting posture. Push the robot down flat onto the table, and and move its head straight forward.
Create called "Quit"(customizable) and use the code: "d
" to continue to the automatic calibration step. The robot will automatically set the calibration values of all its joints. Some joints can still be off and require standard calibration, but it saves most of the time.
Serial Monitor: Send the serial command "fF", then slowly drag one of the legs. The other legs will follow the motion. Send another serial command to quit.
Mobile app: Create called "following"(customizable) and use the code: fF
Create called "Quit"(customizable) and use the code: d
to quit this mode.
Serial Monitor: Send serial command 'fl', which means learning new movements. Move the legs to your intended starting position, then keep the robot steady for about 2 seconds. The robot will count down and then beep slightly to indicate that it has started recording. It won't record small movements, so you can pause in the middle. After 124 frames, if you enter any character in the serial monitor or stop moving it for over 2 seconds, it will stop recording. Send serial command 'fr', which means replay to recall the taught movement.
Mobile app: Create called "start learning"(customizable) and use the code: fl
which means learning new movements. Move the legs to your intended starting position, then keep the robot steady for about 2 seconds. The robot will count down and then beep slightly to indicate that it has started recording. It won't record small movements, so you can pause in the middle. After 124 frames, if you enter any character in the serial monitor or stop moving it for over 2 seconds, it will stop recording.
Create called "replay"(customizable) and use a space character as the code: fr
to which means replay to recall the taught movement.
The skill will also be printed on the (as pictured below), and you can import it into and the .
If you wish to write new applications based on the feedback servo, refer to the source codes in OpenCatEsp32/src/espServo.h.
Linux is a feature that lets you develop software using your Chromebook. Install Linux command line tools, code editors, and IDEs (integrated development environments) on your Chromebook. These can be used to write code, create apps, and more.
Important: If you use your Chromebook at work or school, you might be unable to use Linux. For more information, .
Linux is off by default. You can turn it on at any time from Settings.
On your Chromebook, at the bottom right, select the time.
Select Settings Advanced Developers.
Next to "Linux development environment," select Turn On.
Follow the on-screen instructions(default settings). Setup can take 10 minutes or more.
A terminal window opens. You have a Debian 11 (Bullseye) environment. You can run Linux commands, install more tools using the APT package manager, and customize your shell.
You can access your Linux environment through the terminal app in your Chromebook launcher.
Files created in Linux are stored in a container and are separate from Chrome OS files. You can access them using the "Linux files" app.
You can set the shared folders in the file browser and manage them in the Settings:
Once the setup is complete, a terminal window will open. You can use the following commands to update the package list and install basic development tools:
We have defined a set of serial communication protocols for robots:
All the tokens start with a single ASCII-encoded character to specify their parsing format. They are case-sensitive and usually in lowercase.
Try the following serial commands in :
“ksit”
“m0 30”
“m0 -30”
“kbalance”
“kwkF”
“ktrL”
“d”
The quotation mark indicates that they are character strings. Don’t type quotation marks in the serial monitor.
You can refer to the macro definitions in OpenCat.h to utilize the most updated sets of tokens.
Some more available commands for skills:
The complete set of skills in effect is defined in or : For example:
All the skill names in the list can be called by adding a 'k' to the front and deleting the suffix. For example, there's "sitI" in the list. You can send "ksit" to call the sitting posture. If a skill has "F" or "L" as the second last character, it's a gait. It means walking forward or left. Walking right is a mirror of walking left. So you can send "kwkF", "kwkL", "kwkR" to make the robot walk. Similarly, there are other gaits like trot ("tr"), crawl ("cr"), and stepping ("vt").
For products (, ), there are two ways to upload the firmware (Mind+ mode), which supports the Mind+ extension library:
If you just downloaded a new version of this Desktop App. You should click the Upgrade the Firmware button. You can select 'N' to preserve the calibration values.
If you have upgraded the firmware at least once after a new download, You can click the Update the Mode Only button. It's faster to only switch the modes without refreshing the parameters.
Please download the latest code from . Follow the steps for . and activate this line of code in OpenCat.ino
#define MAIN_SKETCH
#define GROVE_SERIAL_PASS_THROUGH
Then, upload and power on the robot. Use the data cable and to connect with the computer or and complete the pairing.
Note that the gyroscope function is turned off with the Mind+ mode on NyBoard to save memory space. The robot won't be able to self-balance and auto-recover.
If you don't use the "" function block, you can upload for Bittle / Nybble and use the Mind+ extension library. Note:
When the robot is in Mind+ mode, the gyroscope function is turned off, and the robot cannot balance or auto-recover.
Wired connection: The kit includes a connecting the robot's mainboard to the computer.
Wireless connection(Bluetooth): The kit includes a connecting the robot's mainboard to the computer.
How to use C++ to play with Nybble😼 or Bittle🐶
The project is built as a dynamic library so that the program can easily link to it. The recommended practice to use the library is to clone it as a git submodule:
If you are using cmake, simply create a CMakeLists.txt
file and link the library to your executable:
Below is a very simple example on how to use the library.
see for a more comprehensive example.
#include <Wire.h>
#define EEPROM_ADDRESS 0x54
#define EEPROM_CAPACITY 8192 // 64Kbit
#define EEPROM_TESTBYTES 16
// write 1 byte EEPROM by address
void writeEEPROM(int deviceaddress, unsigned int eeaddress, byte data )
{
Wire.beginTransmission(deviceaddress);
Wire.write((int)(eeaddress >> 8)); // MSB
Wire.write((int)(eeaddress & 0xFF)); // LSB
Wire.write(data);
Wire.endTransmission();
delay(5);
}
// read 1 byte EEPROM by address
byte readEEPROM(int deviceaddress, unsigned int eeaddress )
{
byte rdata = 0xFF;
Wire.beginTransmission(deviceaddress);
Wire.write((int)(eeaddress >> 8)); // MSB
Wire.write((int)(eeaddress & 0xFF)); // LSB
Wire.endTransmission();
Wire.requestFrom(deviceaddress,1);
if (Wire.available())
rdata = Wire.read();
return rdata;
}
void testI2CEEPROM(){
byte tmpData = 0;
Serial.println("EEPROM Testing...");
// write EEPROM from 0 to EEPROM_TESTBYTES
for(int i = 0; i < EEPROM_TESTBYTES; i++){
writeEEPROM(EEPROM_ADDRESS, i, i % 256);
delay(1);
}
Serial.println();
// read from 0 to EEPROM_TESTBYTES
for(int i = 0; i < EEPROM_TESTBYTES; i++){
tmpData = (int)readEEPROM(EEPROM_ADDRESS, i);
Serial.print(tmpData);
Serial.print("\t");
}
}
void setup(){
Serial.begin(115200);
Wire.begin();
testI2CEEPROM();
}
void loop(){
}
cd /mnt/chromeos/MyFiles/Downloads/
sudo apt-get install xz-utils
sudo tar -C /opt -xf arduino-1.8.19-linux64.tar.xz
cd /opt
ls
cd arduino-1.8.19/
ls
sudo ./install.sh
cd /mnt/chromeos/MyFiles/Downloads/
sudo apt-get install unzip
unzip OpenCat-main.zip
sudo apt install python3 pip
python3 -V
pip -V
cd /usr/lib/python3.11/
sudo rm EXTERNALLY-MANAGED
sudo pip3 install pyserial
pip list
cd /mnt/chromeos/MyFiles/Downloads/
sudo apt-get install unzip
unzip OpenCatEsp32-main.zip
sudo apt update
sudo apt upgrade
const char* skillNameWithType[]={"bdFI","bkI","bkLI","crFI","crLI","hlwI","mhFI","mhLI","pcFI","phFI","phLI","trFI","trLI","vtFI","vtLI","wkFI","wkLI","balanceI","buttUpI","calibI","droppedI","liftedI","restI","sitI","strI","zeroN","bfI","ckI","climbCeilI","fdI","ffI","hiI","jyI","pdI","peeI","puI","pu1I","rcI","rlLI","rtI","stpI","tsI",};
git submodule add https://github.com/PetoiCamp/opencat_serial_cpp opencat_serial
cmake_minimum_required(VERSION 3.0.2)
project(serial_examples)
option(CATKIN_ENABLE "Enable using the Catkin make extension to cmake (ie for ROS)" OFF)
add_subdirectory(opencat_serial)
add_executable(serial_examples path/to/cpp)
target_link_libraries(serial_examples opencat_serial)
#include "opencat_serial/opencat_serial.hpp"
int main(int argc, char *argv[])
{
// connect to the serial device
OpenCat::Robot rob("/path/to/port");
// create task
OpenCat::Task task;
// set command type to calibration pose
task.command = OpenCat::Command::CALIB_POSE;
// time delayed after execution
task.delay = 2;
// send command
rob.SendTask({OpenCat::Command::CALIB_POSE, 2});
return 0;
}
The pre-assembled robot should have the legs installed, but you can further improve its performance by fine-tuning the joints' calibration.
Make sure you have uploaded the OpenCat Main function firmware before calibrating.
This is a cool tutorial video made by one of our users, which briefs the process and explains its logic.
You don't know where the servos are pointing before they are powered and calibrated. So if you attach the legs, the legs will rotate to random angles and may collide with the robot's body or other legs and get stuck. If a servo is stuck for a long time, it may break.
The robot has a "calib" posture with all joints set at zero degrees. You can put the robot to the calib posture so that you know all the joints should be rotated to their zero points (though you cannot see because the legs are not attached to the servos yet). Then, you can attach the legs to the servos one joint by one joint, perpendicular to their nearby references on the body frame.
Because the servo's gear teeth are discrete, aligning the legs to the right angles perfectly is impossible. So, you will need to fine-tune the offsets within the software.
The principles are the same for Nybble and Bittle.
Entering calibration mode requires the following preparations:
1. All servo circuits are connected to the mainboard
2. The battery is plugged into the controller board and is turned on (long-press the button on the battery to turn on/off the power)
3. Connect the robot to a computer or mobile phone
Fon NyBoard, the USB adapter or Bluetooth dongle is used to connect the robot to a computer / mobile phone
For BiBoard, The USB data cable connection must be made directly to the BiBoard and NOT to the battery's outside charging port. You can also connect to the computer / mobile phone via Bluetooth.
The robot's legs may point to unknown angles when booting up. When entering the calibration state, the joints will be moved to their zero positions. You can see the output gears of the servos rotate and then stop. Then, you can attach the legs and fine-tune the joint offsets in the software interface. There are 3 software interfaces to enter the calibration state and fine-tune the joints.
Use the Mobile App Petoi
Use Arduino IDE
After completing the joint calibration, install the center screws to fix all the joint parts and servo gears.
Robots can be precisely calibrated using the Petoi Desktop App.
Please follow the instructions in the subpages to prepare according to the robot's mainboard.
After the robot is powered on by a battery, there are two methods to enter the calibration state:
It will enter the calibration state automatically when you click the Joint Calibrator button.
Click the Calibrate button in the calibrator interface. Take Bittle for example:
After typing ‘c’ in the serial monitor, with all servos rotated to their zero angles, attach the head, tail, and legs prepared in the previous section to the body. They are generally perpendicular to their linked body frames. The calibration pose is shown below:
Note: Insert the servo-related components directly into the servo output shaft; do not turn the output shaft during this process.
Rotating the limbs counter-clockwise from their zero states will be positive (same as in polar coordinates). Viewed from the left side of the robot's body, the counter-clockwise rotation of the joint is defined as the positive direction.
If we look closer at the servo shaft, we can see it has a certain number of teeth. That’s for attaching the servo arms and avoiding sliding in the rotational direction. In our servo sample, the gears divide 360 degrees into 25 sectors, each taking 14.4 degrees(offset of -7.2~7.2 degrees). That means we cannot always get a perfect perpendicular installation.
The joint calibration interface of different products is shown in the following subpages.
There are two kinds of kit: the construction kit and the pre-assembled kit.
For the construction kit, you must install the components (such as the head, legs, and tail) after the robot enters the calibration state. For more details, please follow the suppage instructions.
The pre-assembled kit already has the components adequately installed. You can do the joint calibration for fine-tuning.
The included L-shaped tool can be used as a reference during calibration. For more details, please follow the instructions on the subpages.
You can switch between "Rest", "Stand up" and "Walk" to test the calibration effect.
If you want to continue calibrating, please click the Calibration button, and the robot will be in the calibration state again (all servos will move to the calibration position immediately). take Bittle for example:
After calibration, remember to click the "Save" button to save the calibration offset. Otherwise, click the "Abort" button to abandon the calibration data. You can save the calibration in the middle in case your connection is interrupted.
After completing the joint calibration, install the center screws to fix the components and servo gears.
It's simple to control Nybble / Bittle via the remote controller.
The infrared receiver for Bittle X (mainboard type: BiBoard V0) is on the microcontroller near the neck of Bittle X.
The infrared receiver for Nyboard is near the tail of the Bittle robot dog.
Remote connection
The remote doesn't require pairing. Make sure its plastic insulation sheet is removed, and point the remote‘s transmitter to the receiver on the robot's back when operating. If the robot doesn't respond, you can use your phone‘s camera to check the transmitter. If it doesn't blink when clicking a button, you need to change its battery. If it blinks, it may indicate the program on the robot is not configured correctly.
Only the position of the buttons matters, though those symbols can help you remember the functionalities. It's better to define position-related symbols to refer to those keys, such as K00 for the 1st row and 1st column, and K32 for the 4th row and 3rd column.
Abbreviations for key definitions can reduce SRAM usage. Due to the limited keys of a physical remote, you can change the definitions for convenience.
The following map is just an illustration. Check the #define KXX command
in OpenCat/src/infrared.h for the actual key definitions in effect. They are also open to your customization.
We also made a customized remote panel for future batches. Previous users can download the design file and print it on A4 paper.
Rest puts the robot down and shuts down the servos. It's always safe to click it if Nybble is doing something awkward.
Balance is the neutral standing posture. You can push the robot from the sides and it will try to recover. You can test its balancing ability on a fluctuating board. Balancing is activated in most postures and gaits.
Pressing F/L/R will make the robot move forward/left/right
B will make the robot move backward
Calibrate puts the robot into calibration posture and turns off the gyro
Stepping lets the robot step at the original spot
Crawl/walk/trot are the gaits that can be switched and combined with the direction buttons
Buttons after trot are preset postures or other skills
Gyro will turn on/off the gyro for self-balancing. Turning off the gyro can accelerate and stabilize the slower gaits. But it’s NOT recommended for faster gaits such as trot. Self-righting will be disabled because the robot no longer knows it's flipped.
Different surfaces have different friction and will affect walking performance. The carpet will be too bushy for the robot's short legs. It can only crawl (command kcr) over this kind of tough terrain.
You can pull the battery pack down and slide along the longer direction of the belly. That will tune the center of mass, which is very important for walking performance.
When the robot is walking, you can let it climb up/down a small slope (<10 degrees)
Use the USB uploader for NyBoard.
For more details, please refer to the Connect NyBoard section in the USB uploader module for specific steps.
You can find the board version number on the NyBoard.
Notes:
Sometimes, if you cannot go through the bootup stage, such as repetitively printing "IMU" and restarting, you may have accidentally dialed the switch to the "RPi" side.
Before uploading the firmware, please ensure that no I2C device is connected to the I2C interface of the mainboard. Otherwise, the firmware upload will fail. The location of the I2C interface is as shown below (in the red box):
Factory Reset Our factory uses it to improve efficiency. However, it automatically resets all the parameters, including the calibration parameters of the servos and the IMU, so it's not recommended for regular users.
Upgrade the Firmware It will upgrade both the Parameters and the Main function firmware. It is mandatory if you just downloaded a new version of this desktop app.
Update the Mode Only If you have upgraded the firmware at least once after downloading a new version of this desktop app, you can switch between the modes without refreshing the parameters. It's faster by skipping the firmware upgrade stage.
After clicking the Upgrade the Firmware button, the uploading process starts immediately. The status bar at the bottom shows the current progress in real time and the results of key processes.
After the Parameters firmware has been successfully uploaded, the board runs the configuration program. Some message windows will pop up in sequence for you to confirm or cancel:
Reset joint offsets? (Y/N)
Select "Yes, " and the program will reset all servo calibration parameters to zero. The status bar will update the corresponding process and result in real time.
Select "No" to preserve the calibration value(so that you don't need to calibrate again if you have done so before).
Calibrate IMU? (Y/N)
Select "Yes, " and the program will calibrate the gyroscope (IMU) to balance the robot correctly. The status bar will update the corresponding process and result in real time.
Select "No," and the program will skip this step.
Note:
Ensure the mainboard is positioned horizontally before clicking the "Yes" button.
When uploading this firmware version for the first time, click the "Yes" button!
When all the steps are completed, a message window will appear showing "Parameter initialization complete!" You must confirm to proceed to the second round of uploading the Main functional firmware.
When the above window pops up, there's an optional step to calibrate the servo driver before clicking OK. If you later find one of the servos stops working but can resume working after re-powering it, it's probably due to an inaccurate PWM driver signal. Please redo the previous upload, and this step CANNOT be skipped.
This calibration makes the servo controller's (PCA9685 chip) angle signal more precise. A short jumper wire connects PWM pin 3 (the signal pin of one of the servo pins) and Grove pin A3, and the wire is steady. It doesn’t have to be a dedicated jumper wire. Any thin metal wire, such as a straightened paper clip, can work as long as it can connect the pins.
The program measures the pulse width of the signal and automatically calibrates the chip after successively getting three identical readings. It usually takes less than 2 seconds. The board will beep three times to indicate that the calibration is done. The calibration offset will be saved to the board for the next bootup. The process should be done at least once, and we have calibrated every board after October 2022. But you can still do it by yourself, just in case.
The tutorial of using the WiFi module as a MicroPython controller
USB Uploader (CH340C)
WiFi ESP8266
Insert the ESP8266 module into the module configuration interface of the USB uploader, and find the corresponding COM port in the Windows device manager.
Download the latest version of Thonny, an out-of-the-box Python editor that natively supports MicroPython.
Download address: https://thonny.org/
The compiled ESP8266 firmware is provided on the MicroPython official website, because our WiFi module is 4MB, please select the latest firmware with the name of ESP8266 with 2MiB+ flash, and download the bin file.
Firmware download address: https://micropython.org/download/esp8266/
There are two ways to upload the MicroPython firmware to the ESP8266 module:
Using the ESPtool download tool, you can more precisely control the partition and use of Flash.
Using Thonny's built-in tool.
For convenience, we use Thonny's built-in tool. The specific steps are as follows:
Open the Thonny, the main interface is as shown below. Thonny uses the Python interpreter in the installation directory by default.
Open Tools -> Options to enter the options page. In the first tab General, we can choose the language we need (needs to be restarted).
Open the second tab Interpreter, we replace the default Python3 interpreter with MicroPython (ESP8266) and select the corresponding port.
At this time, the ESP8266 module has not yet uploaded the MicroPython firmware. Click "Install or update firmware" in the lower right corner of the above picture to update the firmware using the built-in tool.
Select the port (COMx) where the ESP8266 module is located, and select the location where the downloaded MicroPython firmware (.bin file) is located. Check the flash mode: from image file (keep) (the speed will be slower, but it only needs to be burned once and it is not easy to make mistakes), and check the option Erase flash before installing. Press the Install button.
The progress will be displayed in the lower-left corner of the interface, erase the Flash first, and then write the firmware. When the word Done appears, it means that the programming has been completed.
The software preparation work is over, and the following display will appear after closing the download interface. The red text is garbled because ESP8266 will print a string of codes with a baud rate other than 115200 when it starts up. This code cannot be recognized by MicroPython Shell. When Python’s iconic symbol >>> appears, it means that the firmware is uploaded successfully.
ROS Interface
There's also a ROS wrapper for developpers to easily connect to the ROS environment. It is recommended to use ROS with Raspberry Pi.
Currently, it's recommended to install ROS using docker.
install docker on Raspberry Pi (ref)
sudo apt-get update && sudo apt-get upgrade
curl -fsSL https://get.docker.com -o get-docker.sh
sudo sh get-docker.sh
sudo usermod -aG docker pi
# test installation
docker run hello-world
prepare workspace
mkdir -p workspace/src
cd workspace/src
git clone https://github.com/PetoiCamp/ros_opencat
cd ros_opencat
git submodule init && git submodule update
cd ../../..
run the container
docker run -v path/to/workspace:/workspace \
-it --rm --privileged --network host --name ros ros:noetic-robot
source files and build inside the container
cd /workspace
source /opt/ros/noetic/setup.bash
catkin_makbase
source devel/setup.bash
run examples (see Examples for more)
rosrun opencat_examples opencat_examples_serial
Ros is designed with distributed computing in mind. Here's a simple example on how to run nodes on different machines.
on host machine (usually more powerful than Raspberry Pi)
# launch server
roscore
run service node on Raspberry Pi
export ROS_MASTER_URI=http://<Host_IP>:11311/
rosrun opencat_server opencat_service_node
send command from host
rosrun opencat_examples opencat_examples_client_cpp
using serial library
rosrun opencat_examples opencat_examples_serial
using ROS service
# start core
roscore
# start service server
rosrun opencat_server opencat_service_node
# examples using oppencat ros service in C++
rosrun opencat_examples opencat_examples_client_cpp
# examples using opencat ros service in python
rosrun opencat_examples opencat_examples_client_py
There are some great projects from the users who contributed:
The ESP32 used by BiBoard is different from the 328P used by UNO. Because the PWM of ESP32 uses the matrix bus, it can be used on unspecified pins.
The PWM of ESP32 is called LED controller (LEDC). The LED PWM controller is mainly used to control LEDs, and it can also generate PWM signals for the control of other devices. The controller has 8 timers, corresponding to 8 high-speed channels and 8 low-speed channels, totaling 16 channels.
Compared with UNO, directly use "analogWrite()" to input any duty ratio between 0-255. The PWM control of ESP32 on BiBoard is more troublesome. The parameters that need to be controlled are as follows:
Manual selection of PWM channels (0-15) also improves the flexibility of the use of pins
The number of bits of the PWM waveform determines the resolution of the duty cycle of the PWM waveform. The higher the number of bits, the higher the accuracy.
The frequency of the PWM waveform determines the speed of the PWM waveform, the higher the frequency, the faster the speed.
The frequency of the PWM waveform and the number of bits are relative, the higher the number of bits, the lower the frequency. The following example is quoted from the ESP32 programming manual:
For example, when the PWM frequency is 5 kHz, the maximum duty cycle resolution can be 13 bits. This means that the duty cycle can be any value between 0 and 100%, with a resolution of ~0.012% (2 ** 13 = 8192 discrete levels of LED brightness).
The LED PWM controller can be used to generate high-frequency signals, enough to clock other devices such as digital camera modules. Here the maximum frequency can be 40 MHz, and the duty cycle resolution is 1 bit. In other words, the duty cycle is fixed at 50% and cannot be adjusted.
The LED PWM controller API can report an error when the set frequency and duty cycle resolution exceed the hardware range of the LED PWM controller. For example, if you try to set the frequency to 20 MHz and the duty cycle resolution to 3 bits, an error will be reported on the serial port monitor.
As shown above, we need to configure the channel, frequency and number of bits, and select the output pin.
Step 1: Configure the PWM controller
Step 2: Configure the PWM output pins
Step 3: Output PWM waveform
In the demo, we choose IO2 as the output pin, connect IO2 to an LED, and you can observe the effect of the LED breathing light.
const int freq = 5000; // PWM frequency
const int ledcChannel = 0; // ledc channel, 0-15
const int resolution = 8; // resolution of PWM,8bit(0~255)
ledcSetup(ledcChannel, freq, resolution);
ledcAttachPin(ledPin, ledcChannel);
ledcWrite(ledcChannel, dutyCycle);
/* In this demo, we show how to use PWM in BiBoard(ESP32)
* It's different from the Arduino UNO based on the ATMega328P
*/
// define the PWM pin
const int ledPin = 2; // 16 corresponds to GPIO16
// setting PWM properties
const int freq = 5000; // PWM frequency
const int ledcChannel = 0; // ledc channel, in ESP32 there're 16 ledc(PWM) channels
const int resolution = 8; // resolution of PWM
void setup(){
// configure ledc functionalitites
// channels 0-15, resolution 1-16 bits, freq limits depend on resolution
// ledcSetup(uint8_t channel, uint32_t freq, uint8_t resolution_bits);
ledcSetup(ledcChannel, freq, resolution);
// attach the channel to the GPIO to be controlled
ledcAttachPin(ledPin, ledcChannel);
}
void loop(){
// increase the LED brightness
for(int dutyCycle = 0; dutyCycle <= 255; dutyCycle++){
// changing the LED brightness with PWM
ledcWrite(ledcChannel, dutyCycle);
delay(15);
}
// decrease the LED brightness
for(int dutyCycle = 255; dutyCycle >= 0; dutyCycle--){
// changing the LED brightness with PWM
ledcWrite(ledcChannel, dutyCycle);
delay(15);
}
}
Realize remote debugging and upload script
The previous tutorial realized the function of the robot to perform sequence actions by editing Python code offline. But this is very inconvenient. Whenever we need to modify the code, we need to unplug the WiFi module for modification, and we cannot flexibly pause and modify parameters during execution. The reason is that ESP8266 only has one serial port, and we need to use it to communicate with NyBoard. Fortunately, MicroPython uses the WiFi function provided by ESP to realize remote wireless Python debugging - WebREPL.
On the basis of official documents, combined with the characteristics of ESP8266, we wrote the following tutorials:
After connecting the device, enter import webrepl_setup
in the shell interface, and input according to the prompt information:
Enable it running on boot: E
Set password for it: your own password(e.g. 1234)
Repeat the password to confirm
Reboot the ESP8266: y
2. The script to setup webREPL
We use the demo script below, to replace the SSID and password with the network information your own around you.
import network
import time
import webrepl
def do_connect():
# WiFi SSID and Password
wifi_ssid = "YOUR SSID" # YOUR WiFi SSID
wifi_password = "YOUR PASSWORD" # YOUR WiFi PASSWORD
# Wireless config : Station mode
station = network.WLAN(network.STA_IF)
station.active(True)
# Continually try to connect to WiFi access point
while not station.isconnected():
# Try to connect to WiFi access point
print("Connecting...")
station.connect(wifi_ssid, wifi_password)
time.sleep(10)
# Display connection details
print("Connected!")
print("My IP Address:", station.ifconfig()[0])
if __name__ == "__main__":
do_connect()
webrepl.start()
After running the script, it will keep trying to connect to the WiFi network. Once connected, it will automatically start the WebREPL service of the device.
Connected!
My IP Address: 192.168.xxx.xxx
WebREPL daemon started on ws://192.168.xxx.xxx:8266
Started webrepl in normal mode
Remember this IP address (automatically assigned by router DHCP), useful when configuring WebREPL.
We are now debugging the Python script through WebREPL, and the previous serial port is used to communicate with NyBoard. So in the options, change the previous USB-COMx interface to WebREPL.
Then we fill in the IP address, port and password of WebREPL, and click OK.
When WebREPL Connected
is displayed, the connection is successful.
We can try some simple scripts, such as blink.py
.
WebREPL saves serial ports and supports wireless debugging. The disadvantage is that the speed is slow (because of network delay), and the waiting time for software reset is relatively long.
Now we can use webREPL to debug the script, but when we open the serial port monitor, we will find that whenever we run the script, the serial port will send out a series of debugging content: These massive strings will cause the NyBoard to be too late to process and crash. As shown below:
We hope that when debugging the program, the serial port only outputs the commands we want to output, not the Debug information. Open the boot.py
on the device, uncomment the line of code uos.dupterm(None, 1)
and save it , and unbind the serial port and REPL debug. Restart the module, and the serial port debugging assistant will no longer print the debug information.
As a supplement, we can output debug information through the print()
statement, which will be displayed in the Shell through WiFi.
So far, you can easily use the ESP8266 to debug robot through webREPL to edit action sequences based on MicroPython.
BiBoard Hat V1.0 is the extension board of BiBoard V0, which allows for convenient connection of the voice command and other Grove extensible modules.
The extension hat has an onboard voice command module and four grove sockets.
1x Serial2 port (GPIO16, 17).You must dial the slide switch to UART2 to free it for regular serial communication or GPIO. In that case, the Tx pin (GPIO 17) can be used to write.
1x I2C port (GPIO21, 22). It's already used by the main program to read sensors. If you use the BiBoard as a regular ESP32 board without Bittle's firmware, they can be configured as regular GPIO pins to read and write.
2x input-only pins (GPIO 34, 35, 36, 39).
1
A built-in module on the BiBoard
2
UART2/Voice command switch
Connect grove port to UART2 or the Voice command module
3
4 Gove sockets
4
Inter-board connectors
Connect the Grove ports to the top BiBoard
It's equivalent to the independent Grove voice module introduced in the extensible modules.
We adopted the Grove sockets for convenient plug-and-play connections. There are three types of sockets:
Grove Socket
Pin Number
Function
G1
I2C: SDA (GPIO21), SCL (GPIO22)
I2C with 3.3V logic signal
G2
TX (GPIO17), RX (GPIO16)
UART2 (Serial2 port) with 3.3V logic signal
G3
I34, I35
Analog input; 0-3.3V logic, 5V power
G4
I36, I39
Analog input; 0-3.3V logic, 5V power
UART2 shares the GPIO ports with the voice command module. When the switch is dialed to VOICE COMMAND, the Serial2 port can NOT be used. You can dial the slide switch to UART2 to free it for regular serial communication or GPIO.
The function of the switch is shown in the figure below:
Robot doesn't need a Pi to move.
You need to unplug the 6-pin USB adpter for the NyBoard before mounting the Pi to the board.
You can solder a 2x5 socket on NyBoard to plug in a Raspberry Pi. Pi 3A+ is the best fit for NyBoard's dimension.
After you solder on the socket, you won't be able to install the back cover of Bittle.
The red can be 3D printed.
As shown in the , the arguments of tokens supported by Arduino IDE's serial monitor are all encoded as Ascii char strings for human readability. While a master computer (e.g. RasPi) supports extra commands, mostly encoded as binary strings for efficient encoding. For example, when encoding angle 65 degrees:
Ascii: takes 2 bytes to store Ascii characters '6' and '5'
Binary: takes 1 byte to store value 65, corresponding to Ascii character 'A'
Obviously, binary encoding is much more efficient than the Ascii string. However, the message transferred will not be directly human-readable. In the OpenCat repository, I have put a simple Python script that can handle the serial communication between NyBoard and Pi.
In Pi's terminal, type sudo raspi-config
Under the Interface option, find Serial. Disabled the serial login shell and enable the serial interface to use the primary UART:
Run raspi-config with sudo privilege: sudo raspi-config
.
Find Interface Options -> Serial Port.
At the option Would you like a login shell to be accessible over serial?
select 'No'.
At the option Would you like the serial port hardware to be enabled?
select 'Yes'.
Exit raspi-config and reboot for changes to take effect.
You also need to DISABLE the to avoid repeating reset signals sent by Pi's GPIO 4.
If you plug Pi into NyBoard's 2x5 socket, their serial ports should be automatically connected at 3.3V. Otherwise, pay attention to the Rx and Tx pins on your own AI chip and its voltage rating. The Rx on your chip should connect to the Tx of NyBoard, and Tx should connect to Rx.
If you want to run it as a bash command, you need to make it executable:
chmod +x ardSerial.py
You may need to change the proper path of your Python binary on the first line:
#!/user/bin/python
NyBoard has only one serial port. You need to UNPLUG the USB adapter if you want to control Bittle with Pi's serial port.
Typing ./ardSerial.py <args>
is almost equivalent to typing <args> in Arduino's serial monitor. For example, ./ardSerial.py kcrF
means "perform skill crawl Forward".
Both ardSerial.py and the parsing section in OpenCat.ino need more implementations to support all the serial commands in the protocol.
For Nybble:
Reduced motion capability may happen when connected to Pi! A stronger battery is needed.
With the additional current drawn by Pi, Nybble will be less capable for intense movements, such as trot (the token isktr
). The system is currently powered by two 14500 batteries in series. You may come up with better powering solutions, such as using high drain 7.4 Lipo batteries, or 2S-18650. There are a bunch of considerations to collaborate software and hardware for balanced performance. With Nybble's tiny body, it's better to serve as a platform for initiating the communication framework and behavior tree rather than a racing beast.
KERNEL=="ttyS0", SYMLINK+="serial0" GROUP="tty" MODE="0660"
KERNEL=="ttyAMA0", SYMLINK+="serial1" GROUP="tty" MODE="0660"
sudo chgrp -h tty /dev/serial0
sudo chgrp -h tty /dev/serial1
sudo adduser $USER tty
sudo adduser $USER dialout
sudo chmod g+r /dev/ttyS0
sudo chmod g+r /dev/ttyAMA0
NyBoard V1 is an upgraded version considering the users' feedback on NyBoard V0. It's compatible with previous versions, yet has some new design to make it easier to use.
It still uses Atmel ATMega328P as the main chip but adopts 16MHz without accelerating it to 20MHz. Now the board is fully compatible with Arduino Uno, much easier for new users to Arduino.
It keeps driving 16 PWM channels with PCA9685. The pin order is altered, but you don't even need to read the indexes on the board, because the pin mapping is handled within the software.
Now the 6-axis motion sensor MPU6050 is designed on the PCB, rather than a stand-alone module soldered above the board. It supports a built-in DMP (Digital Motion Processor) to calculate the motion data, as well as providing raw data for your own fusion and filtering algorithms.
It continues to use an 8KB onboard I2C EEPROM to save constants for skills.
The power system is redesigned to provide a more stable supply. The structure for peripherals is also optimized.
From Jan 1st, 2021, We start to include an official Bluetooth dongle for wirelessly uploading and communication. The default baud rate for all the communication ports is set to be 115200.
The reset button is more accessible on the back of the board.
We added 4 Grove socket to plug-and-play Seeed Studio's extensible modules. We still provide standard 2.54mm through-holes besides the socket.
We added 7 WS2812 RGB LEDs on the board as another form of output and status indicator.
The socket for the battery is now anti-reverse.
The configuration of NyBoard V1_0 is shown as below:
NyBoard V1_0 uses Atmel ATMega328P-MUR as the main controller. We adopted its smaller version of QFN32 for better layout, and it's near-identical to regular TQFP32.
ATMega328P works at 16MHz with a 5V supply. It has 2KB SRAM, 32KB Flash, and 1KB on-chip EEPROM. With the same bootloader of Arduino Uno, you can upload sketches through the serial port.
The main chip runs at 5V, while the other peripherals run at a 3.3V logic level. We use PCA9306 to convert the I2C bus of ATMega328P to 3.3V. We also added an I2C switch on the bus. By dialing it to "Arduino" or "Raspberry Pi", you can change the I2C master of the onboard peripherals.
MPU6050 is widely used in many DIY projects to acquire the motion state of devices. It detects the 3 acceleration and 3 angular motion states. It also includes a DMP to calculate the state directly, without using the main controller's computational resources.
On NyBoard V1_0, its I2C address is 0x68. The interrupt pin is connected to the PD2 port of ATMega328P (or the D2 pin of Arduino Uno).
There are a lot of available MPU6050 libraries and we are using I2CDev/6050DMP. You can also use other versions:
PCA9685 fans out 16 PWM 12-bit channels with instructions from the I2C port. Its address is set to 0x40. There are 16 PWM indexes printed on the PCB, but you don't really need to read them because the pin-mapping is done in the software. The physical wiring pattern is the same as the previous boards. You do need to check the direction of the servo pins. Regular servos have 3 pins for PWM, power(2S), and ground (GND). The ground should connect to the black wire of the servo.
On NyBoard V1_0, the servos' power connects to the 2S Li-ion battery. We designed our servos to be compatible with 8.4V input. Regular servos usually run at 6V. You should not connect regular 9g servos like the SG90 to the board directly.
We use Adafruit PWM Servo Driver Library for PCA9685.
We save the motion skills with an 8KB onboard I2C EEPROM AT24C64. Its I2C address is 0x54. The lookup table of skills is saved in the 1KB on-chip EEPROM of ATMega328P. It uses <EEPROM.h>. You need to pay attention to their differences when developing new codes.
The buzzer is driven by PD5 (or the D5 of Arduino UNO). The current is amplified by 2N7002 MOS.
We use VS1838B as the Infrared receiver, connected to PD4 (or D4 on Arduino Uno). It's driven by the IRremote library of Arduino, the corresponding remote is encoded in NEC format. You may disable the other protocols in IRremote.h to save Flash (about 10%!)
The two LEDs in the Petoi logo indicates the powering state of the board. The left eye is blue for the logic chips. The right eye is yellow for the servos' power. When NyBoard is connected to the battery, both LEDs should lit up. When NyBoard is powered by the USB downloader, only the blue LED will lit up.
There's an anti-reverse socket for the battery. The battery's output is connected to ADC7 (or A7 of Arduino Uno) and is not threaded to an open pin. ADC7 collects the voltage over a voltage divider. The actual voltage is approximately 2x of the reading. A safe range of battery voltage is below 10V.
You should charge the battery in time when the battery is lower than 7.4V.
We added 7 WS2812 RGB LEDs (or the NeoPixel) on the NyBoard. The pin number is D10. They are powered by the 5V DC-DC power chip for Raspberry Pi and are independent of the 5V network of ATMega328P. So you need to plug in the battery to power the LEDs.
We adopted the Grove sockets for convenient plug-and-play connections. There are three types of socket:
The main chips are powered by a Low-dropout (LDO) linear regulators for noise removal and better stability. We use LM1117-5V and XC6206P-3.3V to power 5V and 3.3V chips. The 3.3V LDO is connected in serial after the 5V LDO for better efficiency.
There's a diode between the battery and LM1117-5V to prevent damage by the wrong connection. There's a self-recover fuse (6V 500mA) on the USB uploader to limit the current and protect the USB port.
The Raspberry Pi consumes much more power, so we choose TPS565201 DC-DC to provide a 5V 3A output. The peak output can be 5A and with high-temperature/current/voltage protection. It will cut off the power when the chip keeps outputting >4A and over 100 Celcius degrees until the temperature drops to normal. The WS2812 RGB LEDs are also powered by this DC-DC source.
The servos are powered by 2S Li-ion batteries directly. Pay attention not to short connect the power or any pins on the NyBoard.
Last updated: Jan 13, 2021
After uploading the MicroPython firmware on ESP8266, we can use it run MicroPython scripts.
We can execute the python scripts directly in the interpreter.
The NyBoard WiFi module ESP8266 uses the IO2 pin to connect with a red LED to indicate the connection status. This LED is programmable. Write a simple python blink script:
Press the green start button on the toolbar, and the script will be sent to the WiFi module through the serial port, and then run after being interpreted by the built-in MicroPython interpreter of ESP8266. Because the Blink script is an endless loop when it needs to stop, press the red stop button to end the program interruption and reset.
We can click View -> File to open the file toolbar, and the file is displayed on the left side of Thonny. The upper part is the directory of the local machine, and the lower part is the files stored in the MicroPython device. By default, there is only one boot.py file, please do not delete this file, it is the startup file of the MicroPython device.
We save the script as blink.py and save it on the machine, right-click on the file and select Upload to /
:
Select the MicroPython device
in the pop-up window:
There is a blink.py
file on the device. So the file is saved on the device.
ESP8266 can send commands to NyBoard through the serial port. We only need to write a simple serial port sending script to send a series of serial port commands to NyBoard, and then the robot can execute sequence actions.
When the actSeq() function is executed, It can output a series of commands through the serial port. Using the serial monitor we can debug. Use the serial port monitor to monitor the output as follows (for the convenience of reading, please use the automatic frame break of the serial port debugger, in fact, there is no automatic line break).
After we debug the sequence action, unplug the ESP8266 and plug it into the NyBoard, the robot dog does not respond because the actSeq()
function is not running. We want to run the scripts automatically after power on. There are two methods:
Please change the file name to "main.py
" and save to the device (Recommend)
Modify the Boot.py
Plug in the battery and long-press the battery button to power on the robot.
For BiBoard, please ensure the program enters the .
The USB data cable connection must be made directly to the BiBoard and NOT to the battery's outside charging port.
You can also connect to the computer via .
# Simple script:
print("Hello MicroPython")
from machine import Pin
import time
# GPIO LED IO2
def blink():
led = machine.Pin(2, machine.Pin.OUT) # Pin 2 ,Output mode
while(True): # loop
led.on() # light on LED
time.sleep(1) # delay 1s
led.off() # light off LED
time.sleep(1) # delay 1s
if __name__ == "__main__":
blink()
from machine import UART
import time
uart = UART(0, baudrate=115200,timeout=5)
# walk
def walk(time_ms):
print("walk")
uart.write("kwkF") # walk cmd
time.sleep_ms(time_ms) # keep time
uart.write("d") # stop
time.sleep_ms(1500)
# backward
def back(time_ms):
print("back")
uart.write("kbk")
time.sleep_ms(time_ms)
uart.write("d")
time.sleep_ms(1500)
# stop
def stop():
uart.write("d")
def initConnection():
connected = False
while True:
uart.write("d")
for t in range(30):
uos.dupterm(None, 1) # disable REPL on UART(0), detach the REPL from UART0
time.sleep_ms(5) #delay is a must
result = uart.read(1)
uos.dupterm(uart, 1) # enable REPL on UART(0), reattach REPL
if result != None:
# uart.write(result) # for debug
if result == b"d":
connected = True
break
time.sleep_ms(10)
if connected:
break
uart.write("b22 4 24 4 26 4")
def actSeq():
initConnection()
time.sleep_ms(2000)
walk(3000)
back(3000)
uart.write("m0 90")
time.sleep_ms(3000)
uart.write("i8 -20 9 -60")
time.sleep_ms(2000)
uart.write("b26 4 24 4 20 4")
time.sleep_ms(1000)
uart.write("d")
uos.dupterm(None, 1) # disable REPL on UART(0), detach the REPL from UART0
if __name__ == "__main__":
actSeq()
Name
Author
Feature
I2Cdev
jrowberg
built-in DMP
Adafruit MPU6050
Adafruit
standard MPU6050 library
Kalman Filter
TKJ Electronics
with Kalman filter
Grove Socket
Pin Number
Function
G1
I2C: SCL, SDA
I2C with 3.3V logic signal
G2
A2, A3
Analog input; 0-5V
G3
PD8, PD9
Digital I/O; 0-5V
G4
PD6, PD7
Digital I/O; 0-5V
This manual for Beginner. Makes it easier for you to get started with the robot(Nybble / Bittle ).
Petoi Desktop App works on both Nybble and Bittle controlled by NyBoard based on ATmega328P or Bittle X controlled by BiBoard based on ESP32.
You can connect the computer to the mainboard using a USB cable, following the instructions on the subsequent sub-pages, which are specific to the robot's mainboard model. To see the sub-pages as in the following picture:
After properly connecting the USB uploader, open the PetoiDesktopApp (for Windows: UI.exe / for Mac: Petoi Desktop App), and select your Model and Language.
If there is no serial port or more than one serial port are detected by the desktop app:
After clicking the Firmware Uploader button, there will be a message box prompt as follows:
Please follow the prompts in the message box. After clicking the Confirm button, If you complete the prompts within 10 seconds, the desktop app will automatically identify the serial port name connecting the robot to the computer. If you complete the operation of unplugging and plugging the USB interface on the computer for more than 10 seconds, the desktop application will enter the manual selection of the serial port name mode:
Click the OK button in the Warning message box first, then you can refresh the serial port list or select one of them (e.g. COM3) and click the OK button in the Manual mode window to open the Firmware Uploader interface as follows:
Once the Firmware Uploader interface is opened, you can also unplug and replug the USB cable from the COMPUTER side. The desktop app will automatically identify the serial port name connecting the robot to the computer.
If unplug the COM5 and replug it on the computer side, it will be discovered by the desktop app as follows:
The 1.0 software won't work properly with the Joint Calibrator, the Skill Composer, and other APIs. Only use it when you want to use CodeCraft (a graphical coding interface by our partner, TinkerGen).
Software version
1.0
2.0 (default)
The 1.0 version is obsolete.
Board version
NyBoard_V1_0 (default) NyBoard_V1_1 NyBoard_V1_2 BiBoard_V0_1
BiBoard_V0_2 BiBoard_V1_0
BiBoard_V0_1 or BiBoard_V0_2 is for Bittle X. BiBoard_V1_0 is for Bittle X V2 only.
Product
Bittle (default) Nybble Bittle X
Mode
Standard (default) RandomMind Voice Mind+ Camera Ultrasonic RandomMind_Ultrasonic Light Touch PIR Gesture IR distance
For NyBoard, these 12 modes can be selected. All of these modes apply to both Bittle and Nybble.
For BiBoard, You only need to upload the Standard mode firmware, and you can switch between different modes via serial port commands. [1]
Serial port
Auto detection or by manual selection.
You can find the correct one through unplug and replug the USB socket on the computer side
There's no correlation between the board (hardware) version and the code (software) version.
After the upload, the status bar will update the corresponding result, such as the success or failure of firmware uploading. If the uploading is successful, a message window of "Firmware upload complete!" will pop up simultaneously.
If the uploading fails, the following message box will pop up:
The log file is located at:
For Windows: The log file is in the same directory as UI.exe
For macOS: You can check the log file as follows:
When you contact our [email protected], please attach the log file to your email.
BiBoard is a robot dog controller based on ESP32 developed by Petoi LLC. Unlike NyBoard, which is for regular users and robot lovers, BiBoard mainly faces developers and geeks. High-performance processors, larger memory and storage (16 MB of Flash), and wireless connections. Audio function is also included.
The function partition for BiBoard is shown below:
Power 1
Battery Socket
Connects to Bittle's battery or provides external 8.4V power
Bittle battery or external 8.4V battery
2
Power LED
Indicates power status: Blue for 5V/3.3V, Orange for 8.4V servo power
3
Power
Provides 5V and 3.3V power
ICS
4
USB
Enables program download and soft reset of the controller
5
IMU
6-axis Inertial Measurement Unit (IMU) for motion sensing
6
EEPROM
External memory for storing data
7
DAC Amp
Amplifies audio signal for speaker output
8
IRDA receiver
Receives infrared signals
Extension
9
PWM Servo
Provides 12 pulse-width modulation (PWM) outputs for controlling servos
10
3 extensions
Offers additional connectivity options: 4 analog inputs, 2 serial ports, 1 I2C interface, and 5V DC-DC power (max 3A)
Buttons
11
Boot and Reset buttons
Press the reset button to restart the program
Block diagram for BiBoard is shown below:
There're 2 ways to power the BiBoard: USB 5V and battery socket 7.4V.
When using USB power, there’s no power output for DC-DC 5V extension and servo. So USB power mainly supplies ICs.
When using battery power at 7.4V (maximum: 8.4V). Both servos and 5V power will be supplied. You can use 5V powering the Raspberry Pi.
Open “Preferences” in Arduino, add ESP32 development board URL:
https://raw.githubusercontent.com/espressif/arduino-esp32/gh-pages/package_esp32_index.json
Save it and then exit.
Open “Boards Manager...” and wait for updates from external board support links. Search “esp32” and install the support package.
Please install the latest available version 2.0.12. Installing version 2.0.13 and above may cause the motherboard to fail to startup.
After showing “INSTALLED”, the BiBoard board support package is finished.
There’s no USB circuit in the ESP32, so we use the CP2102 USB bridge as officially recommended. The maximum download baud is 921600. The bridge is connected to serial 1 of the ESP32.
We use the USB Type-C port; 2 resistors, CC1 and CC2, are added as the identifier.
We tried the automatic download circuit designed by ESP and the NodeMCU, but none of them works perfectly. So we modified the circuit by adding the third transistor and enlarger the capacitor.
The transistors receive standard serial modem signals DTR and RTS and trigger a unique timing-sequence forcing ESP32 into download mode and then reboot. The detail of the automatic download circuit is shown below.
We use Invensense MPU6050, the most widely used IMU. Its I2C address is 0x68, and DMP’s interrupt is connected to IO26 of the ESP32.
With the help of Jrowberg’s MPU6050 DMP library, you can easily get the motion status of the Bittle. The Jrowberg’s MPU6050 library must be modified to adapt ESP32. The data types of “int8” and “PGMSpace” should be pre-defined instead of 8-bit AVR macros. We offer the modified library of MPU6050. You can replace the original library so that both AVR boards and ESP boards would be worked normally.
There is a 64Kbit EEPROM on the BiBoard. You can directly use the EEPROM read and write a program that is used on the Arduino UNO. You can use it to store calibration data.
There is also an example program named “EEPROM” in the ESP32 support package. This is not the demo code of the I2C EEPROM. That’s the demo of the simulated EEPROM by ESP32’s QSPI flash memory.
We use DAC output and a class-D amplifier instead of a PWM buzzer to make Bittle more vivid. You can use 3 ways to drive the audio module:
Use Arduino “Tone()” function.
Use ESP32 “dacWrite()” function like “analogWrite()” in Arduino. The data quality produced by the DAC is better than the PWM.
Use ESP MP3 decode library developed by XTronical, you can play MP3 files. You should configure a file system like SPIFFS or FAT in the flash before you use this MP3 decoder.
URL:https://www.xtronical.com/basics/audio/dacs-on-esp32/
The IR sensor on Nyboard and BiBoard are the same, so you can directly use the sketch from the Nyboard. The BiBoard’s flash is large enough so that you don’t have to disable macros in IRremote.h.
There’re 12 PWM servo sockets on the BiBoard, and the pin number is marked near the socket.
We transform the direction of the PWM servo socket by 90 degrees since the size of the ESP32 module. You should connect the wires first before you screw the BiBoard on the cage.
There’re 3 extension sockets on the BiBoard that marked with P15, P16 and P17.
This socket is used for analog input extension, you can try to connect foot press sensors to this socket.
This socket is used for bus extension of the ESP32.
You can use this interface to connect to the Raspberry Pi, but you cannot directly mount the Raspberry Pi above the BiBoard. Use wires or adapters instead.
Petoi Group Control Solution
ESP-NOW is another wireless communication protocol developed by Espressif that enables multiple devices to communicate without or using Wi-Fi. This protocol is similar to the low-power 2.4GHz wireless connection commonly found in wireless mice—the devices are paired before they can communicate. After pairing, the connection between the devices is continuous, peer-to-peer, and does not require a handshake protocol. It is a fast communication technology with short data transmission and no connection, which allows low-power controllers to directly control all smart devices without connecting to a router. It is suitable for scenarios such as smart lights, remote control, and sensor data return.
After using ESP-NOW communication, if a certain device suddenly loses power, as long as it restarts, it will automatically connect to the corresponding node to resume communication.
The communication modes supported by ESP-NOW are as follows:
one-to-one communication
one-to-many communication
many-to-one communication
many-to-many communication
ESP-NOW supports the following features:
Unicast packet encryption or unicast packet unencrypted communication;
Mixed use of encrypted paired devices and non-encrypted paired devices;
Can carry payload data up to 250 bytes;
Support setting sending callback function to notify the application layer of frame sending failure or success.
At the same time, ESP-NOW also has some limitations:
Broadcast packets are not supported temporarily;
There are restrictions on encrypted paired devices
In Station mode,a maximum of 10 encrypted paired devices are supported;
In SoftAP or SoftAP + Station mixed mode, a maximum of 6 encrypted paired devices are supported;
The number of non-encrypted paired devices is supported, and the total number of encrypted devices does not exceed 20;
Valid payloads are limited to 250 bytes.
Petoi group control can use the ESP-NOW communication function of the ESP8266.
In this case, two Bittles (equipped with ESP8266) and one computer connected with ESP8266 are prepared.
See below for program uploading and MAC address acquisition of the module in the figure.
Install Thonny on the computer to facilitate the debugging of MicroPython of the ESP8266 module. When using the ESP-NOW protocol, special MicroPython firmware is required (see ). Because the normal version of the 8266-MicroPython firmware will prompt that the library cannot be found.
Open Thonny and use the USB uploader to connect the ESP8266 module, enter in the shelll interface:
If there is an error prompt such as "cannot find espnow module", it means that there is a problem with the firmware uploading; if there is no prompt, it means that the firmware uploading is successful.
The group control code is divided into 3 parts:
Query the MAC address of the module
Transmitter program
receiver program
The MAC address is an address used to confirm the location of a network device, and is responsible for the second layer (data link layer) of the OSI network model. The MAC address is also called the physical address and the hardware address. It is burned into the non-volatile memory (such as EEPROM) of the network card when it is produced by the network equipment manufacturer.
The length of the MAC address is 48 bits (6 bytes), usually expressed as 12 hexadecimal numbers. The first 3 bytes represent the serial number of the network hardware manufacturer, which is assigned by IEEE (Institute of Electrical and Electronics Engineers), and the last 3 bytes represent the serial number of a certain network product (such as a network card) manufactured by the manufacturer. As long as you don't change your MAC address, the MAC address is unique in the world. Visually speaking, the MAC address is like the ID number on the ID card, which is unique.
The easiest way to use ESPNOW is to send it by MAC address. We use a small program to query the MAC address of the module.
After running in Thonny, print out the MAC address in the terminal. At this time, you can use a self-adhesive sticker to write the MAC address of the module and paste it on the module.
The transmitter program consists of the following parts:
Enable the WiFi function of the module
Configure the ESP-NOW protocol and enable it
Add a node (peer) that needs to communicate
Send a message
The specific code is as follows:
The receiver program is mainly composed of the following parts:
Enable the WiFi function of the module
Configure the ESP-NOW protocol and enable it
Add a node (peer) that needs to communicate
Receive and decode the message, and send commands to NyBoard through the serial port
The specific code is as follows:
This code is encapsulated in a function named espnow_rx()
for the convenience of automatically starting the program after power-on.
There are two ways to realize automatic startup after power-on:
Rename the code file to main.py
;
Modify the boot.py
;
For beginners, we recommend the first method.
Writing the serial command conversion at the receiving end will make the program too complicated and difficult to maintain. We can create a new function in which to perform instruction conversion and output commands.
After the robot is powered on by the battery, there are 2 methods to enter the calibration state.
Use Bittle for example:
Click the Start Calibration button.
Click the Calibration button in the calibration interface.
For the construction kit, you can install the body parts to the robot torso according to the instructions in the following sub-pages based on the products you choose.
When calibrating, Depending on the product you are using, select the corresponding calibration ruler in the sub-page as an aid. first select the index number of the joint servo from the diagram(when adjusting the leg servo, adjust the thigh first, and then adjust the calf), and then click the "+" or "-" button to fine-tune the joint to the right angle state.
You can click the skill buttons to switch between Rest, Stand, and Walk to test the calibration effect.
Use Bittle for example:
If you want to continue calibrating, please click the Calibration button, and the robot will be in the calibration state again (all servos will move to the calibration position immediately).
After calibration, remember to click the "Save" button to save the calibration offset. Otherwise, click "<" in the upper left corner to abandon the calibration.
For the construction kit, after completing the joint calibration, install the center screws to fix the leg parts and servo gears.
The joint calibrator interface for Bittle X+Arm, which uses BiBoard V0 in the Petoi Desktop App, is as follows:
import espnow
import ubinascii
import network
wlan_sta = network.WLAN(network.STA_IF)
wlan_sta.active(True)
wlan_mac = wlan_sta.config('mac')
print(ubinascii.hexlify(wlan_mac).decode())Pythonp
import network
import espnow
import time
sta = network.WLAN(network.STA_IF) # Enable station mode for ESP
sta.active(True)
sta.disconnect() # Disconnect from last connected WiFi SSID
e = espnow.ESPNow() # Enable ESP-NOW
e.active(True)
peer1 = b'\xe8\x68\xe7\x4e\xbb\x19' # MAC address of peer1's wifi interface
e.add_peer(peer1) # add peer1 (receiver1)
peer2 = b'\x60\x01\x94\x5a\x9c\xf0' # MAC address of peer2's wifi interface
e.add_peer(peer2) # add peer2 (receiver2)
print("Starting...") # Send to all peers
e.send(peer1, "walk", True) # send commands to pear 1
e.send(peer2, "walk", True) # send commands to pear 2
time.sleep_ms(2000)
e.send(peer1, "walk", True)
e.send(peer2, "back", True)
time.sleep_ms(2000)
import network
import espnow
from machine import UART
def espnow_rx():
#config UART
uart = UART(0, baudrate=115200)
# A WLAN interface must be active to send()/recv()
sta = network.WLAN(network.STA_IF)
sta.active(True)
sta.disconnect() # Disconnect from last connected WiFi SSID
e = espnow.ESPNow() # Enable ESP-NOW
e.active(True)
peer = b'\x5c\xcf\x7f\xf0\x06\xda' # MAC address of peer's wifi interface
e.add_peer(peer) # Sender's MAC registration
while True:
host, msg = e.recv()
if msg: # wait for message
if msg == b'walk': # decode message and translate
uart.write("kwkF") # to the NyBoard's command
elif msg == b'back':
uart.write('kbk')
elif msg == b'stop':
uart.write('d')
if __name__ == "__main__":
espnow_rx()
Please refer to the preparation section in the Joint Calibrator of the Petoi Desktop App according to the robot's mainboard.
You must plug the servos and external batteries into the mainboard and check the position and direction of all servos.
Send the serial command ‘c’ in the serial monitor to enter the calibration state. Depending on their initial shaft direction, some may travel larger angles until stopping at the middle point. There will be noise coming from the gear system of the servos. You will see a calibration table like the following:
The first row is the joint indexes; the second row is their calibration offsets:
Index
0
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
Offset
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
Initial values are “-1” or “0” and should be changed by later calibration.
After typing ‘c’ in the serial monitor, with all servos rotated to their zero angles, attach the head, tail, and legs prepared in the previous section to the body. They are generally perpendicular to their linked body frames. The calibration pose is shown below:
Note: Insert the servo-related components directly into the servo output shaft; do not turn the output shaft during this process.
Rotating the limbs counter-clockwise from their zero states will be positive (same as in polar coordinates). Viewed from the left side of the robot's body, the counter-clockwise rotation of the joint is defined as the positive direction.
If we look closer at the servo shaft, we can see it has a certain number of teeth. That’s for attaching the servo arms and avoiding sliding in the rotational direction. In our servo sample, the gears divide 360 degrees into 25 sectors, each taking 14.4 degrees(offset of -7.2~7.2 degrees). That means we cannot always get a perfect perpendicular installation.
In the calibration state, place the head as close to the central axis as possible and insert its servo shaft into the servo arm of the neck.
Press down on the head so it is firmly attached to the neck.
Install upper leg and lower leg components to the output teeth of the servos after the Bittle is powered on and in the calibrated neutral position. Please keep the torso, upper leg, and lower leg installed vertically as much as possible, and do not install the lower leg backward, as shown in the picture.
The command for fine-tuning calibration (refer to the serial protocol) is formatted as cIndex Offset
. Notice that there’s a space between cIndex and Offset. The index number of the robot's joints is shown in the pictures below:
For example :
c8 6
This means giving the 8th servo an offset of 6 degrees.
c0 -4
This means giving the 0th servo(the head) an offset of -4 degrees.
The resolution of the correction amount is 1 degree; do not use decimals.
Find the best offset that can bring the limb to the zero states. It's a process of trial and error.
After calibration, remember to type ‘s’ to save the offsets. Otherwise, they will be forgotten when exiting the calibration state. You can even save every time after you’re done with one servo.
When watching something, one's observations will change from different perspectives. When measuring length, one always wants to read directly above a referencing ruler.
You must keep a parallel perspective when calibrating Bittle. Use the 'L'-shaped joint tuner as a parallel reference to avoid reading errors. Align the tips on the tuner with the center of the screws in the shoulder and knee joints and the little hole on the tip of the foot. Look along the co-axis of the centers. For each leg, calibrate the shoulder servos (index 8~11) first, then the knee servos(index 12~15). When calibrating the knee, use the matching triangle windows on both the tuner and shank to ensure parallel alignment.
After calibration, type ‘d’ or ‘kup’ to validate the calibration. This will result in Bittle / Nybble symmetrically moving its limbs between the rest and stand states.
You may need to do a few rounds of calibrations to achieve optimal states.
Take Bittle, for example, as follows:
After completing the joint calibration, install the center screws to fix the leg parts and servo gears.
Try to understand how the robot keeps balance even during walking. If you add new components to the robot, distribute its weight symmetrically about the spine. You may also need to slide the battery holder back and forth to find the best balance spot. Because the battery is heavier in the front, you can insert it in a reversed direction to shift the center of mass more toward the back.
Please do not force the robot to add heavy objects, which may cause the servos to sweep or get stuck.
Bittle and Bittle X are from the same family and share a lot of common things, except for the microcontroller difference where Bittle X uses BiBoard and Bittle uses NyBoard. So we just refer to Bittle most of the time without specifically mentioning Bittle X.
The differences in specifications of different mainboards are shown in the figure below:
Please refer to the Buzzer beep meaning.
For NyBoard, please refer to .
For BiBoard, please refer to .
Try turning off the Gyro in the mobile app, as shown in the following picture:
Try turning on the Gyro in the mobile app, as shown in the following picture:
Make sure you calibrate the joints with the included L-shaped tuner and understand the references
Remove the rubber toe covers
Turning off the Gyro will make slow gaits more stable
There's a known bug in one of the older firmware. Please upgrade to the latest firmware.
The error that occurs when uploading the sketch is shown below:
There are two calibration steps for different components.
Because the controller board has limited resources, we divide the program into two stages.
In the first stage, we upload the program and large data to the onboard EEPROM (hard disk) and use the remaining programming space to calibrate the IMU, a sensor that measures the body orientation. The board should be leveled and untouched during the (IMU) calibration.
In the second stage, we upload the standard functional code. For the first-time configuration, we need to enter the (joint) calibration state and attach the legs in the right direction.
If you use the Arduino IDE to set up the board, you will handle those stages explicitly. The Petoi Desktop App can finish the two-stage uploading in the background. The mobile app can work only with an already configured board. Its (joint) calibration is only for attaching the legs.
Yes, you still need to use the desktop app/mobile app/Arduino IDE to fine-tune the joints if your robot doesn't walk very stable.
Our microcontrollers are specifically designed for our robots. The open source code is free to use and can be downloaded on GitHub.
You can use Python to control any Petoi robot. The scripts can work either on your computer and connect to the robot wired or wirelessly.
It follows your instructions via the infrared remote, mobile app, or desktop app. It can also do random behaviors if you enable the random mode. Best of all, the program is open source on GitHub, and you can refer to the relevant technical documents to create new skills for your robot.
This is due to the incompatibility of the Python Tk library with MacOS. The temporary solution is that you can press the button and drag the mouse slightly at the same time.
Download the Arduino IDE(e.g. 1.8.19) for Linux from https://github.com/arduino/Arduino/releases/download/1.8.19/arduino-1.8.19.tar.xz
Install it on the Chromebook. Please refer to the video at https://www.youtube.com/watch?v=2cve6n4LZqI
Plug the USB adapter with a USB data cable (for NyBoard) or USB type-C data cable (for BiBoard) into the robot's microcontroller and the Chromebook.
Set the Chromebook Linux VM to recognize the USB port
Settings => Advanced => Developers => Linux development environment => Manage USB devices => USB Serial (turn on)
If you have downloaded and unzipped the OpenCat folder but see the following error:
OpenCat:82:10: fatal error: src/OpenCat.h: No such file or directory
#include "src/OpenCat.h"
^~~~~~~~~~~~~~~
compilation terminated.
You should rename the unzipped OpenCat-main folder to OpenCat so that the OpenCat.ino matches the root name.
For more information, please refer to: https://docs.petoi.com/arduino-ide/upload-sketch-for-nyboard#setup-process
BTW, you also can upload the firmware via the Petoi Desktop App:
https://docs.petoi.com/upload-firmware https://docs.petoi.com/desktop-app/firmware-uploader
Try to set "Bluetooth devices discovery" to "Advanced" as follows:
In the Device Manager, if you open the Other devices list, you may see a CP210X device with a triangle exclamation sign. Right-click it to find the "update driver" option, then select the enclosing folder of your downloaded driver to install.
When connecting, the app will send handshake signals to the robot, and the robot should be running the firmware in standard mode to respond correctly. If the app returns a "not Petoi robot" error, it's probably due to a firmware issue. Please follow this debugging process:
[1]. Please check the version of the app as follows:
App Store
Google Play
[2]. For the startup melody in normal mode, please refer to the 00:13 in the video below:
For how to open the serial monitor and input the serial command, please refer to the instructions in the Petoi Doc Center.
[3]. You can upgrade the firmware via the Petoi Desktop App.
For NyBoard, if the firmware can not be upgraded, please refer to NyBoard can't upload firmware
Please check out the forum post discussing installing springs with various tools. Or you can request Bittle upper legs with pre-installed springs
The toe covers are for special experiments that require more friction. They are not required for regular walking and performance. We have removed them from the standard kit recently, and you may order them as optional accessories.
You may contact us. Show the picture of the broken pieces and explain how they broke. You may find the 3D-printable files or get a replacement directly from us.
Please refer to Bittle's instruction in Final Assembly.
The little bone is included in the Intelligent Camera Module box, and it is not being sold separately. You may download its 3D-printable file at: https://github.com/PetoiCamp/NonCodeFiles/blob/master/stl/Bittle_bone.stl
Both Bittle kit and pre-assembled Bittle include one Lithium battery with a built-in charging circuit. You may add more spare batteries.
You can solder the 2x5 socket on the NyBoard and then mount the Rasberry Pi on the NyBoard.
Read more at https://docs.petoi.com/api/raspberry-pi-serial-port-as-an-interface
In some cases, the motor's output gear may disengage with the following gear. It will result in an abnormal buzzing sound inside the servo. You can take off the bottom of the servo and push the motor inward very hard until you hear a clicking sound.
Please refer to the FAQ on the MU camera.
Turn off the battery's power to see if the serial port can appear. Please refer to Connect to BiBoard via USB type-C data cable.
You can use Petoi Coding blocks to do Scratch-like block-based programming with all of Petoi robots.
There's nothing else to purchase.
How to use python scripts to have fun with the robots
Install python (version≥ 3.6, such as Anaconda3-5.2.0-Windows-x86_64.exe)
Install pyserial library (version 3.5)
When using a USB adapter to connect to the NyBoard or USB type-C data cable to connect to the BiBoard, there should be only one serial port number:
When using the Bluetooth function, there can be two serial port numbers:
Download a fresh OpenCat repository from GitHub:
https://github.com/PetoiCamp/OpenCat
Please utilize GitHub’s version control feature. Otherwise, make sure you download the WHOLE OpenCat FOLDER every time.
Open a Terminal (such as Anaconda Prompt) and enter the path where the Python API is located (***/OpenCatPythonAPI). Then, run the two example scripts in the folder(petoiRobotExample.py and ardSerialExample.py). The script will automatically identify the serial port number at the beginning and complete the connection.
***\OpenCatPythonAPI>python3 ardSerialExample.py
ardSerialExample.py demonstrates how to call the functions defined in ardSerial.py(in the ***/OpenCatPythonAPI/PetoiRobot)
The list testSchedule in ardSerialExample.py is used to test various serial port commands. Run the following script code to see the execution effect of each serial port command in the list:
for task in testSchedule:
wrapper(task)
You can also refer to the content of the testSchedule list (in ***/serialMaster/demos/hlw.py), write a list of behaviors according to your actual needs, and realize your creativity. 🤩 It was used in a Halloween puppet show.
Note: When running the scripts under the path of /serialMaster/demos, you must first use the "cd demos" command to enter the path where the scripts are located (/serialMaster/demos) and then use the python3 command to run the script (e.g., "python3 hlw.py")
Explanation of the serial port commands in the list testSchedule:
'kup' indicates the command to control Bittle to stand normally
2 indicates the postponed time after finishing the command in seconds.
m indicates the command to control the rotation of the joint servo
0 indicates the index number of joint servo
-20 indicates the rotation angle (this value is expressed relative to the reference 0 value used after calibration). The unit is in degrees.
1.5 indicates the postponed time after finishing the command in seconds. It can be a float number.
['M', [0, 45, 0, -45, 0, 45, 0, -45], 2]
The meaning of this example is the same as the previous command.
d indicates the command to put the robot down and shut down the servos
2 indicates the postponed time after finishing the command in seconds
c indicates the command to enter calibration mode
2 indicates the postponed time after finishing the command in seconds. After these motion commands are completed, the next command will be executed after a 2-second delay.
c indicates the command to enter calibration mode
0 indicates the index number of joint servo
-9 indicates the rotation angle. The unit is in degrees.
2 indicates the postponed time after finishing the command in seconds
Using this format, you can enter the calibration mode to calibrate the angle of a specific joint servo. Note: If you want the correction value in this command to take effect, you need to enter the "s" command after executing this command.
The meaning of this example is that the joint servo with serial number 0 rotates -9 degrees. After these motion commands are completed, the next command will be executed after a 2-second delay.
m indicates the command to control the rotation of the joint servo
0 indicates the index number of joint servo
-20 indicates the rotation angle (this angle refers to the origin rather than the additive). The unit is in degrees.
1.5 indicates the postponed time after finishing the command in seconds. It can be a float number.
Using this format, multiple joint servo rotation commands can be issued in a list. These commands are executed sequentially, not simultaneously. The joint angles are treated as ASCII characters so humans can enter them directly.
This example means that the joint servo with index number 0 is first rotated to the 45-degree position, then to the -45-degree position, and so on. After these motion commands are completed, the following command will be executed after a 2-second delay.
Using this format, multiple joint servo rotation commands can be issued in a list and executed AT THE SAME TIME. The joint angles are treated as ASCII characters so humans can enter them directly.
The meaning of this example is that the joint servos with index numbers 8 and 9 are rotated to the -15 and -20 degree positions simultaneously. After these motion commands are completed, the following command will be executed after a 2-second delay.
M indicates the command to rotate multiple joint servos SEQUENTIALLY. The angles are encoded as BINARY numbers for efficiency.
8, 9, 10, 11, and 0 indicate the index numbers of joint servos
50, 50, 50, 50, 0 indicate the rotation angle (this angle refers to the origin rather than additive ). The unit is in degrees
3 indicates the postponed time after finishing the command in seconds
The meaning of this example is the same as the previous command.
'I' indicates the command to control all joint servos to rotate AT THE SAME TIME (currently, the command supports 16 degrees of freedom, that is, 16 servos). The angles are encoded as BINARY numbers for efficiency.
20,0,0,0,0,0,0,0,45,45,45,45,36,36,36,36 indicate the rotation angle of each joint servo corresponding to 0-15 (this angle refers to the origin, rather than additive). The unit is in degrees.
5 indicates the postponed time after finishing the command. The unit is in seconds.
b indicates the command to control the buzzer to beep
10 indicates the music tone
2 indicates the lengths of duration, corresponding to 1/duration second
2 indicates the postponed time after completing the tone. The unit is in seconds
b indicates the command to control the buzzer to beep
0, 14, 14, 21... indicate the music tones
1, 8, 8, 8 indicates the lengths of duration, corresponding to 1/duration second
The last '3' indicates the postponed time after playing the music melody. The unit is in seconds.
Using this format, multiple-tone commands can be issued at once, and a simple melody can be played.
The meaning of this example is to play a simple melody and delay 3 seconds after the music melody is played.
ck = [
-3, 0, 5, 1,
0, 1, 2,
45, 0, 0, 0, 0, 0, 0, 0, 45, 35, 38, 50, -30, -10, 0, -20, 6, 1, 0, 0,
-45, 0, 0, 0, 0, 0, 0, 0, 35, 45, 50, 38, -10, -30, -20, 0, 6, 1, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 30, 30, 30, 30, 30, 30, 30, 30, 5, 0, 0, 0,
]
'K' indicates the skill data to send to Bittle in real-time
The skill array is sent to the robot on the go and executed locally on the robot
You may insert the skills in the skill library or InstinctX.h in this format
For the description of other serial port commands, please refer to Serial Commands.
***\OpenCatPythonAPI>python3 petoiRobotExample.py
petoiRobotExample.py demonstrates how to call the functions defined in robot.py(in the ***/OpenCatPythonAPI/PetoiRobot)
Below are the supported function calls in the library (robot.py):
# use to print debug information
def printH(head, value)
# deactivate the Gyro
def deacGyro()
# get the current angle list of all joints
def getAngleList()
return angleList
# get the current angle value of a joint
def getCurAng(index)
# creat an absolut value list
def absValList(num1, num2)
# rotate angle from relative value to absolute value
# creat an offset value list
def relativeValList(index, symbol, angle)
# rotate the joints sequentially or simultaneously
def rotateJoints(token, var, delayTime)
# play tones
def play(token, var, delayTime)
# encode the character to bytes
def encode(in_str, encoding='utf-8')
def printSkillFileName()
# open the serial port
def openPort(port)
# auto connect serial ports
def autoConnect()
# send a short skill string
def sendSkillStr(skillStr, delayTime)
def loadSkill(fileName, delayTime):
# send a command string
def sendCmdStr(cmdStr, delayTime)
def sendLongCmd(token, var, delayTime)
# get the analog value of a pin
def readAnalogValue(pin)
# get the digital value of a pin
def readDigitalValue(pin)
# set the analog value of a pin
def writeAnalogValue(pin, val)
# set the digital value of a pin
def writeDigitalValue(pin, val)
# close the serial port
def closePort()
Here is a sample code in the petoiRobotExample.py:
#!/usr/bin/python3
# -*- coding: UTF-8 -*-
# MindPlus
# Python
from PetoiRobot import *
autoConnect()
# The list format is [joint index, angle, joint index, angle...]
sendSkillStr('ksit',3)
sendSkillStr('kup',3)
rotateJoints('M', absValList(0, 60), 1)
# The list format is [note, duration, note, duration...]
play('B', [14,4,14,4,21,4,21,4,23,4,23,4,21,2], 1)
closePort()
When the system recognizes that there are multiple serial port numbers, the script will automatically identify all serial port numbers that have been connected to the robot (you can send serial commands to multiple robots at the same time). When the script starts running, it will print out the following prompt information:
2024-11-15 15:14:51,357 PetoiRobot.ardSerial - INFO - ardSerial date: Jun. 20, 2024
Mind+ date: Oct 18, 2023
C:\Users\***\.config\Petoi already exists
C:\Users\***\.config\Petoi\SkillLibrary\Bittle already exists
C:\Users\***\.config\Petoi\SkillLibrary\Nybble already exists
C:\Users\***\.config\Petoi\SkillLibrary\BittleR already exists
*** Available serial ports: ***
COM3
Bittle X
B02_241105
2024-11-15 15:14:54,634 PetoiRobot.ardSerial - INFO - Connect to the serial port list:
2024-11-15 15:14:54,635 PetoiRobot.ardSerial - INFO - COM3
modelName: Bittle
*** The skill names you can call are as follows: ***
* skillFileName
******************************
2024-11-15 15:15:05,134 PetoiRobot.ardSerial - INFO - close the serial port.
Please help the robots find their sparks. Wish you have fun! 😍
OpenCat software works on both Nybble and Bittle, controlled by NyBoard based on ATmega328P. More detailed documentation can be found at the or .
The I2C switch changes the master of I2C devices (gyro/accelerometer, servo driver, external EEPROM). On default “Arduino”, NyBoard uses the onboard ATmega328P as the master chip; On “RPi”, NyBoard uses external chips connected through the I2C ports (SDA, SCL) as the master chip.
Notes:
Sometimes if you cannot go through the bootup stage, such as repetitively printing "IMU" and restarting, maybe you have accidentally dialed the switch to the "RPi" side.
Before uploading the firmware, please make sure not to connect any I2C device to the I2C interface of the mainboard, otherwise, the firmware upload will fail. The location of the I2C interface is as shown below (in the red box):
The setup process for Nybble is almost the same, except that you need to change the model definition to #define NYBBLE.
Make sure you read through the following detailed steps.
With NyBoard V1_*, you can simply choose Arduino Uno.
Only if the bootloader of NyBoard collapsed, which is very unlikely to happen
●
Every NyBoard has to go through functionality checks before shipping, so they should already have a compatible bootloader installed. However, in rare cases, the bootloader may collapse then you won't be able to upload sketches through Arduino IDE.
Well, it's not always the bootloader if you cannot upload your sketch:
Sometimes your USB board will detect a large current draw from a device and deactivate the whole USB service. You will need to restart your USB service, or even reboot your computers;
You need to install the driver for the FTDI USB 2.0 to the UART uploader;
You haven't selected the correct port;
Bad contacts;
Bad luck. Tomorrow is another day!
If you really decide to re-burn the bootloader:
please refer to the chapter
For specific steps, please refer to the in the USB uploader module.
For specific steps, please refer to the in the Dual-Mode Bluetooth Module.
On Mac, the Bluetooth may lose connection after several uploads. In that case, delete the connection and reconnect to resume the functionality.
The Bluetooth dongle is not included in the kit sold by Seeed Studio or its partners. Please write to [email protected] for more information.
Download a fresh OpenCat repository from GitHub: . It’s better if you utilize GitHub’s version control feature. Otherwise, make sure you download the WHOLE OpenCat 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 OpenCat-main folder after unzipping. Rename it to OpenCat before opening the OpenCat.ino, so that the two names match.
Arduino requires the .ino file to be put in a folder with the same name. You must rename the OpenCat-main folder as OpenCat (i.e. delete the -main suffix). Otherwise, Arduino will create another OpenCat folder and move OpenCat.ino into it. It will break the path dependency of related files.
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)
Open up the serial monitor and set up the baud rate. With NyBoard V1_*, choose the board as Arduino Uno and later set the baud rate to 115200 in both the code and the serial monitor.
Compile the code. There should be no error messages. Upload the sketch to your board and you should see Tx and Rx LEDs blink rapidly. Once they stop blinking, messages should appear on the serial monitor.
To configure the board, please follow these steps:
Open the file OpenCat.ino and select your robot and board version. For example:
Comment out #define MAIN_SKETCH
so that it will turn the code to the board configuration mode. Upload and follow the serial prompts to proceed.
Install if no USB port is found under Arduino -> Tools -> Port.
For specific steps, please refer to the in the USB uploader module.
Press the upload button.
You can find the button either under Tools, or at the top-right corner of the IDE.
Set the serial monitor as No line ending and 115200 baud rate.
The serial prompts:
Input ‘Y’ and hit enter if you want to reset all the joint offsets to 0.
The program will do the reset and then update the constants and instinctive skills in the static memory.
To pass this step, you must enter ‘Y’ or ‘n’. Otherwise, the following parameters, including the skill data, will not be updated on the board.
The serial prompts:
Input ‘Y’ and hit enter, if you have never calibrated the IMU or want to redo calibration.
Put the robot flat on the table and don't touch it. The robot will long beep six times to give you enough time. Then it will read hundreds of sensor data and save the offsets. It will beep when the calibration finishes.
When the serial monitor prints "Ready!", you can close the serial monitor to do the next step.
After the IMU calibration, there's an optional step to calibrate the servo driver.
If later you find one of the servos stops working but can resume working after re-powering it, it's probably due to an inaccurate PWM driver signal. You must redo the previous uploading, and this step CANNOT be skipped.
This calibration makes the servo controller (PCA9685 chip)'s angle signal more precise. Use a short jumper wire to connect the PWM pin 3 (the signal pin of one of the servo pins) and Grove pin A3 and hold the wire steady. It doesn’t have to be a dedicated jumper wire. Any thin metal wire, such as a straightened paper clip, can work as long as it can connect the pins.
The program will measure the pulse width of the signal and automatically calibrate the chip after getting three identical readings successively. It usually takes less than 2 seconds. The board will beep three times to indicate the calibration is done. The calibration offset will be saved to the board for the next time of bootup. The process should be done at least once, and we have calibrated every board after October 2022. But you can still do it by yourself, just in case.
Uncomment #define MAIN_SKETCH
to make it active. This time the code becomes the normal program for the major functionalities. Then upload the code.
Open the serial monitor. When the serial monitor prints "Ready!", the robot is ready to take your next instructions.
The default code runs the standard mode. If you have some extensible modules, you may uncomment the macro 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.
In certain cases, you may want to modify the "joint - pin" mapping of the robot. You can modify it in OpenCat/src/OpenCat.h. Make sure you are modifying the code block corresponding to the board version at the beginning of OpenCat.ino. After the modification, remember to save the changes and redo the uploading process from step 2.
Congratulations! Now, you have finished the standard setup steps. You may read the source codes if you want to dive deeper into the program. The skills are saved in multiple places on a NyBoard due to ATmega328P's limited resources. The following diagram may give you some hints to help you understand.
#define BITTLE //Petoi 9 DOF robot dog: 1x on head + 8x on leg
//#define NYBBLE //Petoi 11 DOF robot cat: 2x on head + 1x on tail + 8x on leg
//#define NyBoard_V0_1
//#define NyBoard_V0_2
#define NyBoard_V1_0
//#define NyBoard_V1_1
// #define MAIN_SKETCH
Reset joint offsets? (Y/n):
Calibrate the IMU? (Y/n):
Optional: Connect PWM 3 -> Grove pin A3 to calibrate PCA9685
#define MAIN_SKETCH
NyBoard V1_1 is a V1 refreshed version mainly focused on the shortage of the ATMEGA328P-MU in our supply chain.
Replace the ATMEGA328P-MU(QFN32)with the ATMEGA328P-AU(TQFP32)
Removed 7 WS2812 LEDs to optimize the area.
A green LED is connected to the D10 port with PWM functions.
There's no changes of sockets and pin definitions from V1_0, the bootloader and the OpenCat sketchs is fully compatible.
NyBoard V1 is an upgraded version considering the users' feedback on NyBoard V0. It's compatible with previous versions, yet has some new design to make it easier to use.
It still uses Atmel ATMega328P as the main chip but adopts 16MHz without accelerating it to 20MHz. Now the board is fully compatible with Arduino Uno, much easier for new users to Arduino.
It keeps driving 16 PWM channels with PCA9685. The pin order is altered, but you don't even need to read the indexes on the board, because the pin mapping is handled within the software.
Now the 6-axis motion sensor MPU6050 is designed on the PCB, rather than a stand-alone module soldered above the board. It supports a built-in DMP (Digital Motion Processor) to calculate the motion data, as well as providing raw data for your own fusion and filtering algorithms.
It continues to use an 8KB onboard I2C EEPROM to save constants for skills.
The power system is redesigned to provide a more stable supply. The structure for peripherals is also optimized.
From Jan 1st, 2021, We start to include an official Bluetooth dongle for wirelessly uploading and communication. The default baud rate for all the communication ports is set to be 115200.
The reset button is more accessible on the back of the board.
We added 4 Grove socket to plug-and-play Seeed Studio's extensible modules. We still provide standard 2.54mm through-holes besides the socket.
The socket for the battery is now anti-reverse.
The configuration of NyBoard V1_0 is shown as below:
NyBoard V1_0 uses Atmel ATMega328P-AU, the same MCU of the Arduino Nano (UNO Compatible).
The ATMega328P works at 16MHz with a 5V supply. It has 2KB SRAM, 32KB Flash, and 1KB on-chip EEPROM. With the same bootloader of Arduino Uno, you can upload sketches through the serial port.
The WS2812 serial RGB LEDs are replaced by a single green LED. You can easily use it with standard Arduino GPIO control commands.
The main chip runs at 5V, while the other peripherals run at a 3.3V logic level. We use PCA9306 to convert the I2C bus of ATMega328P to 3.3V. We also added an I2C switch on the bus. By dialing it to "Arduino" or "Raspberry Pi", you can change the I2C master of the onboard peripherals.
MPU6050 is widely used in many DIY projects to acquire the motion state of devices. It detects the 3 acceleration and 3 angular motion states. It also includes a DMP to calculate the state directly, without using the main controller's computational resources.
On NyBoard V1_0, its I2C address is 0x68. The interrupt pin is connected to the PD2 port of ATMega328P (or the D2 pin of Arduino Uno).
There are a lot of available MPU6050 libraries and we are using I2CDev/6050DMP. You can also use other versions:
PCA9685 fans out 16 PWM 12-bit channels with instructions from the I2C port. Its address is set to 0x40. There are 16 PWM indexes printed on the PCB, but you don't really need to read them because the pin-mapping is done in the software. The physical wiring pattern is the same as the previous boards. You do need to check the direction of the servo pins. Regular servos have 3 pins for PWM, power(2S), and ground (GND). The ground should connect to the black wire of the servo.
On NyBoard V1_0, the servos' power connects to the 2S Li-ion battery. We designed our servos to be compatible with 8.4V input. Regular servos usually run at 6V. You should not connect regular 9g servos like the SG90 to the board directly.
We use Adafruit PWM Servo Driver Library for PCA9685.
We save the motion skills with an 8KB onboard I2C EEPROM AT24C64. Its I2C address is 0x54. The lookup table of skills is saved in the 1KB on-chip EEPROM of ATMega328P. It uses <EEPROM.h>. You need to pay attention to their differences when developing new codes.
The buzzer is driven by PD5 (or the D5 of Arduino UNO). The current is amplified by 2N7002 MOS.
We use VS1838B as the Infrared receiver, connected to PD4 (or D4 on Arduino Uno). It's driven by the IRremote library of Arduino, the corresponding remote is encoded in NEC format. You may disable the other protocols in IRremote.h to save Flash (about 10%!)
The two LEDs in the Petoi logo indicates the powering state of the board. The left eye is blue for the logic chips. The right eye is yellow for the servos' power. When NyBoard is connected to the battery, both LEDs should lit up. When NyBoard is powered by the USB downloader, only the blue LED will lit up.
There's an anti-reverse socket for the battery. The battery's output is connected to ADC7 (or A7 of Arduino Uno) and is not threaded to an open pin. ADC7 collects the voltage over a voltage divider. The actual voltage is approximately 2x of the reading. A safe range of battery voltage is below 10V.
You should charge the battery in time when the battery is lower than 7.4V.
We adopted the Grove sockets for convenient plug-and-play connections. There are three types of socket:
The main chips are powered by a Low-dropout (LDO) linear regulator for noise removal and better stability. We use LM1117-5V and XC6206P-3.3V to power 5V and 3.3V chips. The 3.3V LDO is connected in serial after the 5V LDO for better efficiency.
There's a diode between the battery and LM1117-5V to prevent damage by the wrong connection. There's a self-recover fuse (6V 500mA) on the USB uploader to limit the current and protect the USB port.
The Raspberry Pi consumes much more power, so we choose TPS565201 DC-DC to provide a 5V 3A output. The peak output can be 5A and with high-temperature/current/voltage protection. It will cut off the power when the chip keeps outputting >4A and over 100 Celcius degrees until the temperature drops to normal.
The servos are powered by 2S Li-ion batteries directly. Pay attention not to short connect the power or any pins on the NyBoard.
Name
Author
Feature
I2Cdev
jrowberg
built-in DMP
Adafruit MPU6050
Adafruit
standard MPU6050 library
Kalman Filter
TKJ Electronics
with Kalman filter
Grove Socket
Pin Number
Function
G1
I2C: SCL, SDA
I2C with 3.3V logic signal
G2
A2, A3
Analog input; 0-5V
G3
PD8, PD9
Digital I/O; 0-5V
G4
PD6, PD7
Digital I/O; 0-5V
How to use the extension library specially developed for the Petoi robot in Mind+
Download the latest version from the Mind+ official website
Windows: >= V1.7.0
Mac: version: >= V1.7.3 RC2.0
If you cannot download the software from Mind+'s official website, you can download a stable version from the Google Drive folder. However, we strongly recommend that you download and use the official latest version.
After the installation is complete, you can open Mind+
We provide a series of video tutorials on using Petoi Coding Blocks with the free Scratch-like robotics coding curriculum. Be sure to click next to go through all the videos.
Please follow the instructions in the subpages to prepare according to the robot's mainboard.
Paste the GitHub URL(https://github.com/PetoiCamp/Petoi_MindPlusLib) in the text box of the import interface:
Petoi Coding Blocks is a user-extended library of Mind+.
If you open Mind+ by double-clicking the icon, it will not automatically load this extension library, and you need to re-import it manually every time you open the app.
If you open Mind+ by double-clicking the code file(suffix mp or sb3) that uses this extension library or load these code files after opening Mind+, Mind+ will automatically load this extension library.
This extension library can control the robot without compiling and uploading the code to the robot's main board. Click the "Run" button directly to run the program on the Python level and send instructions to the robot's serial port. If you need to stop the program while running, you can click the "Stop" button anytime. The process of the program can be divided into three steps:
Open the serial port
Control the robot
Close the serial port
There are two ways to open the serial port:
Automatically identify and open the serial port
Enter the name of the serial port to open the serial port
When the gyroscope function is turned on, the robot can balance its body in real-time. It may be seen that when the robot is doing preset actions (especially when performing more violent actions), the body will shake back and forth, and even the body will tip over. The robot will automatically perform recovery actions, which may disrupt your preset steps.
If the uploaded sketch is Mind+ mode sketch(#define GROVE_SERIAL_PASS_THROUGH
this line is activated), the gyroscope function will be turned off, and the robot will not be able to balance or auto-recover, so there is no need to add this block.
Use this block to let the robot perform skills pre-built on the robot's main board. Skills from "sit" to "zero" are postures (containing only one action frame). Skills from "boxing" to "sniff" are behaviors (containing multiple posture frames and are performed only once). Skills from "stepping" to "trotRight" are gaits (containing multiple posture frames, and are repeated in periodical loops until stopped).
After finishing the current block's task, the program will wait a short time (delay xx seconds) before moving to the next block.
Use this block to let the robot perform the last skill exported from the Skill Composer.
Use this block to let the robot perform the skill in the skill files, which are in the following directory:
Windows: C:\Users\{your user name}\.config\Petoi\SkillLibrary\{model}
MacOS : /Users/{your user name}/.config/Petoi/SkillLibrary/{model}
Linux: /home/{your user name}/.config/Petoi/SkillLibrary/{model}
The folder name {model} is Bittle or Nybble. When exporting a skill file from the Skill Composer, it will automatically save the skill file to this directory.
Use this block to control one joint or multiple joints to rotate in sequence. There are several ways to use the blocks for reference:
Controls individual joint rotations to an absolute angle value.
Controls individual joint rotations to a relative angle value.
Control multiple joints to rotate sequentially to absolute angle values or relative angle values.
Use the joint angle list to control multiple joints to rotate to absolute angle values in a sequence.
Using this block can control multiple joints to rotate at the same time. There are several ways to use the blocks for reference:
Control multiple joints to rotate to absolute angle values or relative angle values at the same time
Use the joint angle list to control the simultaneous rotation of multiple joints to absolute angle values.
Use this block to get the current angle value of the selected joint. It is recommended to assign it to a variable first and then use the variable and algorithm to control other joints to rotate.
Demo code:
Use this block to control all joints to rotate at the same time. Please use it with the "Action frame" block. As shown below:
Use this block to control the robot to play music. There are several ways to use blocks together for reference:
A list made up of multiple "Tone + Duration" blocks
Using a tone duration list
Use this block to send a serial command to the robot, which can provide you with more and more flexible control methods. For example, you can input "kkcL" (kick the left front leg), and "khiR" (raise the right front leg to say hello). For more serial port commands, please refer to the serial protocol.
Use this block to write an analog value to a specified pin. Analog value range: 0~255
Use this block to read an analog value from a specified pin.
Use this block to write a high/low-level value to the specified pin. High-level: 1; Low-level: 0.
Use this block to read the high/low-level value of the specified pin.
Use this block to read the distance value from the ultrasonic sensor.
For the Petoi RGB Ultrasonic Sensor (or RUS-04), you can set the two pins ( Trigger and Echo) like this:
NyBoard (connects to the D6 and D7 pins)
BiBoard (connects to the Rx and Tx pins)
Use this block to Read the coordinates of the identified target from the camera module(MU camera / Petoi AI Vision module) which connect to the BiBoard.
You can download this test code (testCamera.mp) and run in the Mind+.
Use this block to Read the gesture value from the gesture sensor which connect to the BiBoard.
the gesture value meaning is as following:
0: Up;
1: Down;
2: Left;
3: Right;
You can download this test code (testGesture.mp) and run in the Mind+.
Generally, at the end of the program, it is recommended to use this block to close the serial port communication.
We provide some demos to download for reference in the GitHub repository (Petoi_MindPlusLib/examples).
Skill Composer is a skill development tool specially developed by Petoi for robots (Bittle, Nybble). Good tools are the prerequisite to the success of a job.
The robot must be powered by the battery and running the OpenCat 2.0 firmware to be recognized by the Petoi Desktop App. Before opening the software, please plug in the battery, and long-press the button on the battery to power on the robot.
To connect the robot's mainboard to the computer, please follow the instructions in the subpages according to the kind of mainboard you have.
Open the Petoi Desktop App (for Windows: UI.exe / for Mac: Petoi Desktop App), click the "Skill Composer" button, and open the skill composer interface.
The interface for different kind of product, please refer to the subpages.
Model
Nybble
Bittle
Bittle X+Arm
Nybble cat and Bittle dog have different back leg joint directions. Their skill data are not interchangeable. Select the correct model before operating the Skill Composer. Otherwise, some joints may conflict with the robot's body.
Language
Currently, there are English, 中文, and Italian. You may contribute to the translation script.
Utility
We will keep adding small gadgets to the utility tab. We have an eye color picker for the Nybble cat's ultrasonic sensor with built-in LEDs. We also have an entry where you can add your creator credential to the skills you create.
Connect the robot to your computer through either the USB uploader or system Bluetooth settings, then open up this desktop app. It should automatically detect and connect to the robot. The robot's serial port will appear in the following drop-down menu. The button should turn from "Listening" to "Connected". If the robot fails to connect for the first time, you can click the "Listening" button to disconnect all the ports, then press the "Connect" button again.
The robot's joints will hold position when the force is on. You should NOT rotate them by hand. Turning it off can allow you to rotate the robot's joints freely. It's helpful to quickly pose the robot to plan its center of mass for balancing.
The robot has a gyroscope to detect its body angle and movements. It's used for balancing and roll-recovering. Turning it off can avoid unexpected reactions when rotating the robot.
In certain experimental modes (e.g. RandomMind mode), the robot will move randomly. This button can toggle the behavior on/off.
Like the serial monitor, you can enter a serial command in the text box and send it to the robot by pressing the Enter key or clicking the Send button.
A few preset static postures move the robot's joints to specific positions. You can use them as a starting point to build your motion sequence. We usually start with the "balance" posture, with the robot standing on all four legs.
You can switch between different postures and observe how the sliders in the Joint Controller area update to reflect the changes in joint angles.
The angle sliders can show the robot's current joint angles. They can reversely rotate the robot's joints if you change their values. You can drag the slider bar for large angle adjustments or click above or below the slider bar for fine adjustments (by 1 degree). Some joints will have smaller accessible ranges than the sliders. Try to use angles between -125 and 125 degrees. Sending larger angles will increase the response time.
The sliders correspond to the robot joints if you look down at the robot's body with its head pointing forward. Joints closer to the body are closer to the center of the panel. The robot's joints can be mapped to your own body and become your avatar.
You can control multiple joints by clicking the dial "+" or "-" on each slider. All sliders with their "+" pressed will change by the same increments. Sliders with their "-" button pressed will change by the negative increments. The button can be toggled on and off. Click the "Unbind All" button to disengage all the joints at once.
You can also control the robot's whole body joints with the sliders in the center panel. You can tune these central sliders to adjust the robot's global orientation and translation. The neutral "balance" posture can generate better results than other tilted postures.
Pitch
Adjust the pitch angle
Roll
Adjust the roll angle
Spinal
Move in the spinal direction
Height
Raise or lower the robot's body
The previous functions can modify a single posture. The Skill Editor is a stop-motion animation scheduler. You can add, delete, and insert frames of poses and make the robot perform continuous and smooth motions.
Every frame has a row of buttons and input fields as parameters. The first static row contains the column header to indicate the parameters' names.
You can click the "=" button (the 2nd item of a frame) to activate the corresponding frame and move the robot to the frame's posture. The frame will hold all your new edits on the robot's current posture. The "=" symbol will become bold, and the button will become larger. The "=" symbol will become a red "!" mark if the current frame is edited. You can click this button to save your edits. Otherwise, the current edits will be abandoned if you click the "=" buttons of the other frames.
You can click the "v" button (the 9th item of a frame) to add a frame after the current frame and activate it. The new frame will be identical to the previous activated frame.
You don't always add a new frame after the last frame. You can click the "v" button (the 9th item of a frame) of any intermediate frames to insert a new frame below the "v" button. The new frame carries information identical to the previously activated frame.
You can mirror the activated frame's posture by clicking the ">|<" button.
You can click the "<" button (the 8th item of a frame) to delete the current frame holding the button. All the following frames will shift up. If the activated frame is deleted, its preceding frame will be activated. If the activated frame is the first frame and is deleted, its following frame will be activated.
You may lose track of what each frame holds with multiple edits to the frame list. Switching to individual frames can be time-consuming. We provide a "Note" field (the 7th item of a frame) where you can add short keywords to identify the frames. By default, a random animal name will be added to a frame when created.
If a joint's angle is the same in the current frame and the next frame, editing and saving its angle will also update the angles in the following frames until the angle differs. For example, if joint 8's angles are 4,4,4,4,6,7 in all the frames, changing the angle in the second frame to 8 will update the sequence to 4,8,8,8,6,7.
Besides manually clicking the "=" button (the 2nd item of a frame) to view the single posture, you can click the "Play" button to show the postures in order starting from the activated frame. During playing time, the button's text becomes "Stop" to allow you to stop in the middle.
After clicking the "Export" button, you can choose a location and filename to save the skill (from the activated frame. If the activated frame is the last action frame, all action frames in the action frame list are exported) as a text file. You can cancel the savings to skip. The desktop app will still send the skill to the robot for real-time performance. And you can call the last exported skill by the serial token "T." There are two ways:
Open the serial monitor and input the serial command "T."
Open the mobile app, use the Create Command function, and enter the serial port command "T" in the Code text box.
Export the skill as a customized button in the mobile app. It can be permanent even if you create multiple skills.
You will see a pop-up window after clicking the "Import" button. It allows you to copy-paste a skill data array in the text editor or import an existing skill file you or other users created. You can find example skill data in OpenCat/src/InstinctBittle.h or InstinctNybble.h. A complete skill format should include the "{ }" pair and the numbers between them. Only the first one will be imported if there are multiple skill arrays. The importer will do some simple format checks.
You can use the "Restart" button to clear the Skill Editor panel and start over.
If you need some consecutive action frames in the action frame list to run multiple times in a loop, you can first enter the number of loops in the Repeat text box above the action frame list (on the left side of the label "Set"), and then use the left mouse button to select them in turn, The index numbers (the 1st item of a frame) of the first and last two frames of the continuous action frame that want to achieve cyclic motion (the index number button will appear in a recessed state after selection), as shown in the following figure:
In the action frame list, you can set the running speed of each frame of action (the 3rd item of a frame). There are the following 9 options for you to choose from (speed up the running speed in the order of numerical value):
1,2,4,8,12,16,32,48,max
In the action frame list, the "Delay" option (the 6th item of a frame) in each action frame indicates how long the robot delays before doing the next frame of action after the action of this frame is completed.
There are 17 presets for you to choose from: 0,50,100,200,300,400,500,600,700,800,900,1000,2000,3000,4000,5000,6000.
Of course, you can also enter any integer value in the range of 0~6000 in the "Delay" option box. The unit is milliseconds (ms).
The "Trigger" option (the 4th item of a frame) in the action frame is used to set the body rotation direction when the robot triggers the next action frame. There are the following 5 setting options:
None means that there is no trigger and the angle condition is set
Pitch means the robot body rotates nose-down
-Pitch means the robot body rotates nose-up
Roll means that the robot body rolls to its left side (counter-clockwise when looking from the tail)
-Roll means the robot body rolls to its right side (clockwise when looking from the tail)
The "Angle" option (the 5th item of a frame) is defined with reference to the angle of the polar coordinate system. As shown in the figure above, when the body is horizontal, the angle of the polar coordinate axis is 0 degrees. If the polar coordinate axis rotates counterclockwise, the angle is positive and gradually increases. The angle setting range is an integer value between -125~125.
When a specific trigger and angle are set in the action frame, the next frame of action will be triggered only when the robot rotates over the trigger angle in the trigger's direction. If a delay time is also set in this action frame, it will delay an additional time after the trigger condition is met before moving to the next frame.
When creating actions related to the rotation of the robot body (such as backflips, doing high bar exercises, etc.), it's vital to trigger the motion at a certain body angle whose timing can be hard to estimate, and it may also change during the motion. We can use the gyroscope to monitor the rotation angle of the robot body in real-time, so that the robot can trigger the joint servo at the exact time of the trigger event.
When exporting the action frames, if you want to mirror all the action frames in the action frame list (the robot's left and right side joints will be exchanged, as if seen in a mirror), you can first click the "MirrorAll" button, and then click the "Export" button. If you want to cancel the mirrored export, you can deselect the "MirrorAll" button.
Before exporting action frames, select the "Behavior/Gait" options in the "Skill Editor" area as "Behavior". After clicking the "Export" button, the program will run on the robot and automatically interpolate between these action frames to make the robot move smoothly. All action frames will execute for only one round.
If the "Gait" option is selected before you click the "Export" button, the robot will continue to execute in a loop, and each action frame will run at the fastest speed; NO interpolation between action frames will be added. The motion can be quite brutal. Therefore, it is recommended that beginners always use the "Behavior" option to develop new skills.
When importing some pre-built skill array, the desktop app will automatically select the "Behavior/Gait" option according to the data format. The frames will be loaded into the frame editor, and the robot will automatically move to the first frame's posture.
The desktop app supports the connection of multiple robots through their own serial ports (such as the Bluetooth communication module) to achieve simultaneous control of multiple robots. After a physical connection, the app can only recognize a serial port as a robot. So after the robot is powered on normally:
USB
First, connect the USB uploader to the main board of the robot, and then use the data cable to connect it to the computer's USB interface.
Bluetooth
First, plug the Bluetooth module into the main board of the robot (no need for the ESP32-based board) and pair the board with the computer's Bluetooth setting interface. The desktop app will keep detecting if there is a new serial port connection. When multiple serial ports are successfully connected, the serial port option button in the "State Dials" area will change to "All." Click the drop-down list to view all serial ports that have been successfully connected. All robots will be synchronized in real-time in this way. You can also select any one of the serial ports to control the corresponding robot.
If you unplug a USB serial port on the computer (or disconnect the Bluetooth module in the Bluetooth setting interface), the corresponding serial port will be removed from the drop-down list in real-time.
If you unplug all USB serial ports (disconnect all Bluetooth modules), the serial port option button displays "None," and the left button displays "Listening." The desktop app still automatically detects whether there is a serial port connection. When a robot is reconnected to the computer through the serial port, the button on the left side of the drop-down menu will display "Connected." The corresponding serial port name is displayed in the serial port option button.
If you want the desktop app to stop detecting serial connections, click the "Connected" / "Listening" button. The text in the button will change to "Connect," and all serial connections will be disconnected. Click the "Connect" button again to restart the real-time detection function.
You can modify the source code of the Skill Composer in OpenCat/pyUI/SkillComposer.py.
This function requires the servos after March 2024, the BiBoard, and the latest firmware.
We have added the position feedback feature to recent batches of Petoi servos. The servo can reply to a specific PWM pulse (3500µs) with its current position in the form of pulse length. The central controller (BiBoard) can convert the signal to angles for more interaction.
First, send the robot a serial command "xl" to start the learning process. In the demo, it's triggered by our customized voice command. The robot's servo driver will switch to reading mode. Joint jigs can occur during this transition. Organize the robot's legs and then hold it still. The learning starts when no significant movements are detected.
Pull the legs, and the movement will be recorded. Stopping in the middle is okay because identical postures will be skipped. The recording will stop if the maximal frame is reached or the robot's joints are not moved for 2 seconds.
The recorded command can be called by "xp" to replay. The skill data is also printed to the screen so you can save it and import it into the Skill Composer or other OpenCat interfaces.
The control logic is defined in OpenCatEsp32/src/reaction.h and motion.h.
In the control panel, you can control the robot to perform various postures, behaviors, and gaits.
The left panel sets both the robot's gaits and directions and send combined command, such as "walk left" and "trot forward". The robot will only move if an initial gait and direction are selected. The "step" has no direction, and "backward" has left and right directions. The pause button "||" will pause the robot's motion and turn off the servos, so that you can rotate the joints to any angle. The "Turbo" button ( ) turns on/off the gyro, a sensor to detect the robot's body orientation. Turning it on will make the robot keep adjusting to body angles, and will know when it's upside down. Turning it off will reduce calculation and make it walk faster and more stable.
The built-in postures and behaviors can be triggered by pressing the buttons. Don't press the button too frequently and repeatedly. Allow some time for the robot to finish its current tasks.
Press and hold the button and drag to change the button position.
Double-tap the command button to edit it.
You can also create a customized single command/group command by pressing the "+" button.
After pressing the Create Command button, you can see the following interface:
After entering the editing state, there's a serial console to test the command and configure the robot.
You can try the following useful serial commands in the Code text box:
m0 45
m0 -70 0 70
ksit
m 0 -70 0 70 8 -30
i 0 -45 8 -30 12 -60
Below are the indexes of the joints for your reference. Observe the patterns of the ordering and try to remember them.
j
u0 1
u2 20
b
b1
b12 20
b14 4 14 4 21 4 21 4
Please see this list of common commands that may be added as customized commands. You can enter the "Voice command" column values as the "Name" values and the "Customized command code for Petoi mobile app" column values as the "Code" values.
A more detailed command table can be found in the Serial Protocol.
You can send the skill file to your phone using Messenger or email and open the file on the phone using the Petoi App. A button will be created for the new skill; you can see it when you open the control panel.
The SkillLibrary folder in Github contains new skills for the OpenCat robot, which can be used for your reference. You can use your mobile browser to access the GitHub page of the OpenCat project, open the skill file (such as Bittle_Fold.md), select the "Code" tab, and share it with Petoi Mobile App(make sure the mobile app is connected to your Petoi robot first), as shown in the figures below. Then you can execute this skill by pressing the newly created command button.
On the iOS device, you may not share the .md skill file on the Github via the Chrome browser. You can download the skill file and refer to the method - Import your local customized skill to import it to this smartphone app.
The group command feature lets you chain multiple commands together and play them in sequence.
After pressing the Create Group Command button, you can see the following interface:
You can name the command group in the Name text box and add the command to the Command Group list by clicking the command button in the Command Library selection box. In the Command Group list, you can press and hold the command button and drag to change the command position.
Click the Test or Play () button to test the function of the command group. click the Pause () button to interrupt the command list execution flow.
Click the Delete button to Delete the group command.
If your robot doesn't have any random behavior, you may need to upgrade your robot to the latest firmware.
We keep improving the app and will inform you of the updates when available. Please write to [email protected] if you have any questions about the app.
//token list
#define T_ABORT 'a' //abort the calibration values
#define T_BEEP 'b' //b note1 duration1 note2 duration2 ... e.g. b12 8 14 8 16 8 17 8 19 4 \
//a single 'b' will toggle the melody on/off
#define T_CALIBRATE 'c' //send the robot to calibration posture for attaching legs and fine-tuning the joint offsets. \
//c jointIndex1 offset1 jointIndex2 offset2 ... e.g. c0 7 1 -4 2 3 8 5
#define T_REST 'd'
#define T_GYRO_FINENESS 'g' //adjust the finess of gyroscope adjustment to accelerate motion
#define T_GYRO_BALANCE 'G' //toggle on/off the gyro adjustment
#define T_INDEXED_SIMULTANEOUS_ASC 'i' //i jointIndex1 jointAngle1 jointIndex2 jointAngle2 ... e.g. i0 70 8 -20 9 -20 \
//a single 'i' will free the head joints if it were previously manually controlled.
#define T_JOINTS 'j' //A single "j" returns all angles. "j Index" prints the joint's angle. e.g. "j 8" or "j11".
#define T_SKILL 'k'
#define T_SKILL_DATA 'K'
#define T_INDEXED_SEQUENTIAL_ASC 'm' //m jointIndex1 jointAngle1 jointIndex2 jointAngle2 ... e.g. m0 70 0 -70 8 -20 9 -20
// #define T_MELODY 'o'
#define T_PAUSE 'p'
// #define T_SLOPE 'l'
#define T_SAVE 's' //save the calibration values
// #define T_TILT 't'
// #define T_MEOW 'u'
#define T_PRINT_GYRO 'v' //print the Gyro data once
#define T_VERBOSELY_PRINT_GYRO 'V' //toggle verbosely print Gyro data
// #define T_XLEG 'x'
// #define T_ACCELERATE '.'
// #define T_DECELERATE ','
#define T_RANDOM_MIND 'z' //toggle random behaviors in the RANDOM_MIND mode
#define T_QUERY '?'
#ifdef GROVE_SERIAL_PASS_THROUGH
#define T_READ 'R' //read pin R
#define T_WRITE 'W' //write pin W
#define TYPE_ANALOG 'a' // Ra(analog read) Wa(analog write)
#define TYPE_DIGITAL 'd' // Rd(digital read) Wd(digital write)
#endif
#define T_COLOR 'C' //change the eye colors of the RGB ultrasonic sensor
#define T_INDEXED_SIMULTANEOUS_BIN 'I' //I jointIndex1 jointAngle1 jointIndex2 jointAngle2 ... e.g. I0 70 8 -20 9 -20
#define T_INDEXED_SEQUENTIAL_BIN 'M' //M jointIndex1 jointAngle1 jointIndex2 jointAngle2 ... e.g. M0 70 0 -70 8 -20 9 -20
#define BINARY_COMMAND //disable the binary commands to save space for the simple random demo
#ifdef BINARY_COMMAND
#define T_BEEP_BIN 'B' //B note1 duration1 note2 duration2 ... e.g. B12 8 14 8 16 8 17 8 19 4
#define T_LISTED_BIN 'L' //a list of the DOFx joint angles: angle0 angle1 angle2 ... angle15
// #define T_SERVO_MICROSECOND 'w' //PWM width modulation
#define T_TEMP 'T' //call the last 'K' skill data received from the serial port
#endif
#define EXTENSION 'X'
#define EXTENSION_VOICE 'A'
#define EXTENSION_ULTRASONIC 'U'
This chapter is for Advanced users with programming experience.
For the specific parameters of each functional module of BiBoard, please refer to:
Please refer to Chapter 3.2.1 of the BiBoard Quick Start Guide.
Append a line of code at the end of the file:
#define CONFIG_DISABLE_HAL_LOCKS 1
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.
The BiBoard V0 uses an ESP32 with a 16M 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.
The BiBoard V1 uses an ESP32 with a 4M flash.
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".
Suppose 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 the Add hardware partition configuration option in Arduino IDE.
Download the OpenCatEsp32 repository from GitHub repository: https://github.com/PetoiCamp/OpenCatEsp32 We suggest 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. Please 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 test***.ino codes in the ModuleTests folder. You can upload them separately to test specific modules (I recommend using testBuzzer.ino as your first test sketch).
Install the libraries:
Download and install the MU Vision Sensor library into the Arduino IDE.
b. Install ArduinoJson in the Library Manager:
Set the serial port in the Arduino IDE:
Modify the device type macro definition in OpenCatEsp32.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 OpenCatEsp32.ino according to the mainboard (BiBoard) version.
// #define BiBoard_V0_1 //ESP32 Board with 12 channels of built-in PWM for joints
#define BiBoard_V0_2
// #define BiBoard_V1_0
if the robot(Bittle X+Arm) with the robotic arm, you should also activate the macro definition as follows:
#define ROBOT_ARM // for attaching head clip arm
Otherwise, please comment out this line code.
After the modification is completed, you can click the Upload button (as below) to upload the sketch OpenCatEsp32.ino, and the changes in the code file will be automatically saved.
If the version date of the currently uploaded sketch is newer than the version date of the mainboard firmware, it will automatically enter the initialization startup mode after the sketch upload is completed.
Please open the serial monitor and set the configuration parameters of the serial port monitor to 115200 baud rate and No line ending.
You can check the version date of the currently uploaded sketch in the source code file (OpenCatEsp32/src/OpenCat.h):
#define DATE "250218" // YYMMDD
You can send the serial command "?" in the serial monitor to check the version date of the mainboard firmware:
When the mainboard is powered on, open the serial monitor and you will see the startup information:
ets Jun 8 2016 00:22:57
rst:0xc (SW_CPU_RESET),boot:0x1b (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:1
load:0x3fff0030,len:1344
load:0x40078000,len:13964
load:0x40080400,len:3600
entry 0x400805f0
k
Flush the serial buffer...
* Start *
Bittle X
Software version: B02_250121
Scanning I2C network...
- I2C device found at address 0x54: EEPROM
- I2C device found at address 0x5C: Misc.
- I2C device found at address 0x68: MPU6050
- I2C device found at address 0x69: ICM42670
- I2C device found at address 0x7E: Misc.
- done
GroveVisionQ 0
MuQ 0
Set up the new board...
Unmute and set volume to 5/10
Using constants from I2C EEPROM
- Name the new robot as: Bittle45
Next you will see the following prompt questions:
Reset the joints' calibration offsets? (Y/n):
Send 'Y' to the question, which means resetting all servo corrections to zero.
Send "n" to skip this step.
- Calibrate the Inertial Measurement Unit (IMU)? (Y/n):
Send 'Y' to the question, which means calibrating the IMU, i.e. the gyro/accelerometer sensor.
Send "n" to skip this step.
Halts at the connection stage. To restart it, you can close and reopen the serial monitor or press the reset button on BiBoard. Put the BiBoard FLAT on the table, and don't touch it during calibration.
Sometimes, the program halts at the connection stage. To restart it, you can close and reopen the serial monitor or press the reset button on BiBoard.
The program starts calibration after playing the melody 6 times.
Run factory quality assurance program? (Y/n)
Input 'n' and press Enter to continue. Or you can do nothing, it will Auto skip in 5 seconds.
The details of serial port printing information are as follows:
* Start *
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: BittleED
Reset the joints' calibration offsets? (Y/n):
Y
Buzzer volume: 5/10
- Calibrate the Inertial Measurement Unit (IMU)? (Y/n):
Y
Put the robot FLAT on the table and don't touch it during calibration.
Initializing MPU6050...
OK
If the program stucks, reinstall Arduino ESP32 boards version 2.0.12. Newer version may cause bugs!
- Testing MPU connections...attempt 0
- MPU6050 connection successful
- Initializing DMP...
MPU offsets: 2691 1893 1181 72 -57 0
Calibrate MPU6050...
>....................>....................
MPU offsets:
// X Accel Y Accel Z Accel X Gyro Y Gyro Z Gyro
//OFFSETS 2759, 1871, 1173, 73, -56, -4
- Enabling DMP...
- DMP ready! Waiting for the first interrupt...
BLE: Bittle45_BLE
Waiting for a BLE client connection to notify...
SSP: Bittle45_SSP
The SSP device is started, now you can pair it with Bluetooth!
Setup ESP32 PWM servo driver...
Calibrated Zero Position
135 225 135 135 190 80 190 80 190 80 80 190
Build skill list...88
Run factory quality assurance program? (Y/n)
(Auto skip in 5 seconds)
5...4...3...2...1...n
TaskQ
rest
11
Init voice
Number of customized voice commands on the main board:
10
Turn on the audio response
Show Petoi Logo color
S, A, T, L, D, I, B, U, G, C, Q,
0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Ready!
g
rest
d
XAaXAc
Switch English
When the string "Ready!" is output in the serial monitor, the program will enter the regular startup mode.
Every time the mainboard is powered on, it compares the BIRTHMARK in the EEPROM to determine whether the program has been initialized. If the program has already been initialized, it will not enter the initialization startup mode again.
The default code runs the Standard mode (including the Voice command function). If you want to switch modes, Please open the serial monitor and send the following serial commands:
XA
Voice. For BiBoard V0, the switch on the extension hat should be dialed to the Voice command side (default mode)
XU
Ultrasonic. For BiBoard V0, the switch on the extension hat should be dialed to the Uart2 side; voice control will not work.
XC
Camera
XL
Light
XT
Touch
XI
PIR
XG
Gesture
XD
IR distance
XQ
Quick demo
XS
Enable the Serial 2(Tx2, Rx2). For BiBoard V0, the switch on the extension hat should be dialed to the Uart2 side; voice control will not work.
XB
Enable the back touch funtion.
X
Disable all the module functions above.
z
RandomMind (On/Off)
Long-press the battery button and boot up the robot with one side up. It will enter the calibration state automatically in the regular startup mode. The picture below shows the head, the upper 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) in the regular startup mode.
The BiBoard has built-in Bluetooth, and you can connect it with the mobile app to do joint calibration and remote control.
You can check the update history information in the ChangeLog.md.