Petoi Doc Center
🇺🇸English
Search
K

Firmware Uploader

This manual for Beginner. Makes it easier for you to get started with the robot(Nybble / Bittle ).

** Download the latest version of the Petoi Desktop APP. **

  • After downloading the compressed file(.zip), please unzip it first.
  • Do NOT move the UI.exe to another location in Windows.
Petoi Desktop App works on both Nybble and Bittle, controlled by NyBoard based on ATmega328P, or BiBoard based on ESP32. More detailed documentation can be found at the NyBoard V1_0, NyBoard V1_1 or NyBoard V1_2 (is similar to NyBoard V1_1).
Note: the board version number is here

Dial the I2C switch (SW2) to the "Arduino" side

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. Always select "Arduino" unless you know how to connect the I2C devices from the external 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 ensure 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):

Upload the firmware with the Petoi Desktop APP

Download the latest version of the Petoi Desktop APP.

There may be some OS platform compatibility issues with different computers.
You can still run the app directly from your terminal:
  1. 1.
    Go to OpenCat/pyUI/ in your terminal.
  2. 2.
    Install pyserial, pillow for your Python. You may get a clean Anaconda environment and pip3 install pyserial pillow
  3. 3.
    Run python3 UI.py
For NyBoard, the firmware uploader calls the application avrdude to upload firmware files to the mainboard. For BiBoard, the firmware uploader calls the application esptool to upload firmware files to the mainboard.
Install avrdude in the Linux OS
For Linux system users, in addition to the above steps, you also need to perform the following steps:
1. Install avrdude
  • Fedora : dnf install avrdude
  • CentOS : yum install avrdude
  • Debian / Ubuntu : apt install avrdude
2. Modify the variable avrdudeconfPath in FirmwareUploader.py
  • Fedora / CentOS : avrdudeconfPath = '/etc/avrdude/'
  • Debian / Ubuntu : avrdudeconfPath = '/etc/'

Connect the USB uploader

Check the connected serial ports:
For specific steps, please refer to the Connect NyBoard section in the USB uploader module.

Open the PetoiDesktopApp

After the USB uploader is properly connected, open the PetoiDesktopApp (for Windows: UI.exe / for Mac: Petoi Desktop App), and select your model and language.
Model
Language
Help
The Français, 日语 translations are to be completed. You may contribute to our GitHub repository: OpenCat/pyUI/translate.py.

Click the "Firmware Uploader" button to open the Firmware Uploader interface:

Main interface
Firmware Uploader interface

Select the correct options to upload the latest firmware for the NyBoard.

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).
Options
Values
Note
Software version
1.0
2.0 (default)
The 1.0 version will be obsolete.
Board version
NyBoard_V1_0 (default) NyBoard_V1_1 NyBoard_V1_2 BiBoard_V0
BittleX use BiBoard_V0
Product
Bittle (default) Nybble
Mode
Standard (default) RandomMind Voice Mind+ Camera (Bittle) Ultrasonic (Nybble) RandomMind_Ultrasonic (Nybble)
Some modes are only available on a specific product. It should automatically updated the allowed mode list when you switch between products and boards.
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.

Uploading options

  • Factory Reset It's used by our factory to improve efficiency. It will automatically reset all the parameters including all calibration parameters of the servos and the IMU. So it's not recommended to regular users.
  • Upgrade the Firmware It will upgrade both the parameters and the main function.
    • Mandatory if you just downloaded a new version of this desktop app.
    • You can select 'N' in the pop-up windows to preserve the calibration values.
  • 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 parameter stage.

Upgrade the firmware process

After clicking the Upgrade the Firmware button, the uploading process starts immediately. The status bar at the bottom will show the current progress in real-time, as well as the results of key processes.
After the Parameters firmware has been successfully uploaded, the board starts to run the configuration program by itself. Some message windows will pop up in sequence for you to confirm or cancel:
  • Reset joint offsets? (Y/N)
Select "是(Y)", the program will reset all servo calibration parameters to zero, and the status bar will update the corresponding process and result in real-time.
Select "否(N)" and the program will skip this step.
For software version 1.0, there is a warning message window of "Update Instincts? (Y/N)" will pop up as follow:
Select "是(Y)", the program will upload all skill configuration parameters, and the status bar will update the corresponding process and result in real-time.
Select "否(N)" and the program will skip this step.
If you upload this version of the software for the first time, be sure to select "是(Y)"!
For software version 2.0, this choice is automatically processed as Y in the background..
  • Calibrate IMU? (Y/N)
Select "是(Y)", the program will calibrate the gyroscope (IMU), and the status bar will update the corresponding process and result in real-time.
Select "否(N)" and the program will skip this step.
Note:
  1. 1.
    Make sure the mainboard is positioned horizontally before clicking the "是(Y)" button.
  2. 2.
    When uploading this version of the firmware for the first time, be sure to click the "是(Y)" button!
When all the steps are completed, a message window will pop up showing "Parameter initialization complete!" You must confirm to proceed to the second round of uploading the main functional code.

Calibrate the servo controller chip PCA9685 on the NyBoard

When the above window pops up, there's an optional step to calibrate the servo driver before clicking OK. If later you find one of the servos stops working but can resume working after re-powering the servo, 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.
The program will measure the pulse width of the signal and automatically calibrate the chip after getting three identical readings successive. 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.

Finish uploading the firmware

After the uploading is complete, 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 at the same time.
Note:
  1. 1.
    When you open the software and upload the firmware for the first time, the program will first upload the "Parameters" firmware, then upload the "Main function" firmware. If you re-upload after a successful upload, the program will only upload the "Main function" firmware as long as you only modified the "Mode" option.
  2. 2.
    If the NyBoard is not connected to the battery and powered on, you will hear repetitive descending melodies, indicating that the battery is low or not connected. You need to connect the battery and turn on its power.
If you have Arduino IDE programming experience, you can refer to Upload Sketch For NyBoard.