TinySaber Reprogramming - A How-To Guide

by TinyCircuits Staff July 18, 2017

TinySaber Reprogramming - A How-To Guide


Introduction 

Conquer the galaxy with the TinySaber! This guide will show you how to reprogram your TinySaber using the Arduino IDE. You'll need:

  • A micro-USB cable
  • TinySaber kit
  • Tweezers or a small Flathead Screwdriver


TinySaber Hardware

At the heart of the TinySaber is an 8-bit ATtiny841 microcontroller. Motion detection is acquired via the BMA250 accelerometer, the same sensor chip found on our Accelerometer TinyShield. The rectangles on the back of the TinySaber are simple copper fills that are used as capacitive touch sensors, allowing the TinySaber to sense where the user places their finger on the back of the board. Power is provided by the Li-ion battery, which can be charged through the micro-USB port.


The Software

Thanks to a special bootloader, the microcontroller on the TinySaber only needs a micro-USB cable to communicate with your computer. This bootloader comes pre-installed with the default version of the TinySaber code.


Configuring the Arduino Software IDE

  • Download and install the latest Arduino Software (IDE) from the Arduino website. (On Windows, click Yes/Install when it asks ‘Do you want to install this device driver/software.' You can also select the check box ‘Always trust Arduino.’)
  • Open the Arduino IDE and go to File > Preferences (Windows) or Arduino > Preferences (Mac OSX).
  • Copy and paste this URL into the box that says “Additional Boards Manager URLs” and click OK: http://files.tinycircuits.com/ArduinoBoards/package_tinycircuits_index.json
  • Go to Tools > Board > Boards Manager.
  • Search TinyCircuits AVR Boards. Click install. This will likely take a few minutes. There will be an error stating "Warning - Non-trusted Contribution." You can safely ignore this warning.

Download the Driver 

The next step will be to download the Zadig Driver here: http://zadig.akeo.ie/ and install it.

Once downloaded, install and open the Application. Once the application opens, select libusb-win32 (v1.2.6.0) by using the arrows to the right of the driver name. (You can find more information about libusb here: http://libusb.info/

Plug the TinySaber into your computer via a micro-USB cable. Be sure to use a quality USB cable for this. Many cheap ones only transmit Power, but no signal data, which won't work. Before clicking on the "Install WCID Driver" button, you'll need to reset the microcontroller on the TinySaber by shorting together the Reset pin and the Ground pin. Both are circled on the image below. This can be accomplished with any conductive metal tool such as a pair of tweezers or a small flat head screwdriver. To create the short, press both pins at the same time with your chosen tool.

Once the microcontroller has been reset, you'll see an "Unknown Device" selected in the device drop down menu. You have only six seconds to click on "Install WCID Driver" before the bootloader becomes inactive. (This may take a few attempts.) After the driver installs, you'll get a message stating that the driver has been installed successfully.

To ensure that the driver has actually been installed successfully, you'll need to open your computer's Device Manager, then, reset the TinySaber device again by creating the same short. You should see an Unknown Device #1 listed under libusb32. This will confirm that the driver has installed successfully. You will have six seconds to view the device before it is no longer visible in the device manager. 

If the device appears as Unknown Device under a different category, then the driver may not have been installed correctly. 

If the device is not shown, try resetting the device again or waiting a few seconds for the computer to find the device. Once the driver is installed and working, new code can be uploaded through the Arduino IDE. You will not need to repeat the driver install or configuration steps again. 


The Arduino IDE

To avoid compatibility problems, ensure that you have the most recent version of the Arduino IDE installed. (At the publishing of this article, it is version 1.8.3.) Open the IDE and go to Tools > Board. Select "TinySaber Rev2" under "TinyCircuits AVR Boards."  LTO should be "Disabled" and nothing should be selected under Port. The Programmer option should be set to "Arduino as ISP."

With these things configured, you can now write you own code for the TinySaber in the Arduino IDE! To get started, we recommend using our example code linked at the bottom of this page. You can change the displayed text, lighting effects, color mixes, and sensor sensitivity for the accelerometer or capacitive touch pads. 


Reprogramming

Now that your code is written, you can reprogram the TinySaber. Once you click the Upload button, the code will compile, and the dialog will prompt you to connect your device. Since our TinySaber is already plugged in, we just need to reset it by shorting the same two pins as before. You can also leave the TinySaber unplugged, then plug in when prompted by the Arduino IDE. You'll have 60 seconds to do this. 


Example Code

Click here to download the example code. Extract the TinySaber sketch folder to a location of your choice. Open the folder and open TinySaber.ino in the Arduino IDE. To ensure everything is operating correctly before editing code, use the process detailed above to upload the example code to your TinySaber. This upload should complete successfully.



TinyCircuits Staff
TinyCircuits Staff

Author



Also in Learn

New Tiny Arcade - Assembly Instructions (With Rev5 Boards)
New Tiny Arcade - Assembly Instructions (With Rev5 Boards)

by TinyCircuits Staff July 27, 2017

We are super excited to release our latest version of the beloved Tiny Arcade kit! This assembly tutorial features our...

View full article →

New Tiny Arcade - Assembly Instructions
New Tiny Arcade - Assembly Instructions

by TinyCircuits Staff July 25, 2017

We are super excited to release our latest version of the beloved Tiny Arcade kit! We've updated the design for...

View full article →

Bluetooth Low Energy TinyShield (ST) Tutorial
Bluetooth Low Energy TinyShield (ST) Tutorial

by TinyCircuits Staff May 10, 2017

This tutorial will cover the basic operation of the Bluetooth Low Energy TinyShield (ST) using a standard TinyDuino and a Bluetooth-enabled device.

View full article →