Hack Your Roshamglo Badge

Contributors: Shawn Hymel
Favorited Favorite 1


So you've put together your Roshamglo badge, and now you want more? Well, we can help you with that. In addition to playing infrared (IR) Rock-Paper-Scissors, the Roshamglo board can be reprogrammed with user-created code.

SparkFun Roshamglo Badge Kit


This will allow you to create your own applications for the badge. What can you make with some blinking lights, a five-way switch and IR communication? Well, how about a TV remote or a laser tag game, for starters.

Required Materials

The only things you'll need to reprogram your Roshamglo badge are a fully constructed badge and a computer.

Suggested Reading

If you aren't familiar with the following concepts, we recommend checking out these tutorials before continuing.

IR Communication

This tutorial explains how common infrared (IR) communication works, as well as shows you how to set up a simple IR transmitter and receiver with an Arduino.

What is an Arduino?

What is this 'Arduino' thing anyway? This tutorials dives into what an Arduino is and along with Arduino projects and widgets.

How to Install an ATtiny Bootloader With Virtual USB

With this, you will be able to upload Arduino sketches directly to the ATtiny84 over USB without needing to use a programming device (such as another Arduino or FTDI chip).

Roshamglo Hookup Guide

This tutorial provides everything you need to know to get started with the Roshamglo badge.

Hardware Overview

Note: This is a repeat section from the Roshamglo Hookup Guide, but it could be useful if this is the first place you've visited.

Roshamglo labels

The Roshamglo uses the following:

  • ATtiny84
  • IR LED
  • IR receiver with built-in 38kHz demodulator
  • USB programming
  • Programmable red and green LED
  • Power switch
  • 5-way switch for input
  • Reset switch
  • 6 AAA PTH battery clips
  • 3 AAA batteries for power

The brains behind the Roshamglo is an ATtiny84, a lightweight Arduino-compatible microcontroller. The ATtiny84 comes with the following:

  • 8kB of flash memory for our program (~6kB after the bootloader is installed)
  • 512B of SRAM, which stores our variables used in our program
  • 512B of EEPROM
  • 12 I/O pins MAX (the Roshamglo breaks out 9 of these pins)
  • 10-bit analog-to-digital converter, which can be used on 8 pins

For details about what each pin is able to do, refer to the table below.

PinAnalog or DigitalAdditional UsesRoshamglo Uses
0Both Analog Reference5-way switch down
1Both --5-way switch right
2Both --5-way switch up
3Both --IR Receiver
4Both SCK, SCL5-way switch left
6Both MOSI, SDA, PWM5-way switch center
7Both PWMGreen LED
8Digital PWMRed LED
Missing from the list are digital pins 9 and 10. The bootloader uses these two pins for USB programming.

Jumpers and Pins Highlighted

Each of these pins has been broken out to the edge of the board to make customization easy! If you would like to use any of these pins for something other than what it's currently connected to, we provided jumpers that can easily be cut with a hobby knife. The only pins that do not have a jumper on them are the pins used for the five-way switch. The pins for the switch use the ATtiny's internal pull-up resistors, so as long as the switch is not closed, the pin can be configured in any way you'd like without having to cut traces.

One Important Feature Missing

If you hadn't noticed in the pin description, there was no mention of RX or TX pins. This is because, unfortunately, the ATtiny84 doesn't have a hardware UART. The UART is used for serial communication, whether it's for programming or printing messages to the serial window. You might be thinking, "But doesn't the USB connector provide communication between the ATtiny and the computer?" You're right; it does. To keep the bootloader size as small as possible, the bootloader only allows for USB programming. For serial debugging, you'll need a USB cable and a USB-to-Serial adapter, and the SoftwareSerial library to send messages to a computer. You can learn more about serial communication here.

Install USB Driver

Roshamglo is emulating USB 1.1 using two of its pins. However, there are no common operating system drivers available that work with this custom USB class. As a result, we will need to install custom drivers in order to communicate with (and send our Arduino programs to) the Roshamglo board. Choose your operating system below and follow the directions to install the driver.

Note: We did not write the USB firmware nor the driver. We simply modified them to work with Roshamglo. The true geniuses are the fine folks who wrote micronucleus and libusb.


Make sure the Roshamglo board is OFF, hold the Down button (pull the five-way switch toward the SparkFun logo) and insert it into an available USB slot.

Plug Roshamglo into a USB slot

Once plugged in, the status LED should begin to quickly flash red in short bursts. This means the badge is in "Bootloader Mode."

Flashing LED means it's in bootloader mode

Download the SparkFun ATtiny USB drivers by clicking on the link below.

Unzip the file. Open the Windows Device Manager, and you should see an Unknown device. Right-click on Unknown device and select Update Driver Software.

Updating driver for Roshamglo

In the pop-up window, click Browse my computer for driver software.

Search for SparkFun USB drivers

Click Browse... and open the folder that contains the drivers you just unzipped. It will likely be the sparkfun_attiny_usb_driver folder.

Installing the USB drivers

Click Next. You may get a warning pop-up that says "Windows can't verify the publisher of this driver software." That's OK. Just click Install the driver software anyway.

Tell Windows we want to install the driver software anyway

