# Instructions d’assemblage pour Nybble

Traduction, révision, intégration : UBO Master 2 Rédaction/Traduction 2019-2020 ; A. Pennors ; N. Luce

{% hint style="success" %}

## You can write to <rongzhong.li@petoi.com> to discuss the translation work!

{% endhint %}

Pour que ces instructions soient simples à comprendre, je me concentre sur l’assemblage sans trop entrer dans les détails.

Pour connaître le « pourquoi du comment », posez directement vos questions sur notre forum :\
&#x20;[https://www.petoi.com/forum](https://www.petoi.com/forum%3c1) ou envoyez-les à <info@petoi.com>.

![](/files/-M1PUTULRcVg-fz0h6aC)

Une campagne de financement participatif est en cours sur Indiegogo : [igg.me/at/nybble](http://igg.me/at/nybble). Retrouvez-nous sur les réseaux sociaux (Instagram/Twitter/Facebook/GitHub) : **@PetoiCamp**. Utilisez les hashtags **#nybble** **#petoi** ou **#opencat** pour partager votre construction avec nous, nous reposterons vos publications !&#x20;

{% hint style="info" %}
Last Updated: 02/02/2020
{% endhint %}


# 1 🧘‍♂️ Outils et Préparation

« Un projet bien préparé est à moitié réalisé ! »

## 1.1. Préparation

Installez-vous sur un plan de travail propre et munissez-vous de petites boîtes avant d’ouvrir le paquet. Prenez une photo du contenu du kit au cas où vous perdriez un élément par la suite.

{% hint style="success" %}
Il est préférable de vous installer dans une pièce sans tapis, ni motif ou relief au sol. De petites vis ou ressorts pourraient s’y dissimuler s’ils venaient à tomber par terre.&#x20;
{% endhint %}

## 1.2. Outils et accessoires

{% tabs %}
{% tab title="Nécessaire" %}

| Outil                                            | Remarque                                                                                  |
| ------------------------------------------------ | ----------------------------------------------------------------------------------------- |
| Cutter                                           | Pour couper les languettes des pièces en bois                                             |
| Tournevis plats et cruciformes                   | Pour les vis M2 (diamètre = 2 mm)                                                         |
| Ordinateur doté de l’IDE Arduino                 | Installez la dernière version de l’[IDE Arduino](https://www.arduino.cc/en/Main/Software) |
| Câble USB vers mini USB                          | Pour connecter l’adaptateur à l’ordinateur. Pas de micro-USB                              |
| Deux piles rechargeables lithium-ion 14500 3.7 V | À ne pas confondre avec les piles standard AA (1.5 V). Capacité totale de \~800 mAh.      |
| Chargeur de piles intelligent                    | Attention : l'utilisation d'un mauvais chargeur est potentiellement dangereux !           |
| {% endtab %}                                     |                                                                                           |

{% tab title="Optionnel" %}

| Outil                            | Remarque                                                                                                                                                  |
| -------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Fer à souder et ses accessoires  | [Pour souder la LED décorative au capteur d’ultrasons](https://github.com/PetoiCamp/OpenCat/blob/master/Resources/Nybble_SolderingUltrasound.pdf)         |
| Module Bluetooth HC-05           | [Pour charger vos programmes et communiquer sans fil](https://www.petoi.com/forum/hardware/add-bluetooth-module-for-uploading-sketches-and-communication) |
| Palette de couleurs              | Pour que votre Nybble soit unique                                                                                                                         |
| Imprimante 3D et ses accessoires | Pour créer vos propres formes                                                                                                                             |
| Kit Arduino ou Raspberry Pi      | Pour que Nybble ait encore plus d’options                                                                                                                 |
| Multimètre                       | Pour tester et corriger                                                                                                                                   |
| Oscilloscope                     | Pour tester et corriger                                                                                                                                   |
| Pistolet à colle / super glue    | À éviter. OpenCat est conçu pour être souple !                                                                                                            |
| {% endtab %}                     |                                                                                                                                                           |
| {% endtabs %}                    |                                                                                                                                                           |


# 2 🧩 Contenu du kit

« La vie est comme un kit Nybble... » 🔍

Le contenu du kit et l’emballage sont susceptibles d’être modifiés au fur et à mesure de l’amélioration du produit. Les espaces de noms restent cohérents tout au long de ces instructions.

![](/files/-M1VUV_UeqaWI2rElvaS)

## 2.1. Détacher les pièces du corps des planches en bois

Des résidus de résine provenant de la découpe au laser peuvent subsister sur les pièces en bois. Nettoyez les planches en bois à l’aide d’un chiffon humide.&#x20;

Les pièces sont fixées aux planches en bois par des languettes prédécoupées. Afin d’éviter d’endommager les pièces en bois, nous vous recommandons d’utiliser un cutter pour découper le verso des languettes, où les fibres de bois sont perpendiculaires à celles en surface. Ne détachez pas les pièces à la main.&#x20;

Après avoir détaché toutes les pièces, vous pouvez plier et casser ce qui reste des planches, pour mieux comprendre les propriétés physiques du contreplaqué (anisotropie, élasticité, etc.). Vous serez ainsi plus sûr de vous lors des manipulations à venir.&#x20;

## 2.2. Enlever les échardes

Utilisez l'éponge abrasive pour ôter les éventuelles échardes des pièces en bois. Ne poncez pas trop pour ne pas endommager l’étanchéité des articulations.

## 2.3. Vis

5 types de vis sont utilisés dans ce kit. Comme illustré ci-dessous, elles ont chacune une couleur différente en fonction de leur emplacement. Toutes les vis ne sont pas nécessaires pour l’assemblage de Nybble. Les trous des pièces en bois ne sont pas tous destinés à recevoir des vis. Regardez attentivement [les vidéos d’assemblage](https://www.youtube.com/playlist?list=PLHMFXft_rV6MJ-BhDN-O5I_u4YeAie30n) pour savoir où les placer.

![](/files/-LzqSHAqZPRaRf-a3MBg)

●      A sert à fixer les servo-bras. D (bout pointu) sert à attacher les servomoteurs au corps. Les vis A et D se trouvent dans la pochette d’accessoires de chaque servomoteur, avec les servo-bras en plastique.

●      B sert à fixer les servo-bras/circuit imprimés au corps.&#x20;

{% hint style="info" %}
Afin de simplifier le contenu du kit, cette vis pourrait être remplacée par C dans les versions ultérieures. Dans ce cas, si le trou est trop étroit pour le bout plat de la vis C, [utilisez la vis D pour pré-tarauder](https://www.youtube.com/watch?v=7KNJH10IEIw\&feature=youtu.be).&#x20;
{% endhint %}

●      C (bout plat) sert à fixer les cuisses.

●      E (vis la plus longue) sert à attacher le porte-piles.

Pour les kits plus anciens, B, C et E se trouvent dans la planche en bois qui contient les pattes, à l’intérieur des blocs percés (voir ci-dessous).

![](/files/-LzqSMr7JII0_hYV1cP_)

## 2.4. Ressorts

Ce kit comprend trois types de ressorts : F, G et H.

●      Le gros ressort F assure l’élasticité entre les cuisses. Une pièce de rechange est fournie.

●      Le petit ressort rigide G sert pour le cou.

{% hint style="info" %}
&#x20;Il est remplacé par le ressort F dans les versions ultérieures.
{% endhint %}

●      Le petit ressort souple H sert à attacher le porte-piles.

## 2.5. Servomoteurs

Nous avons récemment changé de fournisseur de servomoteurs. Auparavant, les MG92B étaient utilisés pour les articulations des quatre épaules, tandis que les MG90D étaient utilisés pour les autres articulations.

Les nouveaux servomoteurs disposent de fils plus longs. Des fils plus courts sont utilisés pour les articulations du cou, de la queue et des quatre épaules. Les fils plus longs sont utilisés pour l’articulation de la tête et des quatre genoux.&#x20;

![](/files/-M1VUitYNL9keUB8wgpc)

{% hint style="info" %}
Les amateurs de servomoteurs remarqueront quelques différences.

Dans le kit Nybble, nous utilisons des engrenages métalliques ODMed, un PWM numérique, des servomoteurs à haut voltage avec roulement et des moteurs avec cœur en acier brossé. D’autres servomoteurs peuvent également fonctionner avec le système OpenCat, mais nécessiteront sans doute plus d’essais et d’erreurs pour fonctionner correctement.
{% endhint %}

|   Pièce   |   Signal   | Protocole |          Voltage          |   Moteur   | Roulement |
| :-------: | :--------: | :-------: | :-----------------------: | :--------: | :-------: |
| Plastique | Analogique |    PWM    |             5V            |   Brossé   |   Aucun   |
|   Métal   |  Numérique |   Série   | Haut voltage (jusqu’à 8V) |  Sans cœur |    Oui    |
|           |            |           |                           | Non brossé |           |


# 3 🏗 Assembler le corps

« Le tout est plus que la somme de ses parties. » 🔩

## 3.1. Tête et cou

### 3.1.1. Liste des pièces

![](/files/-M1VlmDMy34eZmPe-2sx)

### 3.1.2. Préparer le capteur d’ultrasons

{% hint style="warning" %}
L’algorithme d’évitement d’obstacles, qui fonctionne avec le capteur d'ultrasons, n’est pas encore intégré au code. L’installation ci-après est un bon point de départ mais n’est pas obligatoire.&#x20;
{% endhint %}

Le capteur est connecté au NyBoard à l’aide d’un fil à quatre broches.

* **Souder la LED au capteur d’ultrasons (optionnel)**

Cette LED RVB peut être soudée aux quatre broches du capteur d’ultrasons (voir les [instructions](https://github.com/PetoiCamp/OpenCat/blob/master/Resources/Nybble_SolderingUltrasound.pdf)) pour indiquer son statut, ou peut être programmée comme lumière décorative.

Pliez les broches du capteur d'ultrasons pour les installer ultérieurement.&#x20;

![](/files/-LzqYVfruCS2nXrLZ-6s)

* **Souder les quatre broches de l’embase du capteur d'ultrasons au NyBoard**&#x20;

Le capteur d’ultrasons est connecté aux broches GPIO apparentes situées sur le côté opposé du circuit imprimé du connecteur TTL. Vous pouvez personnaliser les définitions des broches dans **OpenCat.h**. Pour les définitions par défaut, soudez l’embase de connexion du capteur d’ultrasons dans les trous « D8 D9 D10 GND » comme indiqué ci-dessous.

![](/files/-M1Vlvfnk3DfKjgwbr3w)

### 3.1.3. Découper les servo-bras pour fixer les servomoteurs&#x20;

![](/files/-M1Vm0wpYn6GWZi6VxWO)

La plupart des servo-bras du modèle sont conçus à partir du bras I en croix. Pour vous entraîner, vous pouvez commencer à couper les côtés les plus longs des bras qui ne seront pas utilisés.&#x20;

Vous pouvez également chauffer la lame d’un couteau pour couper les pièces en plastique. Prévoyez un peu de marge, car le bord du plastique fondu sera arrondi.

{% hint style="info" %}
Notez la différence de largeur entre les deux longs côtés des servo-bras I, et repérez bien la zone de découpe (les trous des vis servent de repères).&#x20;
{% endhint %}

Comme nous avons changé de fournisseur de servomoteurs, les servo-bras ont également changé légèrement (comme indiqué ci-après). Pour éviter toute confusion, le servo-bras I peut être utilisé pour la plupart des articulations s’il est coupé de manière appropriée. Le servo-bras K est utilisé pour la queue, tandis que le servo-bras J peut être mis de côté.&#x20;

![](/files/-M1Vm7uxdNnbFvHHsyZD)

### 3.1.4. Assembler la tête&#x20;

N’assemblez que partiellement la tête pour pouvoir la calibrer plus tard. Dans le cas contraire, il sera particulièrement difficile d’insérer le servomoteur entre les pièces du cou. Observez comment le fil électrique est disposé par rapport à la tête. Suivez les instructions de la [vidéo pour assembler les éléments de la tête](https://www.youtube.com/watch?v=pYvfG2Zmowc\&feature=youtu.be).

![](/files/-LzqZXj70buMB2kx72H5)

![](/files/-LzrBQzZkNliUc15A9-M)

![](/files/-Lzr9GTr6ea0WvIpCf3P)

{% hint style="warning" %}
NE CONNECTEZ PAS la tête au cou avant d’avoir calibré le mécanisme d’inclinaison du servomoteur de la tête.
{% endhint %}

## 3.2. Corps

### 3.2.1. Liste des pièces

* NyBoard uniquement

Notez que sans le Raspberry Pi, le NyBoard est fixé sur le dessous de y1, les branchements des servomoteurs placés vers le bas. Dans les versions ultérieures, la pièce y1 est conçue pour être symétrique afin que les deux extrémités disposent de deux trous de vis.

![](/files/-M1VmFyGaw2fisp2IRSU)

* NyBoard avec Raspberry Pi

Utilisez y1Pi pour remplacer y1 et ajoutez le support pour Pi. Soyez attentifs à l’emplacement des pièces roses. Avec le Raspberry Pi, le NyBoard est monté sur y1Pi.

![](/files/-M1VmM4li8Wai_iAevCY)

{% hint style="warning" %}
Dans les versions antérieures du NyBoard, le fabricant utilisait des broches de cavalier plus grandes que prévues, rendant nécessaire le pliage des broches ou la modification du NyBoard afin d’y placer un Pi et d’utiliser le Pi Stand. Ci-joint une liste des solutions trouvées sur le forum : <https://www.petoi.com/forum/clinic/placement-of-raspberry-pi-3b>
{% endhint %}

* Autres régulateurs

Cinq écrous de 6,4 mm sont également inclus pour monter d’autres circuits imprimés.&#x20;

### 3.2.2. Fixer le porte-piles ajustable sur le ventre

Pliez la charnière du porte-piles à 90 degrés pour qu’elle forme un L. L’extrémité doit être le long de la paroi externe du porte-piles (voir photo). La charnière fonctionne comme un interrupteur. Insérez la longue vis E dans le rivet pour une manipulation simplifiée. Insérez le rivet dans le trou du porte-piles en poussant, comme indiqué sur la photo. Soyez attentifs à l’emplacement des trous.&#x20;

![](/files/-LzrFaCaol29HIcDuCQ8)

Les ressorts du porte-piles servent à modifier le centre de gravité pendant la mise au point des allures de Nybble.&#x20;

{% hint style="warning" %}
Le porte-piles est prévu pour des piles standard AA (1.5 V). Cependant, Nybble fonctionne avec des piles rechargeables lithium-ion 3.7 V.
{% endhint %}

### 3.2.3. Assembler le corps

Soyez attentifs aux longues broches du récepteur infrarouge et du port FTDI. Elles sont conçues pour être pliées dans un certain sens.  Ne pliez pas les broches trop souvent pour ne pas fatiguer le métal. Si vous souhaitez monter le Raspberry Pi, imprégnez-vous de la [configuration adaptée](https://www.youtube.com/watch?v=0T1K5_oxFUM\&feature=youtu.be).

![](/files/-M1VW8Q3ILj2lU_5kNLH)

Assemblez le corps comme dans la [vidéo](https://www.youtube.com/watch?v=B8N2KAf8p28\&feature=youtu.be).

{% hint style="info" %}
Il est possible que la colonne soit plus épaisse que la fente de l’épaule. Commencez par l’insérer de l’extérieur pour compresser l’embout et élargir la fente, puis insérez-la de l’intérieur.&#x20;
{% endhint %}

![](/files/-M1VWJEmQEQAFYRV1K2k)

## 3.3. Pattes

### 3.3.1. Liste des pièces

![](/files/-M1VmTvvsVUOsnAq-eff)

### 3.3.2. Attacher le caoutchouc au bout des pattes&#x20;

Le bout dentelé des pattes est immédiatement fonctionnel pour la marche. L’ajout du caoutchouc est optionnel. Il sert à réduire les frottements et à amortir chaque pas.&#x20;

![](/files/-Lzwlfw6ZdJY605tLXrl)

### &#x20;3.3.3. Insérer les servomoteurs dans la fente des pattes&#x20;

Vous devez prendre en compte la direction dans laquelle le fil est tordu. La petite entaille sur le long côté est prévue pour accueillir le fil. Les quatre pattes doivent être symétriques. Suivez la [vidéo d’assemblage](https://www.youtube.com/watch?v=OFdNQe9975Y\&feature=youtu.be) pour assembler la patte.&#x20;

{% hint style="warning" %}
N’INSTALLEZ PAS la vis A du servomoteur pour l’instant.&#x20;
{% endhint %}

## 3.4. Cuisses

### 3.4.1. Liste des pièces

![](/files/-M1VmaFJwv2IkjPbPnkU)

Dans les versions ultérieures, nous utiliserons des pièces en plastique pour cuisse2.

![](/files/-LzvKW2AEidrM7vnKIvm)

### 3.4.2. Découper les servo-bras pour fixer les servomoteurs.&#x20;

La zone de découpe est indiquée dans la section [Tête et cou](https://app.gitbook.com/@petoi-1/s/nybble/~/drafts/-M1Ph90v2SVpBLwY8hKG/v/francais/chapter3#3-1-tete-et-cou). La partie découpée du servo-bras la plus étroite doit être insérée dans le ressort F.&#x20;

### 3.4.3. Assembler les cuisses&#x20;

Avant de fixer les cuisse1 et cuisse2, glissez le fil électrique à travers la fente située au milieu de chacune d’elles. Les quatre pattes doivent être symétriques.

![](/files/-M1l2tI6n9fvbLNPScIe)

Une fois que cuisse1 et cuisse2 sont vissées ensemble, le servo-bras doit coulisser dans la glissière de cuisse2 avec une légère friction. Vous pouvez régler la friction en serrant ou desserrant la vis C. Pour mieux contrôler la friction :

* Grattez la glissière avec un tournevis plat pour réduire la friction.&#x20;
* Pour augmenter la friction, appliquez un peu de colle à papier dans la glissière et laissez sécher.

Suivez les instructions de la [vidéo pour assembler la cuisse](https://www.youtube.com/watch?v=3dtiFp7v2ps\&feature=youtu.be).

{% hint style="warning" %}
NE VISSEZ PAS le cou et les pattes au servomoteur du corps pour l’instant.
{% endhint %}

## 3.5.  Queue

### 3.5.1. Liste des pièces

![](/files/-M1VmgJFwqiujN9h5jD3)

### 3.5.2. Assembler la queue

La vis D est située dans le troisième trou à partir du centre du servo-bras K. Soyez attentif à l’ordre dans lequel les pièces sont empilées. Le rouet (queue2) doit pouvoir tourner avec une légère friction et la queue devrait s’incliner faiblement.

![](/files/-LzvwogrOCGa2pl6dDiL)

Suivez les instructions de la [vidéo pour assembler la queue](https://www.youtube.com/watch?v=7QZRdKz2u_Y\&feature=youtu.be).

{% hint style="warning" %}
NE RACCORDEZ PAS la queue au corps pour l’instant.
{% endhint %}


# 4 ⌨️ Configuration

« Un vrai sac à puces ! »

## 4.1. NyBoard

### 4.1.1. Lire le manuel d’utilisation

Cherchez les informations de la version du NyBoard. Lisez le manuel d’utilisation pour [NyBoard V0\_1](https://github.com/PetoiCamp/OpenCat/blob/master/Resources/NyBoard/NyBoardV0_1.pdf) ou [NyBoard V0\_2](https://github.com/PetoiCamp/OpenCat/blob/master/Resources/NyBoard/NyBoardV0_2.pdf) en fonction de votre version.&#x20;

{% hint style="danger" %}
Attention, une mauvaise manipulation pourrait endommager votre NyBoard.
{% endhint %}

![](/files/-M1Zr4UPVIwxrNqGEQLY)

![](/files/-M1ZrTF3BB2FxeTeQfRm)

### 4.1.2. Régler le potentiomètre dans le sens horaire sur la tension la plus basse

{% hint style="success" %}
Depuis NyBoard V0\_2, nous fournissons un sélecteur de cavalier pour contourner le potentiomètre. Si vous utilisez les servomoteurs métalliques d'un kit Nybble standard, cette section peut être ignorée.
{% endhint %}

Une tension plus élevée augmenterait le couple des servomoteurs et la rapidité de déplacement de Nybble. Ce réglage présente cependant quelques inconvénients : il augmente la consommation d’électricité et l’usure des servomoteurs, réduit la durée de vie de la batterie et affecte la stabilité du circuit imprimé. Selon mes tests, le 5.5 V semble assurer une performance équilibrée.

Lors de la première installation, ne vissez pas le NyBoard car il vous faudra peut-être l’enlever pour régler le potentiomètre. Avant de calibrer plus précisément, assurez-vous que tous les servomoteurs pivotent correctement dans des conditions normales de fonctionnement.&#x20;

### 4.1.3. Régler le commutateur I²C (SW2) sur Ar

Le commutateur I²C change le maître des dispositifs du bus I²C (gyroscope/accéléromètre, pilote des servomoteurs, EEPROM externe). Le réglage par défaut « Ar » du NyBoard utilise l’ATmega328P comme puce maîtresse. Avec « Pi », le NyBoard utilise des puces maîtresses externes connectées via les ports I²C (SDA, SCL).

{% hint style="warning" %}
Parfois, si vous ne pouvez pas passer par la phase de démarrage, il se peut que vous ayez accidentellement réglé l'interrupteur sur « Pi ».&#x20;
{% endhint %}

### 4.1.4. Ajuster NyBoard pour des performances optimales

NyBoard est conçu pour deux types de servomoteurs. Ceux en métal, et ceux en plastique (dans le cas des robots à monter soi-même). Les servomoteurs en plastique ne supportent pas une tension supérieure à 6 V. Un régulateur de tension est donc prévu pour le NyBoard. Le régulateur est calibré pour une puissance maximale de 5 A, qui ne peut être atteinte qu’après de multiples réglages et une mise au point minutieuse.&#x20;

Lorsque le NyBoard fonctionne avec des servomoteurs en métal, quelques réglages sont nécessaires pour des performances optimales. Le NyBoard\_V0\_1 nécessite quelques soudures, suivez les instructions de ce [post sur le forum](https://www.petoi.com/forum/hardware/reconfigure-nyboard-v0-1-for-pro-users). Pour le NyBoard\_V0\_2, vous pouvez connecter le commutateur de cavalier SW3 entre BATT et V\_S. (Pour des raisons de sécurité, lorsque les servomoteurs sont en plastique, le NyBoard est livré avec un SW3 pour connecter BATT et V+)

{% hint style="warning" %}
V\_S correspond à la mise sous tension des servomoteurs. Le commutateur de cavalier alimente les servomoteurs (V\_S) via le régulateur de tension (V+) ou directement via la batterie (BATT). Ne connectez jamais BATT et V+ directement.
{% endhint %}

{% hint style="info" %}
Il s'avère que le NyBoard fonctionne de manière plus stable lorsque les servomoteurs à engrenages métalliques sont alimentés directement par BATT plutôt que par V+. Cependant, si vous utilisez NyBoard pour piloter vos propres servomoteurs à engrenages en plastique, vous devez utiliser le circuit abaisseur.
{% endhint %}

## 4.2. Téléchargements et installations

{% hint style="info" %}
Vous aurez besoin de la dernière version de l’IDE Arduino pour définir l’environnement. Les versions antérieures compilent des fichiers hex plus volumineux qui pourraient excéder les capacités de la mémoire.&#x20;
{% endhint %}

Si auparavant vous avez ajouté d’autres bibliothèques logicielles et que le message d’erreur « XXX library is already installed » s’affiche, il vaut mieux les supprimer d’abord (Marche à suivre : <https://stackoverflow.com/questions/16752806/how-do-i-remove-a-library-from-the-arduino-environment>). En raison des différentes configurations d’installation de l’IDE Arduino, si des messages d’erreur concernant des bibliothèques manquantes s’affichent plus tard pendant la compilation, cherchez simplement sur Google comment les installer sur votre IDE.

### 4.2.1. Installer avec le gestionnaire de bibliothèques

Allez dans le gestionnaire de bibliothèques de l’IDE Arduino (Marche à suivre : {<https://www.arduino.cc/en/Guide/Libraries>), cherchez et installez

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

### 4.2.2. Installer avec la bibliothèque ZIP

Allez sur <https://github.com/jrowberg/i2cdevlib>, téléchargez le fichier zip et dézippez-le. Avec Git, vous pouvez aussi cloner le dépôt entier.

![](/files/-Lztj-3xI3HwaacLQzIw)

Utilisez **Add .ZIP Library** pour trouver **Arduino/MPU6050/** et **Arduino/I2Cdev/**. Cliquez sur les dossiers et **ajoutez-les un par un**.​ Ils n’ont pas nécessairement besoin d’être des fichiers **.ZIP**.&#x20;

![](/files/-LztjW6U6UUIDZeeXib-)

![](/files/-LztjeVZiNzDdDIdaNC2)

### 4.2.3. Ajouter l’assistance de NyBoard à l’IDE Arduino (un grand merci à [A-Ron](https://github.com/asmagill) !)

![](/files/-LztkFjO9z1b8E8luG4A)

1. Ouvrez la fenêtre **Preferences...**
2. Dans le champ **Additional Boards Manager URLs**, ajoutez **<https://raw.githubusercontent.com/PetoiCamp/OpenCat/master/Resources/NyBoard/boardManager/package\\_petoi\\_nyboard\\_index.json>**. Si des URL sont déjà listées dans ce champ, séparez-les par des virgules ou cliquez sur l’icône à côté du champ pour ouvrir l’éditeur et ajouter l’URL sur une nouvelle ligne.
3. Fermez l’éditeur **Additional Boards Manager URLs**, puis cliquez sur OK pour fermer la fenêtre **Preferences**.
4. Pour ouvrir la fenêtre **Boards Manager...** cliquez sur **Tools -> Board: XXXX -> Boards Manager...**&#x20;
5. Saisissez **NyBoard** dans le champ **Filter your search...**
6. Sélectionnez l’entrée et cliquez sur **Install.**
7. Cliquez sur **Close.**
8. Sélectionnez **ATmega328P (5V, 20 MHz) NyBoard** depuis le menu **Tools -> Board: XXXX** (NyBoardV0\_1 et NyBoardV0\_2 utilisent les mêmes paramètres dans Board).

### 4.2.4.     Installation manuelle&#x20;

{% hint style="warning" %}
Seulement si la méthode précédente échoue
{% endhint %}

●      Localisez le fichier **boards.txt**

**Sous Mac** :

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

**Ou** :     &#x20;

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

Faites un clic droit sur Arduino.app et sélectionnez Show Package Contents.

**Sous Windows** :

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

ATTENTION : Si vous avez installé l’IDE Arduino via Microsoft Store, il est probable que vous n’ayez pas accès au dossier où les fichiers de configuration essentiels sont stockés. Le plus simple est de désinstaller l’IDE et de le télécharger/réinstaller directement depuis [https://www.arduino.cc](https://www.arduino.cc/).

**Sous Linux**&#x20;

Si vous téléchargez depuis le terminal ou le gestionnaire de logiciels, vous n’aurez peut-être pas la dernière version (ce qui peut poser problème). Téléchargez la dernière version sur le site d’Arduino : <https://www.arduino.cc/en/Main/Software>

Dézippez le dossier et utilisez le programme `sudo install.sh`

Les fichiers boards.txt sont stockés :

Pour Fedora : boards.txt est symlinké sous :

/etc

Pour Arch :

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

Pour Mint :

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

Pour Ubuntu (version 18.04 lors de l’installation avec `apt-get install arduino`) :&#x20;

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

Après avoir localisé **boards.txt**:

●      Faites une copie de vos fichiers **boards.txt** pour pouvoir revenir en arrière.

●      Créez de nouveaux **boards.txt**.

Vous pouvez télécharger mes fichiers [**boards.txt**](https://github.com/PetoiCamp/OpenCat/blob/master/Resources/NyBoard/boards.txt), ou :

Modifier vos fichiers **boards.txt** avec les droits d’administrateur. Trouvez la section&#x20;

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

et insérez&#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
## --------------------------------------------------
```

le bloc de code dans la section Arduino Pro ou Pro Mini comme indiqué ci-dessous. Enregistrez puis fermez l’éditeur.

```
##############################################################
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
## --------------------------------------------------
```

●      Téléchargez le chargeur d’amorçage (bootloader) [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) et enregistrez-le dans votre dossier Arduino ./bootloaders/atmega/. Notez la présence d'autres chargeurs d’amorçage avec l’extension .hex dans le dossier de sauvegarde.

Redémarrez votre IDE Arduino. Cliquez sur **Tools->Boards** et sélectionnez Arduino Pro ou Pro Mini. Vous trouverez l'ATmega328P (5 V, **20** MHz) dans le menu Processor.

![](/files/-LztkRqK4iSyaCppHrIg)

{% hint style="info" %}
Si vous ne trouvez pas la carte, il se peut que le chemin d’accès des boards.txt soit différent. Recherchez les fichiers boards.txt dans l’ensemble des dossiers de votre ordinateur pour le retrouver.
{% endhint %}

### 4.2.5. Flasher le chargeur d’amorçage&#x20;

{% hint style="warning" %}
Uniquement si le chargeur d’amorçage du NyBoard ne fonctionne pas
{% endhint %}

●      [Qu’est-ce qu’un chargeur d’amorçage ?](https://www.arduino.cc/en/Hacking/Bootloader?from=Tutorial.Bootloader)

Avant l'expédition, chaque NyBoard est soumis à des contrôles de fonctionnalité, de sorte à être équipé d'un chargeur d’amorçage compatible. Il n’est pas exclu que le chargeur d’amorçage soit défaillant, empêchant ainsi le chargement du programme avec l’IDE Arduino.

Toutefois, il est important de noter que le chargeur d’amorçage n’est pas nécessairement la cause des échecs du chargement :

* Il se peut que votre carte USB détecte une forte consommation d’électricité provenant d’un périphérique et désactive l'ensemble des ports USB. Vous devrez alors réinitialiser la connexion USB ou redémarrer votre ordinateur ;
* Installez le pilote de l’adaptateur FTDI USB 2.0 to UART ;
* Vous n’avez pas sélectionné le bon port USB ;
* Mauvais contacts ;
* Pas de chance pour cette fois-ci. Réessayez ultérieurement ! &#x20;

Si vous souhaitez flasher de nouveau le chargeur d’amorçage :

![](/files/-Lztl16lKjZY1iQ83ajL)

* Cliquez sur l'onglet **Tool** de l’IDE Arduino et sélectionnez le processeur **ATmega328P (5V, 20 MHz)**.
* Select your ISP (In-System Programmer). La capture d'écran ci-dessus présente les deux programmeurs les plus courants : le chargeur d’amorçage bon marché **USBtinyISP** (surligné en bleu), et **Arduino as ISP,** qui a l’avantage de fonctionner avec un [Arduino ISP classique](https://www.arduino.cc/en/Tutorial/ArduinoISP) !
* Connectez le programmeur au port SPI de NyBoard. Notez la direction lors de la connexion. Veillez à ce qu'ils soient correctement connectés.
* Flashez le chargeur d’amorçage. Si vous le faites pour la première fois, attendez patiemment que toutes les barres de progression atteignent 100 % et qu'aucun autre message n'apparaisse dans la minute qui suit.

### 4.2.6. Connecter l’adaptateur FTDI

L'image suivante montre deux circuits FTDI classiques.

![](/files/-LztlKH-y7dh2bt-yF5H)

Sur le circuit intégré rouge, réglez le cavalier de sélection de tension à 5 V (et non 3.3 V) sur l'adaptateur d’Arduino. Faites correspondre la broche GND sur l'adaptateur et sur la prise 6 broches du NyBoard.&#x20;

![](/files/-LztmnWoHhPz0039KlcW)

![](/files/-Lztna2R_dI864XK_KDt)

Connectez l’adaptateur FTDI (le module rouge avec 6 broches mâles) à votre ordinateur via un câble USB vers mini USB. L’adaptateur dispose de trois LED : une pour l’alimentation, et deux autres pour Tx et Rx. Une fois la connexion établie, Tx et Rx clignotent pendant une seconde pour signaler la communication initiale, puis s’éteignent. La LED d’alimentation quant à elle, reste allumée. Vous trouverez un nouveau port dans **Tool->Port** “/dev/cu.usbserial-xxxxxxxx” (Mac) ou “COM#” (Windows).

Sous Linux, une fois l’adaptateur connecté à votre ordinateur, vous verrez le port série « **ttyUSB#** » apparaître dans la liste. Il est toutefois possible qu'une erreur de port série survienne lors du chargement. Il vous faudra alors autoriser le port série. Pour ce faire, cliquez sur le lien ci-dessous et suivez les instructions : <https://playground.arduino.cc/Linux/All/#Permission>

![](/files/-LztnwUObRVbQJWa8q1O)

Si Tx et Rx restent allumées, cela signifie que la connexion USB ne fonctionne pas correctement. Vous ne verrez donc pas le nouveau port s'afficher. Ce problème est généralement causé par la protection contre les surintensités de votre ordinateur. Il survient lorsque le NyBoard n'est pas branché à une source d'alimentation externe et que les servomoteurs fonctionnent tous en même temps.&#x20;

Dans les versions ultérieures, la version de l’adaptateur FTDI peut être différente. Vérifiez les marques sur la puce et connectez-la correctement sur le NyBoard.

### 4.2.7. Connecter le Bluetooth à l’adaptateur (optionnel)

Vous pouvez programmer et communiquer avec Nybble via Bluetooth. Pour en savoir plus, consultez les [instructions de paramétrage du Bluetooth](https://www.petoi.com/forum/hardware/add-bluetooth-module-for-uploading-sketches-and-communication) sur le forum OpenCat (PetoiCamp). Vous pouvez également contrôler Nybble avec une [application smartphone](https://github.com/codeandrobots/codeandrobots-app) ou une [API Web](https://www.petoi.com/forum/software/web-api-to-control-nybble-opencatweb) !

### 4.2.8. Télécharger le pack OpenCat

* Téléchargez un nouveau ​dépôt OpenCat sur GitHub : <https://github.com/PetoiCamp/OpenCat>. Il est recommandé d'utiliser la fonction de contrôle de version de GitHub. Si ce n’est pas le cas, assurez-vous que le DOSSIER **Nybble** est bel et bien complet après chaque téléchargement. Les codes doivent tous être de la même version pour pouvoir fonctionner ensemble.&#x20;
* Vous trouverez plusieurs codes testX.ino dans le dossier **ModuleTests**. Vous pouvez les charger pour tester les modules séparément. Ouvrez le programme testX.ino de votre choix (avec le préfixe « test »). (Je vous recommande d'utiliser **testBuzzer.ino** comme premier programme de test)
* Sélectionnez la carte **Arduino Pro ou Pro Mini** et compilez. Aucun message d’erreur n’est sensé apparaître. Chargez le programme sur votre carte, Tx et Rx devraient clignoter rapidement. Lorsque les LED cessent de clignoter, une série de messages doit apparaître dans le moniteur série. Assurez-vous que le paramétrage du débit en bauds (57 600) et de la fréquence de la carte (16 MHz ou 20 MHz) correspondent à la configuration requise.
* En cas d’invites de saisie, veillez à bien définir « No line ending », faute de quoi les fonctions d'analyse ne fonctionneront pas correctement à cause des caractères invisibles « \n » ou « \r ». &#x20;

![](/files/-LztokF8qCuAOD6L4Sui)

Pour les machines sous Linux, le message d’erreur suivant peut apparaître :

![](/files/-M-sk6FtNjGKvlhDhWlJ)

Ainsi, vous devrez ajouter le privilège de lancement à avr-gcc pour compiler le programme Arduino :`sudo chmod +x filePathToTheBinFolder/bin/avr-gcc`

Vous devez également ajouter l’autorisation de lancement de **tous les fichiers** dans /bin, afin que la commande ressemble à : `sudo chmod -R +x /filePathToTheBinFolder/bin`

## 4.3. Utiliser l’IDE Arduino comme interface

Avec l’adaptateur FTDI vers USB qui connecte le NyBoard et l’IDE Arduino, vous disposez de la meilleure interface pour communiquer avec le NyBoard et y modifier jusqu’au dernier octet.&#x20;

J’ai configuré un ensemble de protocoles de communication série pour NyBoard :&#x20;

![](/files/-M1VXmSyiSI0rP--RucX)

Tous les jetons (token) commencent avec un seul caractère codé ASCII pour définir le format d'analyse. Ils sont sensibles à la casse et généralement en minuscules.&#x20;

{% hint style="warning" %}
Certains jetons ne sont pas encore disponibles, comme « h ». Les jetons « i » et « l » occasionnent encore quelques bugs.
{% endhint %}

## 4.4. Utiliser le port série Raspberry Pi comme interface&#x20;

{% hint style="warning" %}
Seulement si vous utilisez Pi comme contrôleur maître. Nybble n’a pas besoin d’un Raspberry Pi pour fonctionner.
{% endhint %}

![](/files/-LzwBRTB2HzgVmsZ_0sw)

Comme indiqué dans le protocole série, les arguments des jetons pris en charge par le moniteur série de l’IDE Arduino sont tous codés en chaînes de caractères ASCII afin de les rendre visibles. Alors qu'un ordinateur pilote (un RasPi par exemple) supporte des commandes supplémentaires, qui sont le plus souvent en chaînes binaires pour un codage plus efficace. Par exemple, lors du codage d’un angle de 65 degrés :

* Ascii : il faut deux octets pour stocker les caractères Ascii « 6 » et « 5 ».
* Binaire : prend un octet pour stocker la valeur 65, correspondant au caractère Ascii « A ».

{% hint style="info" %}
Qu'en est-il de la valeur - 113 ? Elle prend quatre octets comme chaîne Ascii, mais ne prend toujours qu'un octet en codage binaire, bien que le contenu ne soit plus imprimable en tant que caractère.&#x20;
{% endhint %}

De toute évidence, le codage binaire est beaucoup plus efficace que la chaîne Ascii. Cependant, le message transféré ne sera pas directement lisible à l’œil. Dans le dépôt OpenCat, j'ai mis un script Python ardSerial.py qui peut gérer la communication série entre le NyBoard et le Pi.

### 4.4.1. Configurer le port série Raspberry Pi

Dans le terminal du Pi, saisissez `sudo raspi-config`

Dans les options de l'**Interface**, sélectionnez **Serial**. Désactivez le shell de connexion série et activez l'interface série.

{% hint style="info" %}
[Voici un tutoriel complet du site Instructables](https://www.instructables.com/id/Read-and-write-from-serial-port-with-Raspberry-Pi/)
{% endhint %}

Lorsque vous branchez Pi dans la prise 2x5 du NyBoard, leurs ports série sont automatiquement connectés à 3,3 V. Si ce n’est pas le cas, vérifiez les broches Rx et Tx de votre puce AI, ainsi que sa tension nominale. Le Rx de votre puce doit se connecter au Tx du NyBoard, et le Tx doit se connecter au Rx.

### 4.4.2. Modifier l'autorisation du [ardSerial.py](https://github.com/PetoiCamp/OpenCat/blob/main/serialMaster/ardSerial.py)

Si vous souhaitez l'exécuter comme une commande bash, il est nécessaire de le rendre exécutable :

`chmod +x ardSerial.py`

Il se peut qu’il faille changer la première ligne du chemin de votre binaire Python :

`#!/user/bin/python`

### 4.4.3. Utiliser **ardSerial.py** pour contrôler Nybble

{% hint style="warning" %}
Le NyBoard n’a qu’un seul port série. Pour pouvoir contrôler Nybble avec le port série Pi, vous devez DÉCONNECTER l’adaptateur FTDI.
{% endhint %}

Saisir`./ardSerial.py <args>` équivaut à saisir \<args> dans le moniteur série d’Arduino. Par exemple, `./ardSerial.py kcr` signifie « perform s**k**ill **cr**awl » (ramper).

Pour être à même de prendre en charge toutes les commandes série du protocole, l'**ardSerial.py** et la section d'analyse de **Nybble.ino** ont tous deux besoin de modules d'extension.

{% hint style="warning" %}
La capacité de mouvement est réduite lorsque Nybble est connecté à Pi ! Une batterie plus puissante est alors nécessaire.
{% endhint %}

En raison d’une consommation d’électricité plus importante avec Pi, Nybble aura plus de difficultés à effectuer des mouvements soutenus, comme le trot (le jeton du trot est `ktr`). Nybble est alimenté par deux piles 14500 en série. Vous pouvez toutefois trouver de meilleures alternatives d'alimentation, comme l'utilisation de batteries Lipo 7.4 à haut débit, ou 2S-18650. Il y a plusieurs paramètres à prendre en compte pour garantir la meilleure performance possible, tant au niveau des logiciels que du matériel. Au vu de la petite taille de Nybble, il est préférable de se servir d'une plateforme pour lancer le système de communication et l’arbre de comportement, plutôt que d'en faire une bête de course.

## 4.5. Alimentation électrique

Même si vous pouvez programmer le NyBoard directement avec l'adaptateur FTDI, une alimentation externe est nécessaire pour piloter les servomoteurs.&#x20;

Lorsque vous utilisez le FTDI en USB comme seule source d'alimentation, le condensateur des servomoteurs se charge puis se décharge. Si vous utilisez le NyBoard dans ces conditions, la LED jaune se mettra à clignoter. Cependant, la tension de l'USB n'est pas suffisante pour que les servomoteurs fonctionnent très longtemps. Les servomoteurs doivent être alimentés par des batteries externes afin de fonctionner correctement.

### 4.5.1. Voltage

Le NyBoard nécessite une alimentation externe de 7.4\~12 V pour que les servomoteurs fonctionnent. La valeur par défaut utilisée pour configurer l'ensemble des paramètres système de Nybble est de 8 V. Ce qui correspond en général à deux batteries Lithium-ion ou Lithium-polymère montées en série. Une seule batterie contient 4.2 V lorsqu'elle est complètement chargée et peut fonctionner normalement jusqu'à ce que la tension descende à 3.6 V. Ce qui équivaut à environ 7.2 V avec deux batteries montées en série. Avant l'installation, réglez le potentiomètre du NyBoard en le tournant dans le sens horaire pour atteindre la puissance minimale (environ 4.5 V) puis composez-le jusqu'à ce qu'il puisse faire fonctionner le robot correctement. Avec les servomoteurs inclus dans notre kit, la connexion directe de SW3 entre BATT avec V\_S fonctionne mieux et permet de contourner le régulateur de tension (et ainsi de ne pas régler le potentiomètre).&#x20;

Lorsque vous achetez des piles, prenez celles qui comportent les inscriptions « 14500, 3.7 V, lithium-ion non protégé ». Notez que la protection contre les surintensités de certaines piles peut être déclenchée par l’appel de courant de crête (habituellement > 2.5 A), ce qui peut entraîner la réinitialisation ou le dysfonctionnement du NyBoard. Privilégiez les piles avec un régime de décharge plus élevé.&#x20;

Consultez ce [post sur le forum](https://www.petoi.com/forum/clinic/report-your-batteries) pour connaître les piles compatibles avec Nybble.&#x20;

### 4.5.2. Dimensions

Le porte-piles est prévu pour des piles 14500, soit 14 mm de diamètre et 50 mm de longueur. Des piles de 51 mm peuvent aussi convenir. Ces piles ont la même taille que les piles AA, mais elles sont bien plus puissantes. **Par conséquent, elles ne doivent pas être utilisées dans des appareils standard qui fonctionnent avec du AA.** Pour les utilisateurs vivant aux États-Unis, nous avons testé les piles lithium-ion EBL 14500.&#x20;

Vous pouvez également fabriquer un porte-piles capable de supporter des piles plus larges. Cela peut s'avérer utile si vous montez un Raspberry Pi, ou pour augmenter la vitesse de Nybble.&#x20;

### 4.5.3. Branchement&#x20;

Veillez à bien respecter la polarité lors du branchement de l’alimentation électrique. Vérifiez que vous avez bien identifié le positif (+) et le négatif (-) sur la borne d'alimentation du NyBoard et sur votre source d’alimentation électrique.&#x20;

{% hint style="danger" %}
Inverser la polarité pourrait endommager le NyBoard **!**
{% endhint %}

Desserrez les vis du bloc d'alimentation. Insérez les fils du porte-piles puis resserrez les vis. Lorsque vous allumez l'interrupteur, la LED bleue (puce) et la LED jaune (servomoteur) s'allument.&#x20;

![](/files/-LztqFnUhE_fLlMU0afR)

### 4.5.4. La durée de vie de la pile dépend de l'utilisation&#x20;

La pile peut tenir des heures si vous ne faites que coder et effectuer des tests. En revanche, si vous faites fonctionner Nybble sans interruption, elle durera moins de 30 minutes.&#x20;

Lorsque la pile est faible, la LED jaune clignote lentement. Bien que le NyBoard puisse piloter un ou deux servomoteurs, il est très instable quand vous pilotez plusieurs servomoteurs à la fois. **Cela peut occasionner de fréquents redémarrages du programme ou une mauvaise coordination des articulations.** Dans de rares cas, piloter plusieurs servomoteurs à la fois peut engendrer un dysfonctionnement des bits de l'EEPROM. Il vous faudra alors télécharger et enregistrer à nouveau les codes et les constantes à rétablir.&#x20;

### &#x20;4.5.5. Recharge

Pour recharger vos piles, utilisez un chargeur intelligent compatible. Surveillez les piles lors de la recharge.&#x20;

### 4.5.6. Après utilisation

Pour éviter une décharge excessive, **retirez les piles du porte-piles après chaque utilisation**.&#x20;

### 4.5.7. Interférence du signal

Il est possible de connecter l’adaptateur FTDI et la pile en même temps. Vous pouvez rentrer les commandes série lorsque la pile est insérée. Notez que le port série USB peut se désactiver de façon aléatoire. Cela est dû à une consommation élevée des servomoteurs, le système de protection contre les surintensités de l'ordinateur s’enclenche alors et désactive le port USB. Si tel est votre ce cas, vous pouvez changer de port USB, réinitialiser le bus USB ou redémarrer l'ordinateur. Il est donc recommandé d'alimenter la carte en électricité avant de brancher l’adaptateur FTDI&#x20;


# 5 🔌 Brancher les fils électriques

« Tout est connecté. » 🤝

## 5.1. Plan des articulations

Les servomoteurs de Nybble connectés symétriquement aux broches PWM (MLI) sont comparables aux nerfs situés le long de la moelle épinière. Bien que Nybble n'ait pas de degré de liberté (DDL) pour le roulement des épaules, ces indices (4\~7) sont dédiés à la structure complète de l'OpenCat une fois assemblée.

![](/files/-M1Q0GdYhj81MFMWeeeD)

![](/files/-M1Q0YZ8aM0UrS4RZzpl)

{% hint style="info" %}
Les broches PWM du NyBoard V0\_1 et V0\_2 ne sont pas dans le même ordre, bien que la connexion aux servomoteurs reste la même. Tous les réglages s'effectuent par le biais du logiciel.&#x20;
{% endhint %}

Utilisez h pour la tête, t pour la queue, r pour l'articulation de l'épaule, s pour l'axe de l’articulation de l'épaule, k pour l'articulation du genou, F pour l'avant, H pour l'arrière, L pour la gauche et R pour la droite. Le plan complet des articulations de l’OpenCat est :&#x20;

![](/files/-M1Q1kLnY68D5mxMmppJ)

![](/files/-M1Q1oUhYNH5cWV1ee1w)

## 5.2. Brancher les servomoteurs

Référez-vous au modèle de connexion pour brancher correctement les servomoteurs aux broches PWM. Veillez à bien faire correspondre les fils. Le fil marron du servomoteur correspond au GND, tandis que les GND du NyBoard V0\_1 se situent le long de la ligne centrale. Ils sont inversés sur le NyBoard V0\_2.

![  (NyBoard V0\_1 avant)                            (NyBoard V0\_1 arrière)](/files/-LzuyCaI5UQ9IINbFLYz)

Contrôlez rapidement tous les fils marron : ils doivent passer au-dessus des deux autres fils. Pour NyBoard V0\_2, les fils jaunes doivent être au-dessus des deux autres fils.&#x20;

![NyBoard V0\_1](/files/-LzuyVgawhAOMGHGuNH3)

![](/files/-M1VY-gQl6W-FPoOV8z1)

{% hint style="warning" %}
Notez que l'emplacement des fils des servomoteurs reste le même pour le NyBoard V0\_2, bien que l’ordre des couleurs soit inversé.
{% endhint %}

![NyBoard V0\_2](/files/-Lzuym49Zmsm4EAeX_7U)

## 5.3. Connecter les fils

Après le calibrage, la résolution des problèmes et l'assemblage final, il est temps de connecter les fils électriques pour soigner l’apparence de votre Nybble. Sur votre Nybble, plusieurs emplacements sont prévus pour laisser passer les fils. N'hésitez pas à faire preuve de créativité lors de la connexion de vos futurs accessoires. Assurez-vous que les fils ne gênent pas le mouvement des servomoteurs.&#x20;

Vous trouverez ci-dessous l'organisation de mes fils.&#x20;

![](/files/-M1VY9Ds_pFMaDlOuIf1)

![NyBoard avec Raspberry Pi](/files/-LzuwaVYFLC1C6TvmDNM)

## 5.4. Connecter le capteur d’ultrasons

Si vous ne l'avez pas encore fait, branchez le fil à 4 broches, veillez à bien faire correspondre la couleur des fils et les signaux. Lorsque vous regardez Nybble dans les yeux, les connexions sont (de gauche à droite) :

| VCC | Trigger | Echo | Ground |
| :-: | :-----: | :--: | :----: |

Raccordez la seconde extrémité du fil à l'embase que vous avez soudée au début de l'assemblage à l’aide du tableau suivant.

| Côté capteur | Côté NyBoard |
| :----------: | :----------: |
|      Vcc     |      D8      |
|    Trigger   |      D9      |
|     Echo     |      D10     |
|      GND     |      GND     |


# 6 📐 Calibrage

« Un coup manqué, même de peu, reste un coup manqué ! » 🎯

{% hint style="info" %}
Le calibrage est indispensable au bon fonctionnement de Nybble.&#x20;
{% endhint %}

Jusqu'à présent, nous n'avons fait que préparer les pièces du corps, mais nous ne les avons pas encore vissées aux servomoteurs. Si les servomoteurs ne sont pas calibrés avant d'être fixés, ils peuvent tourner dans tous les sens et rester coincés, ce qui peut endommager les servomoteurs ou les pièces du corps.&#x20;

Le calibrage comporte quatre étapes :&#x20;

1. Écrire les constantes dans le tableau.
2. Mettre le circuit sous tension, laisser les servomoteurs tourner librement jusqu'à l'angle/état de calibrage nul.
3. Fixer les pièces du corps aux servomoteurs.
4. Régler les compensations dans le logiciel.&#x20;

Retrouvez [plus de détails à propos du calibrage](https://www.petoi.com/forum/basic-assembly-and-setup/the-logic-behind-calibration-process) sur le forum OpenCat.&#x20;

## 6.1. Définir les constantes

### 6.1.1. Il existe trois types de constantes à enregistrer dans le NyBoard :&#x20;

1. Les définitions relatives à l'assemblage, comme la correspondance des articulations, le sens de rotation et le brochage du capteur d’ultrasons. Elles sont relativement précises et l’essentiel est présenté dans **OpenCat.h**. Elles sont compatibles avec les robots à venir ;&#x20;
2. Les paramètres liés au calibrage, notamment les compensations du MPU6050 et le réglage des articulations, sont mesurés en temps réel et enregistrés dans l'EEPROM embarquée. Cette mesure ne s'effectue qu'une seule fois ;&#x20;
3. Les données relatives aux mouvements, comme les postures, la démarche et les comportements préprogrammés sont principalement définies dans **Instinct.h**. Il est également possible d’ajouter de nouvelles compétences personnalisées à votre Nybble !&#x20;

### 6.1.2. Charger et lancer **WriteInstinct.ino**.

**WriteInstinct.ino** écrit des constantes dans la mémoire morte embarquée ou I²C EEPROM et enregistre les valeurs pour le calibrage. Par la suite, le programme principal **Nybble.ino** l’écrasera.

Vous devez changer les options par défaut **\*** sur`#define NyBoard_V*_*` dans **Instinct.h** en fonction de la version de votre NyBoard. La version que vous utilisez est indiquée sur le côté gauche du terminal vert de la batterie.

Une fois le chargement de **WriteInstinct.ino** terminé, lancez le moniteur série. Plusieurs questions vous seront posées :

`Reset all joint calibration? (Y/n)`(Souhaitez vous réinitialiser tous les calibrages des articulations ?)

Si vous n’avez jamais calibré les articulations, ou si vous souhaitez les réinitialiser, saisissez « Y ». ATTENTION : le « Y » est sensible à la casse !

`Do you need to update Instincts? (Y/n)`(Avez-vous besoin de mettre à jour Instincts ?)

Si vous avez modifié Instinct.h de quelque manière que ce soit, saisissez « Y ». Cependant, une fois que vous aurez une meilleure compréhension du fonctionnement de la mémoire, vous verrez que ce n'est pas toujours nécessaire.&#x20;

`Calibrate MPU? (Y/n)`(Souhaitez-vous calibrer le microprocesseur ?)

Si vous avez déjà calibré le MPU6050, c’est-à-dire le capteur de l’accélérateur / du gyroscope, saisissez « Y ».

Il arrive que le programme s’interrompe à l’étape de connexion. Si tel est le cas, fermez puis lancez à nouveau le moniteur série ou appuyez sur le bouton de réinitialisation sur NyBoard pour le redémarrer.&#x20;

![](/files/-Lzv0rwEzTSjJ7uaVf8a)

## 6.2. Paramétrer le mode calibrage

L'état de calibrage correspond au point médian de la portée du servomoteur. Le calibrage des servomoteurs peut être fait dans **WriteInstinct.ino** ou **Nybble.ino**. En cas de problème avec les constantes, je vous recommande de le faire sous **WriteInstinct.ino**.&#x20;

Pour un calibrage efficace, branchez TOUS les servomoteurs et la batterie. Puis, saisissez « c » dans le moniteur série pour lancer le calibrage.  Les servomoteurs tourneront successivement à intervalles irréguliers avant de s’arrêter. Selon la direction initiale de l’arbre, certains pourront former des angles plus grands jusqu’à s’arrêter au point médian.  Le système d’engrenage des servomoteurs devrait alors faire du bruit. Référez-vous à la table de calibrage :

![](/files/-Lzv116AxfCllE3bDK1O)

La première ligne représente les indices d’articulation, la deuxième ligne correspond à leurs compensations de calibrage :&#x20;

| **Indice**       | 0  | 1  | 2  | 3  | 4  | 5  | 6  | 7  | 8  | 9  | 10 | 11 | 12 | 13 | 14 | 15 |
| ---------------- | -- | -- | -- | -- | -- | -- | -- | -- | -- | -- | -- | -- | -- | -- | -- | -- |
| **Compensation** | -1 | -1 | -1 | -1 | -1 | -1 | -1 | -1 | -1 | -1 | -1 | -1 | -1 | -1 | -1 | -1 |

Les valeurs de départ sont « -1 » ou « 0 » et devront être modifiées par un calibrage ultérieur.&#x20;

{% hint style="info" %}
Les servomoteurs possèdent un potentiomètre qui contrôle la variation de rotation. En position statique, ils génèrent une tension autour de l’angle de l’axe de sortie. Après une courte période d’utilisation, une vibration se fera sentir. Elle ne vous posera pas de problèmes en mouvement continu. Des servomoteurs de meilleure qualité peuvent vous éviter ce genre d’inconvénients, mais ils coûtent également 10 fois plus cher. &#x20;
{% endhint %}

## 6.3. Visser la tête, la queue et les jambes&#x20;

### 6.3.1. Coordonner le système

Une fois que vous avez saisi « c » et que tous les servomoteurs sont en position initiale, vissez les éléments précédemment préparés (tête, queue et pattes) au corps de votre Nybble. Ils devraient être perpendiculaires à la partie du corps qui leur est associée. Évitez de faire pivoter l’arbre du servomoteur pendant la procédure.&#x20;

La rotation des membres dans le sens antihoraire à partir de leur position initiale donnera une valeur positive (comme les coordonnées polaires). L’angle d’inclinaison de la tête est l’unique exception. Dans le cas d’une rotation dans le sens horaire, vous obtiendrez une position « tête haute » plus naturelle.&#x20;

![](/files/-M1QON73yHGe9NokbKve)

### 6.3.2. Comprendre les divisions d’angle

En regardant de plus près l’arbre du servomoteur, vous remarquerez qu’il contient plusieurs dents, qui servent à visser les servo-bras tout en évitant de glisser dans le sens de rotation. Dans l’exemple ci-dessous, les engrenages sont divisés en 20 secteurs sur 360 degrés, chacun de **18** degrés. Par conséquent, on ne peut pas toujours obtenir une installation perpendiculaire parfaite. Faites de votre mieux pour qu’ils soient le plus proche possible de la position initiale. Utilisez la vis A pour attacher les membres sur les servomoteurs.&#x20;

![](/files/-Lzv1X9p7IXl-AC3vLTW)

## 6.4. Trouver et sauvegarder les compensations de calibrage idéales

### 6.4.1. Régler précisément le calibrage dans le logiciel

La commande de calibrage est programmée comme suit `cIndex Offset`(référez-vous aux protocoles de communication série pour NyBoard). Vous remarquerez qu’il y a une espace entre l’Indice et la Compensation.&#x20;

Par exemple, `c8 6` signifie que le huitième servomoteur est compensé de 8 degrés. Trouvez la compensation qui rapprochera le plus possible le membre de sa position initiale.&#x20;

{% hint style="info" %}
Veuillez noter que si votre valeur de compensation absolue est supérieure à 9, alors le membre n’est pas vissé au plus près de sa position initiale. Par conséquent, la portée du servomoteur sera diminuée de chaque côté. Retirez le membre et faites-le pivoter d’une dent. La compensation sera plus petite et inversée.&#x20;
{% endhint %}

Par exemple, si votre valeur de calibrage est de -13, retirez-le membre, faites-le pivoter d’une dent et vissez à nouveau. Le nouveau calibrage devrait être de 5 sachant que le total doit systématiquement être de 18. Évitez de pivoter l'arbre du servomoteur pendant la procédure.&#x20;

![](/files/-M1VYMWha9gau7Mgyirw)

Une fois le calibrage effectué, n’oubliez pas d’enregistrer vos compensations en saisissant « s », sans quoi vos compensations seront perdues une fois le mode calibrage fermé. Il est également possible d’effectuer un enregistrement après le calibrage de chaque servomoteur.&#x20;

### &#x20;6.4.2. Équerre en « L »

En fonction de l’angle de vue, la perception ne sera pas la même. C’est pourquoi on lit directement au-dessus de la règle lorsque l’on mesure une longueur.&#x20;

Il est important de conserver une perspective parallèle lorsque vous calibrez Nybble. Pour éviter les erreurs de lecture, utilisez l’équerre en « L » comme point de repère parallèle. Alignez les extrémités de l’équerre avec le milieu des vis situées dans les articulations des épaules et des genoux et le petit trou sur le bout du pied. Regardez le long de l’axe parallèle aux centres. Pour chaque patte, calibrez d’abord les servomoteurs de l’épaule (indices 8\~11), puis les servomoteurs du genou (indices 12\~15). Lors du calibrage du genou, assurez-vous que votre alignement est parallèle en utilisant les trous triangulaires présents sur l’équerre et la patte.&#x20;

![](/files/-M1QRRceGDaemICEl0wN)

### 6.4.3. Validation

Une fois le calibrage terminé, validez en saisissant « d » ou « kbalance ». Les mouvements des membres de Nybble sont maintenant symétriques debout comme assis. &#x20;

![](/files/-M1VYV-xBqpjVOAaHK55)

### 6.4.4. Centre de gravité

Essayez de comprendre comment Nybble garde son équilibre même lorsqu’il marche. Si vous souhaitez ajouter de nouveaux accessoires sur Nybble, essayez de répartir au mieux la charge de chaque côté de la colonne. Il se peut que vous ayez besoin de pousser le porte-piles en avant ou en arrière afin de trouver le bon équilibre.&#x20;


# 7 🕹 Jouer avec Nybble

« Vous ne pouvez pas contrôler le vent, mais vous pouvez contrôler la voile. » ⛵️

## 7.1. Contrôler avec l’IDE Arduino

Essayez les commandes série suivantes dans le moniteur série :

* **« k**sit »
* **« m**0 30 »
* **« m**0 -30 »
* **« k**balance »
* **« k**tr »
* **« k**trL »
* **« d »**

{% hint style="warning" %}
Les guillemets indiquent que ce sont des chaînes de caractères. Ne saisissez pas les guillemets dans le moniteur série.
{% endhint %}

## 7.2. Contrôler avec la télécommande infrarouge

### 7.2.1. Schéma des touches

Seule la position des boutons compte, bien que ces symboles pourront vous aider à vous rappeler des fonctionnalités. Je vais définir les symboles associés aux positions pour me référer à ces touches.&#x20;

Je me sers des abréviations afin de réduire l’utilisation de la mémoire SRAM. Je change souvent les définitions pour m’amuser.&#x20;

{% hint style="warning" %}
Le schéma ci-dessous n'est qu'une illustration. Référez-vous à **String translateIR(){...}**  dans **Nybble.ino** pour obtenir les vraies définitions de touches. Tu peux également les personnaliser selon tes envies.
{% endhint %}

![](/files/-M1VYedtRgAVwbZq11Es)

### 7.2.2. Mouvements intégrés

* Le bouton **1** arrête les servomoteurs et éteint Nybble. Il est plus prudent de cliquer dessus si Nybble se comporte **bizarrement**. Vraiment. Il y a encore quelques zones d'ombre dans le système que je ne comprends pas totalement.&#x20;
* Le bouton **2** active la position debout statique. Nybble peut se coucher sur le flanc ou lever les pattes arrière et la queue. Testez son équilibre sur une surface en mouvement. En réalité l’équilibre est effectif dans la plupart des postures et démarches.
* Prenez Nybble par le milieu de la colonne et soulevez-le afin que ses pattes ne soient plus posées et qu’elles puissent bouger librement. Chaque bouton de la télécommande infrarouge correspond à une action, essayez-les tous. Placez ensuite Nybble sur une large surface plane et essayez-les à nouveau. La démarche et les gestes ne seront pas les mêmes, en fonction de la surface. Les petites jambes de Nybble ne sont pas faites pour marcher sur de la moquette. Mais il peut ramper dessus (commande **kcr**).&#x20;
* Vous pouvez baisser le porte-piles et le faire glisser dans le sens de la longueur du ventre. Le centre de gravité sera mieux défini pour une meilleure démarche. Si ce n’est pas fait, il risque de tomber régulièrement.
* Nybble est capable de monter ou descendre une pente légère (moins de 10 degrés)
* Si vous souhaitez que Nybble arrête l’action qu’il effectue, placez-le à la verticale comme un chat qu’on attrape par le cou.

{% hint style="info" %}

* Si Nybble émet toujours un bip après avoir exécuté **Nybble.ino**, avec des chiffres indiqués (autour de 500) sur le moniteur série, c’est que l’alarme de basse tension est déclenchée. Il vous faut alimenter NyBoard avec deux batteries Lithium-Ion / Lithium-Polymère de 3.7 V chacune pour que le test soit réussi.
* « FIFO overflow! Using last reading! » est une correction de l’algorithme d’origine MPU6050 du moniteur série. Ce n’est pas un bug.&#x20;
* Les servomoteurs ont été conçus pour être actionnés par des engrenages internes. Évitez de les faire pivoter trop rapidement par vous-même.&#x20;
* **N’utilisez pas Nybble pendant trop longtemps.** Le système électronique risquerait de surchauffer et la durée de vie des servomoteurs serait considérablement réduite. Il est pas possible de [reconfigurer NyBoard V0\_1](https://www.petoi.com/forum/hardware/reconfigure-nyboard-v0-1-for-pro-users) pour prolonger la durée de fonctionnement de Nybble.&#x20;
* Il peut arriver que le programme s’arrête en raison d’une variation de voltage. Vérifiez si la pile est faible (moins de 3.5 V chacune ou moins de 7 V en série). Appuyez sur le bouton de réinitialisation se trouvant sur le NyBoard pour redémarrer le programme.
* Nybble est acrophobe ! Si vous le soulevez et le faites tourner au-delà d'un certain degré, son mouvement actuel sera interrompu. Pour ne pas effrayer Nybble, ne le retournez pas !
* Soyez gentils avec Nybble comme avec un vrai chaton. (^=◕ᴥ◕=^)
  {% endhint %}


# 8 👨‍🏫 Apprendre de nouvelles compétences à Nybble

« Donnez du poisson à un chat, il mangera pendant une journée, apprenez-lui à pêcher et il mangera pour le restant de ses jours. » 🎣

## 8.1. Comprendre les compétences dans **Instinct.h**.

![](/files/-M1QV7Q1mCrmy_oIrSdE)

Un ensemble d'angles d'articulation définit une posture statique, tandis qu'une série d’ensembles définit un mouvement régulier, habituellement une démarche.

L’EEPROM est limitée à 1 000 000 cycles d’écriture. Je décide donc de minimiser les opérations d’écriture.

Il existe deux sortes de compétences : **Instincts** et **Newbility**. Les chemins sont tous deux écrits sur l’EEPROM embarquée (1 KB) dans la table de références, mais les données réelles sont stockées à différents emplacements de la mémoire :

* La mémoire I²C EEPROM (8 KB) stocke les **Instincts**.&#x20;

Les Instincts sont des compétences déjà programmées et perfectionnées. On peut les comparer à une « mémoire musculaire ». La plupart des Instincts sont écrits de manière linéaire une seule fois sur la mémoire I²C EEPROM avec WriteInstinct.ino. Leurs chemins sont générés et enregistrés dans la table de références sur l’EEPROM embarquée lors de l’exécution de WriteInstinct.ino.

* PROGMEM, (qui partage la mémoire vive 32 KB avec le programme) stocke la **Newbility**.&#x20;

Une Newbility est une nouvelle compétence expérimentale qui nécessite de nombreux tests. Elle n’est ni écrite sur l’I²C, ni sur l’EEPROM embarquée, mais elle est conservée sur la mémoire vive sous un format PROGMEM. Il doit être téléchargé comme le serait un composant d’un programme Arduino. Son chemin est également défini pendant l'exécution du code, bien que la valeur change rarement si le nombre total de compétences (y compris tous les Instincts et Newbilities) reste inchangé.

## 8.2. Exemple de code **Instinct.h**

```cpp
//a short version of Instinct.h as example

#define WalkingDOF 8
#define NUM_SKILLS 6
#define I2C_EEPROM
const char cr[] PROGMEM = { 
26, 0, -5,
 35, 37,-46,-53,-23,-32, -3, 12,
 40, 28,-42,-59,-24,-28, -4, 12,
 ...
 33, 39,-47,-51,-22,-32, -3, 11,
};
const char stair[] PROGMEM = { 
54, 0, 30,
 44, 90,-39,-38, 10,-32,-10, 32,
 45, 90,-32,-46, 16,-38,-16, 38,
 …
 43, 90,-44,-32,  6,-26, -6, 26,
};
const char pu1[] PROGMEM = { 
1, 0, 0,
  0,-30,  0,  0,  0,  0,  0,  0, 20, 20, 60, 60, 60, 60,-55,-55,};
const char pu2[] PROGMEM = { 
1, 0, 0,
  0, 10,  0,  0,  0,  0,  0,  0, 60, 60, 40, 40,-45,-45,-55,-55,};
const char rest[] PROGMEM = { 
1, 0, 0,
-30,-80,-45,  0, -3, -3,  3,  3, 60, 60,-60,-60,-45,-45, 45, 45,};
const char zero[] PROGMEM = { 
1, 0, 0,
  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,};
#if !defined(MAIN_SKETCH) || !defined(I2C_EEPROM)
const char* skillNameWithType[] =
{"crI", "stairN", "pu1I", "pu2I", "restI", "zeroN",};
const char* progmemPointer[] = 
{cr, stair, pu1, pu2, rest, zero, };
#else
const char* progmemPointer[] = {stair, zero};
#endif
```

### 8.2.1. Constantes définies

`define WalkingDOF 8`

Indique que le nombre de DDL pour marcher est de 8 sur Nybble.&#x20;

`define NUM_SKILLS 6`

Le nombre devrait être le même que dans la liste `const char* skillNameWithType[]`.

`define I2C_EEPROM`

Indique que NyBoard contient une mémoire I²C EEPROM pour enregistrer les Instincts.

{% hint style="warning" %}
Si vous construisez votre propre circuit imprimé qui n’en contient pas, il n’est pas nécessaire de le préciser sur cette ligne. Les deux sortes de compétences sont maintenant enregistrées sur la mémoire vive sous le format PROGMEM. De toute évidence, cela réduira l'espace flash disponible pour les codes fonctionnels. S'il y avait trop de compétences, cela pourrait même dépasser la taille limite pour le chargement du programme. &#x20;
{% endhint %}

### 8.2.2. Structure des données relatives à l’ensemble des compétences

Regardez bien les deux compétences suivantes :

```cpp
const char rest[] PROGMEM = { 
1, 0, 0,
-30,-80,-45,  0, -3, -3,  3,  3, 60, 60,-60,-60,-45,-45, 45, 45,};
const char cr[] PROGMEM = { 
26, 0, -5,
 35, 37,-46,-53,-23,-32, -3, 12,
 40, 28,-42,-59,-24,-28, -4, 12,
 ...
 33, 39,-47,-51,-22,-32, -3, 11,
};
```

Elles sont formatées ainsi :

![](/files/-M1VnJFU2gOhgxDeDoPx)

{% hint style="info" %}
Une posture ne correspond qu’à un seul mouvement, tandis qu’une allure correspond à plusieurs mouvements.&#x20;
{% endhint %}

### 8.2.3. Suffixes indiquant un Instinct ou une Newbility

Vous devez charger **WriteConst.ino** pour écrire les compétences dans l’EEPROM pour la première fois.. Voici les informations qui seront utilisées :

```cpp
const char* skillNameWithType[] =
{"crI", "stairN", "pu1I", "pu2I", "restI", "zeroN",};
const char* progmemPointer[] = 
{cr, stair, pu1, pu2, rest, zero, };
```

{% hint style="info" %}
Vous remarquerez l’emploi des suffixes **I** ou **N** sur les chaînes d’appellation de la compétence. Ils indiquent au programme où stocker les données relatives aux compétences et quand définir leurs chemins.
{% endhint %}

Plus tard, si tous ces facteurs sont réunis, le programme n’aura besoin que de ce repère pour se référer à la liste`const char* progmemPointer[] = {stair, zero};`afin d’exploiter au mieux les compétences prédéfinies.&#x20;

## 8.3. Définir de nouveaux comportements et compétences

### 8.3.1 Modifier le modèle de compétences existant

Il existe déjà une compétence appelée « zeroN » sur Instinct.h. Il s'agit d'une posture non définie qui n’attend plus qu’on la configure.

Vous pouvez tout d’abord utiliser la commande `mIndex Offset` pour bouger les articulations dans la position de votre choix, puis remplacer les angles d’articulation (en gras) en une seule fois :

```cpp
const char zero[] PROGMEM = { 
1, 0, 0,
  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,};
```

Vous pouvez simplement charger **Nybble.ino** chaque fois que vous changez le tableau (sans avoir à charger **WriteInstinct.ino**) puisqu’il est considéré comme une Newbility et n’a pas besoin d’être écrit sur la mémoire morte I²C EEPROM. Pour déclencher la nouvelle posture, appuyez sur le bouton **7** de la télécommande infrarouge ou saisissez`kzero` dans le moniteur série.&#x20;

Vous pouvez renommer cette compétence mais n’oubliez pas de mettre à jour le schéma des touches de la télécommande infrarouge.&#x20;

### 8.3.2. Découvrir plus de compétences cachées dans Instinct.h

Davantage de compétences sont cachées dans Instinct.h et peuvent être utilisées via le moniteur série avec la commande liée au jeton « k ». Par exemple, `kcd1` permettra à Nybble de passer dans la posture « cd1 », qui signifie « se pencher en avant ».

![](/files/-M1ZzcYM_jyoHQ1fXdK-)

Vous pouvez également écrire des programmes courts pour que Nybble effectue plusieurs compétences à la suite, de la même manière que les « pompes » dans Nybble.ino. Par exemple, en connectant les postures « cd1 » et « cd2 » comme séquence en boucle, vous pouvez faire en sorte que Nybble se penche en avant, regarde de gauche à droite, puis de droite à gauche.&#x20;

### 8.3.3 Automatisation

Jusqu'à présent, Nybble est contrôlé par la télécommande infrarouge, vous permettant de prendre les décisions concernant son comportement.&#x20;

Vous pouvez connecter Nybble avec votre ordinateur ou votre smartphone et les laisser envoyer des instructions automatiquement.

En ajoutant des capteurs (notamment sensoriels) ou des modules de communication (à l’image d’un module de contrôle vocal), vous pouvez apporter une nouvelle perception à Nybble, et lui apprendre de nouvelles capacités. Vous pouvez donc intégrer de nombreux comportements automatiques et potentiellement rendre Nybble autonome !&#x20;


# 9 👨‍🎓 Comprendre OpenCat.h

« Vendez la mèche... de poils de chat ! » 🧞‍♂️

## 🔬Cela nécessitera un autre guide&#x20;

Le système de contrôle de Nybble est OpenCat, que je développe depuis un certain temps. Vous pouvez lire d'autres histoires via mes [publications ](https://www.hackster.io/petoi/opencat-845129)sur Hackster.io.

![](/files/-M1QZyQuh1C5NKQt5L1A)

Cela représente beaucoup de travail pour l'instant 🤷🏻‍♂️ mais vous êtes les bienvenus pour en discuter avec moi sur le forum ou par email. La bonne nouvelle, c'est que je garderai le code compatible avec les futurs modèles d'OpenCat, et même avec [vos propres robots faits maison](https://www.petoi.com/forum/showcase) ! J'espère que la documentation sera complétée au cours des processus.&#x20;

![](/files/-LzvAzCUfoN2lDr77qlQ)


# 10 🛠 Jouer avec le code et le logiciel

« Plus rapide, plus intelligent et plus mignon que jamais ! » 🦾

Pour qu'il 👉 VOUS ressemble !

Partagez vos connaissances et votre créativité avec notre communauté sur <https://www.petoi.com/forum>.

![](/files/-M1Qa9IcohURLOF8WIOk)


# Aufbauanleitung für Nybble

Übersetzung: Christopher Spitzner / Misterfloppy\@gmx.de

## Erste Schritte

Damit diese Anleitung einfach zu handhaben ist konzentriere ich mich auf die Montage und nicht auf eine ausführliche Erklärung.&#x20;

Wer spezifische Fragen zum "Warum" anstatt "Wie" hat, meldet sich bitte in unserem Forum unter  <https://www.petoi.com/forum> oder schreibt an <info@petoi.com>.

![](/files/-M0MByOtcsbKZD2hRyn_)

Die Crowdfunding Kampange ist auf Indiegogo aktiv: [igg.me/at/nybble](http://igg.me/at/nybble). Unsere Konten für soziale Medien (Instagram/Twitter/Facebook/GitHub) sind **@PetoiCamp**. Teilen Sie Ihren Nybble mit uns, unter **#nybble #petoi #opencat** damit wir für Sie reposten können!&#x20;

{% hint style="info" %}
Last Updated: 18/02/2020
{% endhint %}


# 1 🧘‍♂️ Werkzeuge und Vorbereitung

"Ein gut geschäumter Bart ist halb geschoren." 🪒

## 1.1. Vorbereitung

Bereite einen sauberen Schreibtisch und einige kleine Kisten vor um die Teile aus dem Paket auszupacken. &#x20;

{% hint style="success" %}
Es ist ratsam, in einem Raum ohne Teppich oder strukturiertem Fußboden zu arbeiten. Kleine Schrauben und Federn verschwinden schnell, wenn sie mal vom Tisch fallen sollten.
{% endhint %}

## 1.2. Werkzeuge und Zubehör

{% tabs %}
{% tab title="Benötigt" %}

| Werkzeug                          | Bemerkungen                                                                            |
| --------------------------------- | -------------------------------------------------------------------------------------- |
| Cutter Messer                     | Um die Teile aus dem Puzzle auszuschneiden                                             |
| Flach und Kreuz Schraubendreher   | Für M2 (Durchmesser = 2mm) Schrauben                                                   |
| Computer mit Arduino IDE          | Installiere die aktuellste [Arduino IDE](https://www.arduino.cc/en/Main/Software)      |
| USB zu Mini USB cable             | Verbinde den Uploader mit dem Computer. Kein Micro USB                                 |
| 2 x 14500 3.7V Li-ion Akkus       | Nicht mit normalen AA Batterien (1.5V) mischen! Die Kapazität sollte etwa 800mAh sein. |
| Intelligentes Ladegerät für Akkus | Falsches Ladegerät kann gefährlich sein!                                               |
| Schleifschwamm                    | Um überstehende Holzreste von den Teilen zu entfernen                                  |
| {% endtab %}                      |                                                                                        |

{% tab title="Optional" %}

| Werkzeug               | **Bemerkungen**                                                                                                                                   |
| ---------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- |
| Lötkolben mit Zubehör  | [Löte eine dekorative LED an den Ultraschall Sensor](https://github.com/PetoiCamp/OpenCat/blob/master/Resources/Nybble_SolderingUltrasound.pdf)   |
| HC-05 Bluetooth Modul  | [Sketch per WLAN hochladen und Kommunikation](https://www.petoi.com/forum/hardware/add-bluetooth-module-for-uploading-sketches-and-communication) |
| Farben                 | Gib deinem Nibble einen einzigartigen Look                                                                                                        |
| 3D Drucker mit Zubehör | Für dein ganz spezielles Design                                                                                                                   |
| Arduino/Raspberry Pi   | Für zusätzliche Spielereien                                                                                                                       |
| Multimeter             | Test und Debug                                                                                                                                    |
| Oszilloskop            | Test and Debug                                                                                                                                    |
| Heiß / Sekundenkleber  | Nicht unbedingt verwenden. OpenCat wurde so entwickelt das sie weich ist!                                                                         |
| {% endtab %}           |                                                                                                                                                   |
| {% endtabs %}          |                                                                                                                                                   |


# 2 🧩 Öffne die Box

"Das Leben ist wie eine Schachtel Nybble." 🔍

Tatsächlicher Inhalt und die Verpackungsmethode können im Zuge der Verbesserung angepasst oder geändert werden. Die einzelnen Namen der Teile wird aber weiterhin einheitlich bleiben.

![](/files/-M0IcKMgwdvHaW_POKFZ)

## 2.1. Teile von der Grundplatte schneiden

Auf den Teilen könnten sich Reste vom Laserschneiden befinden. Verwende ein feuchtes, weiches Tuch um die Grundplatte zu reinigen.

Die Funktionsteile sind mit leicht angeschnittenen Laschen an der Grundplatte befestigt. Obwohl diese Teile leicht von Hand rausgenommen werden können, wird dringend empfohlen die Rückseite dieser Laschen mit einem Messer anzuschneiden. Dadurch wird eine mögliche Beschädigung der Teile vermieden.&#x20;

Nachdem alle Teile entfernt wurden, ist es ratsam die Grundplatte mal zu biegen und zu sogar zu brechen. Das hilft, die Eigenschaften des Materials sowie die Festigkeit oder Elastizität besser zu verstehen. Es gibt mehr Sicherheit bei der späteren Handhabung.&#x20;

## 2.2. Spitze Fasern entfernen

Nutze einen Schleifschwamm um überstehende Holzreste von den Teilen zu entfernen. Nicht zuviel wegschleifen, dies könnte die Fugen zwischen den einzelnen Teilen beeinträchtigen.

## 2.3. Schrauben

Im Bausatz werden fünf verschiedene Schrauben verwendet. Ich habe diese unterschiedlich eingefärbt um die Position einfacher zu kennzeichnen. Für Nybble´s Montage werden nicht alle Schrauben benötigt. Nicht alle Löcher in den Teilen benötigen Schrauben. Schaue die [Montageanleitung](https://www.youtube.com/playlist?list=PLHMFXft_rV6MJ-BhDN-O5I_u4YeAie30n) an um alle Schrauben zu lokalisieren.

![](/files/-LzqSHAqZPRaRf-a3MBg)

●      A ist für die Befestigung von Servohebeln. D (sharfe Spitze) ist für die Befestigung von Servos am Rahmen. A und D werden in den Zubehör Tüten von jedem Servo mit Kunstoff Servohebeln geliefert.

●      B ist für die Befestigung von Servohebeln / Platinen am Rahmen.&#x20;

{% hint style="info" %}
In späteren Versionen kann diese durch C ersetzt werden, um den Inhalt des Bausatz einfacher zu machen. Falls ein Loch zu klein ist oder wegen der flachen Spitze nicht passt, [nutze die Schraube D zum vorbohren](https://youtu.be/7KNJH10IEIw).&#x20;
{% endhint %}

●      C (flache Spitze) ist zum fixieren der Oberschenkel.

●      E (immer am längsten) ist für die Anbringung des Batteriehalters.

Bei früheren Packeten befinden sich, B, C und E auf der Grundplatte innerhalb der Blöcke wie hier gezeigt:

![](/files/-LzqSMr7JII0_hYV1cP_)

## 2.4. Federn

Es gibt drei verschiedene Federn: F, G, H.

●      Die große Feder F wird zur elastischen Verbindung im Oberschenkel verwendet. Es gibt eine Ersatz Feder.

●      Die harte kurze Feder G ist für den Hals.

{% hint style="info" %}
&#x20;Diese wird in späteren Bausätzen durch die Feder F ersetzt.
{% endhint %}

●      Die weiche kurze Feder H dient zur Befestigung des Batteriehalters.

## 2.5. Servos

Wir wechseln zu einem neuen Servohersteller aus den letzten Chargen. Zuvor wurden für die vier Schultergelenke MG92B verwendet. MG90D wurden für die anderen Gelenke genutzt.

Die neuen Servos unterscheiden sich durch ihre Kabellängen. Kürzere Kabel werden für den Hals, das Hinterteil und die vier Schultergelenke verwendet. Längere Kabel werden für die Kopfneigung und die vier Kniegelenke verwendet.&#x20;

![](/files/-M0IcVpYoc_ASjPzE9Kp)

{% hint style="info" %}
Bei den Hobby-Servos gibt es mehrere Bereiche, in denen sie sich unterscheiden können.&#x20;

Im Nybble Bausatz, verwenden wir ODMed Metallgetriebe, digitale PWM- und HV-Servos mit Lager und gebürsteten Eisenkern Motoren. Andere Servos können auch im OpenCat Rahmen funktionieren, benötigen aber möglicherweise weitere Versuche um die beste Leistung zu erzielen.
{% endhint %}

| Getriebe |  Signal | Protokoll |    Spannung    |    Motor   | Lager |
| :------: | :-----: | :-------: | :------------: | :--------: | :---: |
|  Plastik |  Analog |    PWM    |       5V       |  gebürstet | keine |
|  Metall  | Digital |  Seriell  | HV (bis zu 8V) |   kernlos  |   Ja  |
|          |         |           |                | bürstenlos |       |


# 3 🏗 Rahmenmontage

"Das ganze ist mehr als die Summer seiner Teile." 🔩

## 3.1. Kopf und Nacken

### 3.1.1. Teile Liste

![](/files/-M0Icl6gCpOR1Iiibk_J)

### 3.1.2. Ultraschall-Sensor vorbereiten

{% hint style="warning" %}
Der Algorithmus zur Hindernisvermeidung mit dem Ultraschallsensor wurde noch nicht in den freigegebenen Code integriert. Das folgende Setup bietet einen Startpunkt ist aber nicht zwingend erforderlich.&#x20;
{% endhint %}

Der Sensor wird über ein 4-poliges Kabel an das NyBoard angeschlossen.

* **Löten Sie die optionale LED an den Ultraschallsensor**

Die optionale RGB-LED kann an die vier Pins des Ultraschallsensors gelötet werden ([Anleitung](https://github.com/PetoiCamp/OpenCat/blob/master/Resources/Nybble_SolderingUltrasound.pdf)) um den Bertiebszustand anzuzeigen. Sie kann auch als dekoratives Licht programmiert werden.

Biege die Stifte des Ultraschallsensors zur späteren Installation. &#x20;

![](/files/-LzqYVfruCS2nXrLZ-6s)

* **4-Pin Ultraschallsensor an NyBoard anlöten.**&#x20;

Das Ultraschallmodul wird an die freiliegende GPIO-Pins angeschlossen, die sich in gegeüber dem TTL-Stecker auf der Platine befinden. Die Pin-Definitionen können in der **OpenCat.h**.angepasst werden. Bei der Standart Definition wird das Ultraschallmodul in die mit “D8 D9 D10 GND” beschrifteten Löcher wie unten abgebildet gelötet.

![](/files/-LzqY__cEG2oJ17Hwi4J)

### 3.1.3. Schneiden der Servohebel zum Anbringen von Servos&#x20;

![](/files/-M0IcpJ5SJhxzm1HLgX3)

Die meisten Servohebel des Modells werden aus dem kreuzförmigen Hebel I zugeschnitten. Da nicht alle Servohebel benötigt werden kann man daran das schneiden üben.

Eine alternative Methode zum schneiden ist die Verwendung eines leicht erwärmten Messers. Man lässt diese etwas länger ruhen, damit der geschmolzene Kunststoff eine abgerundete Kante hat.&#x20;

{% hint style="info" %}
Achte auf den Breitenunterschied zwischen den beiden Längsseiten von Servohebel I sowie auf die Lage der Schnitte (unter Verwendung der Schraubenlöcher als Referenz).&#x20;
{% endhint %}

Da wir den Servolieferanten wechseln, haben sich auch die Servohebel ein wenig verändert. (wie unten dargestellt). Um Verwirrungen zu vermeiden, kann der Servohebel I für die meisten Gelenke verwendet werden. Dazu entsprechend scheiden. Servohebel K wird für den Schwanz verwendet. Servohebel J wird nicht benötigt.&#x20;

![](/files/-M0IcwSn_b6oqBQ_KnfX)

### 3.1.4. Setze die Kopfgruppe zusammen&#x20;

Die Grundgerüst sollte für eine spätere Kalibirerung nur teilweis zusammengebaut werden. Ansonsten wird es schwierig sein, das Servo zwischen den Halsstücken einzusetzen. Beachte auch, wie die Servokabel im Kopf organisiert sind. Baue die Kopfgruppe wie in der [Kopf Animation](https://youtu.be/pYvfG2Zmowc) gezeigt zusammen.&#x20;

![](/files/-LzqZXj70buMB2kx72H5)

![](/files/-LzrBQzZkNliUc15A9-M)

![](/files/-Lzr9GTr6ea0WvIpCf3P)

{% hint style="warning" %}
Verbinde den Kopf NOCH NICHT mit dem Rumpf, da das Neige-Servo am Kopf kalibriert werden muss.&#x20;
{% endhint %}

## 3.2. Körper

### 3.2.1. Teile Liste

* Nur NyBoard

Beachte, dass das NyBoard ohne den Raspberry Pi, an der Unterseite von y1 mit den Servoanschlüssen nach unten montiert wird. In späteren Versionen ist das y1 Stück so symmtrisch gestaltet, dass beide Enden zwei Schraubenlöcher haben.

![](/files/-M0Id1G03XuspcyzKc6j)

* NyBoard mit Raspberry Pi

Verwende y1Pi um y1 zu ersetzen und füge den Pi Halter hinzu. Achte auf die Position der rosa Teile. Beachte, dass beim Raspberry Pi Einbau das NyBoard auf y1Pi montiert wird.

![](/files/-M0Id3yB35T-8bxEh0E7)

{% hint style="warning" %}
Bei früheren Chargen von NyBoards hat der Hersteller höhere Jumper-Pins als erwartet verwendet, sodass es notwendig ist die Pins zu biegen oder das Nyboard anderweitig zu modifizieren, damit ein Pi darauf passt und der Pi Halter verwendet werden kann. Eine Liste von Lösungsvorschlägen finden Sie im Forum unter diesem Link: <https://www.petoi.com/forum/clinic/placement-of-raspberry-pi-3b>
{% endhint %}

* Andere Controller

Ich habe 5 x 1”/4 Muttern für die Monatage anderer Controller beigefügt.

### 3.2.2. Installiere den verstellbaren Akkuhalter am Bauch

Biege das Scharnier L des Akkuhalters wie unten gezeigt um 90 Grad. Das wird der Schalter. Führe die lange Schraube E durch die Hülse. Setze dann die Hülse in das Loch an der Unterseite des Akkuhalters. Achte auf die Position der Löcher.&#x20;

![](/files/-LzrFaCaol29HIcDuCQ8)

Die mit einer Feder befestigte Strucktur des Akkuhalters dient zur Verlagerung des Masseschwerpunktes bei der Feinabstimmung von Schritten.&#x20;

{% hint style="warning" %}
Der Akkuhalter ist für AA (1.5V) Akkus. Nybble braucht aber 3.7V Li-ion Akkus.
{% endhint %}

### 3.2.3. Setze die Körpergruppe zusammen

Achte auf die langen Stifte vom Infrarotempfänger und FTDI Port. Sie sind so konstruiert, das sie in die gewünschte Position gebogen werden können.  Biege die Stifte und den Infrarot Empfänger nicht zu oft da dies zu Materialermüdung führt und diese dann abbrechen könnten. Beachte die [angepasste Konfiguration](https://youtu.be/0T1K5_oxFUM) wenn ein Pi montiert wird.&#x20;

![](/files/-M0IdAjRfwpggoqRLI1V)

Setze die Körpergruppe wie in der [Körper Animation](https://youtu.be/B8N2KAf8p28) gezeigt zusammen.

{% hint style="info" %}
Das Rückgrat kann dicker sein als der Schlitz auf der Schulter. Es kann zuerst von außen eingeführt werden um die Spitze zu verengen und den Schlitz zu erweitern. Dann kann es komplett bis zur Innenseite der Schulter eingeführt werden.
{% endhint %}

![](/files/-M0IdEZylpdWBUNEU8GN)

## 3.3. Unterschenkel

### 3.3.1. Teile Liste

![](/files/-M0IdI7v2t-9e6lEFyzs)

### 3.3.2. Befestigen den Gummi am Ende des Unterschenkels.&#x20;

Die gezackte Strucktur am Ende des Unterschenkels ist bereits zum gehen geeignet. Die Gummifüße sind optional, um die Reibung zu erhöhen und Nybbles Schritte weicher zu machen. &#x20;

![](/files/-Lzwlfw6ZdJY605tLXrl)

### &#x20;3.3.3. Setze das Servo in den Schlitz am Unterschenkel ein &#x20;

Achte auch auf die Richtung des Kabels. Die kleine Delle an der Längskante ist so gestaltet, dass der Draht durchgelassen wird. Denke an die Symmetrie der vier Unterschenkel. Baue den Unterschenkel wie in der [Unterschenkel  Animation](https://youtu.be/OFdNQe9975Y) gezeigt zusammen.&#x20;

{% hint style="warning" %}
Installiere die Servoschraube A NOCH NICHT.&#x20;
{% endhint %}

## 3.4. Oberschenkel

### 3.4.1. Stückliste

![](/files/-M0IdQmCx_FaxzGeiNyT)

In späteren Versionen werden wir Kunststoffteile für Oberschenkel 2 verwenden.

![](/files/-M0J6b01ghKdb3OjYTGb)

### 3.4.2. Schneide die Servohebel zum Anbringen von Servos

Die genaue Position wurde im Abschnitt [Kopf und Nacken](applewebdata://3DB2C061-F79A-4126-A8EA-235A7B32E635#_wx3wihxumxlg) gezeigt. Der abgeschittene schmalere Servohebel ist zum Einführen in die Feder F vorgesehen.&#x20;

### 3.4.3. Oberschenkel zusammensetzen

Vor dem schließen von Oberschenkel1 und Oberschenkel2 den Draht des Unterschenkels durch den Schlitz in der Mitte des Oberschenkels stecken. Denke an die Symmetrie der vier Beine.

![](/files/-M0IdYTW1km-KSPftQjn)

Der geschnittene Servohebel sollte in der Lage sein , in der Schiene auf Oberschenkel2 mit leichter Reibung zu gleiten nachdem Oberschenkel1 und Oberschenkel2 zusammengeschraubt wurden. Der Anzugdruck der Schraube C kann so eingestellt werden, dass die richtige Reibung erreicht wird. Wenn mehr Kontrolle über den Anzugdruck benötigt:

* Kratze mit einem flachen Schraubendreher an der Schiene um die Reibung zu verringern.&#x20;
* Trage ein wenig Papierkleber in die Schiene ein und lasse diesen trocknen um die Reibung zu erhöhen.&#x20;

Bau den Oberschekel wie in der [Oberschenkel Animation ](https://youtu.be/3dtiFp7v2ps)gezeigt zusammen.&#x20;

{% hint style="warning" %}
Schraube Hals und Beine NOCH NICHT an die Servos der Körpers.
{% endhint %}

## 3.5.  Schwanz

### 3.5.1. Stückliste

![](/files/-M0IdbgVAxt6SI9qZqlz)

### 3.5.2. Schwanz zusammensetzen

Die Schraube D wird in das dritte Loch von der Mitte des Servohebels K aus gezählt eingebaut. Achte auf die Reihenfolge, in der jedes Teil gestapelt wird. Das Rad sollte sich mit geringer Reibung drehen können. Das gesamte Heck sollte sich ein wenig neigen können.&#x20;

![](/files/-LzvwogrOCGa2pl6dDiL)

Setze den Schwanz wie in der [Schwanz Animation](https://youtu.be/7QZRdKz2u_Y) gezeigt zusammen.&#x20;

{% hint style="warning" %}
Verbinde den Schwanz NOCH NICHT mit dem Körper.
{% endhint %}


# 4 ⌨️ Konfiguration

"Wer liebt Fritten?" 🍟

## 4.1. NyBoard

### 4.1.1. Lese das Handbuch

Finde die Versions Info auf dem NyBoard. Lese das entsprechende Handbuch für [NyBoard V0\_1](https://github.com/PetoiCamp/OpenCat/blob/master/Resources/NyBoard/NyBoardV0_1.pdf) oder [NyBoard V0\_2](https://github.com/PetoiCamp/OpenCat/blob/master/Resources/NyBoard/NyBoardV0_2.pdf).

{% hint style="danger" %}
Falsche Handhabung kann das NyBoard beschädigen!
{% endhint %}

![](/files/-M0IdgNFyuxZ1DN_dwiW)

![](/files/-M0IdzxKVb6V6fUkaeg6)

### 4.1.2. Drehe das Potentiometer im Uhrzeigersinn um mit niedriger Spannung zu beginnen

{% hint style="success" %}
Ab NyBoard V0\_2 bieten wir einen Jumper Selektor zur Umgehung des Potentiometers an. Wenn Metallservos in einem Standard Nybble Bausatz verwendet werden, kann dieser Schritt übersprungen werden.
{% endhint %}

Höhere Spannung erhöht das Drehmoment der Servos und lässt Nybble schneller laufen. Der Nachteil ist, dass die Stromaufnahme erhöht wird, was wiederrum die Akkulaufzeit verkürzt. Ebenso wird die Stabilität der Schaltung beeinflusst und der Servo Verschleis beschleunigt. Nach meinem Tests scheinen 5.5V eine ausgewogene Leistung zu ergeben.

Bei der Erstinstallation sollte das NyBoard nicht mit Schrauben befestigt werden, da es möglicherweise zum einstellen mit einem Potentiometer harausgenommern werden muss. Vergewissere dich, dass die Servos im normalen Betriebszustand gut drehen bevor die Feineinstellung vorgenommen wird.

### 4.1.3. Stelle den I2C Schalter (SW2) auf Ar

Der I2C Schalter ändert den Master von I2C-Bausteinen (Gyro/Beschleunigungsmesser, Servotreiber, externer EEPROM). Bei der Voreinstellung “Ar”, verwendet das NyBoard den integrierten ATmega328P als Master-Chip. Bei "Pi" verwendet NYBoard externe Chips, die über die I2CPorts (SDA, SCL) angeschlossen sind als Master Chip.

{% hint style="warning" %}
Manchmal, wenn der Bootvorgang nicht durchläuft, wurde vielleicht versehentlich der Schalter auf "Pi" gestellt.
{% endhint %}

### 4.1.4. Das MyBoard für optimale Leistung anpassen

Das NyBoard ist für zwei Anwendungsfälle konzipiert. Einer ist für Nybble und Metallgetriebeservos, der zweite ist für DIY Roboter die Kunststoffgetriebe Servos verwenden. Kunststoffgetriebe Servos können nur 6V aushalten, daher gibt es einen Step Down Chip auf dem NyBoard. Der Chip ist für 5A maximale Leistung ausgelegt, kann aber nur mit mehreren richtigen Einstellungen und sorgfältiger Abstimmung erreicht werden.

Bei der Verwendung von NyBoard und den Metallgetriebe Servos von Nybble, kann durch einige Anpassungen eine optimierte Leistung erreicht werden. Für NyBoard\_V0\_1 müssen einige Lötarbeiten durchgeführt werden. Dies kann man sich im [Forum](https://www.petoi.com/forum/hardware/reconfigure-nyboard-v0-1-for-pro-users) anschauen. Für NyBoard\_V0\_2 können Sie den Jumper SW3 zwischen BATT und V\_S anschließen. (Im Hinblick auf die Sicherheit von Kunststoffgetriebe-Servos wird das NyBoard standartmäßig mit der Jumperstellung SW3 geliefert, die V\_S und V+ verbindet).

{% hint style="warning" %}
V\_S bedeutet Leistung für Servo. Der Jumper wählt, ob die Servos (V\_S) uber den Step-Down-Chip (V+) oder direkt über die Akkus (BATT) versorgt werden sollen. (BATT) und (V+) sollten also niemals direkt verbunden werden.
{% endhint %}

{% hint style="info" %}
Wie sich zeigt, arbeitet das NyBoard stabiler, wenn die Metallgetriebe Servos direkt mit BATT statt mit V+ betrieben werden. Wenn Sie das NyBoard verwenden um Ihre eigenen Kunstoffgetriebe Servos anzutreiben, müssen Sie die Step-Down-Schaltung verwenden.
{% endhint %}

## 4.2. Downloads and Installationen

{% hint style="info" %}
Es wird die aktuellste Arduino IDE benötigt um die Umgebung einzurichten. Ältere Versionen neigen dazu, größere Hex-Dateien zu kompilieren, die die Speichergrenze überschreiten können.
{% endhint %}

Wenn zuvor andere Bibliotheken hinzugefügt wurden und die Fehlermeldung "XXX library is already installed" zu sehen ist, empfiehlt es sich, diese zuerst zu löschen. (Anleitung:​​ <https://stackoverflow.com/questions/16752806/how-do-i-remove-a-library-from-the-arduino-environment>). Wenn es aufgrund unterschiedlicher Konfigurationen der Arduino-IDE-Installation bei der Kompilierung Fehlermeldungen bezüglich fehlender Bibliotheken gibt, google danach und Installiere diese in der Ardunio IDE.

### 4.2.1. Install durch Bibliotheksmanager

Gehe zur Bibliotheksverwaltung (Anleitung: <https://www.arduino.cc/en/Guide/Libraries>), dann suche und installiere:

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

### 4.2.2. Install durch hinzufügen einer .ZIP Bibliothek

Gehe zu [jrowberg/i2cdevlib: I2C device library collection for AVR/Arduino  or other C++-based MCUs](https://github.com/jrowberg/i2cdevlib), lade die Zip-Datei herunter und entpacke diese. Alternativ kann auch das komplette repository geklont werden.

![](/files/-Lztj-3xI3HwaacLQzIw)

Im Arduino IDE bei Sketch auf **Add .ZIP Library** und dann **Arduino/MPU6050/** zusätzlich noch **Arduino/I2Cdev/**. Auf die Ordner klicken und diese **nacheinander hinzufügen**. Es müssen keine **.ZIP** Dateien sein.

![](/files/-LztjW6U6UUIDZeeXib-)

![](/files/-LztjeVZiNzDdDIdaNC2)

### 4.2.3. NyBoard Unterstüzung für Arduino IDE hinzufügen (Danke an [A-Ron](https://github.com/asmagill)!)

![](/files/-LztkFjO9z1b8E8luG4A)

1. Öffne die **Einstellungen...**
2. Im Feld **Weitere Boards** Manager URLs  **<https://raw.githubusercontent.com/PetoiCamp/OpenCat/master/Resources/NyBoard/boardManager/package\\_petoi\\_nyboard\\_index.json>** einfügen. Wenn in diesem Feld bereits URLs aufgelistet sind, tenne diese mit Kommas oder klicke auf das Symbol neben dem Feld um einen Editor zu öffnen und die obere URL in eine neue Zeile einzufügen.
3. Klicke auf OK um das Einstellungsfenster zu schliessen (Zuvor geöffnete Fenster müssen geschlossen werden um das Einstellungsfenster zu schließen.)
4. Öffne den **Boards Manager...** unter **Tools -> Board: XXXX -> Boards Manager...** &#x20;
5. In **Filter your search...** schreibe **NyBoard**
6. Wähle den Eintrag aus und klicke auf **Installieren**
7. Klicke auf **Schliessen**
8. Wähle **ATmega328P (5V, 20 MHz) NyBoard** aus dem **Tools -> Board: XXXX** Menü (NyBoardV0\_1 und NyBoardV0\_2 benutzen die gleichen Einstellungen).

### 4.2.4.     Manuelle Board Installations Methode&#x20;

{% hint style="warning" %}
Nur wenn die obere Methode fehlschlägt
{% endhint %}

●      Finde die Datei **boards.txt**

**Mac Ort**:

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

**Oder**:     &#x20;

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

Zum Zugriff , Rechtsklick auf Arduino.app und wähle Show Package Contents

**Windows Ort**:

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

WICHTIG! Wenn die Arduino IDE über den Microsoft Store installiert wurde, gibt es warscheinlich keinen Zugriff auf den Ordner, da dort kritische Konfigurationsdateien gepeichert sind. Die einfachste Lösung ist, Arduino wieder zu deinstallieren und diese direkt von [https://www.arduino.cc](https://www.arduino.cc/) neu zu installieren.

**Linux**&#x20;

Beim Herunterladen über das Terminal oder den Packetverwalter erhält man möglicherweise nicht die neueste Version, was ein Problem werden kann. Bitte die neuste Version von der Arduino Webseite herunterladen: <https://www.arduino.cc/en/Main/Software>

Entpacke das Packet und `sudo install.sh`

Der Speicherort der boards.txt files ist:

**Fedora:** boards.txt is verlinkt unter:

/etc

**Arch:** boards.txt ist unter:

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

**Mint:**

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

**Ubuntu** (on **18.04** installieren mit  `apt-get install arduino`):&#x20;

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

nach auffinden von **boards.txt**:

●      Mache eine Kopie von **boards.txt** falls etwas rückgängig gemacht werden soll.

●      Erstelle eine neue **boards.txt**.

Du kannst meine [**boards.txt**](https://github.com/PetoiCamp/OpenCat/blob/master/Resources/NyBoard/boards.txt) Datei herunterladen, oder:

Editiere deine **boards.txt** mit Admin Rechten. Finde den folgenden Abschnitt&#x20;

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

füge folgendes ein:

```
## 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 der Arduino Pro oder Pro Mini Sektion wie unten beschrieben. Speichere und schliesse den 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
## --------------------------------------------------
```

●      Lade [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) herunter. Lege diese in deinem Arduino Ordner ab unter: ./bootloaders/atmega/. Es sollten auch andere Bootloader mit .hex Endung in diesem Ordner sein.

Arduino IDE neustarten. Unter **Tools->Boards**, wähle Arduino Pro oder Pro Mini. Dort sollte ATmega328P (5V, **20** MHz) im Prozessor menü sein.

![](/files/-LztkRqK4iSyaCppHrIg)

{% hint style="info" %}
Wenn das Board dort nicht zu finden ist, verwendet die Arduino IDE möglicherweise die boards.txt von einem anderen Pfad. Suche die boards.txt in allen Ordnern auf deinem Computer. Finde die Datei, die genutzt wird.
{% endhint %}

### 4.2.5. Brenne den Bootloader&#x20;

{% hint style="warning" %}
Nur wenn der Bootloader von NyBoard nicht mehr funktioniert.
{% endhint %}

●      [Was ist ein Bootloader?](https://www.arduino.cc/en/Hacking/Bootloader?from=Tutorial.Bootloader)

Jedes NyBoard durchläuft vor der Auslieferung eine Funktionsprüfung, daher sollte bereits ein kompatibler Bootloader installiert sein. In seltenen Fällen kann es jedoch vorkommen, dass der Bootloader zusammenbricht und man dann keine Sketche über die Arduino-IDE hochladen kann.

Nun, es liegt nicht immer am Bootloader, wenn Sie Ihren Sketch nicht hochladen können:

* &#x20;Manchmal erkennt der USB-Anschluss eine zu hohe Stromaufnahme von einem Gerät und deaktiviert den gesamten USB-Dienst. Dann muss der USB-Dienst oder Pc neu gestartet werden;
* Der Treiber für den Uploader FTDI USB 2.0 to UART muss installiert sein;
* Es wurde ein falscher Port ausgewählt;
* Schlechter oder keinen Kontakt;
* Kein Glück. Morgen ist ein neuer Tag!

Wenn man sich wirklich entscheidet, den Bootloader neu zu brennen:

![](/files/-Lztl16lKjZY1iQ83ajL)

* Wähle das **ATmega328P (5V, 20 MHz)** Board aus dem **Tools** Menü der Arduino IDE.
* Wähle deinen ISP (In-System Programmer). Der obige Screenshot zeigt zwei beliebte Programmer: Der hervorgehobene USBtinyISP ist ein günstiger Bootloader, den man sich kaufen kann, während der ausgewählte Arduino als ISP einen normalen [Arduino as ISP](https://www.arduino.cc/en/Tutorial/ArduinoISP) verwenden kann.
* Verbinde den Programmer mit dem SPI-Port auf dem NyBoard. Achte beim Anschließen auf die Richtung. Stelle sicher, dass es eine gute Verbindung ist.
* Brenne den Bootloader. Wenn das zum ersten Mal gemacht wird, warte geduldig, bis mehrere Prozentbalken 100% erreichen und eine Minute lang keine weiteren Meldungen mehr erscheinen.

### 4.2.6. FTDI-Uploader anschließen

Das folgende Bild zeigt zwei gängige FTDI-Boards.

![](/files/-LztlKH-y7dh2bt-yF5H)

Auf dem roten Board muss der Jumper auf 5V (nicht 3,3V)  gesetzt sein. Der GND des Uploaders und die 6-polige Buchse auf dem NyBoard müssen übereinstimmen.

![](/files/-LztmnWoHhPz0039KlcW)

![](/files/-Lztna2R_dI864XK_KDt)

Verbinde den Computer über ein USB-mini zu USB-Kabel mit dem FTDI-Uploader (der rote Chip mit 6 männlichen Pins). Der Uploader hat drei LEDs, Power, Tx und Rx. Direkt nach dem Anschluss sollten Tx und Rx eine Sekunde lang blinken, was die erste Kommunikation anzeigt, dann dimmen. Nur die Power-LED sollte weiter leuchten. Ein neuer Port ist unter Tool->Port als "/dev/cu.usbserial-xxxxxxxxxx" zu finden. (Mac) oder "COM#" (Windows).

Unter Linux sieht man, sobald der Uploader am Computer angeschlossen ist, eine "ttyUSB#" in der Liste der seriellen Ports. Es kann aber immer noch ein Fehler der seriellen Schnittstelle beim Hochladen auftreten. Man muss der seriellen Schnittstelle den Zugriff erlauben. Bitte gehe zu diesem Link und folge den Anweisungen: <https://playground.arduino.cc/Linux/All/#Permission>

![](/files/-LztnwUObRVbQJWa8q1O)

Wenn Tx und Rx weiterhin aufleuchten, stimmt etwas mit der USB-Kommunikation nicht. Der neue Anschluss ist dann nicht zu sehen. Normalerweise wird dies durch den Überlastschutz Ihres Computers verursacht, wenn das NyBoard **nicht** mit einer externen Stromversorgung verbunden ist und sich alle Servos auf einmal bewegen.

In späteren Versionen könnte es eine andere Variante des FTDI-Uploaders geben. Überprüfe einfach die Markierungen auf dem Chip und Verbinde diesen korrekt mit dem NyBoard.

### 4.2.7. Bluetooth uploader anschließen (optional)

Es ist möglich Nybble drahtlos zu programmieren und zu kommunizieren. Schaut euch dazu die [Bluetooth Anleitung](https://www.petoi.com/forum/hardware/add-bluetooth-module-for-uploading-sketches-and-communication) im OpenCat Forum an. Nybble kann dann mit einer [Smartphone APP](https://github.com/codeandrobots/codeandrobots-app) oder [Web API](https://www.petoi.com/forum/software/web-api-to-control-nybble-opencatweb) gesteuert werden!

### 4.2.8. OpenCat Packet herunterladen

* Lade ein neues ​OpenCat repository von GitHub herunter: <https://github.com/PetoiCamp/OpenCat>. Es ist besser, wenn die Versionskontrollfunktion von GitHub verwendet wird. Andernfalls stelle sicher, dass immer der GANZE **Nybble** ORDNER Heruntergeladen wird. Alle Programme müssen die gleiche Version sein damit sie funktionieren.&#x20;
* Es gibt mehrere **testX.ino**-Codes im Ordner ModuleTests. Man kann diese hochladen, um bestimmte Module separat zu testen. Öffne einen beliebigen **testX.ino**-Sketch mit dem Präfix "test". (Ich empfehle die Verwendung von **testBuzzer.ino** als ersten Sketch).
* Wählt als Board Arduino Pro oder Pro Mini und kompiliert. Es sollte keine Fehlermeldungen geben. Lade den Sketch auf das Board hoch. Die LEDs Tx und Rx sollten schnell blinken. Sobald sie aufhören zu blinken, sollten Meldungen auf dem seriellen Monitor erscheinen. Vergewissere dich, dass die Einstellung der Baudrate (57600) und die Boardfrequenz (16MHz oder 20MHz) mit der Konfiguration übereinstimmt.
* Wenn eine Eingabeaufforderung angezeigt wird, stelle sicher das "Kein Zeilenende" gewählt wurde. Andernfalls verwirren die unsichtbaren Zeichen '\n' oder '\r' die Parsen-Funktionen.

![](/files/-LztokF8qCuAOD6L4Sui)

Bei Linux-Systemen kann die folgende Fehlermeldung angezeigt werden:

![](/files/-M-sk6FtNjGKvlhDhWlJ)

Um den Sketch von Arduino zu kompilieren, muss man das Ausführungs Privileg zum avr-gcc hinzufügen:`sudo chmod +x filePathToTheBinFolder/bin/avr-gcc`

Zusätzlich muß die Ausführungsberechtigung für alle Dateien innerhalb von /bin hinzugefügt werden, der Befehl ist: `sudo chmod -R +x /filePathToTheBinFolder/bin`

## 4.3. Arduino IDE as interface

Mit dem FTDI-zu-USB-Konverter, der das NyBoard und die Arduino-IDE verbindet, haben Sie die ultimative Schnittstelle um mit dem NyBoard zu kommunizieren und jedes Byte darauf zu ändern.&#x20;

Ich habe eine Reihe von seriellen Kommunikationsprotokollen für NyBoard definiert:&#x20;

![](/files/-M0Ie7FNjVBI6q3-kx1t)

Alle Kürzel beginnen mit einem einzelnen Ascii-codierten Zeichen, um das Parsing-Format festzulegen. Sie unterscheiden zwischen Groß- und Kleinschreibung und sind gewöhnlich klein geschrieben.

{% hint style="warning" %}
Einige Zeichen wurden nicht implementiert, wie z.B. "h". Das Kürzel 'i' und 'l' haben noch einige Bugs.
{% endhint %}

## 4.4. Raspberry Pi's serieller Anschluss als Schnittstelle&#x20;

{% hint style="warning" %}
Nur bei Verwendung von Pi als Master-Controller. Nybble braucht keinen Pi, um sich zu bewegen.
{% endhint %}

![](/files/-LzwBRTB2HzgVmsZ_0sw)

Wie im seriellen Protokoll gezeigt, sind die Kürzel, die vom seriellen Monitor der Arduino-IDE unterstützt werden, alle als Ascii-Zeichenketten für die menschliche Lesbarkeit kodiert. Während ein Master-Computer (z.B. RasPi) zusätzliche Befehle unterstützt, die für eine effiziente Kodierung meist als binäre Zeichenketten kodiert sind. Zum Beispiel bei der Kodierung des Winkels 65 Grad:

* Ascii: benötigt 2 bytes um Ascii Zeichen zu speichern, Zeichen '6' und '5'
* Binär: benötigt 1 byte um den Wert 65 zu speichern, was dem Ascii Zeichen 'A' entspricht

{% hint style="info" %}
Was ist mit dem Wert -113? Er benötigt vier Bytes als Ascii-Zeichenkette, aber immer noch nur ein Byte in binärer Kodierung, wobei der Inhalt nicht mehr als Zeichen angezeigt werden kann.
{% endhint %}

Offensichtlich ist die binäre Kodierung viel effizienter als die Ascii-Zeichenkette. Die übertragene Nachricht ist jedoch nicht direkt für den Menschen lesbar. Ich habe im OpenCat-Repository ein einfaches Python-Skript [ardSerial.py](https://github.com/PetoiCamp/OpenCat/blob/main/serialMaster/ardSerial.py), das die serielle Kommunikation zwischen NyBoard und Pi verarbeiten kann.

### 4.4.1. Raspberry Pi's seriellen Port konfigurieren

In Pi's Terminal, gebt ein: `sudo raspi-config`

Unter **Interface** findet man die Option **Serial**. Deaktiviert die serielle Anmeldeshell und aktiviert die serielle Schnittstelle.

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

Wenn man den Pi an die 2x5-Buchse des NyBoards anschließt, sollten deren serielle Anschlüsse automatisch mit 3,3V verbunden werden. Andernfalls achte auf die Rx- und Tx-Pins auf Ihrem eigenen AI-Chip und dessen Spannungswert. Der Rx auf dem Chip sollte mit dem Tx des NyBoards verbunden werden, und der Tx sollte mit dem Rx verbunden werden.

### 4.4.2. Ändere die Berechtigung von [ardSerial.py](https://github.com/PetoiCamp/OpenCat/blob/master/SerialMasterPython/ardSerial.py)

Wenn man ihn als Bash-Befehl ausführen will, muss man diesen ausführbar machen:

`chmod +x ardSerial.py`

Möglicherweise muss der richtige Pfad Ihrer Python-Binary in der ersten Zeile geändert werden:

`#!/user/bin/python`

### 4.4.3. Nutze ardSerial.py als Kommander von Nybble

{% hint style="warning" %}
Das NyBoard hat nur einen seriellen Anschluss. Man muß den FTDI-Konverter **AUSSTECKEN**, wenn man Nybble mit der seriellen Schnittstelle von Pi steuern möchte.
{% endhint %}

Die Eingabe von `./ardSerial.py <args>` ist fast gleichbedeutend mit der Eingabe von \<args> in Arduino's seriellem Monitor. Beispielweise `./ardSerial.py kcr` bedeutet "Fähigkeit-Kriechen durchführen".

Beide, also **ardSerial.py** und der Parsing-Abschnitt in **Nybble.ino**, benötigen weitere Implementierungen, um alle seriellen Befehle im Protokoll zu unterstützen.

{% hint style="warning" %}
Bei der Verbindung mit Pi kann es zu einer reduzierten Bewegungsfähigkeit kommen. Eine stärkere Batterie ist erforderlich.
{% endhint %}

Mit dem zusätzlichen Stromverbrauch durch den Pi wird Nybble weniger in der Lage sein, intensive Bewegungen, wie z.B. Trab, auszuführen (das Zeichen ist`ktr`). Das System wird derzeit von zwei 14500 Akkus in Reihe betrieben. Sie finden möglicherweise bessere Lösungen für die Stromversorgung, wie z.B. die Verwendung von 7,4 Lipo-Akkus mit hoher Kapazität oder 2 S-18650. Es gibt eine Reihe von Überlegungen zur Zusammenarbeit von Software und Hardware für eine ausgewogene Leistung. Mit Nybbles winzigem Körper ist es besser, die Initiierung des Kommunikationsrahmens und des Verhaltensablaufs zu bedienen, als ein rennendes Biest zu haben.

## 4.5. Akkus

Obwohl Sie das NyBoard direkt mit dem FTDI-Uploader programmieren können, ist für den Antrieb der Servos eine externe Stromversorgung erforderlich.

### 4.5.1. Spannung

Das NyBoard benötigt eine externe Spannung von 7,4\~9V, um die Servos anzutreiben. Bei Nybble verwenden wir den 8V-Standard, um alle Parameter als gesamtes zu konfigurieren. Das sind normalerweise zwei in Reihe geschaltete Li-Ionen- oder Li-Poly-Akkus. Ein einziger Akku hat eine Spannung von 4,2V, wenn er voll aufgeladen ist, und kann normal arbeiten, bis die Spannung auf 3,6V abfällt. Das sind etwa 7,2V bei zwei, in Reihe geschalteten Akkus. Vor der Installation dreht man das Potentiometer auf dem NyBoard im Uhrzeigersinn, um zunächst die minimale Ausgangsspannung (etwa 4,5V) zu testen. Dann dreht man das Potentiometer solange hoch, bis der Roboter richtig funktioniert. Bei unseren Bausatz-Servos funktioniert es eigentlich besser, SW3 zwischen BATT mit V\_S zu verbinden und den Step-down-Chip zu umgehen (so muss nicht mit dem Potentiometer eingestellt werden).

Wenn man nach Akkus sucht, sucht man mit den Schlüsselwörtern "14500 3,7V Li-Ion-Batterie ungeschützt". Mir ist aufgefallen, dass der Überstromschutz einiger Akkus durch die Spitzenstromaufnahme (normalerweise >2,5A) ausgelöst werden kann, wodurch das NyBoard zurückgesetzt wird oder nicht mehr funktioniert. Versuche Akkus mit höherer Entladungsleistung zu finden.

Lies diesen [Forumsbeitrag](https://www.petoi.com/forum/clinic/report-your-batteries) um Akkus zu finden, die gut mit Nybble funktionieren.

### 4.5.2. Dimensionen

Der mitgelieferte Batteriehalter ist für 14500 Akkus ausgelegt, das sind 14 mm Durchmesser und 50 mm Länge. 50 ± 1 mm sollten auch passen. Diese haben die gleiche größe wie AA-Batterien, sind aber wesentlich Leistungsstärker. **Verwenden Sie diesearauf, nicht in normalen AA-Geräten!.** Wenn Sie in den USA leben, wir haben mit EBL 14500 Li-Ionen-Akkus getestet.

Es können auch andere Akkuhalterungen entworfen werden, um größere Akkus für eine bessere Leistung zu transportieren. Das ist vor allem dann notwendig, wenn ein Raspberry Pi genutzt wird oder Nybble schneller laufen soll.

### 4.5.3. Verbindung&#x20;

Vorsicht mit der Polarität beim Anschluss der Stromversorgung. Achtet darauf, dass das positive (+) und das negative (-) Zeichen sowohl an der Stromklemme des NyBoards als auch an der Stromversorgung zu sehen ist.

{% hint style="danger" %}
**Eine falsche Polung kann Ihr NyBoard beschädigen!**
{% endhint %}

Löst die Schrauben des Stromblocks. Führe die Drähte des Akkuhalters ein und ziehe die Schrauben an. Beim Einschalten sollte sowohl die blaue (für Chip) als auch die gelbe LED (für Servos) aufleuchten.

![](/files/-LztqFnUhE_fLlMU0afR)

### 4.5.4. Die Lebensdauer des Akkus variiert nach Verwendung&#x20;

Sie kann Stunden betragen wenn Sie hauptsächlich programmieren und Körperhaltungen testen. Oder weniger als 30 Minuten, wenn man Nybble laufen lässt.

Wenn der Akku schwach ist, blinkt die gelbe LED langsam. Obwohl das NyBoard immer noch ein oder zwei Servos antreiben kann, wird es sehr instabil sein wenn mehrere Servos gleichzeitig angetrieben werden. **Das führt zu wiederholten Neustarts oder ungünstigen Gelenkdrehungen.** In seltenen Fällen kann es sogar die Bits im EEPROM verändern. Zum wiederherstellen muss man dann die Programmcodes neu hochladen und die Konstanten neu speichern.

### &#x20;4.5.5. Laden

Sie benötigen kompatible intelligente Ladegeräte für die Akkus. Die Akkus sollten beim Aufladen immer beaufsichtigt werden.

### 4.5.6. Nach Gebrauch

Nach dem Spielen die **Akkus aus dem Batteriehalter entfernen, um eine Tiefentladung zu vermeiden.**

### 4.5.7. Signalstörungen

Es ist in Ordnung, FTDI und Akku zur gleichen Zeit anzuschließen. Man kann serielle Befehle eingeben, während das Akku angeschlossen ist. Mir ist aufgefallen, dass der serielle USB-Anschluss zufällig deaktiviert wird. Ich denke, das liegt an der plötzlichen Stromaufnahme durch die Servos. Dadurch wird der Überstromschutz des Computers ausgelöst und der USB-Anschluss deaktiviert. In diesem Fall, den USB-Bus zurücksetzen oder den Computer neu starten. Es ist also eigentlich besser, das Board mit einer Batterie zu versorgen, bevor Sie den FTDI Uploader einstecken.


# 5 🔌 Kabel anschließen

"Alles ist verbunden." 🤝

## 5.1. Gelenk Karte

Nybbles Servos sind symmetrisch mit den PWM-Pins des NyBoards verbunden und ähneln den Nerven entlang des Rückenmarks. Obwohl Nybble nicht über Schulter-Roll-DoF verfügt, sind diese Indexe (4\~7) für das gesamte OpenCat-Framework reserviert.

![](/files/-M0IeE2bxxfJtNjbMfr7)

![](/files/-M0IeGaQUvdmjmH48sns)

{% hint style="info" %}
NyBoard V0\_1 und V0\_2 haben unterschiedliche PWM-Pin-Belegungen, die Position vom Servoanschluss bleiben gleich. Alle Anpassungen werden in der Software vorgenommen.
{% endhint %}

Verwende h für Kopf, t für Schwanz, r für Schulter-Rollgelenk, s für Schulter-Nickgelenk, k für Kniegelenk, F für vorne, H für hinten, L für links, R für rechts, die vollständige Gelenkkarte von OpenCat ist:&#x20;

![](/files/-M0IeMcrWqFI0Gy_0nAT)

![](/files/-M0IePMKNM5fPfTzvg3S)

## 5.2. Die Servos einstecken

Beachte das Schaltschema zum Anschluss der Servos mit den PWM-Pins. **Vorsicht mit der Richtung der Drähte.** Der braune Draht des Servos ist GND, während GND auf dem NyBoard V0\_1 entlang der Mittellinie liegen. Auf dem NyBoard V0\_2 liegen sie gegenüber.

![  (NyBoard V0\_1 Vorderseite)                            (NyBoard V0\_1 Rückseite)](/files/-LzuyCaI5UQ9IINbFLYz)

Eine schnelle Überprüfung ist, dass alle braunen Drähte auf NyBoard V0\_1 von der Platinenoberfläche weg zeigen. Auf NyBoard V0\_2 sollten die braunen Drähte an der Plattenoberfläche sein.

![NyBoard V0\_1](/files/-LzuyVgawhAOMGHGuNH3)

![](/files/-M0IeUGl1UktyvogGd6D)

{% hint style="warning" %}
Bei NyBoard V0\_2 ist die Position der Servodrähte immer noch die gleiche, aber die Richtung der Farben ist entgegengesetzt.
{% endhint %}

![NyBoard V0\_2](/files/-Lzuym49Zmsm4EAeX_7U)

## 5.3. Verkabelung

Nach der Kalibrierung, der Fehlersuche und der endgültigen Montage ist es an der Zeit, über die Verkabelung nachzudenken damit Nybble ordentlich aussieht. Es gibt mehrere Steckplätze auf dem Rahmen, die als Kabelverteiler konzipiert sind. Es kann auch ein eigener Stil für den Anschluss von zukünftigem Zubehör entwickelt werden. Achte darauf, dass die Kabel die Bewegung der Servos nicht behindern.

Unten ist meine Verkabelung:&#x20;

![](/files/-M0IeY9X6C3eX4y3b6io)

![NyBoard mit Raspberry Pi](/files/-LzuwaVYFLC1C6TvmDNM)

## 5.4. Ultraschall-Sensor anschließen

Falls noch nicht geschehen, stecke das 4-polige Kabel ein, notiere, welche Kabelfarben an welche Signale angeschlossen sind. Beim Blick in Nybbles Augen sind die Verbindungen von links nach rechts:

| VCC | Trigger | Echo | Ground |
| :-: | :-----: | :--: | :----: |

Schließe das andere Ende des Kabels an den Stecker an, der zuvor bei der Montage eingelötet wurde. Verwende dazu die folgende Abbildung:

| Sensor Seite | NyBoard Seite |
| :----------: | :-----------: |
|      Vcc     |       D8      |
|    Trigger   |       D9      |
|     Echo     |      D10      |
|      GND     |      GND      |


# 6 📐 Kalibrierung

"Ein Verfehlen ist so gut wie eine Meile." 🎯

{% hint style="info" %}
Die Kalibrierung ist für die einwandfreie Funktion von Nybble unerlässlich.
{% endhint %}

In den vorangegangenen Abschnitten haben wir die Körperteile vorbereitet,  sie aber nicht auf die Servos geschraubt. Wenn wir die Servos nicht vor dem Anbringen kalibrieren, können sie sich in jede Richtung drehen, stecken bleiben und die Servos oder Körperteile beschädigen.

Die Kalibrierung erfolgt in vier Schritten:

1. Schreib Konstante an das Board
2. Einschalten, Servos frei bis zum Nullwinkel/Kalibrierungszustand drehen lassen
3. Körperteile an den Servos befestigen
4. Feinabstimmung der Abweichungen (Offsets) in der Software

Die [Logik hinter der Kalibrierung](https://www.petoi.com/forum/basic-assembly-and-setup/the-logic-behind-calibration-process) kann im OpenCat Forum gefunden werden.

## 6.1. Schreibe Konstante

### 6.1.1. Es gibt drei Arten von Konstanten, die im NyBoard gespeichert werden:

1. Montagebezogene Definitionen, wie Gelenkabbildung, Drehrichtung, Sensorpins. Sie sind weitgehend festgelegt und werden in **OpenCat.h** definiert. Sie werden auch für meine zukünftigen Roboter einheitlich gehalten;
2. Kalibrierungsbezogene Parameter, wie MPU6050-Verschiebungen und Gelenkkorrekturen. Sie werden in Echtzeit gemessen und im integrierten EEPROM gespeichert. Diese müssen nur einmal gemessen werden;
3. Geschicklichkeitsdaten, wie Haltungen, Gangarten und vorprogrammierte Verhaltensweisen. Sie werden in **Instinct.h** definiert. Es können auch weitere Fähigkeiten hinzugefügt werden.&#x20;

### 6.1.2. WriteInstinct.ino hochladen und ausführen

Die Rolle von **WriteInstinct.ino** besteht darin, Konstanten entweder in das Onboard oder in das I2C-EEPROM zu schreiben und die Kalibrierungswerte zu speichern. Diese werden danach mit dem Sketch **Nybble.ino** überschrieben.

Sie müssen den \* von `#define NyBoard_V*_*` in **Instinct.h** ändern, damit er mit der Version des NyBoards übereinstimmt. Die Versionsnummer ist links neben dem grünen Akkuanschluss.

Nachdem das Hochladen von **WriteInstinct.ino** abgeschlossen ist, öffne den seriellen Monitor. Es erscheinen mehrere Fragen:

`Reset all joint calibration? (Y/n)`

Wenn die Gelenke noch nie kalibriert wurden oder neu kalibriert werden müssen, gebe bei der Frage 'Y' ein. Beachte GROß- KLEINSCHREIBUNG!

`Do you need to update Instincts? (Y/n)`

Wenn die **Instinct.h** in irgendeiner Weise verändert wurde, sollte 'Y' eingegeben werden. Dies ist nicht immer notwendig ist, erfordert aber ein tieferes Verständnis der Speicherverwaltung.

`Calibrate MPU? (Y/n)`

Wenn der MPU6050, d.h. also Kreisel-/Beschleunigungssensor noch nie kalibriert wurde, 'Y' eingeben.

Manchmal kann das Programm in der Verbindungsphase hängen bleiben. Durch Schließen und erneutes Öffnen des seriellen Monitors oder durch Drücken der Reset-Taste auf dem NyBoard kann man das Programm neu starten.

![](/files/-Lzv0rwEzTSjJ7uaVf8a)

## 6.2. Kalibrierungsmodus aufrufen

Der Kalibrierungszustand ist als der mittlere Punkt des zulässigen Servobereichs definiert. Die Kalibrierung für Servos kann entweder in **WriteInstinct.ino** oder **Nybble.ino** durchgeführt werden. Ich empfehle, dies mit **WriteInstinct.ino** zu tun falls etwas mit den Konstanten nicht stimmt.

Es MÜSSEN alle Servos und der Akku für eine ordnungsgemäße Kalibrierung eingesteckt sein. Gebe dann auf dem seriellen Monitor 'c' ein, um in den Kalibrierungsmodus zu gelangen. Die Servos sollten sich in unmerklichen Zeitabständen nacheinander drehen und dann anhalten. Abhängig von ihrer anfänglichen Ausrichtung können einige Servos größere Winkel zurücklegen, bis sie in der Mitte zum Stillstand kommen. Man hört auch ein Geräusch vom Getriebe der Servos. Hier sieht man die Kalibrierungstabelle:

![](/files/-Lzv116AxfCllE3bDK1O)

Die erste Reihe ist der Gelenk-Index, die zweite Reihe der Kalibrierungs-Offset:

| **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 |

Die Anfangswerte sind "-1" oder "0" und sollten durch die Kalibrierung verändert werden.

{% hint style="info" %}
Die Servos verwenden Potentiometer in Rückkopplungsschleife zur Positionsregelung. Wenn sie in statischer Position gehalten werden, neigen sie dazu, um den Zielwinkel zu schwingen. Nach einiger Zeit ensteht eine Parkinson ähnliche Schwingung. Bei kontinuierlicher Bewegung wird sie sich kaum auswirken. Bessere Servos ohne diese Probleme könnten das 10-fache kosten, so dass der Austausch eines ausgefallenen Servos die kostengünstigere Lösung ist.
{% endhint %}

## 6.3. Kopf, Schwanz und Beine anbringen&#x20;

### 6.3.1. Koordinatensystem

Nach der Eingabe von 'c', bei der alle Servos auf ihren Nullwinkel gedreht sind, werden nun Kopf, Schwanz und Beine, die im vorherigen Abschnitt vorbereitet wurden, am Körper befestigt. Diese stehen in der Regel senkrecht zum verbundenen Körperrahmen. Vermeide es, die Servowelle während des Vorgangs zu drehen.

Die drehung der Gliedmaßen gegen den Uhrzeigersinn aus ihrem Nullzustand heraus ist positiv (wie bei den Polarkoordinaten). Die einzige Ausnahme ist der Neigungswinkel des Kopfes. Es ist einfacher zu sagen: Kopf nach oben, während er sich aus der Drehung im Uhrzeigersinn ergibt.

![](/files/-M0IeevfBUJ47BXPghZp)

### 6.3.2. Die Winkel-Einteilungen verstehen

Wenn wir uns die Servowelle genauer ansehen, sehen wir, dass diese eine bestimmte Anzahl von Zähnen hat. Das ist für die Befestigung der Servoarme und um ein gleiten in Drehrichtung zu vermeiden. In unserer Beispiel Servo sind die Zahnräder um 360 Grad in 20 Sektoren unterteilt, von denen jeder 18 Grad einnimmt. Das bedeutet, dass wir nicht immer eine exakt senkrechte Installation erhalten können. Versuche, sie möglichst nahe an ihren Nullzustand zu bringen. Benutze Schraube A, um die Glieder an die Servos zu schrauben.

![](/files/-Lzv1X9p7IXl-AC3vLTW)

## 6.4. Finde und sichere die Kalibrierungs-Offsets

### 6.4.1. Feinabstimmung der Kalibrierung auf Softwareseite

Der Befehl für die Kalibrierung (siehe [Serielles kommunikations Protokoll für NyBoard](applewebdata://BF1734DD-7BA4-4F33-AD2F-EB6CDD62923D#_hdzulhnk7rln)) ist als `cIndex Offset` formatiert. Beachte, dass zwischen Index und Offset ein Leerzeichen ist.

Zum Beispiel bedeutet `c8 6`, dem 8. Servo einen Versatz von 6 Grad zu geben. Finde den besten Offset, der die Gliedmaße in den Nullzustand bringt.&#x20;

{% hint style="info" %}
Ist der absolute Wert des Offsets größer als 9, wurde das Körperteil nicht perfekt am Nullpunkt angebracht. Dies führt zu einer verringerung des zulässigen Bereichs eines Servos auf beiden Seiten. Nehme das Körperteil ab und drehe es um einen Zahn. Dies führt zu einem entgegengesetzten, aber kleineren Versatz.
{% endhint %}

Wenn z.B. -13 als Kalibrierwert verwendet wurde, nehme das Gliedmaß ab, drehe dieses entgegengesetzt um einen Zahn und setze sie wieder ein. Der neue Kalibrierwert sollte dann etwa 5 betragen, d.h. sie summieren sich auf 18. Vermeide es, das Servo während dieser justierung zu drehen.

![](/files/-M0IejXf6G2fg7ZLC57M)

Denke nach der Kalibrierung daran, 's' einzugeben, um die Offsets zu speichern. Andernfalls werde diese beim Verlassen des Kalibrierungszustandes nicht gespeichert. Man sollte jedes Mal speichern, wenn ein Servo kalibriert ist.&#x20;

### &#x20;6.4.2. ’L’-förmiger Gelenksteller

Wenn man etwas beobachtet, ändert sich dies aus verschiedenen Perspektiven. Deshalb sollten wir bei der Längenmessung immer direkt über dem Lineal nachsehen.

Es ist besonders wichtig, dass bei der Kalibrierung von Nybble eine parallele Perspektive beibehalten wird. Verwende den 'L'-förmigen Gelenksteller als Parallelreferenz, um Ablesefehler zu vermeiden. Richte die Spitzen des Abstimmgerätes auf die Mitte der Schrauben in den Schulter- und Kniegelenken und auf das kleine Loch an der Fußspitze aus. Schaue entlang der Koaxialachse der Zentren. Kalibriere diese für jedes Bein. Zuerst die Schulterservos (8-11) und dann die Knieservos (12-15). Verwende bei der Kalibrierung des Knies die passenden Dreiecksfenster sowohl am Abstimmgerät als auch am Schaft, um eine parallele Ausrichtung zu gewährleisten.

![](/files/-M0IenY43O02PjQ6Hqtc)

### 6.4.3. Validierung

Gebe nach der Kalibrierung 'd' oder 'kbalance' ein, um die Kalibrierung zu validieren. Dies führt dazu, dass Nybble seine Gliedmaßen zwischen Ruhe und Stehen Zustand symmetrisch bewegt. &#x20;

![](/files/-M0Iesi8-ZEMpyJ3glyO)

### 6.4.4. Masseschwerpunkt

Versuche zu verstehen, wie Nybble auch beim gehen das Gleichgewicht hält. Wenn Nybble mit neuen Komponenten ausgestattet wird, versuche das Gewicht symmetrisch auf die Wirbelsäule zu verteilen. Möglicherweise muss der Akkuhalter auch hin- und her geschoben werden, um die beste Stelle für das Gleichgewicht zu finden.


# 7 🕹 Mit Nybble spielen

"Sie können den Wind nicht lenken, aber Sie können Ihre Segel justieren." ⛵️

## 7.1. Steuerung mit der Arduino IDE

Probiere die folgenden Befehle im seriellen Monitor aus:

* “**k**sit”
* “**m**0 30”
* “**m**0 -30”
* “**k**balance”
* “**k**tr”
* “**k**trL”
* “**d**”

{% hint style="warning" %}
Das Anführungszeichen zeigt nur an, dass es sich um Zeichenketten handelt. Bei der Eingabe auf dem seriellen Monitor dürfen keine Anführungszeichen verwendet werden.
{% endhint %}

## 7.2. Steuerung mit Infrarot-Fernbedienung

### 7.2.1. Tasten-Zuweisung

Nur die Position der Knöpfe ist von Bedeutung, wobei die Symbole helfen können, sich an die Funktionalitäten zu erinnern. Ich werde positionsbezogene Symbole definieren, die sich auf diese Tasten beziehen.

Ich verwende Abkürzungen für die wichtigsten Definitionen, um die SRAM-Nutzung zu reduzieren. Aufgrund der begrenzten Tasten einer physischen Fernbedienung verändere ich die Definitionen immer aus Spaß.

{% hint style="warning" %}
Die folgende Abbildung ist nur eine Illustration. Überprüfe die Funktion String translateIR(){...} in **Nybble.ino** auf die tatsächlich gültigen Tastendefinitionen. Diese können auch angepasst werden.
{% endhint %}

![](/files/-Lzv9nTMgv-xBbL32qm4)

### 7.2.2. Folgende Bewegungen werden hier vorgestellt

* Taste 1 schaltet die Servos ab und schickt Nybble in den Schlaf. Es ist immer sicher, darauf zu drücken, wenn Nybble etwas AWWARD macht. Ich meine es ernst. Es gibt immer noch einige Geister im System, die ich nicht ganz verstehe.
* Taste 2 ist die neutrale Stehposition. Nybble kann an der Seite geschoben werden, oder man lässt ihn aufstehen, um Hinterbeine und Schwanz zu bewegen. Seine Balancierfähigkeit kann auf einem schwankenden Brett getestet werden. Tatsächlich wird das Balancieren in den meisten Haltungen und Gängen aktiviert.
* Hebe Nybble in der Mitte der Wirbelsäule an, so dass sich alle Beine frei in der Luft bewegen können. Klicke auf alle Tasten der IR-Fernbedienung, um zu sehen, was sie bewirken. Lege Nybble dann auf einen breiten, flachen Tisch und versuche, diese Tasten erneut. Unterschiedliche Oberflächen haben unterschiedliche Reibung und beeinflussen die Laufleistung. Der Teppich wird für Nybbles kurze Beine zu buschig sein. Über diese Art von schwierigem Gelände kann er nur krabbeln (Befehl kcr).
* Man kann den Akkupack nach unten ziehen und entlang der längsseite des Bauches verschieben. Dadurch wird der Schwerpunkt eingestellt, was für die Gehleistung sehr wichtig ist. Sonst kann es passieren, dass er immer wieder umfällt.
* Wenn Nybble geht, kann man ihn einen kleinen Abhang (<10 Grad) hoch- und runterklettern lassen.
* Was immer Nybble auch tut, man kann ihn anheben und er wird aufhören sich zu bewegen. Wie eine Katze, die am Nacken gepackt wird.

{% hint style="info" %}

* Wenn Nybble nach dem Ausführen von **Nybble.ino** ständig piept, und auf dem seriellen Monitor Zahlen (etwa 500) angezeigt werden, wurde der Unterspannungs-Alarm ausgelöst. Man muss das NyBoard mit zwei 3,7-V-Li-ion/Li-Poly-Akkus betreiben, um den Schwellenwert zu übersteigen.
* "FIFO-Überlauf! Using last reading!" im seriellen Monitor ist eine algorithmische Lösung für die originale MPU6050-Bibliothek. Es handelt sich nicht um einen Fehler.
* Die Servos sind für den Antrieb über Innenzahnräder ausgelegt. Die Servos sollten nicht zu schnell von Hand gedreht werden.
* **Lasst Nybble nicht zu lange laufen.** Das wird die Elektronik überhitzen und die Lebensdauer der Servos verkürzen. Es ist möglich, das NyBoard V0\_1 so umzukonfigurieren, dass Nybble länger laufen kann.
* Manchmal kann das Programm aufgrund von Spannungsschwankungen stoppen. Prüfen Sie, ob der Akku schwach wird (< 3,5V pro Stück oder <7,0V in Reihe). Drücken Sie den Reset-Knopf auf dem NyBoard, um das Programm neu zu starten.
* Nybble hat Akrophobie! Wenn Sie ihn anheben und über einen gewissen Grad drehen, wird seine aktuelle Bewegung unterbrochen. Drehen Sie Nybble nicht um, um ihn zu erschrecken!
* Seid so freundlich, als würdet ihr mit einem echten Kätzchen spielen. (^=◕ᴥ◕=^)
  {% endhint %}


# 8 👨‍🏫 Nybble Fähigkeiten beibringen

"Gib einer Katze einen Fisch und du fütterst sie einen Tag lang. Bringt man einer Katze Fischen bei, füttert man sie ein Leben lang." 🎣

## 8.1. Verstehen von Fähigkeiten der **Instinct.h**

![](/files/-M0JBqv6r4TBWDRvJDuP)

Ein Frame mit Gelenkwinkeln definiert eine statische Haltung, während eine Reihe von Frames eine periodische Bewegung, in der Regel eine Gangart, definiert.

Das EEPROM hat begrenzte (1.000.000) Schreibzyklen. Daher will ich die Schreiboperationen darauf minimieren.

Es gibt zwei Arten von Fähigkeiten: **Instinkt** und **Newbility**. Die Adressen von beiden werden als Nachschlagetabelle in das eingebaute EEPROM(1KB) geschrieben, die eigentlichen Daten werden an verschiedenen Speicherplätzen gespeichert:

* I2C EEPROM (8KB) speichert **Instinkte**.

Die Instinkte sind bereits verfeinerte/fixierte Fähigkeiten. Man kann sie mit dem "Muskelgedächtnis" vergleichen. Multiple Instinkte werden nur einmal mit **WriteInstinct.ino** linear in das I2C EEPROM geschrieben. Ihre Adressen werden während der Laufzeit von **WriteInstinct.ino** generiert und in der Nachschlagetabelle im Onboard-EEPROM gespeichert.

* PROGMEM (das den 32KB-Flash mit dem Sketch teilt) speichert **Newbility**.

**Newbility** ist eine neue experimentelle Fähigkeit, die viele Tests erfordert. Sie wird weder in das I2C noch in das Onboard-EEPROM geschrieben, sondern in den Flash-Speicher im Format von PROGMEM. Es muss als ein Teil des Sketch von Arduino hochgeladen werden. Seine Adresse wird während der Laufzeit des Codes zugewiesen, obwohl sich der Wert selten ändert, wenn die Gesamtzahl der Fähigkeiten (einschließlich aller Instinkte und **Newbility**) unverändert bleibt.

## 8.2. Example **Instinct.h**

```cpp
//a short version of Instinct.h as example

#define WalkingDOF 8
#define NUM_SKILLS 6
#define I2C_EEPROM
const char cr[] PROGMEM = { 
26, 0, -5,
 35, 37,-46,-53,-23,-32, -3, 12,
 40, 28,-42,-59,-24,-28, -4, 12,
 ...
 33, 39,-47,-51,-22,-32, -3, 11,
};
const char stair[] PROGMEM = { 
54, 0, 30,
 44, 90,-39,-38, 10,-32,-10, 32,
 45, 90,-32,-46, 16,-38,-16, 38,
 …
 43, 90,-44,-32,  6,-26, -6, 26,
};
const char pu1[] PROGMEM = { 
1, 0, 0,
  0,-30,  0,  0,  0,  0,  0,  0, 20, 20, 60, 60, 60, 60,-55,-55,};
const char pu2[] PROGMEM = { 
1, 0, 0,
  0, 10,  0,  0,  0,  0,  0,  0, 60, 60, 40, 40,-45,-45,-55,-55,};
const char rest[] PROGMEM = { 
1, 0, 0,
-30,-80,-45,  0, -3, -3,  3,  3, 60, 60,-60,-60,-45,-45, 45, 45,};
const char zero[] PROGMEM = { 
1, 0, 0,
  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,};
#if !defined(MAIN_SKETCH) || !defined(I2C_EEPROM)
const char* skillNameWithType[] =
{"crI", "stairN", "pu1I", "pu2I", "restI", "zeroN",};
const char* progmemPointer[] = 
{cr, stair, pu1, pu2, rest, zero, };
#else
const char* progmemPointer[] = {stair, zero};
#endif
```

### 8.2.1. Definierte Konstante

`define WalkingDOF 8`

Bedeutet, dass die Anzahl der DoF (Grad der Freiheit) für das gehen auf Nybble 8 beträgt.

`define NUM_SKILLS 6`

Die Gesamtzahl der Fertigkeiten 6 beträgt. Anzahl und Listeneinträge sollten übereinstimmen.`const char* skillNameWithType[]`.

`define I2C_EEPROM`

Bedeutet, dass es ein I2C EEPROM auf dem NyBoard gibt, um Instinkte zu speichern.

{% hint style="warning" %}
Wer eine eigene Platine baut, die kein I2C hat, sollte diese Zeile auskommentieren. Dann werden beide Arten von Fähigkeiten als PROGMEM im Flash gespeichert. Dadurch wird der verfügbare Flash-Speicherplatz für Funktionscodes reduziert. Wenn es zu viele Fähigkeiten gibt, kann es sogar die Größenbegrenzung für das Hochladen des Sketches überschreiten.&#x20;
{% endhint %}

### 8.2.2. Datenstruktur des Fähigkeitsarrays

Betrachtet die folgenden beiden Fähigkeiten:

```cpp
const char rest[] PROGMEM = { 
1, 0, 0,
-30,-80,-45,  0, -3, -3,  3,  3, 60, 60,-60,-60,-45,-45, 45, 45,};
const char cr[] PROGMEM = { 
26, 0, -5,
 35, 37,-46,-53,-23,-32, -3, 12,
 40, 28,-42,-59,-24,-28, -4, 12,
 ...
 33, 39,-47,-51,-22,-32, -3, 11,
};
```

Sie werden formatiert als:

![](/files/-M0Io5NCKGG9p3Z3m6xI)

{% hint style="info" %}
Eine Körperhaltung hat nur einen Frame, und ein Gang hat mehr als einen Frame.&#x20;
{% endhint %}

### 8.2.3. Suffix zur Angabe von Instinkt und **Newbility**

Sie müssen **WriteConst.ino** hochladen, um die Fähigkeiten zum ersten Mal in das EEPROM zu schreiben. Die folgenden Informationen werden verwendet:

```cpp
const char* skillNameWithType[] =
{"crI", "stairN", "pu1I", "pu2I", "restI", "zeroN",};
const char* progmemPointer[] = 
{cr, stair, pu1, pu2, rest, zero, };
```

{% hint style="info" %}
Man beachte das Suffix I oder N in den Namensketten der Fähigkeiten. Sie teilen dem Programm mit, wo die Skill-Daten gespeichert werden sollen und wann ihre Adressen zugeordnet werden.
{% endhint %}

Wenn es sich bei dem hochgeladenen Sketch um den Hauptsketch **Nybble.ino** handelt und Sie ein NyBoard mit I2C-EEPROM verwenden, benötigt das Programm später nur den Verweis auf die **Newbility**-Liste

`const char* progmemPointer[] = {stair, zero};`

&#x20;um das volle können der vordefinierten Fähigkeiten zu extrahieren.&#x20;

## 8.3. Neue Fähigkeiten und Verhaltensweisen definieren

### 8.3.1 Die vorhandene Fähigkeitsvorlage modifizieren

Es gibt bereits eine Fähigkeit Namens "zeroN" in **Instinct.h**. Es ist eine Haltung im Null-Zustand, die auf eine neue Definition wartet.

Zuerst kann der Befehl `mIndex Offset` verwendet werden, um einzelne Gelenke an die Zielposition zu bewegen, anschließend können die Gelenkwinkel ( Fettschrift) im Feld auf einmal ersetzt werden:

```cpp
const char zero[] PROGMEM = { 
1, 0, 0,
  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,};
```

Da es als **Newbility** deklariert ist und nicht in das I2C EEPROM geschrieben werden muss, kann man **Nybble.ino** jedes Mal hochladen, wenn das Arry verändert wurde (ohne **WriteInstinct.ino** hochzuladen). Man kann die neue Haltung auslösen, indem 7 auf der IR-Fernbedienung gedrückt wird oder gibt `kzero` in den seriellen Monitor ein.

Sie können diese Fähigkeit umbenennen, aber nicht vergessen, die Tastaturbelegung der IR-Fernbedienung zu aktualisieren.&#x20;

### 8.3.2. Entdecke mehr verborgene Fähigkeiten in Instinct.h

In **Instinct.h** sind weitere Fähigkeiten versteckt. Sie können vom seriellen Monitor aus mit dem Befehl 'k' aufgerufen werden. Zum Beispiel wird kcd1 Nybble in die Stellung "cd1" bringen, was "check down" bedeutet.

![](/files/-M0IfF9WuFT5DV6TL8XA)

Außerdem können kurze Programme geschrieben werden, um mehrere Fähigkeiten nacheinander auszuführen, wie das "Liegestütz"-Verhalten in **Nybble.ino**. Wenn man beispielsweise die Körperhaltung "cd1" und "cd2" als Schleifenfolge verbindet, kann man Nybble dazu bringen, sich nach vorne zu lehnen, von links nach rechts und dann von rechts nach links zu schauen.

### 8.3.3 Automatisierung

Bislang wurde Nybble mit der Infrarot-Fernbedienung gesteuert. Sie treffen Entscheidungen für Nybbles Verhalten.&#x20;

Nybble kann mit dem Computer oder dem Smartphone verbunden werden, um Anweisungen automatisch zu senden. Nybble wird sein bestes geben, um diese Anweisungen zu befolgen.

Durch das hinzufügen einiger Sensoren (z.B. eines Berührungssensors) oder Kommunikationsmoduls (z.B. eines Sprachsteuerungsmodul) kann Nybble neue Wahrnehmungs- und Entscheidungsfähigkeiten erhalten. Sie können diese automatischen Fähigkeiten zusammenfassen und dafür sorgen, dass Nybble schließlich von alleine lebt!


# 9 👨‍🎓 OpenCat.h verstehen

"Lasst die Katze aus dem Sack." 🧞‍♂️

## 🔬Das wird ein anderes Lehrbuch werden.&#x20;

Das Steuerungssystem hinter Nybble ist OpenCat, das ich schon seit einiger Zeit entwickel. Sie können weitere Geschichten aus meinem [Beiträgen](https://www.hackster.io/petoi/opencat-845129) auf Hackster.io lesen.

![](/files/-M0IwHuwsRZH9upabV8h)

Es ist im Moment zu viel Arbeit 🤷🏻‍♂️ aber Sie können gerne mit mir im Forum oder per E-Mail darüber diskutieren. Das Gute ist, dass ich den Code mit zukünftigen OpenCat-Modellen und sogar mit [Ihren eigenen DIY Robotern](https://www.petoi.com/forum/showcase) kompatibel halte! Hoffentlich wird die Dokumentation während des Prozesses vervollständigt.

![](/files/-LzvAzCUfoN2lDr77qlQ)


# 10 🛠 Chaos mit dem Roboter

"Schneller! Schlauer! Niedlicher!" 🦾

Das schreibst 👉 DU!

Teile dein Wissen und deine Kreativität mit der Gemeinschaft unter <https://www.petoi.com/forum>.

![](/files/-M0IfMv7Y9ZxlmEwgpzW)


# 狸宝用户手册😼

李荣仲

## 导读

为使本文档简明易用，我侧重于组装步骤而非原理剖析。如果您对“为什么”更感兴趣，欢迎来我们的论坛<https://www.petoi.com/forum>发帖，或写信给<info@petoi.com>和我讨论。

![](/files/-LzqLLxy8Dl8E3aP-Duy)

我们已在Indiegogo（[igg.me/at/nybble](http://igg.me/at/nybble)）上众筹成功并在[官网](https://nybble.petoi.com/chinese-1/www.petoi.com/store)持续销售狸宝套件，国内淘宝包邮。我们的社交网络（B站/Instagram/推特/脸书/GitHub）帐号&#x4E3A;**@PetoiCamp**，欢迎通过标签 **#nybble #petoi #opencat** 分享您的组装成果或心得，我们会转发的！

{% hint style="info" %}
最近更新: 07/24/2022
{% endhint %}


# 1 🧘‍♂️ 工具和准备

“磨刀不误砍柴工” 🪓

## 1.1 准备

准备一张整洁的工作台，和一些小盒子以盛放物料。事先给套件内容拍个照以备后期参考。

{% hint style="success" %}
最好在没有地毯或马赛克瓷砖的房间组装，小螺钉和弹簧往往“遇土则入”。🐒
{% endhint %}

## 1.2 工具和配件

{% tabs %}
{% tab title="必需" %}

|              工具             |                                                                                备注                                                                               |
| :-------------------------: | :-------------------------------------------------------------------------------------------------------------------------------------------------------------: |
|             美工刀             |                                                                             用于取下结构件                                                                             |
|              砂纸             |                                                                               抛光毛刺                                                                              |
|           平头和十字螺丝刀          |                                                                          适用M2螺丝（直径2mm）                                                                          |
|              电脑             | <p>下载 <a href="https://github.com/PetoiCamp/OpenCat/releases">Petoi 桌面应用程序</a></p><p>安装最新版<a href="https://www.arduino.cc/en/Main/Software">Arduino IDE</a></p> |
| USB-micro USB线缆或USB-TypeC线缆 |                                                                             连接开发板和电脑                                                                            |
|      2节14500 3.7V锂离子电池      |                                                                        **不要和普通5号电池弄混了！**                                                                        |
|           锂电池智能充电器          |                                                                           用错充电器可能酿成事故！                                                                          |
|         {% endtab %}        |                                                                                                                                                                 |

{% tab title="可选" %}

|       工具      |                                                        备注                                                       |
| :-----------: | :-------------------------------------------------------------------------------------------------------------: |
|      电烙铁      |      [焊接LED装饰灯](https://github.com/PetoiCamp/OpenCat/blob/master/Resources/Nybble_SolderingUltrasound.pdf)      |
|   HC-05蓝牙模块   | [无线上传代码和遥控](https://www.petoi.com/forum/hardware/add-bluetooth-module-for-uploading-sketches-and-communication) |
|     油漆或染料     |                                                      给狸宝上色                                                      |
| Arduino或树莓派套件 |                                                    给狸宝添加更多组件                                                    |
|      万用表      |                                                       调试用                                                       |
|      示波器      |                                                       调试用                                                       |
|    热熔胶/万能胶    |                                                  尽量避免这种不可逆的方案！                                                  |
|  {% endtab %} |                                                                                                                 |
| {% endtabs %} |                                                                                                                 |


# 2 🧩 开箱

“生活就像一盒巧克狸宝” 🔍

实际套件内容和包装方式可能会随生产批次略作调整，但本说明书的命名空间将保持一致。

最新版本：

![](/files/lW68oWeYz4ZpsaCEjnd1)

早期版本：

![](/files/-LzqMiO7lGRc5u-WaA1i)

## 2.1 从基板切下结构件

结构件在激光切割过程中可能会残留焦油污渍，可用湿纸巾整体擦拭基板正反面。

有用的结构件都通过细小的连接固定在基板上。虽然很容易用手推出，但我们仍推荐您用小刀切断连接，以免在掰扯中导致木质沿纤维方向开裂。

结构件可随用随取，以免凌乱。在取出所有结构件后，您可以试着弯曲和折断残留的基板框架，以感受木质胶合板的机械强度、弹性及各向异性。这有助于增强手感，在后续的组装过程中提高信心。

## 2.2 去除毛刺

用砂条除去结构件上可能残存的毛刺以防扎手，但不要过度打磨，否则会影响组装的紧度。

## 2.3 螺丝

套件中有5种螺丝，示意图中用不同的颜色来更好地标注它们在结构上的位置。并不是所有配送的螺丝都会用完，也不是所有结构件上的孔洞都需要螺丝。请仔细观察[组装动画](https://www.youtube.com/playlist?list=PLHMFXft_rV6MJ-BhDN-O5I_u4YeAie30n)中的螺丝分布。

![](/files/-LzqSHAqZPRaRf-a3MBg)

* A用于锁定舵机臂和舵机输出轴。A和D在随舵机的附件包中。
* B（尖头）用于把电路板固定到骨架上，**但在后续版本中已经被螺丝C取代了**。
* C（平头）用于固定大腿的对夹结构。如果觉得C的平头很难钻进一些小的孔洞中，可以[用D的尖头预先扩孔](https://youtu.be/7KNJH10IEIw)。
* D（尖头）用于把舵机固定到结构件上。
* E（最长的那两根）用于安装电盒。

在最早期的批次中，B、C和E是封装在如下图的基板上的。

![](/files/-LzqSMr7JII0_hYV1cP_)

## 2.4 弹簧

有三种弹簧：F，G，H。

* 最粗长的弹簧F用于大腿中的缓冲结构，会有一个额外的备用件。
* 粗短的弹簧G装在脖子下面，后来也被F取代了。
* 细短的弹簧H（两根）用于电池盒的悬挂结构。

## 2.5 舵机

之前我们使用辉盛的MG92B作为肩关节，MG90D作为其他关节。回国后我们优化升级了舵机方案，仅在电缆长短上有所区分。短线舵机（6个）用于摇头、尾、肩等离躯干近的关节，长线舵机（5个）用于点头和膝关节。同时我们细调了舵机的各项参数以更适合狸宝的使用场景。

![](/files/-LzqSgmc6mklGooo4Wco)

{% hint style="info" %}
业余模型舵机有一些重要的参数指标，如下表：
{% endhint %}

|  齿轮 |  信号 |  协议 |   电压   |  马达 |  轴承 |
| :-: | :-: | :-: | :----: | :-: | :-: |
|  塑料 |  模拟 | PWM |   5V   |  有刷 |  无  |
|  合金 |  数字 |  串口 | 高压（8V） | 空心杯 |  有  |
|     |     |     |        |  无刷 |     |

在狸宝套件里，我们配套了订制的合金齿、数字PWM、高压铁芯马达的带轴承的舵机。对于完全DIY的玩家，其他通用舵机仍然适用于OpenCat的控制框架，但是需要更多的调试以达到最好的性能表现。

## 2.6 测试支架

您可以3D打印这个支架，保证狸宝的腿在编程和测试中不会接触地面。

{% embed url="<https://www.thingiverse.com/thing:7003788>" %}

<figure><img src="/files/7KL542aRevIAq4A33cAh" alt="" width="332"><figcaption></figcaption></figure>


# 3 ⌨️ 配置NyBoard

"谁喜欢炸薯条？" 🍟

配置 NyBoard，有两种方法：

* 最简单的方法是使用 [Petoi 桌面应用程序](https://docs.petoi.com/v/chinese/zhuo-mian-ying-yong/zong-lan)
* 如果您有一定的编程经验，可以使用[Arduino IDE](https://docs.petoi.com/v/chinese/arduino-ide/wei-nyboard-shang-chuan-cheng-xu)


# 4 🏗 组装骨架

"整体大于局部的堆砌" 🔩

您可以快速地看一下整体的组装流程，部分更新的元件会在文字部分有说明。

{% embed url="<https://www.bilibili.com/video/BV13A411J75F>" %}

{% embed url="<https://www.bilibili.com/video/BV1EM4y1c7aq>" %}

## 4.1 头颈

### 4.1.1 物料单

![](/files/-LzqY3Ww_qXvI6506FS7)

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

### 4.1.2 预处理超声波传感器模块

{% hint style="warning" %}
超声波测距避障算法尚未整合进已发布的代码中，下列步骤仅为玩家提供一个起点，对于实现Nybble的基本功能非必要操作。
{% endhint %}

我们使用一块ODM的[内置 RGB 灯超声波模块](https://docs.petoi.com/v/chinese/kuo-zhan-mo-kuai/chao-sheng-bo-chuan-gan-qi)。它不需要焊接，但你需要把配送的连接头部的插线卡扣削掉才能装进头里。

示例代码：

示例<https://github.com/PetoiCamp/OpenCat/tree/main/ModuleTests/testRGBLedUlrasonic>

教程： <https://youtu.be/kV2UYbpfGic>

{% embed url="<https://www.bilibili.com/video/BV1GL4y177SR>" %}

{% hint style="info" %}
2021年1前我们使用的是通用的超声波模块。

传感器通过四针母-母杜邦线连接到NyBoard上。

* **把可选LED焊接到超声波模块上**

可选的RGB三色LED可以[焊到超声波模块](https://files.gitbook.com/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LygA-EAoP4h8Q2BOGHR-887967055%2Fuploads%2FzwPZbWvDIVbQCXYh9etz%2FNybble_SolderingUltrasound.pdf?alt=media\&token=b2271a90-4c83-4dbc-a0bd-37c00ed1535a)的四个引脚上以指示其工作状态，或仅作为可编程的装饰灯使用。

把超声波模块的引脚向两边微微弯折以便后面的安装。

<img src="/files/-LzqYVfruCS2nXrLZ-6s" alt="" data-size="original">

* **把4针排针焊接到NyBoard空余的GPIO上**

超声波模块和NyBoard背面空余的GPIO相连。您也可以在**OpenCat.h**中自定义GPIO的用途。默认代码中超声波模块应与“D8 D9 D10 GND”相连，如下图。

<img src="/files/-LzqY__cEG2oJ17Hwi4J" alt="" data-size="original">
{% endhint %}

### 4.1.3 切割舵机摇臂

![](/files/-LzqZ5SpzWye9GDfnJOy)

大部分用到的舵机摇臂都是通过对十字形臂 I 切割而来，您可以用其他用不到的舵机摇臂先练练手。您可以用剪刀、指甲钳或烧热的小刀进行切割，注意预留长度便于微调。

{% hint style="info" %}
注意参考螺丝孔的位置来确定剪切的位置。对于辉盛舵机的十字臂，还要注意两边长臂的粗细。
{% endhint %}

我们更换舵机供应商后，舵机配套的摇臂也有所变化（如下图）。为降低复杂度，现在我们只用摇臂 I 和 K。K可以用在尾巴上的舵机，其他摇臂都从十字臂 I 剪切而来。

![](/files/-LzqZF39t2q6nsaTXLUe)

### 4.1.4 组装头颈

按[组装动画](https://zhuanlan.zhihu.com/p/56113182)顺序依次组装头颈。

{% hint style="info" %}
注意目前只能装好一边的颈部，以便后续的校准安装。另外注意舵机线的绕行方向，否则会蹭到侧面的脖子。
{% endhint %}

![](/files/-LzqZXj70buMB2kx72H5)

![](/files/-LzrBQzZkNliUc15A9-M)

![](/files/-Lzr9GTr6ea0WvIpCf3P)

{% hint style="warning" %}
不要把头部舵机和脖子上的舵机摇臂连起来，后面还要校准！
{% endhint %}

## 4.2 躯干

### 4.2.1 物料单

* 只装NyBoard的构型

![](/files/-LzrEp4ugQzR4OuO_N9k)

在不安装树莓派的情况下，NyBoard是安装在y1底面的，同时舵机的插针也朝向腹面。在后续版本中，y1两边的螺丝孔都改成了两个以保持对称。

* 安装树莓派的构型

![](/files/-LzrBckOyUA7tvAf5R5p)

用y1Pi替代y1，注意比较粉红色结构件的位置变化。另外，这时NyBoard要安装在y1Pi的上面。树莓派通过2x5的插座和NyBoard连接，同时两侧需要用Pi Stand辅助支撑。

{% hint style="warning" %}
在第一批下线的100片NyBoard上，生产商使用了略高的跳线针，会影响树莓派的安装。需要把这些跳线针弯折一些以降低高度，详见[论坛帖子](https://www.petoi.com/forum/clinic/placement-of-raspberry-pi-3b)。
{% endhint %}

* 兼容其他开发板

结构件中有5个木质六角螺母，可用于其他开发板的安装固定。

### 4.2.2 安装可调节重心的电池盒

2022年6月后我们给 Nybble 标配一块可充电锂电池，也可以在我们的[`网店`](https://sjrhnplpq7y1qvcd-55020159160.shopifypreview.com/collections/robots)购买。给原版Nybble升级的3D打印件可以在[此](https://github.com/PetoiCamp/NonCodeFiles/blob/master/stl/NybbleWood/Nybble_Belly/Nybble_BellyForBittleBattery.stl)下载。

![](/files/9YxYTnCV0uFcFA0tVGJ8)

{% embed url="<https://youtu.be/aWU1mOPHKWk>" %}
新电池块的安装方式
{% endembed %}

{% embed url="<https://www.bilibili.com/video/BV1S34y1Q78D>" %}

{% hint style="info" %}
如果你手上的是电池盒版本：

电池盒上的铁条起到开关的作用。把铁条末端折成90度，这样在闭合时可以紧贴电池盒。把长螺丝穿过铆钉，再一起穿过电池盒上的孔，注意孔洞的位置。稍微用力把铆钉推进孔里。

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

电池盒将通过一个弹簧悬挂结构与躯干相连，来调整行走时的重心。

{% hint style="warning" %}
虽然这里用的是通用5号电池（1.5V AA）的电池盒，但Nybble用的是 3.7V 14500 锂离子电池。二者尺寸相同，注意不要弄混。
{% endhint %}
{% endhint %}

### 4.2.3 组装躯干

按[组装动画](https://zhuanlan.zhihu.com/p/56113182)顺序依次组装躯干。如果要安装树莓派，请观察动画[调整构型](https://youtu.be/0T1K5_oxFUM)。

注意红外线和6针插口的长引脚，它们应折向特定方向以适应不同的安装构型。但不要过多弯折以免金属疲劳断裂。

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

{% hint style="info" %}
脊柱件的榫头可能会比肩膀件上的卯口略大，可以先反着把脊柱插进肩膀，摇晃磨合，然后再按正常方向进行组装。
{% endhint %}

![反向插入进行磨合](/files/-LzrJRfRYTu2wdHxD_aQ)

## 4.3 小腿

### 4.3.1 物料单

![](/files/-LzrC_qyLTV5CQXWhLXv)

### 4.3.2 穿上胶鞋

脚尖的锯齿状表面已足够满足行走的摩擦力要求，硅胶垫的作用是增大摩擦力和缓冲。其实在某些路面上，赤脚比穿鞋效果好。

![](/files/-Lzwlfw6ZdJY605tLXrl)

### &#x20;4.3.3 组装小腿

按[组装动画](https://zhuanlan.zhihu.com/p/56113182)顺序依次组装小腿。

把舵机插入小腿的窗口，注意舵机线缠绕的方式，这是为了避免和后面要安装的电池盒发生摩擦。在安装时要思考四条腿的对称性。

{% hint style="warning" %}
先不要拧上螺丝，很多人会在对称性上犯错，到最终组装时才发现。
{% endhint %}

## 4.4 大腿

### 4.4.1 物料单

![](/files/-LzrE1NqocWQbfCOyXJH)

在新的版本中，我们用更精确、更强韧的3D打印件取代了木质的thigh2。

![](/files/-M0GUaQAoLqH8sHjmz2H)

### 4.4.2 切割舵机摇臂

切割的位置详见前面的[**头颈**](https://docs.petoi.com/v/chinese/3-zu-zhuang-gu-jia#3-1-3-jian-qie-duo-ji-yao-bi)小节，切割后的摇臂小枝刚好能插入弹簧F里。

### 4.4.3 组装大腿

按[组装动画](https://zhuanlan.zhihu.com/p/56113182)顺序依次组装大腿。

在用螺丝C合并和锁定thigh1和thigh2前，把从小腿引出的舵机线穿过大腿中间的狭缝。布线时要思考四条腿的对称性。

![](/files/-LzrGqfQjXknCSljIYtH)

注意组合时螺丝的插入方向

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

拧上螺丝C后，舵机臂应该刚好能在大腿的槽中滑动，可以通过调节螺丝的松紧度来调节滑动摩擦力的大小。如果调节范围不够，还可以：

* 用平头螺丝刀把thigh2的槽刮深；
* 在thigh2的槽里滴一层胶水，平置阴干，以使槽变浅。

{% hint style="warning" %}
暂时不要把小腿装到大腿上，也不要把大腿装到躯干上。
{% endhint %}

## 4.5  尾巴

### 4.5.1 物料单

![](/files/-LzrHT_lNLp1xQoNm70x)

### 4.5.2 组装尾巴

按[组装动画](https://zhuanlan.zhihu.com/p/56113182)顺序依次组装尾巴。

螺丝D要拧入摇臂K的从中间数第三个螺丝孔里。注意其他各部件的堆叠顺序。尾尖的轮子应该可以顺滑地转动，而整个尾部可以相对尾根扬起一个小角度。

![](/files/-LzvwogrOCGa2pl6dDiL)

在最新的版本中，尾巴和摇臂的连接结构被大大地简化了：

![](/files/-MjZ8hslaYYebx0hGzzV)

{% hint style="warning" %}
暂时不要把尾巴装到躯干上。
{% endhint %}


# 5 🔌 连线

“万物互联” 🤝

## 5.1 关节映射

类似于四肢到脊髓的神经连接，狸宝的舵机对称地连接在NyBoard的PWM插头上。虽然狸宝没有肩膀的滚转自由度，但对应的关节序号（3\~7）仍然预留着，和完整的OpenCat架构保持兼容。

![](/files/-LztzfKi1t-h0c3PrAKu)

![](/files/j8YxcmbIAHPmQmN193tp)

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

{% hint style="info" %}
NyBoard V0\_1 和 V0\_2 的 PWM 脚序号顺序是不一样的，但是实际连线的模式一样，所有调整都通过修改程序里的映射表完成了。

直接按照上图所示舵机编号与PWM引脚针位置的对应关系连线即可。
{% endhint %}

## 5.2 连接舵机

{% hint style="warning" %}
观察舵机索引号与正确的 PWM 引脚连接起来。 小心电线的方向。 舵机的棕色线为 GND (-)，在NyBoard V0\_1上沿中线排列。 在更高版本的 NyBoards上，它们沿外沿排列。

快速检查一下 NyBoard V0\_1 上的所有棕色电线都应该远离电路板表面。 在 NyBoard V0\_2 上，棕色线应靠近电路板表面。

从 NyBoard V0\_2 开始（包括 V1\_\*的主板），舵机插线的位置还是一样的，但是颜色的方向会 NyBoard V0\_1 相反。

<img src="/files/-LzuyeF0enbBsNQnuiwW" alt="" data-size="original">
{% endhint %}

尽管各版本NyBoard的PCB不尽相同，但连线的模式是相同的。你不需要查看电路板上的舵机序号，因为相关的映射已经在程序中解决了。你只需要在上传代码时选择正确的电路板型号。

## 5.3 准备校准

{% hint style="info" %}
安装头尾和腿前必须先进入校准模式。校准时，需要将头、尾、腿部组件安装在舵机输出轴的齿轮上。暂时不要拧上螺丝。

进入校准状态有5种方法：

* 长按电池上按钮，将机器人身体左/右侧立开机，机器人会自动进入校准状态。&#x20;
* 使用移动端应用 **Petoi**  app 进入校准页面
* 使用 Petoi 桌面应用程序中 **关节校准** 子程序
  * 如果您已经用串口适配器连接了机器人和电脑，点击“**关节校准**”按钮会自动进入校准状态
  * 点击校准界面中的“**校准位**”按钮
* 在Arduino IDE的串口监视器中，输入串口命令“**c**”&#x20;
* 按下遥控器上的校准按钮 ![](/files/Z6sDyx6Cg8ET03cAPOAx)（3,3 - 第 3 行和第 3 列）。
  {% endhint %}

如下图所示安装头部、尾部和腿部组件：

![](/files/uONYGimCDzN46Z6LNYIc)

可以借助套件中的 L 形尺作为参考进行安装。

![](/files/QtB9oYji6WEUTRfjWNfU)

## 5.4 布线

在校准、排查和最终安装后，可以花些时间来优化布线，使狸宝看起来更清爽。在机身上分布着很多布线的小窗口可用来整理线缆，您可以发展出自己喜欢的模式，基本原则是不要让线缆干涉到舵机的运动，并且留有一定的缓冲余地。

下面是我们建议的布线方式：

NyBoard V1\_\* 主板 :

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

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

{% hint style="info" %}
NyBoard V0\_\* 主板 :

<img src="/files/-Lzux4DyWVNeLFyWg9tA" alt="只有NyBoard" data-size="original">

<img src="/files/-LzuwaVYFLC1C6TvmDNM" alt="NyBoard 加树莓派" data-size="original">
{% endhint %}


# 6 📐 校准

"失之毫厘，差之千里" 🎯

{% hint style="danger" %}
千万不要在第一次校准前把腿装到舵机上。

当舵机断电时，它们的输出轴可能被转到随机的角度，如果这时装上了腿，机器人并不知道这些腿的指向。当机器人上电时，这些腿可能互相冲撞或卡在机身上。长期堵转可能会损坏舵机。
{% endhint %}

机器人的关节需要校准才能继续使用。确保所有的舵机已按正确的方向连接到了主板的正确的位置上，电池正在供电（猫图标的黄色LED 在发光），并且所有的腿和头、尾没有装在舵机上，这些舵机都可以自由旋转。

我们的校准流程会给主板发送一个校准指令，并把所有关节转向已知的角度。您可以把腿按最接近的姿势装到关节舵机上，再用软件进行校准。

校准 Nybble，有三种方法：&#x20;

* 使用[移动应用 Petoi](https://docs.petoi.com/v/chinese/shou-ji-ying-yong/xiao-zhun-yu-kong-zhi)
* 使用 [Petoi 桌面应用程序](https://docs.petoi.com/v/chinese/zhuo-mian-ying-yong/guan-jie-xiao-zhun)
* 使用 [Arduino IDE](https://docs.petoi.com/v/chinese/arduino-ide/shi-yong-arduino-ide-xiao-zhun)


# 7 🕹 撸猫

“樯橹灰飞烟灭” ⛵️

没有任何编程经验的用户可以通过以下4种方式来控制Nybble：

* 使用[**红外遥控器**](https://docs.petoi.com/v/chinese/hong-wai-yao-kong/yao-kong-qi)
* 使用手机应用 [**Petoi**](https://docs.petoi.com/v/chinese/shou-ji-ying-yong/kong-zhi)
* 使用桌面应用程序[**技能创作坊**](https://docs.petoi.com/v/chinese/zhuo-mian-ying-yong/ji-neng-chuang-zuo-fang)
* 使用[**Petoi编程积木**](https://docs.petoi.com/v/chinese/tu-xing-hua-bian-cheng/petoi-bian-cheng-ji-mu)

如果你有一定的编程经验或想探索更高级的功能，可以尝试以下方法：

* 使用 [**Arduino IDE**](https://docs.petoi.com/v/chinese/chuan-kou-xie-yi)
* 使用 [**Python**](https://docs.petoi.com/v/chinese/api/serialmaster-shi-yong-zhi-nan)
* 使用 [**MicroPython**](https://docs.petoi.com/v/chinese/tong-xin-mo-kuai/wifi-mo-kuai-esp8266/micropython-kong-zhi-qi)
* 使用 [**ESP8266 + Python**](https://docs.petoi.com/v/chinese/tong-xin-mo-kuai/wifi-mo-kuai-esp8266/shi-yong-esp8266-+-python-jiao-ben-shi-xian-wu-xian-qun-kong)
* 使用 [**Raspberry Pi**](https://docs.petoi.com/v/chinese/api/tong-guo-shu-mei-pai-kong-zhi-ji-qi-ren)
* 使用[**扩展模块**](https://docs.petoi.com/v/chinese/kuo-zhan-mo-kuai/kuo-zhan-mo-kuai-gai-yao-shuo-ming)


# 8 👨‍🏫 驯猫

“授喵以鱼不如授喵以渔” 🎣

为狸宝创作新技能，有两种方法：

* 使用桌面应用程序的[技能创作坊](https://docs.petoi.com/v/chinese/zhuo-mian-ying-yong/ji-neng-chuang-zuo-fang)
* [编写Arduino程序代码](https://petoi.gitbook.io/r-and-d-memo/)


# 9 👨‍🎓 深读代码

"好奇害死猫。" 🧞‍♂️

## 🔬详细解读大概能编成一套课本了

狸宝背后的设计框架是OpenCat，您可以在Hackster.io上读到我早年的几篇[帖子](https://www.hackster.io/petoi/opencat-845129)。作为业余爱好几经寒暑，竟成了我创业的契机。

![](/files/-M-40wqGNG8R6cfqcf0a)

通用性的技术文档已合并在 [docs.petoi.com](https://nybble.petoi.com/chinese-1/www.docs.petoi.com) 左侧目录，欢迎同好通过论坛或电邮和我讨论。我会保持目前代码和未来OpenCat产品线的兼容性，甚至可以驱动[玩家DIY的机器人](https://www.petoi.com/forum/showcase)。希望本文档可以在项目进行中逐渐完备起来。

![](/files/-LzvAzCUfoN2lDr77qlQ)


# 10 🔩 给狸宝准备一些新玩具

具体详情请参考文档中心[扩展模块](https://docs.petoi.com/v/chinese/kuo-zhan-mo-kuai/kuo-zhan-mo-kuai-gai-yao-shuo-ming)相关章节。


# 11 🛠 各显神通

“更快！更巧！更萌！” 🦾

由 👉 您书写！和全世界的玩家分享您的知识和创意吧！‌

论坛地址：<https://www.petoi.com/forum>

![](https://blobscdn.gitbook.com/v0/b/gitbook-28427.appspot.com/o/assets%2F-LygA-EAoP4h8Q2BOGHR%2F-Lzv3BWkB2SUaHOyWf07%2F-LzvAfufU5ndu8PDxgN9%2FOlympics.png?alt=media\&token=a475fef0-0b98-462d-b526-b9c0a6708450)


# Nybble User Manual 😼

Rongzhong Li

## Getting started

To keep these instructions simple to use, I’m focusing on the assembly rather than an in-depth explanation.&#x20;

If you have specific questions on “why” rather than “how”, please post on our [Petoi robot forum](https://www.petoi.com/forum) at or write to <info@petoi.com>.

![](/files/-LzqLLxy8Dl8E3aP-Duy)

You can support us by shopping at [Petoi coding robot shop](https://www.petoi.com/store). Our social media (Instagram/Twitter/Facebook/GitHub) account is **@PetoiCamp**. Share your build with us by tagging **#nybble #petoi #opencat** so we can repost it for you!&#x20;

{% hint style="info" %}
Last Updated: 07/24/2022
{% endhint %}


# 1 🧘‍♂️ Tools and Preparation

"A beard well lathered is half shaved." 🪒

## 1.1 Preparation

Prepare a clean desk and some small boxes to unzip the package. Take a picture of the kit contents in case you lost something later.&#x20;

{% hint style="success" %}
It’s better to work in a room without carpet or textured mosaic. Little screws and springs can magically hide themselves if dropped onto the ground.&#x20;
{% endhint %}

## 1.2 Tools and accessories

{% tabs %}
{% tab title="Required" %}

| **Tool**                                                                                             | **Notes**                                                                                                                                     |
| ---------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------- |
| Utility knife                                                                                        | Cut the tabs holding the wooden puzzle pieces                                                                                                 |
| Sanding paper/foam                                                                                   | Remove pointy fibers                                                                                                                          |
| Flat and Phillips screwdrivers                                                                       | For M2 (diameter = 2mm) screws                                                                                                                |
| A Windows/Mac/Linux Computer                                                                         | Install the latest [Arduino IDE](https://www.arduino.cc/en/Main/Software) or [the Desktop App](https://github.com/PetoiCamp/OpenCat/releases) |
| USB-microUSB or USB-TypeC cable                                                                      | Connect the uploader to the computer.                                                                                                         |
| [2 x 14500 3.7V Li-ion batteries](https://www.petoi.com/blogs/blog/recommended-batteries-for-nybble) | <p>Don’t mix with regular AA batteries (1.5V)! </p><p>The capacity should be around 800mAh. </p>                                              |
| Smart charger for batteries                                                                          | Wrong charger may cause danger!                                                                                                               |
| {% endtab %}                                                                                         |                                                                                                                                               |

{% tab title="Optional" %}

| **Tool**                      | **Note**                                                                                                                                       |
| ----------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------- |
| Soldering iron w/ accessories | [Solder the decorative LED to ultrasound sensor](https://github.com/PetoiCamp/OpenCat/blob/master/Resources/Nybble_SolderingUltrasound.pdf)    |
| HC-05 bluetooth module        | [Wirelessly upload sketch and communicate](https://www.petoi.com/forum/hardware/add-bluetooth-module-for-uploading-sketches-and-communication) |
| Color paints                  | Give your Nybble a unique look                                                                                                                 |
| 3D printer w/ accessories     | Add your special design                                                                                                                        |
| Arduino/Raspberry Pi kit      | Add more gadgets to Nybble                                                                                                                     |
| Multimeter                    | Test and debug                                                                                                                                 |
| Oscilloscope                  | Test and debug                                                                                                                                 |
| Hot glue/super glue           | Avoid using them. OpenCat is designed to be soft!                                                                                              |
| {% endtab %}                  |                                                                                                                                                |
| {% endtabs %}                 |                                                                                                                                                |


# 2 🧩 Open the Box

"life is like a box of Nybble." 🔍

The actual kit contents and packaging method may be adjusted as we improve the product. This instruction will keep consistent with the current namespace.

Newest kit contents:

![](/files/jvkh1w4KzBKsi4bNySJa)

Early kit contents:

![](/files/-LzqMiO7lGRc5u-WaA1i)

## 2.1 Cut body pieces off the baseboard.

There might be some tar residue on the wooden pieces from laser cutting. Use a piece of wet soft tissue to clean up the board.&#x20;

The functional pieces are attached to the baseboard by lightly cut tabs. Though you could pop those pieces out by hand, it’s very highly recommended that you use a knife to cut on the backside of the tabs to avoid potential damage to the middle layer, where the fiber direction is perpendicular to the surface fiber.&#x20;

After taking out all the pieces from the baseboard, you are encouraged to bend and break the remaining structures on the baseboard, to understand the mechanical properties of plywood, such as anisotropic strength, elasticity, etc. That will give you confidence in later handling.&#x20;

## 2.2 Remove pointy fibers.

Use the sanding foam to clean up any thorns on the pieces. Don’t sand too much, or it may affect the tightness between joints.

## 2.3 Screws

There are five different screws used in the kit. I’m coloring them differently to indicate their locations better. Not all screws are required to assemble Nybble. Not all holes on the puzzle pieces need screws. Observe the [assembling animation](https://www.youtube.com/playlist?list=PLHMFXft_rV6MJ-BhDN-O5I_u4YeAie30n) carefully to locate them.

![](/files/-LzqSHAqZPRaRf-a3MBg)

●      A is for attaching servo arms. D (sharp tip) is for attaching servos to the frame. A and D come in each servo's accessory pouch with plastic servo arms.

●      B is for attaching servo arms/circuit boards to the frame.&#x20;

●      C (flat tip) is for binding the thighs.

●      E (always the longest) is for attaching the battery holder.

{% hint style="info" %}
In later versions, the types of screws are reduced to simplify the kit content and avoid confusion.&#x20;

* Screw B and D are both replaced by C.
* Screw E is canceled after a rechargeable battery is used to replace the battery holder.
  {% endhint %}

{% hint style="info" %}
For the earliest packages, B, C and E are located in the shank board within the multi-punched blocks like this:

<img src="/files/-LzqSMr7JII0_hYV1cP_" alt="" data-size="original">
{% endhint %}

## 2.4 Springs

There are three different springs: F, G, H.

●      The eight spring F is used for elastic connection in the thigh. There’s one spare unit.

●      The hard short spring G is for the neck

●      The soft short spring H is for attaching the battery holder.&#x20;

{% hint style="info" %}
In later versions, the types of springs are reduced to simplify the kit content and avoid confusion. &#x20;

* The hard short spring G is replaced by spring F.
* The soft short spring H is canceled after a rechargeable battery is used to replace the battery holder.
  {% endhint %}

## 2.5 Servos

We are switching to a new servo manufacturer from recent batches. Previously, MG92B was used for the four shoulder joints. MG90D was used for other joints.

The new servos are differentiated by their cable length. Shorter cables are used for the neck, tail, and four shoulder joints. Longer cables are used for head tilting and the four knee joints.&#x20;

![](/files/-LzqSgmc6mklGooo4Wco)

{% hint style="info" %}
For hobbyist servos, there are several fields where they can differentiate.&#x20;

In the Nybble kit, we are using ODMed metal gear, digital PWM, HV servos with bearing, and brushed iron core motors. Other generic servos can still work with the OpenCat framework but may need more trials and errors for best performance.
{% endhint %}

|   Gear  |  Signal | Protocol |    Voltage    |   Motor   | Bearing |
| :-----: | :-----: | :------: | :-----------: | :-------: | :-----: |
| Plastic |  Analog |    PWM   |       5V      |  Brushed  |   None  |
|  Metal  | Digital |  Serial  | HV (up to 8V) |  Coreless |   Yes   |
|         |         |          |               | Brushless |         |

## 2.6 Test Stand

You can 3D print this test stand so Nybble's legs won't touch the ground during programming and testing.&#x20;

{% embed url="<https://www.thingiverse.com/thing:7003788>" %}

<div align="center"><figure><img src="/files/yKoMsVk1OK80qSeNqVmG" alt="" width="332"><figcaption></figcaption></figure></div>


# 3 🏗 Assemble the Frame

"The whole is more than the sum of its parts." 🔩

{% hint style="warning" %}
We highly recommend you watch the overall assembling process before starting. Some updated components are noted in the following paragraphs.&#x20;
{% endhint %}

{% embed url="<https://youtu.be/g7_ODr_3DTc>" %}

{% embed url="<https://youtu.be/HSD98a8pLe8>" %}

## 3.1 Head and neck

### 3.1.1 Part list

![](/files/-LzqY3Ww_qXvI6506FS7)

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

### 3.1.2 Prepare ultrasonic sensor

{% hint style="warning" %}
The obstacle avoidance algorithm using the ultrasound sensor has not yet been integrated into the released code. The following setup provides a starting point but is not mandatory.&#x20;
{% endhint %}

We include an ODMed [ultrasonic sensor with RGB LED](https://docs.petoi.com/extensive-modules/ultrasonic-sensor) in the Nybble kit. It doesn't require soldering, but you need to trim off the plastic clip residue of the connection wire on the head's end.&#x20;

You can download the demo code at <https://github.com/PetoiCamp/OpenCat/tree/main/ModuleTests/testRGBLedUlrasonic>

BelowT is a tutorial video:&#x20;

{% embed url="<https://youtu.be/kV2UYbpfGic>" %}

With the basic distance detection and some proportional reactions, you can achieve the following demo:

{% embed url="<https://www.youtube.com/watch?v=vhaYcKimkFY>" %}

{% hint style="info" %}
Before Jan 2021, we used a standard ultrasonic sensor. The sensor is connected to the NyBoard via a 4-pin cable.

* **Solder on the optional LED to the ultrasonic sensor**

The optional RGB LED can be soldered to the four pins of the ultrasound sensor ([instructions](https://files.gitbook.com/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LygA-EAoP4h8Q2BOGHR-887967055%2Fuploads%2FzwPZbWvDIVbQCXYh9etz%2FNybble_SolderingUltrasound.pdf?alt=media\&token=b2271a90-4c83-4dbc-a0bd-37c00ed1535a)) to indicate its working status or can be programmed as decorative light. Bend the pins of the ultrasonic sensor for later installation.​![](https://files.gitbook.com/v0/b/gitbook-legacy-files/o/assets%2F-LygA-EAoP4h8Q2BOGHR%2F-LzooypNIrH8TdxMXMoW%2F-LzqYVfruCS2nXrLZ-6s%2FultrasonicBend.png?alt=media\&token=984678d6-1dd6-4ef3-a518-4aca887deb15)Write a caption​

* **Solder 4-pin ultrasonic sensor header to NyBoard**

The ultrasonic module is connected to the exposed GPIO pins located in the opposite corner of the board from the TTL connector. You can customize the pin definitions in **OpenCat.h**. By default definitions, solder the ultrasonic module connection header in the holes labeled “D8 D9 D10 GND” as pictured below.​![](https://files.gitbook.com/v0/b/gitbook-legacy-files/o/assets%2F-LygA-EAoP4h8Q2BOGHR%2F-LzooypNIrH8TdxMXMoW%2F-LzqY__cEG2oJ17Hwi4J%2Fultrasound.png?alt=media\&token=cda3ebea-1d0c-4101-91cf-ff349379d549)Write a caption<br>
{% endhint %}

### 3.1.3 Trim the servo arms for attaching servos.&#x20;

![](/files/-LzqZ5SpzWye9GDfnJOy)

Most of the servo arms on the model are trimmed from the cross-shaped arm I. Since there will be more unused straight arms, you can practice trimming with them first.&#x20;

An alternative method to trimming is using a half-burned knife to cut the plastic parts off. Leave a little bit longer because melted plastic will have a rounded edge.&#x20;

{% hint style="info" %}
Pay attention to the width difference between servo arm I’s two long sides, as well as the trimming location (using screw holes as references).&#x20;
{% endhint %}

As we switched servo suppliers, the servo arms also changed a little bit (as shown below). To reduce confusion, the servo arm I can be used for most of the joints, just trim it accordingly. Servo arm K is used for the tail. Servo J can be omitted.&#x20;

![](/files/-LzqZF39t2q6nsaTXLUe)

{% hint style="info" %}
In kits after January 2021, we included the new servo arms that require minimal effort to cut. You only need to cut the cross-shaped servo arm to make the L-shaped connector for the neck joint.&#x20;
{% endhint %}

### 3.1.4 Assemble the head group.&#x20;

Watch the [head animation](https://youtu.be/pYvfG2Zmowc) to understand the assembling process, but don't assemble them all at once. Every part that connects to the servo's output shaft should not be fixed before calibration.

Notice how the servo wire is organized in the head.&#x20;

![](/files/-Lzr9GTr6ea0WvIpCf3P)

![](/files/-LzqZXj70buMB2kx72H5)

{% hint style="info" %}
Note that the base should only be partially assembled for later calibration. Otherwise, it will be difficult to insert the servo between neckpieces.&#x20;
{% endhint %}

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

## 3.2 Body

### 3.2.1 Part list

* NyBoard only

Note that without the Raspberry Pi, the NyBoard is mounted to the underside of y1 with the servo connections facing downward. In later versions, the y1 piece is designed to be symmetric so that both ends have two screw holes.

![](/files/-LzrEp4ugQzR4OuO_N9k)

* NyBoard with Raspberry Pi

Use y1Pi to replace y1, and add Pi Stand. Pay attention to the location of the pink pieces. Note that with the Raspberry Pi, the NyBoard is mounted on top of y1Pi.

![](/files/-LzrBckOyUA7tvAf5R5p)

{% hint style="warning" %}
On earlier batches of NyBoards, the manufacturer used taller jumper pins than expected, so it will be necessary to bend pins or otherwise modify the NyBoard to fit a Pi on top and use the Pi Stand. There is a list of suggested solutions in the forum by this link: <https://www.petoi.com/forum/clinic/placement-of-raspberry-pi-3b>
{% endhint %}

* Other controllers

I also included 5 x 1”/4 nuts for mounting other circuit boards.&#x20;

### 3.2.2 Install the adjustable battery holder to the belly

After June 2022, we start to equip Nybble with a rechargeable Li-ion battery pack. It's also available at our [online store](https://www.petoi.com/collections/robots) if you get an earlier version of Nybble with a battery holder. Please add a note if you need the [3D-printed belly](https://github.com/PetoiCamp/NonCodeFiles/blob/master/stl/NybbleWood/Nybble_Belly/Nybble_BellyForBittleBattery.stl) as well.&#x20;

![](/files/ouqyBYL0OL7v46TMrKsu)

{% embed url="<https://youtu.be/aWU1mOPHKWk>" %}
Simply match and slide the battery
{% endembed %}

{% embed url="<https://youtu.be/mZQJZ_0Gyzk>" %}

{% hint style="info" %}
If you get the battery holder version:

Bend the hinge L of the battery holder to 90 degrees, close to the wall. It functions as a switch. Insert the long screw E through the rivet so that you can better handle the rivet. Insert and push the rivet into the hole on the bottom of the battery holder. Pay attention to the holes’ locations.&#x20;

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

The spring attached structure of the battery holder is used for shifting the center of mass when fine-tuning gaits.&#x20;

{% hint style="warning" %}
The battery holder is generic for AA (1.5V) batteries. But Nybble uses 3.7V Li-ion batteries.
{% endhint %}
{% endhint %}

### 3.2.3 Assemble the body group

Pay attention to the long pins of the infrared receiver and FTDI port. They are designed to be bent in favorable directions.  Don’t bend the pins too often or it will lead to metal fatigue. Observe the [adjusted configuration](https://youtu.be/0T1K5_oxFUM) if you want to mount a Pi.&#x20;

![](/files/-LzrC2fZy3IEP6sgt6M7)

Assemble the body group as shown in the [body animation](https://youtu.be/B8N2KAf8p28).

{% hint style="info" %}
The spine piece may be thicker than the slot on the shoulder. You can insert it from the outside first to compress the tip and widen the slot, then insert it into the inside of the shoulder.&#x20;
{% endhint %}

![](/files/-LzrJRfRYTu2wdHxD_aQ)

## 3.3 Shank

### 3.3.1 Part list

![](/files/-LzrC_qyLTV5CQXWhLXv)

### 3.3.2 Attach the rubber to the tip of the shank.&#x20;

The serrated structure on the tip of the shank is already good for walking. The rubber toe is optional to increase friction and soften each step.&#x20;

![](/files/-Lzwlfw6ZdJY605tLXrl)

### &#x20;3.3.3 Insert the servo into the slot on the shank.&#x20;

Pay attention to the direction that the wire is twisted. The small dent on the long edge is designed to let the wire go through. Think about the symmetry of the four legs. Assemble the shank as shown in the [shank animation](https://youtu.be/OFdNQe9975Y).&#x20;

{% hint style="warning" %}
DO NOT  install the servo screw A yet.&#x20;
{% endhint %}

## 3.4 Thigh

### 3.4.1 Part list

![](/files/-LzrE1NqocWQbfCOyXJH)

In later versions, we will use plastic pieces for thigh2.

![](/files/-M0GUaQAoLqH8sHjmz2H)

### 3.4.2 Trim the servo arms for attaching servos.&#x20;

The location has been shown in the [Head and Neck](applewebdata://3DB2C061-F79A-4126-A8EA-235A7B32E635#_wx3wihxumxlg) section. The trimmed narrower servo arm is designed to be inserted into spring F.&#x20;

### 3.4.3 Assemble the thigh.&#x20;

Before closing thigh1 and thigh2, put the wire of the shank through the slot in the middle of the thigh. Think about the symmetry of the four legs.&#x20;

![](/files/-LzrGqfQjXknCSljIYtH)

When installing the screws, pay attention to the directions you insert them.&#x20;

<figure><img src="/files/5WMQ38077cCx3TnyqUZ4" alt=""><figcaption></figcaption></figure>

The servo arm should be able to slide in the track on thigh2 with subtle friction after thigh1 and thigh2 are screwed together. You can tune the tightness of screw C to achieve proper friction. If you need more control over the tightness:

* Scratch the track using a flat screwdriver to reduce friction.&#x20;
* Apply a little paper glue to the track and let it dry to increase friction.

Assemble the thigh as shown in the [thigh animation](https://youtu.be/3dtiFp7v2ps).&#x20;

{% hint style="warning" %}
DO NOT screw the neck and legs to the body’s servos yet.
{% endhint %}

## 3.5 Tail

### 3.5.1 Part list

![](/files/-LzrHT_lNLp1xQoNm70x)

### 3.5.2 Assemble the tail.

The screw D is installed in the third hole counted from the center of the servo arm K. Pay attention to the order that every piece is stacked. The wheel (tail2) should be able to rotate with little friction, and the whole tail should be able to tilt by a small degree.

![](/files/-LzvwogrOCGa2pl6dDiL)

Assemble the tail as shown in the [tail animation](https://youtu.be/7QZRdKz2u_Y).&#x20;

{% hint style="info" %}
In kits after January, we included a special servo arm to simplify the installation of the tail joint.&#x20;
{% endhint %}

![](/files/-MjZ8hslaYYebx0hGzzV)

{% hint style="warning" %}
DO NOT connect the tail to the body yet.
{% endhint %}


# 4 🔌 Connect Wires

"Everything is connected." 🤝

## 4.1 Joint map

Nybble's servos are connected to NyBoard's PWM pins symmetrically and resemble the nerves along the spinal cord. Though Nybble doesn't have shoulder roll DoF, those indexes(4\~7) are reserved for the full OpenCat framework.

![](/files/duREMTcfaaUi0FogBpny)

![](/files/y9Q64HSOSnHUlKyVFaKA)

<figure><img src="/files/JlXXN8KgVpFlI5UzKv83" alt=""><figcaption><p>Observe the wiring pattern on the board</p></figcaption></figure>

{% hint style="info" %}
NyBoard V0\_\* and V1\_\* have different PWM pin orders, but the physical servo connection remains the same. All adjustments are handled in the software. **You don't even need to read the pin numbers on the PCB board.**&#x20;
{% endhint %}

## 4.2 Plug in the servos

{% hint style="warning" %}
Observe the indexing pattern to connect servos with the correct PWM pins. Be careful with the wires’ direction. The brown wire of the servo is GND, while the GND on NyBoard V0\_1 is along the centerline. In later versions of NyBoards, they are the opposite.

A quick check is that all On NyBoard V0\_1 the brown wires should be far away from the board surface. On NyBoard V0\_2 the brown wires should be close to the board surface.&#x20;

From NyBoard V0\_2 (to NyBoard V1\_X), the location of servo wires will still be the same, but their direction of colors will be opposite.

<img src="/files/-LzuyeF0enbBsNQnuiwW" alt="" data-size="original">
{% endhint %}

Even though the PCB layouts vary on different NyBoards, the wiring pattern is the same. You don't need to read the indexes of the servo pins when plugging the servos. The joint mapping is done automatically in the OpenCat code. You just need to select the right board version when uploading the code.

## 4.3 Wiring

## 4.3 Prepare for calibration

{% hint style="info" %}
You must enter the calibration mode before installing the head and the legs. After entering the calibration state, you need to attach the head, tail, and leg components to the servo's output shaft. Don't screw them yet.&#x20;

There are five methods to enter the calibration state:

* Long-press the battery and boot up the robot with one side up. It will enter the calibration state automatically.&#x20;
* Use the mobile app [**Petoi**](https://docs.petoi.com/mobile-app/app-guide#calibrate-the-joints) and enter the calibration panel.&#x20;
* Use [**Joint Calibrator**](https://docs.petoi.com/desktop-app/calibrator) in **Petoi Desktop App**:
  * If you have already connected the robot and computer with a serial port, It will enter the calibration state after you click the "**Joint Calibrator**" button
  * Click the "**Calibrate**" button in the calibrator's interface
* In the [**serial monitor**](https://docs.petoi.com/arduino-ide/calibration-with-arduino-ide) of Arduino IDE, enter the serial command "**c**"
* Press the calibrating button ![](/files/MAxmugnn72LiwoHyWFj7) (3,3 - the 3rd row and 3rd column) on the infrared remote.
  {% endhint %}

Install the head, tail and leg components as following picture:

![](/files/3g5b71v1nE3kKh5RpcYe)

You can install the legs with the reference of a triangle ruler or the L-shaped ruler included in the kit.

![](/files/TTfaIMEVzHvkzrmQdyxB)

## 4.4 Wiring

After calibration, troubleshooting and final assembling, It’s time to think about wiring routes to make Nybble look neat. There are multiple slots on the frame designed as a wire organizer. Feel free to develop your own style for connecting future accessories. Make sure the wires don’t get in the way of the servos‘ movement.&#x20;

Below are the wiring routes.:

NyBoard V1\_\* *:*

<figure><img src="/files/05tCIbHSPwCP3LeVZGOv" alt=""><figcaption></figcaption></figure>

<figure><img src="/files/1PsvaIYFe2A1ELaGAIG9" alt=""><figcaption></figcaption></figure>

{% hint style="info" %}
NyBoard V0\_\* *:*

<img src="/files/-Lzux4DyWVNeLFyWg9tA" alt="NyBoard alone" data-size="original">

<img src="/files/-LzuwaVYFLC1C6TvmDNM" alt="NyBoard with Raspberry Pi" data-size="original">
{% endhint %}


# 5 ⌨️ NyBoard Configuration

"Who loves fried chips?" 🍟

There are two methods to config the NyBoard:

* The simplest method is to use the [**Petoi Desktop App**](https://docs.petoi.com/desktop-app/introduction). No programming is involved. You can play with some preset modes.&#x20;
* &#x20;If you have some programming experience, you can use the [**Arduino IDE**](https://docs.petoi.com/arduino-ide/upload-sketch-for-nyboard). You will be able to modify the open-source codes for your new projects.&#x20;

If you are using the BiBoard, please refer to this [**Arduino configuration instruction**](https://docs.petoi.com/arduino-ide/upload-sketch-for-biboard).

* The simplest method is to use the [**Petoi Desktop App**](https://docs.petoi.com/desktop-app/flash-uploader).&#x20;
* If you have some programming experience, you can use the [**Arduino IDE**](https://docs.petoi.com/arduino-ide/upload-sketch-for-nyboard).


# 6 📐 Calibration

"A miss is as good as a mile." 🎯

{% hint style="danger" %}
You should NOT attach the legs to the servos before the first-time calibration.

When the servos are powered off, their output shafts can be rotated to random angles. If you attach the legs, the robot won't know where the legs are pointing. When the robot is powered, the legs could run into each other or collide with the body. The servos may be damaged after getting stuck for a long time.&#x20;
{% endhint %}

The joints of the robot have to be calibrated before future use. Make sure all the servos are connected to the right spot on the circuit board in the right direction, the battery is powering (the yellow LED in the cat's logo is lighting up), and all the legs and head/tail are NOT attached to the servos so that the servos can rotate freely.

Our calibration routine will send a calibration signal to the main board and rotate all the joints to known positions. Then you can attach the legs close to the reference posture, and fine-tune the angles using the software.&#x20;

There are three methods to calibrate Nybble:

* Use the mobile app [**Petoi**](https://docs.petoi.com/app-guide).&#x20;
* Use the [**Petoi Desktop App**](https://docs.petoi.com/desktop-app/calibrator).&#x20;
* Use the [**Arduino IDE**](https://docs.petoi.com/arduino-ide/calibration-with-arduino-ide).


# 7 🕹 Play with Nybble

"You can't direct the wind, but you can adjust your sails." ⛵️

### See [the Getting Started guide](https://docs.petoi.com/getting-started-guide).

There are 4 methods for users without any programming experience to control Nybble:

* Use [**the IR Remote Controller**](https://docs.petoi.com/ir-remote/remote-controller).
* Use [**Petoi Mobile App**](https://docs.petoi.com/mobile-app/controller).
* Use [**Petoi Desktop App**](https://docs.petoi.com/desktop-app/skill-composer).
* Use [**Petoi Coding Blocks**](https://docs.petoi.com/graphical-programming-interface/petoi-coding-blocks).

If you have some programming experience or want to explore more advanced features, you can try the following methods:

* Use [**Arduino IDE**](https://docs.petoi.com/arduino-ide/serial-commands).
* Use [**Python**](https://docs.petoi.com/python/serialmaster-user-guide).
* Use [**MicroPython**](https://docs.petoi.com/communication-modules/wifi-esp8266/micropython-controller).
* Use [**ESP8266 + Python**](https://docs.petoi.com/communication-modules/wifi-esp8266/esp8266-+-python-scripts-implement-wireless-crowd-control).
* Use [**Raspberry Pi**](https://docs.petoi.com/api/raspberry-pi-serial-port-as-an-interface).
* Use the [**extensible modules**](https://docs.petoi.com/extensible-modules/introduction).


# 8 👨‍🏫 Teach Nybble New Skills

"Give a cat a fish and you feed it for a day. Teach a cat to fish and you feed it for a lifetime." 🎣

## 8.1 Understand skills in **InstinctNybble.h**.

## 8.2 Example **InstinctNybble.h**

### 8.2.1 Defined constants

### 8.2.2 Data structure of skill array

### 8.2.3 Suffix for indicating Instinct and Newbility

## 8.3 Define new skills and behaviors

### 8.3.2 Add more skills in InstinctNybble.h

There are two ways to create new skills for Nybble:

* Use [the Skill Composer](https://docs.petoi.com/desktop-app/skill-composer) in the desktop app
* [Write Arduino code](https://docs.petoi.com/applications/skill-creation)


# 9 👨‍🎓 Understand OpenCat.h

"Let the cat out of the bag." 🧞‍♂️

## 🔬It will make another textbook.&#x20;

The controlling framework behind Nybble is OpenCat, which I've been developing for a while. You can read more stories from my [posts](https://www.hackster.io/petoi/opencat-845129) on Hackster.io.

![](/files/-M-40wqGNG8R6cfqcf0a)

It's too much work for now 🤷🏻‍♂️ but you are welcome to discuss it with me on the forum or through email. Good thing is, I will keep the code compatible with future OpenCat models, and even [your own DIY robots](https://www.petoi.com/forum/showcase)! Hopefully, the documentation will be completed during the processes.&#x20;

![](/files/-LzvAzCUfoN2lDr77qlQ)


# 10 🔩 Extensible Modules

## Please refer to the [Extensive Modules](https://docs.petoi.com/extensive-modules/introduction) in the Doc center.


# 11 🛠 Do more with Nybble

"Faster! Smarter! Cuter!" 🦾

To be written by 👉 YOU!

Share your knowledge and creativity with the community at <https://www.petoi.com/forum>.

![](/files/-LzvAfufU5ndu8PDxgN9)


# Инструкция по сборке Nybble 😼

Rongzhong Li

## Начало работы

Чтобы эти инструкции были просты в использовании, я сосредоточился на сборке, а не на подробном объяснении.&#x20;

Если у вас есть конкретные вопросы «почему», а не «как», пожалуйста, напишите на нашем форуме по адресу <https://www.petoi.com/forum> или напишите по адресу <info@petoi.com>.

![](/files/-LzqLLxy8Dl8E3aP-Duy)

Краудфандинговая кампания активна на Indiegogo: [igg.me/at/nybble](http://igg.me/at/nybble). Наши социальные сети (Instagram/Twitter/Facebook/GitHub) аккаунт **@PetoiCamp**. Поделитесь своей сборкой с нами, пометив тегом **#nybble #petoi #opencat** чтобы мы могли сделать репост для вас!&#x20;

{% hint style="info" %}
Последнее обновление: 02/02/2020
{% endhint %}


# 1 🧘‍♂️ Tools and Preparation

"A beard well lathered is half shaved." 🪒

## 1.1. Preparation

Prepare a clean desk and some small boxes to unzip the package. Take a picture of the kit contents in case you lost something later.&#x20;

{% hint style="success" %}
It’s better to work in a room without carpet or textured mosaic. Little screws and springs can magically hide themselves if dropped onto the ground.&#x20;
{% endhint %}

## 1.2. Tools and accessories

{% tabs %}
{% tab title="Required" %}

| **Tool**                        | **Notes**                                                                                        |
| ------------------------------- | ------------------------------------------------------------------------------------------------ |
| Utility knife                   | Cut the tabs holding the wooden puzzle pieces                                                    |
| Sanding paper/foam              | Remove pointy fibers                                                                             |
| Flat and Phillips screwdrivers  | For M2 (diameter = 2mm) screws                                                                   |
| Computer with Arduino IDE       | Install the latest [Arduino IDE](https://www.arduino.cc/en/Main/Software)                        |
| USB to mini USB cable           | Connect the uploader to computer. Not micro USB                                                  |
| 2 x 14500 3.7V Li-ion batteries | <p>Don’t mix with regular AA batteries (1.5V)! </p><p>The capacity should be around 800mAh. </p> |
| Smart charger for batteries     | Wrong charger may cause danger!                                                                  |
| {% endtab %}                    |                                                                                                  |

{% tab title="Optional" %}

| **Tool**                      | **Note**                                                                                                                                       |
| ----------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------- |
| Soldering iron w/ accessories | [Solder the decorative LED to ultrasound sensor](https://github.com/PetoiCamp/OpenCat/blob/master/Resources/Nybble_SolderingUltrasound.pdf)    |
| HC-05 bluetooth module        | [Wirelessly upload sketch and communicate](https://www.petoi.com/forum/hardware/add-bluetooth-module-for-uploading-sketches-and-communication) |
| Color paints                  | Give your Nybble a unique look                                                                                                                 |
| 3D printer w/ accessories     | Add your special design                                                                                                                        |
| Arduino/Raspberry Pi kit      | Add more gadgets to Nybble                                                                                                                     |
| Multimeter                    | Test and debug                                                                                                                                 |
| Oscilloscope                  | Test and debug                                                                                                                                 |
| Hot glue/super glue           | Avoid using them. OpenCat is designed to be soft!                                                                                              |
| {% endtab %}                  |                                                                                                                                                |
| {% endtabs %}                 |                                                                                                                                                |


# 2 🧩 Open the Box

"life is like a box of Nybble." 🔍

Actual kit contents and packaging method may be adjusted as we improve the product. This instruction will keep consistent with the current namespace.

![](/files/-LzqMiO7lGRc5u-WaA1i)

## 2.1. Cut body pieces off the baseboard.

There might be some tar residue on the wooden pieces from laser cutting. Use a wet soft tissue to clean up the board.&#x20;

The functional pieces are attached to the baseboard by lightly cut tabs. Though you could pop those pieces out by hand, it’s very highly recommended that you use a knife to cut on the back side of the tabs to avoid potential damage to the middle layer, where the fiber direction is perpendicular to the surface fiber.&#x20;

After taking out all the pieces from the baseboard, you are encouraged to bend and break the remaining structures on the baseboard, to understand the mechanical properties of plywood, such as anisotropic strength, elasticity, etc. That will give you confidence in later handling.&#x20;

## 2.2. Remove pointy fibers.

Use the sanding foam to clean up any thorn on the pieces. Don’t sand too much or it may affect the tightness between joints.

## 2.3. Screws

There are five different screws used in the kit. I’m coloring them differently to better indicate their locations. Not all screws are required to assemble Nybble. Not all holes on the puzzle pieces need screws. Observe the [assembling animation](https://www.youtube.com/playlist?list=PLHMFXft_rV6MJ-BhDN-O5I_u4YeAie30n) carefully to locate them.

![](/files/-LzqSHAqZPRaRf-a3MBg)

●      A is for attaching servo arms. D (sharp tip) is for attaching servos to the frame. A and D come in each servo's accessory pouch with plastic servo arms.

●      B is for attaching servo arms/circuit boards to the frame.&#x20;

{% hint style="info" %}
In later versions it may be replaced by C to simplify the kit content. In that case, if the hole is too small for screw C’s flat tip, [use screw D to pre-tap](https://youtu.be/7KNJH10IEIw).&#x20;
{% endhint %}

●      C (flat tip) is for binding the thighs.

●      E (always the longest) is for attaching the battery holder.

For earlier packages, B, C and E are located in the shank board within the multi-punched blocks like this:

![](/files/-LzqSMr7JII0_hYV1cP_)

## 2.4. Springs

There are three different springs: F, G, H.

●      The big spring F is used for elastic connection in the thigh. There’s one spare unit.

●      The hard short spring G is for the neck

{% hint style="info" %}
&#x20;It’s replaced by spring F in later versions
{% endhint %}

●      The soft short spring H is for attaching the battery holder.&#x20;

## 2.5. Servos

We are switching to a new servo manufacturer from recent batches. Previously, MG92B were used for the four shoulder joints. MG90D were used for other joints.

The new servos are differentiated by their cable length. Shorter cables are used for the neck, tail and the four shoulder joints. Longer cables are used for head  tilting, and the four knee joints.&#x20;

![](/files/-LzqSgmc6mklGooo4Wco)

{% hint style="info" %}
For hobbyist servos, there are several fields where they can differentiate.&#x20;

In Nybble kit, we are using ODMed metal gear, digital PWM, HV servos with bearing and brushed iron core motors. Other generic servos can still work with OpenCat framework, but may need more trials and errors for best performance.
{% endhint %}

|   Gear  |  Signal | Protocol |    Voltage    |   Motor   | Bearing |
| :-----: | :-----: | :------: | :-----------: | :-------: | :-----: |
| Plastic |  Analog |    PWM   |       5V      |  Brushed  |   None  |
|  Metal  | Digital |  Serial  | HV (up to 8V) |  Coreless |   Yes   |
|         |         |          |               | Brushless |         |


# 3 🏗 Assemble the Frame

"The whole is more than the sum of its parts." 🔩

## 3.1. Head and neck

### 3.1.1. Part list

![](/files/-LzqY3Ww_qXvI6506FS7)

### 3.1.2. Prepare ultrasonic sensor

{% hint style="warning" %}
The obstacle avoidance algorithm using the ultrasound sensor has not yet been integrated into the released code. The following setup provides a startpoint but is not mandatory.&#x20;
{% endhint %}

The sensor is connected to the NyBoard via a 4 pin cable.

* **Solder on the optional LED to ultrasound sensor**&#x20;

The optional RGB LED can be soldered to the four pins of the ultrasound sensor ([instructions](https://github.com/PetoiCamp/OpenCat/blob/master/Resources/Nybble_SolderingUltrasound.pdf)) to indicate its working status, or can be programmed as a decorative light.&#x20;

Bend the pins of the ultrasonic sensor for later installation.&#x20;

![](/files/-LzqYVfruCS2nXrLZ-6s)

* **Solder 4-pin ultrasonic sensor header to NyBoard**&#x20;

The ultrasonic module is connected to the exposed GPIO pins located in the opposite corner of the board from the TTL connector. You can customize the pin definitions in **OpenCat.h**. By default definitions, solder the ultrasonic module connection header in the holes labeled “D8 D9 D10 GND” as pictured below.

![](/files/-LzqY__cEG2oJ17Hwi4J)

### 3.1.3. Trim the servo arms for attaching servos.&#x20;

![](/files/-LzqZ5SpzWye9GDfnJOy)

Most of the servo arms on the model are trimmed from the cross shaped arm I. Since there will be more unused straight arms, you can practice trimming with them first.&#x20;

An alternative method to trimming is using a half-burned knife to cut the plastic parts off. Leave a little bit longer because melted plastic will have a rounded edge.&#x20;

{% hint style="info" %}
Pay attention to the width difference between servo arm I’s two long sides, as well as the trimming location (using screw holes as references).&#x20;
{% endhint %}

As we switch servo suppliers, the servo arms also changed a little bit (as shown below). To reduce confusion, servo arm I can be used for most of the joints, just trim it accordingly. Servo arm K is used for the tail. Servo J can be omitted.&#x20;

![](/files/-LzqZF39t2q6nsaTXLUe)

### 3.1.4. Assemble the head group.&#x20;

Note that the base should only be partially assembled for later calibration. Otherwise it will be difficult to insert the servo between neck pieces. Also notice how the servo wire is organized in the head. Assemble the head group as shown in the [head animation](https://youtu.be/pYvfG2Zmowc).&#x20;

![](/files/-LzqZXj70buMB2kx72H5)

![](/files/-LzrBQzZkNliUc15A9-M)

![](/files/-Lzr9GTr6ea0WvIpCf3P)

{% hint style="warning" %}
DO NOT connect the head with neck yet, because the tilt servo on the head has to be calibrated.
{% endhint %}

## 3.2. Body

### 3.2.1. Part list

* NyBoard only

Note that without the Raspberry Pi, the NyBoard is mounted to the underside of y1 with the servo connections facing downward. In later versions, the y1 piece is designed to be symmetric that both ends have two screw holes.

![](/files/-LzrEp4ugQzR4OuO_N9k)

* NyBoard with Raspberry Pi

Use y1Pi to replace y1, and add Pi Stand. Pay attention to the location of the pink pieces. Note that with the Raspberry Pi, the NyBoard is mounted on top of y1Pi.

![](/files/-LzrBckOyUA7tvAf5R5p)

{% hint style="warning" %}
On earlier batches of NyBoards, the manufacturer used taller jumper pins than expected, so it will be necessary to bend pins or otherwise modify the Nyboard to fit a Pi on top and use the Pi Stand. There is a list of suggested solutions in the forum by this link: <https://www.petoi.com/forum/clinic/placement-of-raspberry-pi-3b>
{% endhint %}

* Other controllers

I also included 5 x 1”/4 nuts for mounting other circuit boards.&#x20;

### 3.2.2. Install the adjustable battery holder to belly

Bend the hinge L of battery holder to 90 degrees, close to the wall. It functions as a switch. Insert the long screw E through the rivet so that you can better handle the rivet. Insert and push the rivet into the hole on the bottom of the battery holder. Pay attention to the holes’ locations.&#x20;

![](/files/-LzrFaCaol29HIcDuCQ8)

The spring attached structure of the battery holder is used for shifting the center of mass when fine tuning gaits.&#x20;

{% hint style="warning" %}
The battery holder is generic for AA (1.5V) batteries. But Nybble uses 3.7V Li-ion batteries.
{% endhint %}

### 3.2.3. Assemble the body group

Pay attention to the long pins of infrared receiver and FTDI port. They are designed to be bent to favorable directions.  Don’t bend the pins too often or it will lead to metal fatigue. Observe the [adjusted configuration](https://youtu.be/0T1K5_oxFUM) if you want to mount a Pi.&#x20;

![](/files/-LzrC2fZy3IEP6sgt6M7)

Assemble the body group as shown in the [body animation](https://youtu.be/B8N2KAf8p28).

{% hint style="info" %}
The spine piece may be thicker than the slot on the shoulder. You can insert it from outside first to compress the tip and widen the slot, then insert it to the inside of the shoulder.&#x20;
{% endhint %}

![](/files/-LzrJRfRYTu2wdHxD_aQ)

## 3.3. Shank

### 3.3.1. Part list

![](/files/-LzrC_qyLTV5CQXWhLXv)

### 3.3.2. Attach the rubber to the tip of the shank.&#x20;

The serrated structure on the tip of shank is already good for walking. The rubber toe is optional to increase friction and soften each step.&#x20;

![](/files/-Lzwlfw6ZdJY605tLXrl)

### &#x20;3.3.3. Insert the servo into the slot on the shank.&#x20;

Pay attention to the direction that the wire is twisted. The small dent on the long edge is designed to let wire go through. Think about symmetry of the four legs. Assemble the shank as shown in the [shank animation](https://youtu.be/OFdNQe9975Y).&#x20;

{% hint style="warning" %}
DO NOT  install the servo screw A yet.&#x20;
{% endhint %}

## 3.4. Thigh

### 3.4.1. Part list

![](/files/-LzrE1NqocWQbfCOyXJH)

In later versions, we will use plastic pieces for thigh2.

![](/files/-M0GUaQAoLqH8sHjmz2H)

### 3.4.2. Trim the servo arms for attaching servos.&#x20;

The location has been shown in the [Head and Neck](applewebdata://3DB2C061-F79A-4126-A8EA-235A7B32E635#_wx3wihxumxlg) section. The trimmed narrower servo arm is designed to be inserted into spring F.&#x20;

### 3.4.3. Assemble the thigh.&#x20;

Before closing thigh1 and thigh2, put the wire of the shank through the slot in the middle of the thigh. Think about symmetry of the four legs.&#x20;

![](/files/-LzrGqfQjXknCSljIYtH)

The servo arm should be able to slide in the track on thigh2 with subtle friction after thigh1 and thigh2 are screwed together. You can tune the tightness of screw C to achieve proper friction. If you need more control on the tightness:

* Scratch the track using a flat screw driver to reduce friction.&#x20;
* Apply a little paper glue in the track and let dry to increase friction.

Assemble the thigh as shown in the [thigh animation](https://youtu.be/3dtiFp7v2ps).&#x20;

{% hint style="warning" %}
DO NOT screw neck and legs to the body’s servos yet.
{% endhint %}

## 3.5.  Tail

### 3.5.1. Part list

![](/files/-LzrHT_lNLp1xQoNm70x)

### 3.5.2. Assemble the tail.

The screw D is installed in the third hole counted from the center of the servo arm K. Pay attention to the order that every piece are stacked. The wheel (tail2) should be able to rotate with little friction, and the whole tail should be able to tilt by a small degree.

![](/files/-LzvwogrOCGa2pl6dDiL)

Assemble the tail as shown in the [tail animation](https://youtu.be/7QZRdKz2u_Y).&#x20;

{% hint style="warning" %}
DO NOT connect the tail to body yet.
{% endhint %}


# 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 %}

![](/files/-LzwWsuguxr5M3Dyj-_w)

![](/files/-LzwXyKwTpkGDjv53GOI)

### 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.

![](/files/-Lztj-3xI3HwaacLQzIw)

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;

![](/files/-LztjW6U6UUIDZeeXib-)

![](/files/-LztjeVZiNzDdDIdaNC2)

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

![](/files/-LztkFjO9z1b8E8luG4A)

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.

![](/files/-LztkRqK4iSyaCppHrIg)

{% 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:

![](/files/-Lztl16lKjZY1iQ83ajL)

* 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.

![](/files/-LztlKH-y7dh2bt-yF5H)

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;

![](/files/-LztmnWoHhPz0039KlcW)

![](/files/-Lztna2R_dI864XK_KDt)

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>

![](/files/-LztnwUObRVbQJWa8q1O)

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;

![](/files/-LztokF8qCuAOD6L4Sui)

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

![](/files/-M-sk6FtNjGKvlhDhWlJ)

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;

![](/files/-Lztp9Z0gcq9r9EaqR2q)

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 %}

![](/files/-LzwBRTB2HzgVmsZ_0sw)

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;

![](/files/-LztqFnUhE_fLlMU0afR)

### 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;


# 5 🔌 Connect Wires

"Everything is connected." 🤝

## 5.1. Joint map

Nybble's servos are connected to NyBoard's PWM pins symmetrically and resembles the nerves along the spinal cord. Though Nybble doesn't have shoulder roll DoF, those indexes(4\~7) are reserved for the full OpenCat framework.

![](/files/-LztzfKi1t-h0c3PrAKu)

![](/files/-LzutwN-uGTXiC8ELCNN)

{% hint style="info" %}
NyBoard V0\_1 and V0\_2 have different PWM pin orders, but the physical servo connection remains the same. All adjustments are done in the software.&#x20;
{% endhint %}

Use h for head, t for tail, r for shoulder roll joint, s for shoulder pitch joint, k for knee joint, F for front, H for hind, L for left, R for right, the full joints map of OpenCat is:&#x20;

![](/files/-LzutPHSWo558pOpogkN)

![](/files/-LzuthE7bbrVCAX6Q4ba)

## 5.2. Plug in the servos

Observe the indexing pattern to connect servos with correct PWM pins. Be careful with the wires’ direction. The brown wire of servo is GND, while the GND on NyBoard V0\_1 are along the centerline. On NyBoard V0\_2 they are opposite.

![  (NyBoard V0\_1 Front)                            (NyBoard V0\_1 Back)](/files/-LzuyCaI5UQ9IINbFLYz)

A quick check is that all On NyBoard V0\_1 the brown wires should be far away from the board surface. On NyBoard V0\_2 the brown wires should be close to the board surface.&#x20;

![NyBoard V0\_1](/files/-LzuyVgawhAOMGHGuNH3)

![](/files/-LzuyeF0enbBsNQnuiwW)

{% hint style="warning" %}
For NyBoard V0\_2, the location of servo wires will still be the same, but their direction of colors will be opposite
{% endhint %}

![NyBoard V0\_2](/files/-Lzuym49Zmsm4EAeX_7U)

## 5.3. Wiring

After calibration, troubleshooting and final assembling, It’s time to think about wiring routes to make Nybble look neat. There are multiple slots on the frame designed as wire organizer. Feel free to develop your own style for connecting future accessories. Make sure the wires doesn’t get in the way of servos‘ movement.&#x20;

Below is my wiring routes.&#x20;

![NyBoard alone](/files/-Lzux4DyWVNeLFyWg9tA)

![NyBoard with Raspberry Pi](/files/-LzuwaVYFLC1C6TvmDNM)

## 5.4. Connect Ultrasonic Sensor

If you have not already, plug in the 4 pin cable, make a note of which cable colors are attached to which signals. When looking into Nybble’s eyes, the connections from left to right are:

| VCC | Trigger | Echo | Ground |
| :-: | :-----: | :--: | :----: |

Connect the other end of the cable to the header you soldered in place earlier in assembly. Use the following mapping

| Sensor Side | NyBoard Side |
| :---------: | :----------: |
|     Vcc     |      D8      |
|   Trigger   |      D9      |
|     Echo    |      D10     |
|     GND     |      GND     |


# 6 📐 Calibration

"A miss is as good as a mile." 🎯

{% hint style="info" %}
Calibration is vital for Nybble to work properly.&#x20;
{% endhint %}

In previous sections, we have prepared those body parts, but haven’t screwed them onto servos. If we don’t calibrate the servos before attaching them, they may rotate to any direction, get stuck, and cause damage to either the servos or body parts.&#x20;

The calibration has four steps:&#x20;

1. Write constants to the board
2. Power on the circuit, let servos rotate freely to zero angle/calibration state&#x20;
3. Attach body parts to the servos
4. Fine tune the offsets in software.&#x20;

The [logic behind calibration](https://www.petoi.com/forum/basic-assembly-and-setup/the-logic-behind-calibration-process) can be found on OpenCat forum.&#x20;

## 6.1. Write constants

### 6.1.1. There are three types of constants to be saved to NyBoard:&#x20;

1. Assembly related definitions, like joint mapping, rotation direction, sensor pins. They are pretty fixed and are mostly defined in **OpenCat.h**. They are even kept consistent with my future robots;&#x20;
2. Calibration related parameters, like MPU6050 offsets and joint corrections. They are measured in realtime and are saved in on-board EEPROM. They only need to be measured once;&#x20;
3. Skill related data, like postures, gaits, and pre-programmed behaviors. They are mostly defined in **Instinct.h**. You can add more customized skills too. &#x20;

### 6.1.2. Upload and run **WriteInstinct.ino**.

The role for **WriteInstinct.ino** is to write constants to either onboard or I2C EEPROM, and save calibration values. It will be overwritten by the main sketch **Nybble.ino** afterward.

You need to change the **\*** on `#define NyBoard_V*_*` in **Instinct.h** to match your NyBoard’s version. The version number is to the left of the green battery terminal.

After finish uploading **WriteInstinct.ino**, open the serial monitor. You will see several questions:

`Reset all joint calibration? (Y/n)`

If you have never calibrated the joints, or if you want to recalibrate the servos with fresh start, type ‘Y’ to the question. The ‘Y’ is CASE SENSITIVE!

`Do you need to update Instincts? (Y/n)`

If you have modified the Instinct.h in any way, you should type ‘Y’. Though it’s not always necessary once you have a deeper understanding of the memory management.&#x20;

`Calibrate MPU? (Y/n)`

If you have never calibrated the MPU6050, i.e. the gyro/accelerometer sensor, type ‘Y’.

Sometimes the program could hang at the connection stage. You can close the serial monitor and reopen it, or press the reset button on NyBoard,  to restart the program.&#x20;

![](/files/-Lzv0rwEzTSjJ7uaVf8a)

## 6.2. Enter calibration mode

The calibration state is defined as the middle point of servo’s reachable range. Calibration for servos can be done in either **WriteInstinct.ino** or **Nybble.ino**. I recommend you do it with **WriteInstinct.ino** in case there’s something wrong with the constants.&#x20;

You MUST plug in all the servos and battery for proper calibration. Then in the serial monitor, type ‘c’ to enter calibration mode.  The servos should rotate one by one with unnoticeable time intervals then stop. 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 the calibration table:

![](/files/-Lzv116AxfCllE3bDK1O)

The first row is the joint indexes, the second row is their calibration offsets:&#x20;

| **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.&#x20;

{% hint style="info" %}
The servos are using potentiometer in feedback loop for position control. When holding at static position, they tend to vibrate around the target angle. A Parkinson’s-like vibration will develop after a short period of use. It won’t affect much during continuous motion. Better servos without these troubles could cost 10 times more, so replacing a failed unit is a more cost effective solution. &#x20;
{% endhint %}

## 6.3. Attach head, tail, and legs.&#x20;

### 6.3.1. Coordinate system

After entering ‘c’, with all servos rotated to their zero angle, now attached the head, tail, and legs prepared in previous section to the body. They are generally perpendicular to their linked body frames. Avoid rotating the servo shaft during the operation.&#x20;

Rotating the limbs counter-clockwise from their zero state will be positive (same as in polar coordinates). The only exception is the tilt angle for head. It’s more natural to say head up, while it’s the result from rotating clockwise.&#x20;

![](/files/-Lzv1GgNdhi13EDFsEwP)

### 6.3.2. Understand the angle divisions

If we take a closer look at the servo shaft, we can see it has a certain number of teeth. That’s for attaching the servo arms, and to avoid sliding in the rotational direction. In our servo sample, the gears are dividing 360 degrees to 20 sectors, each taking **18** degrees. That means we cannot always get exact perpendicular installation. But try to get them as close as possible to their zero states. Use screw A to fix the limbs onto servos.&#x20;

![](/files/-Lzv1X9p7IXl-AC3vLTW)

## 6.4. Find and save calibration offsets

### 6.4.1. Fine tune the calibration on software side

The command for calibration (refer to the [serial communication protocol for NyBoard](applewebdata://BF1734DD-7BA4-4F33-AD2F-EB6CDD62923D#_hdzulhnk7rln)) is formatted as `cIndex Offset`. Notice that there’s a space between Index and Offset.&#x20;

For example, `c8 6` means giving the 8th servo an offset of 6 degrees. Find the best offset that can bring the limb to zero state.&#x20;

{% hint style="info" %}
If you find the absolute value of offset is larger than 9, that means you are not attaching the limb closest to its zero state. That will result in decreased reachable range of the servo on either side. Take off the limb and rotate it by one tooth. It will result in an opposite but smaller offset.&#x20;
{% endhint %}

For example, if you have to use -13 as the calibration value, take the limb off, rotate by one tooth then attach back. The new calibration value should be around 5, i.e.,  they sum up to 18. Avoid rotating the servo shaft during this adjustment.&#x20;

![](/files/-Lzv21Omz3uQuqP-XoQP)

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.&#x20;

### &#x20;6.4.2. ‘L’ shaped joint tuner

When watching something, the observation will change from different perspectives. That’s why when measuring length, we always want to read directly above the ruler.&#x20;

It’s especially important that you keep parallel perspective when calibrating Nybble. 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 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 shoulder servos (indexed 8\~11) first, then the knee servos(indexed 12\~15). When calibrating the knee, use the matching triangle windows on both the tuner and shank to ensure parallel alignment.&#x20;

![](/files/-Lzv2aLOyP5KjX-_6kh1)

### 6.4.3. Validation

After calibration, type ‘d’ or ‘kbalance’ to validate the calibration. It will result in Nybble symmetrically moving its limbs between rest and stand state. &#x20;

![](/files/-Lzv2zsyR1jzPZB6pCpD)

### 6.4.4. Center of mass

Try to understand how Nybble keeps balance even during walking. If you are adding new components to Nybble, try your best to distribute its weight symmetrically about the spine. You may also need to slide the battery holder back and forth to find the best spot for balancing.&#x20;


# 7 🕹 Play with Nybble

"You can't direct the wind, but you can adjust your sails." ⛵️

## 7.1. Control with Arduino IDE

Try the following serial commands in the serial monitor:

* “**k**sit”
* “**m**0 30”
* “**m**0 -30”
* “**k**balance”
* “**k**tr”
* “**k**trL”
* “**d**”

{% hint style="warning" %}
The quotation mark just indicates that they are character strings. Don’t type quotation mark in the serial monitor.
{% endhint %}

## 7.2. Control with Infrared remote

### 7.2.1. Key map

Only the position of the buttons matters, though those symbols can help you remember the functionalities. I’m going to define position related symbols to refer to those keys.&#x20;

I’m using abbreviations for key definitions to reduce SRAM usage. Due to the limited keys of a physical remote, I always change the definitions for fun.&#x20;

{% hint style="warning" %}
The following map is just an illustration. Check function **String translateIR(){...}**  in **Nybble.ino** for the actual key definitions in effect. They are also open to your customization.
{% endhint %}

![](/files/-Lzv9nTMgv-xBbL32qm4)

### 7.2.2. Check out the following featured motions

* Button **1** shuts down the servos and send Nybble to sleep. It's always safe to click it if Nybble is doing something **AWKWARD**. I’m serious. There’s still some ghosts in the system I don’t fully understand.&#x20;
* Button **2** is the neutral standing posture. You can push Nybble from side, or make it stand up will hind legs and tail. You can test its balancing ability on a fluctuating board. Actually balancing is activated in most postures and gaits.
* Lift Nybble at the middle of its spine so that all its legs can move freely in the air. Click all the buttons on the IR remote to see what they do. Then put Nybble on a wide flat table and try those buttons again. Different surfaces have different friction and will affect walking performance. Carpet will be too bushy for Nybble’s short legs. It can only crawl (command **kcr**) over this kind of tough terrain.&#x20;
* 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. Otherwise it may keep falling down.
* When Nybble is walking, you can let it climb up/down a small slope (<10 degrees)
* Whatever Nybble is doing, you can lift it vertically, and it will stop moving, just like a cat scruffed on the neck.

{% hint style="info" %}

* If Nybble keeps beeping after you run **Nybble.ino**, with numbers (something around 500) printed in the serial monitor, it’s the low voltage alarm being triggered. You need to power NyBoard with two 3.7V Li-ion/Li-poly batteries to pass the threshold.
* “FIFO overflow! Using last reading!” in the serial monitor is an algorithmic fix to the original MPU6050 library. It’s not a bug.&#x20;
* The servos are designed to be driven by internal gears. Avoid rotating the servos too fast from outside.&#x20;
* **Don’t keep Nybble walking for too long.** That will overheat the electronics and reduce the servos’ life span. It’s possible to [reconfigure NyBoard V0\_1](https://www.petoi.com/forum/hardware/reconfigure-nyboard-v0-1-for-pro-users) to make Nybble run longer.&#x20;
* Sometimes the program may halt due to voltage fluctuation. Check if the battery is running low (< 3.5V each or <7.0V in series). Press the reset button on NyBoard to restart the program.
* Nybble has acrophobia! If you lift it and rotate it over a certain degree, its current movement will be interrupted. Don't flip Nybble over to scare it!&#x20;
* Be kind as if you were playing with a real kitten. (^=◕ᴥ◕=^)
  {% endhint %}


# 8 👨‍🏫 Teach Nybble New Skills

"Give a cat a fish and you feed it for a day. Teach a cat to fish and you feed it for a lifetime." 🎣

## 8.1. Understand skills in **Instinct.h**.

![](/files/-LzvA1urnfiCPOkXHQKw)

One frame of joint angles defines a static posture, while a series of frames defines a periodic motion, usually a gait.

EEPROM has limited (1,000,000) write cycles. So I want to minimize write operations on it.

There are two kinds of skills: **Instincts** and **Newbility**. The addresses of both are written to the onboard EEPROM(1KB) as a lookup table, but the actual data is stored at different memory locations:

* I2C EEPROM (8KB) stores **Instincts**.&#x20;

The Instincts are already fine-tuned/fixed skills. You can compare them to “muscle memory”. Multiple Instincts are linearly written to the I2C EEPROM only once with **WriteInstinct.ino**. Their addresses are generated and saved to the lookup table in onboard EEPROM during the runtime of **WriteInstinct.ino**.

* PROGMEM (sharing the 32KB flash with the sketch) stores **Newbility**.&#x20;

A Newbility is any new experimental skill that requires a lot of tests. It's not written to the I2C nor onboard EEPROM, but the flash memory in the format of PROGMEM. It has to be uploaded as one part of Arduino sketch. Its address is also assigned during the runtime of the code, though the value rarely changes if the total number of skills (including all Instincts and Newbilities) is unchanged.

## 8.2. Example **Instinct.h**

```cpp
//a short version of Instinct.h as example

#define WalkingDOF 8
#define NUM_SKILLS 6
#define I2C_EEPROM
const char cr[] PROGMEM = { 
26, 0, -5,
 35, 37,-46,-53,-23,-32, -3, 12,
 40, 28,-42,-59,-24,-28, -4, 12,
 ...
 33, 39,-47,-51,-22,-32, -3, 11,
};
const char stair[] PROGMEM = { 
54, 0, 30,
 44, 90,-39,-38, 10,-32,-10, 32,
 45, 90,-32,-46, 16,-38,-16, 38,
 …
 43, 90,-44,-32,  6,-26, -6, 26,
};
const char pu1[] PROGMEM = { 
1, 0, 0,
  0,-30,  0,  0,  0,  0,  0,  0, 20, 20, 60, 60, 60, 60,-55,-55,};
const char pu2[] PROGMEM = { 
1, 0, 0,
  0, 10,  0,  0,  0,  0,  0,  0, 60, 60, 40, 40,-45,-45,-55,-55,};
const char rest[] PROGMEM = { 
1, 0, 0,
-30,-80,-45,  0, -3, -3,  3,  3, 60, 60,-60,-60,-45,-45, 45, 45,};
const char zero[] PROGMEM = { 
1, 0, 0,
  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,};
#if !defined(MAIN_SKETCH) || !defined(I2C_EEPROM)
const char* skillNameWithType[] =
{"crI", "stairN", "pu1I", "pu2I", "restI", "zeroN",};
const char* progmemPointer[] = 
{cr, stair, pu1, pu2, rest, zero, };
#else
const char* progmemPointer[] = {stair, zero};
#endif
```

### 8.2.1. Defined constants

`define WalkingDOF 8`

Means the number of DoF (Degree of Freedom) for walking is 8 on Nybble.&#x20;

`define NUM_SKILLS 6`

Means the total number of skills is 6. It should be the same as the number of items in list `const char* skillNameWithType[]`.

`define I2C_EEPROM`

Means there’s an I2C EEPROM on NyBoard to save Instincts.

{% hint style="warning" %}
If you are building your own circuit board that doesn’t have it, comment out this line. Then both kinds of skills will be saved to the flash as PROGMEM. Obviously, it will reduce the available flash space for functional codes. If there were too many skills, it may even exceed the size limit for uploading the sketch. &#x20;
{% endhint %}

### 8.2.2. Data structure of skill array

Observe the following two skills:

```cpp
const char rest[] PROGMEM = { 
1, 0, 0,
-30,-80,-45,  0, -3, -3,  3,  3, 60, 60,-60,-60,-45,-45, 45, 45,};
const char cr[] PROGMEM = { 
26, 0, -5,
 35, 37,-46,-53,-23,-32, -3, 12,
 40, 28,-42,-59,-24,-28, -4, 12,
 ...
 33, 39,-47,-51,-22,-32, -3, 11,
};
```

They are formatted as:

![](/files/-LzwSXPWJxPY4etyWqJ3)

{% hint style="info" %}
A posture has only one frame, and a gait has more than one frames.&#x20;
{% endhint %}

### 8.2.3. Suffix for indicating Instinct and Newbility

You must upload **WriteConst.ino** to have the skills written to EEPROM for the first time. The following information will be used:

```cpp
const char* skillNameWithType[] =
{"crI", "stairN", "pu1I", "pu2I", "restI", "zeroN",};
const char* progmemPointer[] = 
{cr, stair, pu1, pu2, rest, zero, };
```

{% hint style="info" %}
Notice the suffix **I** or **N** in the skill name strings. They tell the program where to store skill data and when to assign their addresses.
{% endhint %}

Later, if the uploaded sketch is main sketch **Nybble.ino**, and if you are using NyBoard that has an I2C EEPROM, the program will only need the pointer to Newbility list&#x20;

`const char* progmemPointer[] = {stair, zero};`

&#x20;to extract the full knowledge of pre-defined skills.&#x20;

## 8.3. Define new skills and behaviors

### 8.3.1 Modify the existing skill template

There’s already a skill called “zeroN” in Instinct.h. It’s a posture at zero state waiting for your new definition.

You can first use command `mIndex Offset` to move individual joint to your target position, then replace the joint angles (bold fonts) in array at once:

```cpp
const char zero[] PROGMEM = { 
1, 0, 0,
  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,};
```

Because it’s declared as a Newbility and doesn’t require writing to I2C EEPROM, you can simply upload **Nybble.ino** everytime you change the array (without uploading **WriteInstinct.ino**). You can trigger the new posture by pressing **7** on the IR remote, or type `kzero` in the serial monitor.&#x20;

You can rename this skill, but remember to update the keymap of IR remote.&#x20;

### 8.3.2. Explore more skills hidden in Instinct.h

There are more skills hidden in Instinct.h. They can be called from the serial monitor with token 'k' command. For example, `kcd1` will move Nybble to posture "cd1", which means "check down".

![](/files/-M-3rEAyHjAhwCGiIDZZ)

You can also write short programs to perform multiple skills sequentially, like the "push up" behavior in **Nybble.ino**. For example, by connecting posture "cd1" and "cd2" as a looping sequence, you can make Nybble lean forward, look from left to right, then right to left.&#x20;

### 8.3.3 Automation

So far Nybble is controlled by the infrared remote. You make decisions for Nybble's behavior.&#x20;

You can connect Nybble with your computer or smartphone, and let them send out instructions automatically. Nybble will try its best to follow those instructions.

By adding some sensors (like a touch sensor), or some communication modules (like a voice control module), you can bring new perception and decision abilities to Nybble. You can accumulate those automatic behaviors and eventually make Nybble live by itself!&#x20;


# 9 👨‍🎓 Understand OpenCat.h

"Let the cat out of the bag." 🧞‍♂️

## 🔬It will make another textbook.&#x20;

The controlling framework behind Nybble is OpenCat, which I've been developing for a while. You can read more stories from my [posts](https://www.hackster.io/petoi/opencat-845129) on Hackster.io.

![](/files/-M-40wqGNG8R6cfqcf0a)

It's too much work for now 🤷🏻‍♂️ but you are welcome to discuss it with me on the forum or through email. Good thing is, I will keep the code compatible with future OpenCat models, and even [your own DIY robots](https://www.petoi.com/forum/showcase)! Hopefully the documentation will be completed during the processes.&#x20;

![](/files/-LzvAzCUfoN2lDr77qlQ)


# 10 🛠 Mess Up with the Robot

"Faster! Smarter! Cuter!" 🦾

To be written by 👉 YOU!

Share your knowledge and creativity with the community at <https://www.petoi.com/forum>.

![](/files/-LzvAfufU5ndu8PDxgN9)


