# Firmware Uploader

## \*\* Download the latest version of the [Petoi Desktop APP](https://github.com/PetoiCamp/DesktopAppRelease/releases). \*\*

For detailed installation tutorials and usage instructions, please refer to [Desktop APP Introduction](https://guide.petoi.com/desktop-app/introduction).

## Connect the mainboard to the computer

You can connect the computer to the mainboard using a USB cable, following the instructions on the subsequent sub-pages ( [BiBoard V1](/desktop-app/firmware-uploader/biboard-v1.md)/ [BiBoard V0](/desktop-app/firmware-uploader/biboard-v0.md) / [NyBoard](/desktop-app/firmware-uploader/nyboard.md) ), which are specific to the robot's mainboard model.&#x20;

## Upload the firmware using the Petoi Desktop app

### Open the PetoiDesktopApp

**After** properly connecting the mainboard with the computer via a USB data cable, open the PetoiDesktopApp (for Windows: UI.exe / for Mac: Petoi Desktop App), and select your **Model** and **Language**.

#### Menu bar in Petoi Desktop APP

<div align="left"><img src="/files/qBCd9Bhez4849Yf780QA" alt="Model"> <img src="/files/gR5eBhARz93cFxxlprzO" alt="Language"> <img src="/files/3sAlQfjLKtep2lBKB4Hg" alt="Help"></div>

### Click the Firmware Uploader button

<div align="center"><img src="/files/bmSa9E1wwzopUOGaqGUS" alt="Main interface"></div>

### Auto Detect the Serial Port&#x20;

If there is **no** serial port or **more than one** serial port is detected by the desktop app:

<figure><img src="/files/zPEK9HCklsSKKfOlij4n" alt=""><figcaption></figcaption></figure>

After clicking the **Firmware Uploader** button,  there will be a message box prompt as follows:

<figure><img src="/files/ii8QC9zLeNtH6vwtQWhP" alt=""><figcaption></figcaption></figure>

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：

<figure><img src="/files/kgnSTTD7u6lGHXvrUqz1" alt=""><figcaption></figcaption></figure>

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:

<figure><img src="/files/IAPsr99lxuNKhqeN7S3w" alt=""><figcaption></figcaption></figure>

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 used to connect the robot to the computer.

<figure><img src="/files/4910PiAdo9AGvz9107Rb" alt=""><figcaption></figcaption></figure>

If you unplug the **COM5** and replug it on the computer side, it will be discovered by the desktop app as follows:

<figure><img src="/files/VW5yOQDHLRpfGYUgqW7W" alt=""><figcaption></figcaption></figure>

<figure><img src="/files/QDyj6IxfGOZBglAI9zm9" alt=""><figcaption></figcaption></figure>

<figure><img src="/files/6kaCalAgQlbDT7Ivx4cw" alt=""><figcaption></figcaption></figure>

### Select the correct options to upload the latest firmware.&#x20;

{% hint style="warning" %}
The 1.0 software won't work correctly with the Joint Calibrator, the Skill Composer, and other APIs. Use it only when you want to use the CodeCraft, a graphical coding interface provided by our partner, TinkerGen.&#x20;
{% endhint %}

<table><thead><tr><th width="176">Options</th><th width="293">Values</th><th>Notes</th></tr></thead><tbody><tr><td>Product</td><td><p>Bittle (default)</p><p>Bittle X</p><p>Bittle X+Arm<br>Nybble<br>Nybble Q</p></td><td></td></tr><tr><td>Mode</td><td>Standard (default)<br>RandomMind <br>Voice<br>Mind+<br>Camera <br>Ultrasonic <br>RandomMind_Ultrasonic<br>Light<br>Touch<br>PIR<br>Gesture<br>IR distance</td><td><p>Because <strong>Bittle X running on BiBoard</strong> has more memory space, you only need to upload with the <strong>Standard</strong> mode firmware.  Then you can switch between different modes via serial port commands. [1]</p><p></p><p>For NyBoard, these 12 modes can be selected. All of these modes apply to both <strong>Bittle</strong> and <strong>Nybble</strong>.</p><p></p></td></tr><tr><td>Software version</td><td><p>2.0 (default)</p><p>1.0</p></td><td>The 1.0 version is obsolete.</td></tr><tr><td>Serial port</td><td>Auto detection or by manual selection. </td><td>You can find the correct one through unplug and replug the USB socket on the computer side</td></tr><tr><td>Board version</td><td><p>NyBoard_V1_0 (default<em>)</em><br>NyBoard_V1_1<br>NyBoard_V1_2<br>BiBoard_V0_1</p><p>BiBoard_V0_2<br>BiBoard_V1_0</p></td><td>BiBoard_V0_1 or BiBoard_V0_2  is for <strong>Bittle X.</strong>  <br>BiBoard_V1_0 is for <strong>Bittle X V2</strong> and <strong>Nybble Q</strong>.</td></tr></tbody></table>

{% hint style="info" %}
\[1] You can use the serial commands to [switch modes](https://guide.petoi.com/desktop-app/pages/8ajuxMEplUPiNYi4SRyi#id-2.9-switch-working-mode-via-the-serial-commands-optional) for **BiBoard**:\
For **BiBoard,** Mind+ mode is supported by default, so it doesn't require a serial command to switch on.\
You can learn about the functionw of each module through the [**EXTENSIBLE MODULES**](https://guide.petoi.com/extensible-modules/introduction).
{% endhint %}

{% hint style="warning" %}
There's no correlation between the board (hardware) version and the code (software) version.
{% endhint %}

### Uploading options

Please follow the instructions on the subsequent sub-pages ([NyBoard](/desktop-app/firmware-uploader/nyboard.md#uploading-options) / [BiBoard V0 and BiBoard V1](/desktop-app/firmware-uploader/biboard-v0.md#uploading-options)), depending on the type of your robot's mainboard. &#x20;

### Finish uploading the firmware

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.

<figure><img src="/files/LoanvpTqxeu9rGHNDzAj" alt=""><figcaption></figcaption></figure>

{% hint style="info" %}
Note:&#x20;

1. For NyBoard, when you open the software and upload the firmware for the first time, the program will first upload the "**Parameters**" firmware and then the "**Main function**" firmware.&#x20;
2. After uploading the firmware, if the NyBoard or BiBoard V1 is not connected to the battery and powered on, you will hear repetitive descending melodies, indicating that the battery is low or disconnected. You need to connect the battery and turn on its power.&#x20;
   {% endhint %}

### Check the log&#x20;

From the desktop app version **1.2.7**, the log information will be output in the console box at the bottom of the interface:

<figure><img src="/files/Kusypy1JUioDU1uI0sgi" alt=""><figcaption></figcaption></figure>

You can directly click the **Copy** button to copy all the log information, or you can first select specific key information in the console output box with your mouse, then click the **Copy** button to copy only that portion of the log information, and then paste this information into an email and send it to support.petoi.com for assistance.

{% hint style="info" %}
For the old version of the desktop app, if the upload fails, the following message box will pop up:

<img src="/files/dlpmDOhPH7XgCXMd5IgK" alt="" data-size="original">

the log file is located at:

* For Windows: The log file is in the same directory as **UI.exe**

  ![](https://docs.petoi.com/~gitbook/image?url=https%3A%2F%2F1565080149-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252F-MQ6a951Q6Jn1Zzt5Ajr-887967055%252Fuploads%252FNl61Gr6RNtDYEuJek7Gm%252Fimage.png%3Falt%3Dmedia%26token%3D0e0ea071-11e4-48e7-9f80-cbfbca10ccac\&width=768\&dpr=4\&quality=100\&sign=996aee40\&sv=2)
* For macOS: You can check the log file as follows:

  ![](https://docs.petoi.com/~gitbook/image?url=https%3A%2F%2F1565080149-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252F-MQ6a951Q6Jn1Zzt5Ajr-887967055%252Fuploads%252FGLeXErV4KpBrfbJQhO3o%252Fimage.png%3Falt%3Dmedia%26token%3Dee485581-cf60-4008-aba7-5c4a91b16ee3\&width=768\&dpr=4\&quality=100\&sign=d6a8daf1\&sv=2)![](https://docs.petoi.com/~gitbook/image?url=https%3A%2F%2F1565080149-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252F-MQ6a951Q6Jn1Zzt5Ajr-887967055%252Fuploads%252FL7O8qDstl6NwlwRQ4ZmJ%252Fimage.png%3Falt%3Dmedia%26token%3D972abd2e-b715-4f05-8601-baa99d22ad17\&width=768\&dpr=4\&quality=100\&sign=a61fc3b5\&sv=2)

When you contact our **<support@petoi.com>**, please attach the log file to your email.
{% endhint %}

### Run Firmware Uploader in the terminal

{% hint style="info" %}
There may be some OS platform compatibility issues with different computers.

You can still run the app directly from your terminal:

1. Go to OpenCat/pyUI/ in your terminal.
2. Install **PySerial** and **Pillow** for your Python installation. You may get a clean Anaconda environment and `pip3 install pyserial pillow`
3. Run `python3 UI.py`

For **NyBoard**, the firmware uploader calls the application **avrdude** to upload firmware files to the microcontroller.&#x20;

For **BiBoard**, the firmware uploader calls the application **esptool** to upload firmware files to the microcontroller.&#x20;

**Linux OS**

For Linux system users, in addition to the above steps, you also need to perform the following steps:

1\. Install **avrdude**&#x20;

* 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/'`
  {% endhint %}

{% hint style="info" %}
If you have experience with the Arduino IDE, you will see the same log message when uploading.

* For the BiBoard, please review the [Upload Sketch for BiBoard](/arduino-ide/upload-sketch-for-biboard.md).
* For the NyBoard, please review the [Upload Sketch for NyBoard](/arduino-ide/upload-sketch-for-nyboard.md).
  {% endhint %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://guide.petoi.com/desktop-app/firmware-uploader.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
