Roshamglo Hookup Guide

Pages
Contributors: Alex the Giant
Favorited Favorite 1

Introduction

SparkFun Roshamglo Badge Kit

KIT-14130
12.95

The Roshamglo Badge Kit is an easy to assemble badge that allows you to play Rock-Paper-Scissors with an opponent using infrared (IR) communication. The Roshamglo will also keep track of your score, which you can upload to the scoreboard station and see how you’re doing against other people at the event.

Required Materials

To follow along with this hookup guide, you will need the following:

Suggested Reading

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

How to Solder: Through-Hole Soldering

This tutorial covers everything you need to know about through-hole soldering.

IR Communication

This tutorial explains how common IR communication works, as well as shows you how to set up a simple IR transmitter and receiver.

What is an Arduino?

What is this 'Arduino' thing anyway?

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).

Hardware Overview

Roshamglo labels

The Roshamglo uses the following:

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

The brains behind the Roshamglo is an ATtiny84, a light weight 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 IO 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
5Both MISO, PWMIR LED
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 have been broken out to 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 two, 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 5-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 computer?”, and 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 Software Serial library to send messages to a computer. You can learn more about serial communication here.

Hardware Assembly

To use your Roshamglo, all that’s needed is to solder in the battery clips. To insert the battery clips, you’ll need to turn the board to the side with the pictures of the batteries and push the battery clips into the holes. Make sure that the metal tab on the ends are facing away from the center of the board.

Highlight of battery solder joints

Make sure the battery clips aren’t touching each other! To make sure they won’t short against each other, make sure the clips sit flat against the circuit board.

After the clips are installed, you can turn the board over and solder all of the joints on the top side of the board. When they’re all soldered together, they should look like this:

Roshamglo Soldered

Installing the batteries are easy, but as you install the batteries, make sure you insert the batteries in the same orientation as the silkscreen image between each pair of battery clips. After the batteries are installed, you’re all set! You can move the switch on the left side of the board to “ON”, and you should see the red power LED come on.

Highlight of Battery Orientation

How to Use the Roshamglo

To use the Roshamglo, first make sure that the board is on. When you move the power switch to “ON”, the red LED should illuminate.

How to Play

Playing the game is very straight forward, next to the 5-way switch are three images that correspond to your three possible moves: rock, paper, and scissors. To set your move as rock, you will push the switch to the left towards the rock image. Paper and scissors are played the same way, but this time towards their corresponding images. When you move the switch, the green LED will flash quickly every time the IR LED sends a signal. Once the LED starts to blink, you’ll want to point the USB connector towards your opponent’s controller.

If you’ve pressed the button by mistake, you can press the switch in any direction to cancel the move. Once you select your move though, the green LED will blink for a few seconds. After both sides have received their opponent’s move, the center LEDs will display one of the following:

  • Solid red - lose
  • Solid green - win
  • Alternating red and green - tie
  • Blinking red - see explanation below
  • Fading - timeout. Try standing closer to your opponent and aiming your USB connector at their USB connector

A blinking red LED could mean one of two things. One possibility is that you have played against an opponent too many times. Each controller has a unique ID and your Roshamglo will not function with the same opponent after 15 rounds. We want the Roshamglo to start a conversation with people around you, and the Roshamglo can be used to help break the ice. So walk around and continue on your quest of total domination! Another possibility is that the score saved to your controller is full. You can dump your points by heading over to the scoreboard station.

Viewing and Uploading Your Score

You can view your score by closing the 5-way switch’s center switch (push the switch straight down towards the top of the board). Each time the green LED turns on, represents one point. The score is saved to a 8-bit register, which means that the maximum score you can have saved is 255 points. You can clear your score by uploading it to the scoreboard station. If the LED is red, it means that your current saved score is 0.

To upload your score, head over to the scoreboard station. With the board powered on, insert the board to the station and move the 5-way switch to the down position (towards the SparkFun Logo and lanyard clip). Just like when you’re playing a game, the green LED will flash a few times. The score will be successfully read when the LED changes to solid green. If the LED is solid red, that means that it was not able to read the score.

Summary of the LED Indicator

If the center LED is fading on and off, it means you’re in standby mode. In standby, the board will go into a deep sleep for two seconds, and then wake up to fade LED on and off. Pressing the 5-way switch in any direction will wake up the Roshamglo and perform the function attached to that switch. There are three other modes that control the LED, those LED patterns are described below.

Playing a game:

LED ColorMeaning
Blinking GreenTransmitting IR.
Solid GreenYou won!
Solid RedYou lost.
Alternating Red and GreenIt's a tie!
Blinking RedCase 1: Played this person too many times.
Case 2: Saved score is too high. Upload score to reset.

Checking your score:

LED ColorMeaning
Blinking GreenEach blink represents 1 point.
RedYour saved score is 0. Go find someone to play against!

Uploading your score:

LED ColorMeaning
Blinking GreenTransmitting IR.
Solid GreenScore uploaded successfully. You can now remove your controller.
RedUnable to upload score.

Resources and Going Further

Now that you’ve successfully got your Roshamglo up and running, it’s time to incorporate it into your own project! If you’d like to hack your Roshamglo, you should check out the Hack Your Roshamglo Badge tutorial.

For more information, check out the resources below:

If you don’t have a scoreboard available to reset the play counter, you can download the firmware here. Commenting out gameResult = 3; on line 279 will remove the play count limitation.

Need some inspiration for your next project? Check out some of these related tutorials:

IR Control Kit Hookup Guide

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

ZX Distance and Gesture Sensor Hookup Guide

How to connect and use the SparkFun ZX Distance and Gesture Sensor with an Arduino.

Boss Alarm

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

Hack Your Roshamglo Badge

Learn how to customize and program your Roshamglo badge.

Roshamglo Project: TV-B-Gone

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