> For the complete documentation index, see [llms.txt](https://nybble.petoi.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://nybble.petoi.com/russian/chapter4.md).

# 4 ⌨️ Configuration

"Who loves fried chips?" 🍟

## 4.1. NyBoard

### 4.1.1. Read the user manual

Find the version info on NyBoard. Read the user manual for [NyBoard V0\_1](https://github.com/PetoiCamp/OpenCat/blob/master/Resources/NyBoard/NyBoardV0_1.pdf) or [NyBoard V0\_2](https://github.com/PetoiCamp/OpenCat/blob/master/Resources/NyBoard/NyBoardV0_2.pdf) accordingly.&#x20;

{% hint style="danger" %}
Wrong operations may damage your NyBoard!
{% endhint %}

![](https://1612257218-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LygA-EAoP4h8Q2BOGHR%2F-LzvBBccsFiCMvRtWl8L%2F-LzwWsuguxr5M3Dyj-_w%2FNyBoardV2Label.jpg?alt=media\&token=2e039dc5-a55f-456e-9893-2f4db6b72eea)

![](https://1612257218-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LygA-EAoP4h8Q2BOGHR%2F-LzvBBccsFiCMvRtWl8L%2F-LzwXyKwTpkGDjv53GOI%2FNyBoardV2Label2.jpg?alt=media\&token=39dc3dac-1d86-4923-81e4-01c4590e0fa2)

### 4.1.2. Dial the potentiometer clockwise to start from the lowest voltage.

{% hint style="success" %}
From NyBoard V0\_2, we provide a jumper selector to bypass the potentiometer. If you are using the metal servos in a standard Nybble kit, this section can be skipped.
{% endhint %}

Higher voltage will increase the servos’ torque and make Nybble move faster. The downside is it will increase current draw, reduce battery life, affect the stability of circuit, and accelerate the wearing of the servos. Based on my tests, 5.5V seems to result in a balanced performance.

For initial installation, don’t put screws on the NyBoard as you may need to take it out for tuning the potentiometer. Make sure all the servos can rotate fine in normal working condition before making fine calibrations.&#x20;

### 4.1.3. Dial the I2C switch (SW2) to Ar.

The I2C switch changes the master of I2C devices (gyro/accelerometer, servo driver, external EEPROM). On default “Ar”, NyBoard uses the on-board ATmega328P as the master chip; On “Pi”, NyBoard uses external chips connected through the I2C ports (SDA, SCL) as the master chip.

{% hint style="warning" %}
Sometimes if you cannot go through the bootup stage, maybe you have accidentally dialed the switch to "Pi".&#x20;
{% endhint %}

### 4.1.4. Adjust the NyBoard for optimized performance.

NyBoard is designed for two use cases. One is for Nybble that uses metal geared servos, the other is for DIY robots that may use plastic geared servos. Plastic servos can only stand 6V so there is a step down chip on NyBoard. The chip is rated for 5A maximal output, but can only be achieved with multiple proper settings and careful tuning.&#x20;

When using NyBoard with the metal geared servos of Nybble, optimized performance can be achieved by some adjustment. For NyBoard\_V0\_1, you will need to do some soldering work as discussed in the [forum post](https://www.petoi.com/forum/hardware/reconfigure-nyboard-v0-1-for-pro-users). For NyBoard\_V0\_2, you can connect the jumper switch SW3 between BATT and V\_S (Considering safety for plastic servos, by default NyBoard comes with SW3 connecting V\_S and V+).&#x20;

{% hint style="warning" %}
V\_S means power for servo. The jumper switch chooses whether to power the servos (V\_S) by the step down chip (V+) or by the batteries (BATT) directly. So BATT and V+ should never be connected directly.
{% endhint %}

{% hint style="info" %}
It turns out that NyBoard works more stable when powering the metal geared servos directly with BATT rather than V+. However, if you are using NyBoard to drive your own plastic geared servos, you do need to use the step down circuit.&#x20;
{% endhint %}

## 4.2. Downloads and installations

{% hint style="info" %}
You will need the newest Arduino IDE to set up the environment. Older versions tend to compile larger hex files that may exceed the memory limit.&#x20;
{% endhint %}

If​ you have previously added other libraries and see error message "XXX library is already installed", ​​​​I would recommend you delete them first (instruction:​​ <https://stackoverflow.com/questions/16752806/how-do-i-remove-a-library-from-the-arduino-environment>). Due to different configurations of your Arduino IDE installation, if you see any error messages regarding missing libraries during later compiling, just google and install them to your IDE.

### 4.2.1. Install through library manager

Go to the library manager of Arduino IDE (instruction: <https://www.arduino.cc/en/Guide/Libraries>), search and install&#x20;

* **Adafruit PWM Servo Driver**
* **IRremote**
* **QList**

### 4.2.2. Install by adding .ZIP library

Go to [jrowberg/i2cdevlib: I2C device library collection for AVR/Arduino  or other C++-based MCUs](https://github.com/jrowberg/i2cdevlib), download the zip file and unzip. You can also git clone the whole repository.

![](https://1612257218-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LygA-EAoP4h8Q2BOGHR%2F-LzrYmnztRT1Ker56wMm%2F-Lztj-3xI3HwaacLQzIw%2Fi2clib.png?alt=media\&token=2bd3aae9-2e3b-4df3-8e88-11924cd16408)

Use **Add .ZIP Library** to find **Arduino/MPU6050/** and **Arduino/I2Cdev/**. Click on the folders and **add them one by one**.​ They don’t have to be **.ZIP** files.&#x20;

![](https://1612257218-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LygA-EAoP4h8Q2BOGHR%2F-LzrYmnztRT1Ker56wMm%2F-LztjW6U6UUIDZeeXib-%2FaddZip.png?alt=media\&token=d829c40c-32a2-4add-a714-11486ac411b1)

![](https://1612257218-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LygA-EAoP4h8Q2BOGHR%2F-LzrYmnztRT1Ker56wMm%2F-LztjeVZiNzDdDIdaNC2%2Fi2cdev.png?alt=media\&token=710cf368-eb69-4eb9-804a-777ed2853909)

### 4.2.3. Add NyBoard support to Arduino IDE (many thanks to [A-Ron](https://github.com/asmagill)!)

![](https://1612257218-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LygA-EAoP4h8Q2BOGHR%2F-LzrYmnztRT1Ker56wMm%2F-LztkFjO9z1b8E8luG4A%2FNyBoardURL.png?alt=media\&token=25feaa11-8b36-4b9e-b79c-31bc545543dd)

1. Open the **Preferences...** panel&#x20;
2. In the **Additional Boards Manager URLs** field, add **<https://raw.githubusercontent.com/PetoiCamp/OpenCat/master/Resources/NyBoard/boardManager/package\\_petoi\\_nyboard\\_index.json>**. If there are already URLs listed in this field, separate them with commas or click on the icon next to the field to open up an editor and add this URL to a new line.
3. Click on the OK button to close the Preferences panel (you have to close the previously opened **Additional Boards Manager URLs** editor first, to close the Preference panel)
4. Open the **Boards Manager...** window with the **Tools -> Board: XXXX -> Boards Manager...** menu item.&#x20;
5. In the **Filter your search...** field, type **NyBoard**
6. Select the entry and click on **Install**
7. Click on the **Close** button
8. Select **ATmega328P (5V, 20 MHz) NyBoard** from the **Tools -> Board: XXXX** menu (NyBoardV0\_1 and NyBoardV0\_2 are using the same board settings.)

### 4.2.4.     Manual Board Installation Method&#x20;

{% hint style="warning" %}
Only if the above method fails
{% endhint %}

●      Locate the file **boards.txt**

**Mac location**:

/Users/UserName/Library/Arduino15/packages/arduino/hardware/avr/version#/

**Or**:     &#x20;

/Applications/Arduino.app/Contents/Java/hardware/arduino/avr

To access, right click on Arduino.app and choose Show Package Contents

**Windows location**:

C:\Program Files(x86)\Arduino\hardware\arduino\avr\\

IMPORTANT! If you have installed the Arduino IDE via the Microsoft Store, you likely will not have access to the folder where critical configuration files are stored. The easiest solution is to uninstall the IDE and download/re-install it directly from [https://www.arduino.cc](https://www.arduino.cc/).

**Linux**&#x20;

Downloading from the terminal or from the software manager might not give you the latest version which can be an issue. Please download the latest version from Arduino’s site: <https://www.arduino.cc/en/Main/Software>

Unzip the package and `sudo install.sh`

The location of boards.txt files is:

Fedora: boards.txt is symlinked under:

/etc

Arch: boards.txt is found at:

/usr/share/arduino/hardware/archlinix-arduino/avr/

Mint:

location\_of\_installation/arduino/hardware/arduino/avr

Ubuntu (on 18.04 when installing with `apt-get install arduino`):&#x20;

/usr/share/arduino/hardware/arduino/boards.txt

after locating **boards.txt**:

●      Make a copy of **boards.txt** in case you want to roll back.

●      Create new **boards.txt**.

You can download my [**boards.txt**](https://github.com/PetoiCamp/OpenCat/blob/master/Resources/NyBoard/boards.txt) file, or:

Edit your **boards.txt** with admin privilege. Find the section of&#x20;

pro.name=Arduino Pro or Pro Mini&#x20;

and insert the&#x20;

```
## Arduino Pro or Pro Mini (5V, 20 MHz) w/ ATmega328P
## --------------------------------------------------
pro.menu.cpu.20MHzatmega328=ATmega328P (5V, 20 MHz) NyBoard

pro.menu.cpu.20MHzatmega328.upload.maximum_size=30720
pro.menu.cpu.20MHzatmega328.upload.maximum_data_size=2048
pro.menu.cpu.20MHzatmega328.upload.speed=57600

pro.menu.cpu.20MHzatmega328.bootloader.low_fuses=0xFF
pro.menu.cpu.20MHzatmega328.bootloader.high_fuses=0xDA
pro.menu.cpu.20MHzatmega328.bootloader.extended_fuses=0xFD
pro.menu.cpu.20MHzatmega328.bootloader.file=atmega/ATmega328_20MHz.hex

pro.menu.cpu.20MHzatmega328.build.mcu=atmega328p
pro.menu.cpu.20MHzatmega328.build.f_cpu=20000000L

## Arduino Pro or Pro Mini (5V, 16 MHz) w/ ATmega328P
## --------------------------------------------------
```

code block in the Arduino Pro or Pro Mini section as below. Save and quit your editor.

```
##############################################################
pro.name=Arduino Pro or Pro Mini

pro.upload.tool=avrdude
pro.upload.protocol=arduino

pro.bootloader.tool=avrdude
pro.bootloader.unlock_bits=0x3F
pro.bootloader.lock_bits=0x0F

pro.build.board=AVR_PRO
pro.build.core=arduino
pro.build.variant=eightanaloginputs

## Arduino Pro or Pro Mini (5V, 20 MHz) w/ ATmega328P
## --------------------------------------------------
pro.menu.cpu.20MHzatmega328=ATmega328P (5V, 20 MHz) NyBoard

pro.menu.cpu.20MHzatmega328.upload.maximum_size=30720
pro.menu.cpu.20MHzatmega328.upload.maximum_data_size=2048
pro.menu.cpu.20MHzatmega328.upload.speed=57600

pro.menu.cpu.20MHzatmega328.bootloader.low_fuses=0xFF
pro.menu.cpu.20MHzatmega328.bootloader.high_fuses=0xDA
pro.menu.cpu.20MHzatmega328.bootloader.extended_fuses=0xFD
pro.menu.cpu.20MHzatmega328.bootloader.file=atmega/ATmega328_20MHz.hex

pro.menu.cpu.20MHzatmega328.build.mcu=atmega328p
pro.menu.cpu.20MHzatmega328.build.f_cpu=20000000L

## Arduino Pro or Pro Mini (5V, 16 MHz) w/ ATmega328P
## --------------------------------------------------
```

●      Download [ATmega328\_20MHz](https://github.com/PetoiCamp/OpenCat/blob/master/Resources/NyBoard/bootloaders/atmega/ATmega328_20MHz.hex)[.hex](https://github.com/PetoiCamp/OpenCat/blob/master/Resources/NyBoard/bootloaders/atmega/ATmega328_20MHz.hex) and put it in your Arduino folder ./bootloaders/atmega/. You should see other bootloaders with .hex suffix in the save folder.

Restart your Arduino IDE. In **Tools->Boards**, select Arduino Pro or Pro Mini. You should find ATmega328P (5V, **20** MHz) in Processor menu.

![](https://1612257218-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LygA-EAoP4h8Q2BOGHR%2F-LzrYmnztRT1Ker56wMm%2F-LztkRqK4iSyaCppHrIg%2FprocessorSelection.png?alt=media\&token=44dd4d2b-23f0-42bb-9417-defcfe96b489)

{% hint style="info" %}
If you cannot find the board, your Arduino IDE may be using the boards.txt in another path. Search boards.txt in all the folders on your computer. Find out the right file that's in effect.
{% endhint %}

### 4.2.5. Burn the bootloader&#x20;

{% hint style="warning" %}
Only if the bootloader of NyBoard collapsed
{% endhint %}

●      [What is a bootloader?](https://www.arduino.cc/en/Hacking/Bootloader?from=Tutorial.Bootloader)

Every NyBoard has to go through functionality checks before shipping, so they should already have 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:

* &#x20;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 UART uploader;
* You haven't selected the correct port;
* Bad contacts;
* Bad luck. Tomorrow is another day! &#x20;

If you really decide to re-burn the bootloader:

![](https://1612257218-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LygA-EAoP4h8Q2BOGHR%2F-LzrYmnztRT1Ker56wMm%2F-Lztl16lKjZY1iQ83ajL%2FISP.png?alt=media\&token=d87f23db-ca16-4173-9996-e5333748fdca)

* Select the **ATmega328P (5V, 20 MHz)** board under the **Tool** menu of Arduino IDE.
* Select your ISP (In-System Programmer). The above screenshot shows two popular programmers: the highlighted **USBtinyISP** is a cheap bootloader you can buy, while the checked **Arduino as ISP** can let you use a regular [Arduino as ISP](https://www.arduino.cc/en/Tutorial/ArduinoISP)!
* Connect the programmer with the SPI port on NyBoard. Notice the direction when connecting. Make sure they have good contact.
* Burn bootloader. If it's your first time doing so, wait patiently until you see several percent bars reach 100% and no more messages pop up for one minute.

### 4.2.6. Connect FTDI uploader

The following picture shows two common FTDI boards.

![](https://1612257218-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LygA-EAoP4h8Q2BOGHR%2F-LzrYmnztRT1Ker56wMm%2F-LztlKH-y7dh2bt-yF5H%2FFTDIcompare.jpg?alt=media\&token=e9206e70-1fff-4f71-9835-908fea4f8de6)

On the red board, the jumper selector should be put on 5V (not 3.3V) on the uploader for Arduino. Match the GND on both the uploader and the 6-pin socket on NyBoard.&#x20;

![](https://1612257218-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LygA-EAoP4h8Q2BOGHR%2F-LzrYmnztRT1Ker56wMm%2F-LztmnWoHhPz0039KlcW%2FFTDIconnection.jpg?alt=media\&token=539e2fd9-19bf-4e70-a921-4edc51b4c34d)

![](https://1612257218-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LygA-EAoP4h8Q2BOGHR%2F-LzrYmnztRT1Ker56wMm%2F-Lztna2R_dI864XK_KDt%2FFTDIonNybble.jpg?alt=media\&token=e99d7553-83fb-4b98-a43e-e1f80c9337ed)

Connect your computer with the FTDI uploader (the red chip with 6 male pins) through mini-USB to USB cable. The uploader has three LEDs, power, Tx and Rx. Right after connection, the Tx and Rx should blink for one second indicating initial communication, then dim. Only the power LED should keep litting up. You can find a new port under **Tool->Port** as “/dev/cu.usbserial-xxxxxxxx” (Mac) or “COM#” (Windows).

For Linux, once the uploader is connected to your computer, you will see a “**ttyUSB#”** in the serial port list. But you may still get a serial port error when uploading. You will need to give the serial port permission. Please go to this link and follow the instructions: <https://playground.arduino.cc/Linux/All/#Permission>

![](https://1612257218-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LygA-EAoP4h8Q2BOGHR%2F-LzrYmnztRT1Ker56wMm%2F-LztnwUObRVbQJWa8q1O%2FUSBserial.png?alt=media\&token=58156850-61be-4d85-9950-94688edb1d87)

If Tx and Rx keep litting up, there’s something wrong with the USB communication. You won’t see the new port. It’s usually caused by overcurrent protection by your computer, if you’re not connecting NyBoard with external power supply and the servos move all at once.&#x20;

In later versions, there may be a different version of the FTDI uploader. Just check the marks on the chip and connect it with NyBoard correctly.

### 4.2.7. Connect bluetooth uploader (optional)

It’s possible to program and communicate with Nybble wirelessly. Check out the [bluetooth instruction](https://www.petoi.com/forum/hardware/add-bluetooth-module-for-uploading-sketches-and-communication) on the OpenCat forum. You can even control Nybble with [smartphone APP](https://github.com/codeandrobots/codeandrobots-app) or [web API](https://www.petoi.com/forum/software/web-api-to-control-nybble-opencatweb) from there!

### 4.2.8. Download OpenCat package

* Download a fresh ​OpenCat repository from GitHub: <https://github.com/PetoiCamp/OpenCat>. It’s better if you utilize GitHub’s version control feature. Otherwise make sure you download the WHOLE **Nybble** FOLDERevery time. All the codes have to be the same version to work together.&#x20;
* 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)
* Choose board as **Arduino Pro or Pro Mini** and​ compile. 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 in the serial monitor. Make sure that your baud rate setting (57600) and board frequency(16MHz or 20MHz) matches with the configuration.
* If there're input prompts, make sure you set "No line ending". Otherwise the invisible '\n' or '\r' characters will confuse the parsing functions. &#x20;

![](https://1612257218-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LygA-EAoP4h8Q2BOGHR%2F-LzrYmnztRT1Ker56wMm%2F-LztokF8qCuAOD6L4Sui%2FserialMonitor.png?alt=media\&token=c76b4aca-a162-4088-aae7-503d6992b923)

For Linux machines, you may see the following error message:

![](https://1612257218-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LygA-EAoP4h8Q2BOGHR%2F-M-shq4EHdpgV-IFuv5_%2F-M-sk6FtNjGKvlhDhWlJ%2FIMG_AA1C8D8E941E-1.jpeg?alt=media\&token=e3b33ce6-7774-469a-bb92-f81bc15aa1a3)

You will need to add execution previlige to the avr-gcc to compile the Arduino sketch:`sudo chmod +x filePathToTheBinFolder/bin/avr-gcc`

Further more, you need to add execution permission to **all files** within /bin, so the command would be : `sudo chmod -R +x /filePathToTheBinFolder/bin`

## 4.3. Arduino IDE as interface

With the FTDI to USB converter connecting NyBoard and Arduino IDE, you have the ultimate interface to communicate with NyBoard and change every byte on it.&#x20;

I have defined a set of serial communication protocol for NyBoard:&#x20;

![](https://1612257218-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LygA-EAoP4h8Q2BOGHR%2F-LzrYmnztRT1Ker56wMm%2F-Lztp9Z0gcq9r9EaqR2q%2FserialProtocol.png?alt=media\&token=d51ad740-83ff-4633-9a45-77980688661f)

All the token starts with a single Ascii encoded character to specify its parsing format. They are case-sensitive and usually in lower case.&#x20;

{% hint style="warning" %}
Some tokens haven't been implemented, such as 'h'. Token 'i' and 'l' still have some bugs.
{% endhint %}

## 4.4. Raspberry Pi serial port as interface&#x20;

{% hint style="warning" %}
Only when using Pi as a master controller. Nybble doesn't need a Pi to move.&#x20;
{% endhint %}

![](https://1612257218-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LygA-EAoP4h8Q2BOGHR%2F-LzvBBccsFiCMvRtWl8L%2F-LzwBRTB2HzgVmsZ_0sw%2FIMG_6068.JPG?alt=media\&token=2ac0d332-8be9-4f65-be87-9d778e434700)

As shown in the serial protocol, 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'

{% hint style="info" %}
What about value -113? It takes four bytes as an Ascii string, but still takes only one byte in binary encoding, though the content will no longer be printable as a character.&#x20;
{% endhint %}

Obviously, binary encoding is much more efficient than Ascii string. However, the message transferred will not be directly human readable. In the OpenCat repository, I have put a simple Python script [ardSerial.py](https://github.com/PetoiCamp/OpenCat/tree/master/SerialMasterPython) that can handle the serial communication between NyBoard and Pi.

### 4.4.1. Config Raspberry Pi serial port

In Pi's terminal, type `sudo raspi-config`

Under **Interface** option, find **Serial**. Disabled the serial login shell and enable the serial interface.

{% hint style="info" %}
[A good tutorial on Instructable](https://www.instructables.com/id/Read-and-write-from-serial-port-with-Raspberry-Pi/)
{% endhint %}

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.

### 4.4.2. Change the permission of [ardSerial.py](https://github.com/PetoiCamp/OpenCat/blob/main/serialMaster/ardSerial.py)

If you want to run it as 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`

### 4.4.3. Use **ardSerial.py** as the commander of Nybble

{% hint style="warning" %}
NyBoard has only one serial port. You need to UNPLUG the FTDI converter if you want to control Nybble with Pi's serial port.
{% endhint %}

Typing `./ardSerial.py <args>` is almost equivalent to typing \<args> in Arduino's serial monitor. For example, `./ardSerial.py kcr` means "perform s**k**ill **cr**awl".

Both **ardSerial.py** and the parsing section in **Nybble.ino** need more implementations to support all the serial commands in the protocol.

{% hint style="warning" %}
Reduced motion capability may happen when connected to Pi! Stronger battery is needed.
{% endhint %}

With the additional current draw by Pi, Nybble will be less capable for intense movements, such as trot (the token is`ktr`). 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're a bunch of considerations to collaborate software and hardware for a 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.

## 4.5. Battery

Though you can program NyBoard directly with the FTDI uploader, external power is required to drive the servos.&#x20;

When powering the NyBoard with only USB FTDI, there's obviously charging and uncharging in the servo's capacitor and cause the yellow LED to pulse. However the USB's current is not sufficient to keep the servos working. The servo circuit has to be powered by external batteries to work properly.

### 4.5.1. Voltage

NyBoard requires 7.4\~9V external power to drive the servos. On Nybble, we are using 8V standard to configure all the parameters as a whole system. That's usually two Li-ion or Li-poly batteries connected in series. A single battery is 4.2V when fully charged and can work normally until voltage drops to 3.6V. That’s about 7.2V with two batteries connected in series. Before installation, dial the potentiometer on NyBoard clockwise to try minimum output first (about 4.5V), then dial it up until it can make the robot work properly. With our kit servos, it actually works better to connect SW3 between BATT with V\_S directly and bypass the step-down chip (so no need to tune the potentiometer).&#x20;

When looking for batteries, search for keywords “14500 3.7V li-ion battery unprotected”. I’ve noticed that the overcurrent protection of some batteries could be triggered by peak current draw-(usually >2.5A), causing NyBoard to reset or malfunction. Try find batteries with higher discharge rating.&#x20;

Read this [forum ](https://www.petoi.com/forum/clinic/report-your-batteries)[post](https://www.petoi.com/forum/clinic/report-your-batteries) to find batteries that work on Nybble.&#x20;

### 4.5.2. Dimensions

The included battery holder is sized for 14500 batteries, that’s 14 mm in diameter, and 50 mm in length. 50 ± 1 mm should still fit in. They are the same size as AA batteries, but much more powerful. **Make sure not to use them in regular AA devices.** If you are in the US, we have tested with EBL 14500 li-ion batteries.&#x20;

You can also design other battery holders to carry larger batteries for better performance. That’s especially necessary if you mount a Raspberry Pi or want Nybble run faster.&#x20;

### 4.5.3. Connection&#x20;

Be careful with the polarity when connecting the power supply. Make sure you can find the positive (+) and negative (-) sign on both the NyBoard's power terminal and your power supply.&#x20;

{% hint style="danger" %}
**Reversed connection may damage your NyBoard!**
{% endhint %}

Loosen the screws of the power block. Insert the wires of the battery holder then tighten the screws. When turn the switch on, both the blue LED (for chip) and the yellow LED (for servo) should lit up.&#x20;

![](https://1612257218-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LygA-EAoP4h8Q2BOGHR%2F-LzrYmnztRT1Ker56wMm%2F-LztqFnUhE_fLlMU0afR%2F_B2L6724.jpg?alt=media\&token=a6c477e8-0846-4a92-bce3-ff6609cea7d9)

### 4.5.4. Battery life varies according to usage&#x20;

It can last hours if you're mainly coding and testing postures, or less than 30 mins if you keep Nybble running.&#x20;

When the battery is low, the yellow LED will blink slowly. Although NyBoard can still drive one or two servos, it will be very unstable to drive multiple servos at once.  **That will lead to repeatedly restarting the program, or awkward joint rotations.** In rare cases, it may even alter the bits in EEPROM. You will need to reupload the codes and re-save the constants to recover.&#x20;

### &#x20;4.5.5. Charging

You will need compatible smart chargers for the batteries. Keep batteries attended during charging.&#x20;

### 4.5.6. After use

After playing, remember to **remove the batteries from battery holder to avoid over discharging**.&#x20;

### 4.5.7. Signal interference

It's ok to connect both FTDI and battery at the same time. You can type in serial commands while the battery is connected. I do notice that the USB serial port could be disabled randomly. I think that's due to the sudden current draw by servos. It will trigger the computer’s over current protection and disable the USB port. In that case, you can change the USB port you're connecting to, reset the USB bus, or restart the computer.  So actually it’s better to power the board by battery before plug in the FTDI.&#x20;


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

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

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://nybble.petoi.com/russian/chapter4.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
