Rongzhong Li
Чтобы эти инструкции были просты в использовании, я сосредоточился на сборке, а не на подробном объяснении.
Если у вас есть конкретные вопросы «почему», а не «как», пожалуйста, напишите на нашем форуме по адресу https://www.petoi.com/forum или напишите по адресу info@petoi.com.
Краудфандинговая кампания активна на Indiegogo: igg.me/at/nybble. Наши социальные сети (Instagram/Twitter/Facebook/GitHub) аккаунт @PetoiCamp. Поделитесь своей сборкой с нами, пометив тегом #nybble #petoi #opencat чтобы мы могли сделать репост для вас!
Последнее обновление: 02/02/2020
"A beard well lathered is half shaved." 🪒
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.
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.
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 |
USB to mini USB cable | Connect the uploader to computer. Not micro USB |
2 x 14500 3.7V Li-ion batteries | Don’t mix with regular AA batteries (1.5V)! The capacity should be around 800mAh. |
Smart charger for batteries | Wrong charger may cause danger! |
Tool | Note |
Soldering iron w/ accessories | |
HC-05 bluetooth module | |
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! |
"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.
There might be some tar residue on the wooden pieces from laser cutting. Use a wet soft tissue to clean up the board.
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.
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.
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.
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 carefully to locate them.
● 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.
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.
● 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:
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
It’s replaced by spring F in later versions
● The soft short spring H is for attaching the battery holder.
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.
For hobbyist servos, there are several fields where they can differentiate.
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.
Gear | Signal | Protocol | Voltage | Motor | Bearing |
Plastic | Analog | PWM | 5V | Brushed | None |
Metal | Digital | Serial | HV (up to 8V) | Coreless | Yes |
Brushless |
"The whole is more than the sum of its parts." 🔩
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.
The sensor is connected to the NyBoard via a 4 pin cable.
Solder on the optional LED to ultrasound sensor
The optional RGB LED can be soldered to the four pins of the ultrasound sensor (instructions) to indicate its working status, or can be programmed as a decorative light.
Bend the pins of the ultrasonic sensor for later installation.
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.
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.
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.
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).
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.
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.
DO NOT connect the head with neck yet, because the tilt servo on the head has to be calibrated.
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.
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.
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
Other controllers
I also included 5 x 1”/4 nuts for mounting other circuit boards.
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.
The spring attached structure of the battery holder is used for shifting the center of mass when fine tuning gaits.
The battery holder is generic for AA (1.5V) batteries. But Nybble uses 3.7V Li-ion batteries.
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 if you want to mount a Pi.
Assemble the body group as shown in the body animation.
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.
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.
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.
DO NOT install the servo screw A yet.
In later versions, we will use plastic pieces for thigh2.
The location has been shown in the Head and Neck section. The trimmed narrower servo arm is designed to be inserted into spring F.
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.
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.
Apply a little paper glue in the track and let dry to increase friction.
Assemble the thigh as shown in the thigh animation.
DO NOT screw neck and legs to the body’s servos yet.
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.
Assemble the tail as shown in the tail animation.
DO NOT connect the tail to body yet.
"Who loves fried chips?" 🍟
Find the version info on NyBoard. Read the user manual for NyBoard V0_1 or NyBoard V0_2 accordingly.
Wrong operations may damage your NyBoard!
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.
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.
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.
Sometimes if you cannot go through the bootup stage, maybe you have accidentally dialed the switch to "Pi".
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.
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. 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+).
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.
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.
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.
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.
Go to the library manager of Arduino IDE (instruction: https://www.arduino.cc/en/Guide/Libraries), search and install
Adafruit PWM Servo Driver
IRremote
QList
Go to jrowberg/i2cdevlib: I2C device library collection for AVR/Arduino or other C++-based MCUs, download the zip file and unzip. You can also git clone the whole repository.
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.
Open the Preferences... panel
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.
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)
Open the Boards Manager... window with the Tools -> Board: XXXX -> Boards Manager... menu item.
In the Filter your search... field, type NyBoard
Select the entry and click on Install
Click on the Close button
Select ATmega328P (5V, 20 MHz) NyBoard from the Tools -> Board: XXXX menu (NyBoardV0_1 and NyBoardV0_2 are using the same board settings.)
Only if the above method fails
● Locate the file boards.txt
Mac location:
/Users/UserName/Library/Arduino15/packages/arduino/hardware/avr/version#/
Or:
/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.
Linux
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
):
/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 file, or:
Edit your boards.txt with admin privilege. Find the section of
pro.name=Arduino Pro or Pro Mini
and insert the
code block in the Arduino Pro or Pro Mini section as below. Save and quit your editor.
● Download 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.
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.
Only if the bootloader of NyBoard collapsed
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:
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!
If you really decide to re-burn the bootloader:
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!
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.
The following picture shows two common FTDI boards.
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.
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
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.
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.
It’s possible to program and communicate with Nybble wirelessly. Check out the bluetooth instruction on the OpenCat forum. You can even control Nybble with smartphone APP or web API from there!
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.
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.
For Linux machines, you may see the following error message:
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
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.
I have defined a set of serial communication protocol for NyBoard:
All the token starts with a single Ascii encoded character to specify its parsing format. They are case-sensitive and usually in lower case.
Some tokens haven't been implemented, such as 'h'. Token 'i' and 'l' still have some bugs.
Only when using Pi as a master controller. Nybble doesn't need a Pi to move.
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'
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.
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 that can handle the serial communication between NyBoard and Pi.
In Pi's terminal, type sudo raspi-config
Under Interface option, find Serial. Disabled the serial login shell and enable the serial interface.
If you plug Pi into NyBoard's 2x5 socket, their serial ports should be automatically connected at 3.3V. Otherwise pay attention to the Rx and Tx pins on your own AI chip, and its voltage rating. The Rx on your chip should connect to the Tx of NyBoard, and Tx should connect to Rx.
If you want to run it as bash command, you need to make it executable:
chmod +x ardSerial.py
You may need to change the proper path of your Python binary on the first line:
#!/user/bin/python
NyBoard has only one serial port. You need to UNPLUG the FTDI converter if you want to control Nybble with Pi's serial port.
Typing ./ardSerial.py <args>
is almost equivalent to typing <args> in Arduino's serial monitor. For example, ./ardSerial.py kcr
means "perform skill crawl".
Both ardSerial.py and the parsing section in Nybble.ino need more implementations to support all the serial commands in the protocol.
Reduced motion capability may happen when connected to Pi! Stronger battery is needed.
With the additional current draw by Pi, Nybble will be less capable for intense movements, such as trot (the token isktr
). The system is currently powered by two 14500 batteries in series. You may come up with better powering solutions, such as using high drain 7.4 Lipo batteries, or 2S-18650. There'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.
Though you can program NyBoard directly with the FTDI uploader, external power is required to drive the servos.
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.
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).
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.
Read this forum post to find batteries that work on Nybble.
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.
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.
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.
Reversed connection may damage your NyBoard!
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.
It can last hours if you're mainly coding and testing postures, or less than 30 mins if you keep Nybble running.
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.
You will need compatible smart chargers for the batteries. Keep batteries attended during charging.
After playing, remember to remove the batteries from battery holder to avoid over discharging.
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.
"Everything is connected." 🤝
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.
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.
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:
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.
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.
For NyBoard V0_2, the location of servo wires will still be the same, but their direction of colors will be opposite
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.
Below is my wiring routes.
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 |
"A miss is as good as a mile." 🎯
Calibration is vital for Nybble to work properly.
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.
The calibration has four steps:
Write constants to the board
Power on the circuit, let servos rotate freely to zero angle/calibration state
Attach body parts to the servos
Fine tune the offsets in software.
The logic behind calibration can be found on OpenCat forum.
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;
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;
Skill related data, like postures, gaits, and pre-programmed behaviors. They are mostly defined in Instinct.h. You can add more customized skills too.
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.
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.
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.
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:
The first row is the joint indexes, the second row is their calibration offsets:
Index | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 |
Offset | -1 | -1 | -1 | -1 | -1 | -1 | -1 | -1 | -1 | -1 | -1 | -1 | -1 | -1 | -1 | -1 |
Initial values are “-1” or “0”, and should be changed by later calibration.
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.
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.
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.
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.
The command for calibration (refer to the serial communication protocol for NyBoard) is formatted as cIndex Offset
. Notice that there’s a space between Index and Offset.
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.
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.
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.
After calibration, remember to type ‘s’ to save the offsets. Otherwise they will be forgotten when exiting the calibration state. You can even save every time after you’re done with one servo.
When watching something, the observation will change from different perspectives. That’s why when measuring length, we always want to read directly above the ruler.
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.
After calibration, type ‘d’ or ‘kbalance’ to validate the calibration. It will result in Nybble symmetrically moving its limbs between rest and stand state.
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.
"You can't direct the wind, but you can adjust your sails." ⛵️
Try the following serial commands in the serial monitor:
“ksit”
“m0 30”
“m0 -30”
“kbalance”
“ktr”
“ktrL”
“d”
The quotation mark just indicates that they are character strings. Don’t type quotation mark in the serial monitor.
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.
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.
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.
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.
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.
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.
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.
The servos are designed to be driven by internal gears. Avoid rotating the servos too fast from outside.
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 to make Nybble run longer.
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!
Be kind as if you were playing with a real kitten. (^=◕ᴥ◕=^)
"Give a cat a fish and you feed it for a day. Teach a cat to fish and you feed it for a lifetime." 🎣
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.
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.
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.
define WalkingDOF 8
Means the number of DoF (Degree of Freedom) for walking is 8 on Nybble.
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.
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.
Observe the following two skills:
They are formatted as:
A posture has only one frame, and a gait has more than one frames.
You must upload WriteConst.ino to have the skills written to EEPROM for the first time. The following information will be used:
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.
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
const char* progmemPointer[] = {stair, zero};
to extract the full knowledge of pre-defined skills.
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:
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.
You can rename this skill, but remember to update the keymap of IR remote.
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".
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.
So far Nybble is controlled by the infrared remote. You make decisions for Nybble's behavior.
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!
"Let the cat out of the bag." 🧞♂️
The controlling framework behind Nybble is OpenCat, which I've been developing for a while. You can read more stories from my posts on Hackster.io.
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! Hopefully the documentation will be completed during the processes.
"Faster! Smarter! Cuter!" 🦾
To be written by 👉 YOU!
Share your knowledge and creativity with the community at https://www.petoi.com/forum.