You should see a notification that the SparkFun ATtiny driver was installed successfully. Close that window, and verify that your Unknown device now shows up as SparkFun ATtiny in the Device Manager.

Successful installation of the SparkFun ATtiny USB driver


You'll need to install Homebrew and use it to install libusb. Enter the following commands into a Terminal:

/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
brew doctor
brew install libusb-compat


Good news! Linux doesn't require special drivers. However, you will need to do one of the following to be able to program Roshamglo from Arduino:

1) When you download the Arduino IDE (next section), make sure you run it as root: sudo ./arduino

Running Arduino as root

2) Or, you can add some udev rules so that Linux enumerates your device with write permissions. Create a file in rules.d:

sudo edit /etc/udev/rules.d/49-micronucleus.rules

Copy the following contents into that file:

# UDEV Rules for Micronucleus boards including the Digispark.
# This file must be placed at:
# /etc/udev/rules.d/49-micronucleus.rules    (preferred location)
#   or
# /lib/udev/rules.d/49-micronucleus.rules    (req'd on some broken systems)
# After this file is copied, physically unplug and reconnect the board.
SUBSYSTEMS=="usb", ATTRS{idVendor}=="16d0", ATTRS{idProduct}=="0753", MODE:="0666"
KERNEL=="ttyACM*", ATTRS{idVendor}=="16d0", ATTRS{idProduct}=="0753", MODE:="0666", ENV{ID_MM_DEVICE_IGNORE}="1"
# If you share your linux system with other users, or just don't like the
# idea of write permission for everybody, you can replace MODE:="0666" with
# OWNER:="yourusername" to create the device owned by you, or with
# GROUP:="somegroupname" and mange access using standard unix groups.

Save and exit.

Adding Arduino Compatibility

Arduino is not a full-featured development environment, but it does allow us to prototype embedded programs quickly and easily. To begin, navigate to Arduino's software page and download the Arduino IDE for your operating system.

If you need help installing Arduino for your operating system, you can follow this guide.

Important! Your Roshamglo board will only work with Arduino versions 1.6.10 and above.

Download and Install the Board Package

Because the Roshamglo board is not supported by the Arduino IDE by default, we need to add it manually. Open the Arduino program and go to File > Preferences. Then copy and paste the URL below into the Additional Board Manager URLs text box.


Modifying the additional boards URL in Arduino

Then hit OK, and navigate to the Tools > Board > Boards Manager… tool. A search for “tiny” should turn up a SparkFun ATtiny Boards result. Select that and click Install.

Installing the Sparkfun ATtiny Boards definitions

Once the installation is complete, go to Tools > Board and select Roshamglo (ATtiny84, 3.3V, 8MHz) under the SparkFun ATtiny Boards section.

Selecting the ATtiny84 under the boards section in Arduino

The Roshamglo board comes with two LEDs (a red LED and green LED built into one package), as well as a five-way switch (left, right, up, down and center). We can test that our Roshamglo board can be reprogrammed by writing and uploading a simple program.

Open the Arduino IDE and enter the following code:

void setup() {
  pinMode(7, OUTPUT);

void loop() {
  digitalWrite(7, HIGH);
  digitalWrite(7, LOW);

Click on the Upload button.

alt text

If you are asked to save your work, click Cancel (save it if you want, but you don't need to save to compile and upload your code).

Wait until you see Uploading appear in the Arduino IDE.

alt text

Make sure the Roshamglo board is OFF, hold the Down button (pull the five-way switch toward the SparkFun logo) and insert it into an available USB port while continuing to hold the Down button.

Plug Roshamglo into a USB slot

Let go of the Down button, and the status LED should begin to quickly flash red in short bursts. This means the badge is in "Bootloader Mode." You will need to do this every time you upload a new program to it.

Flashing LED means it's in bootloader mode

After a moment, you should see Done uploading appear in Arduino.

alt text

Remove the Roshamglo board from your computer. Slide the power switch to ON.

Turn on Roshamglo

And that's it! Your Arduino should begin flashing the green LED on and off every second.

Roshamglo blinking

Note: If you get an error message while uploading, it could be caused by a variety of reasons. The way we're uploading programs to Roshamglo is actually hacked together, as we're emulating USB on the badge, which many computers do not like. Here are some things to try if you do get an error:
  • Try a different USB port
  • Unplug other USB devices
  • Close other programs that might be running
  • Reinstall the Roshamglo USB driver
  • Try a different computer

Resources and Going Further

Being able to make something blink is an important first step. You can now reprogram your Roshamglo to perform a wide variety of tasks, like blinking in different patterns, controlling the blink with the control stick, etc.

But wait, there's more! The board comes equipped with an infrared (IR) transmitter and IR receiver. That means you could control TVs (with the right IR codes) or set up a simple "laser tag" game to play with your friends.

For more information, such as the Roshamglo source code, check out these resources:

These tutorials might help as inspiration for your next project:

IR Control Kit Hookup Guide

How to get the most out of the infrared receivers and transmitters included in the IR Control Kit.

Boss Alarm

Build a Boss Alarm that alerts you of anyone walking into your office and automatically changes your computer screen.

Roshamglo Project: TV-B-Gone

Turn your Roshamglo board into a (nearly) universal TV power button.