Upload Sketch For NyBoard

Setup Process

OpenCat software works on both Nybble and Bittle, controlled by NyBoard based on ATmega328P. More detailed documentation can be found at the NyBoard V1_0 or NyBoard V1_1.
Note: the version number is here

Dial the I2C switch (SW2) to Arduino.

The I2C switch changes the master of I2C devices (gyro/accelerometer, servo driver, external EEPROM). On default “Arduino”, NyBoard uses the onboard ATmega328P as the master chip; On “RPi”, NyBoard uses external chips connected through the I2C ports (SDA, SCL) as the master chip.
Sometimes if you cannot go through the bootup stage, maybe you have accidentally dialed the switch to "RPi".

Downloads and installations Arduino IDE

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.
With NyBoard V1_*, you can simply choose Arduino Uno.
Only if the bootloader of NyBoard collapsed, which is very unlikely to happen

Burn the bootloader (no need for normal use)

Every NyBoard has to go through functionality checks before shipping, so they should already have a 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 the 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:
  • With NyBoard V1_*, you can simply choose Arduino Uno 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.

Connect the uploader (sometimes referred to as the programmer)

Connect your computer with the uploader through USB to micro-USB cable. The uploader has three LEDs, power, Tx, and Rx. Right after the connection, the Tx and Rx should blink for one second indicating initial communication, then dim. Only the power LED should keep lighting 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 lighting 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 an external power supply and the servos move all at once.
If you cannot find the serial port after connecting to your computer, you may need to install the driver for the CH340 chip.

Connect Bluetooth uploader (optional)

It’s possible to program and communicate with Nybble / Bittle wirelessly. You can even control Bittle with a smartphone APP or web API from there!
We include our official Bluetooth dongle in the standard Bittle kit. It can be used for wirelessly uploading sketches and communicating with the robot. The baud rate is set to 115200.
You need to connect it to your computer like what you do with a Bluetooth AirPod. The default passcode is 0000 or 1234. Then you can select it under Tools->Port of Arduino IDE, and use it in the same way as the wired uploader.
On Mac, the Bluetooth may lose connection after several uploads. In that case, delete the connection and reconnect to resume the functionality.
The Bluetooth dongle is not included in the kit sold by Seeed Studio or its partners. Please write to [email protected] for more information.

Download the OpenCat package

We keep updating the codes as an open-source project. You can star and follow our GitHub repository to get the newest features and bug fixes. You can also share your codes with worldwide OpenCat users.
  • 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 OpenCat FOLDER every time. All the codes have to be the same version to work together.
  • If you download the Zip file of the codes, you will get an OpenCat-main folder after unzipping. You need to rename it to OpenCat before opening the OpenCat.ino, so that the two names match.
No matter where you save the folder, the file structure should be:
  • 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)
  • Open up the serial monitor and set up the baud rate. With NyBoard V1_*, choose the board as Arduino Uno and later set the baud rate to 115200 in both the code and the serial monitor.
  • Compile the code. 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 on the serial monitor.
To configure the board, please follow these steps:
  1. 1.
    Open the file OpenCat.ino, select your robot and board version. For example:
1
#define BITTLE //Petoi 9 DOF robot dog: 1x on head + 8x on leg
2
//#define NYBBLE //Petoi 11 DOF robot cat: 2x on head + 1x on tail + 8x on leg
3
4
//#define NyBoard_V0_1
5
//#define NyBoard_V0_2
6
#define NyBoard_V1_0
7
//#define NyBoard_V1_1
Copied!
The symbol // deactivates the line of code and turns them into comments. Make sure you have only one line of the parallel options activated.
2. Comment out #define MAIN_SKETCH so that it will turn the code to the board configuration mode. Upload and follow the serial prompts to proceed.
1
// #define MAIN_SKETCH
Copied!
If you activate #define AUTO_INIT, the program will automatically set up without prompts. It will not reset joint offsets but calibrate the IMU. It's just a convenient option for our production line.
3. Plug the USB uploader into your computer. Install the driver if no USB port is found under Arduino -> Tools -> Port.
4. Plug the USB uploader into the NyBoard.
5. Press the upload button.
6. Open the serial monitor. You can find the button either under Tools, or at the top-right corner of the IDE.
Set the serial monitor as No line ending and 115200 baud rate.
7. The serial prompts:
1
Reset joint offsets? (Y/n):
Copied!
Input ‘Y’ and hit enter, if you want to reset all the joint offsets to 0.
The program will do the reset, then update the constants and instinctive skills in the static memory.
8. IMU (Inertial Measurement Unit) calibration.
The serial prompts:
1
Calibrate the IMU? (Y/n):
Copied!
Input ‘Y’ and hit enter, if you have never calibrated the IMU or want to redo calibration.
Put the robot flat on the table and don't touch it. The robot will long beep six times to give you enough time. Then it will read hundreds of sensor data and save the offsets. It will beep when the calibration finishes.
When the serial monitor prints "Ready!", you can close the serial monitor to do the next step.
9. Uncomment #define MAIN_SKETCH to make it active. This time the code becomes the normal program for the major functionalities. Then upload the code.
1
#define MAIN_SKETCH
Copied!
Open the serial monitor, when the serial monitor prints "Ready!", the robot is ready to take your next instructions.