Game:Jump Wheel

From Hackerspace ACKspace
Revision as of 18:52, 25 September 2014 by Xopr (talk | contribs) (created first draft on the game page)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search
Project: Game:Jump Wheel
Featured:
State Active
Members Lots of participants
GitHub No GitHub project defined. Add your project here.
Description Synchronize your jump with your coop players and beat the record
Picture
No project picture! Fill in form Picture or Upload a jpeg here
File:JumpWheel.jpg
Our publicity stunt project

synopsis

The game consists of a wheel with four players on it. If a player jumps, the center point of gravity of the wheel changes, and the wheel will turn.

To get a player to jump, a person needs to jump on a special built jump pad.

Lots of participants worked or helped on this; add your name if you were involved.

the software

The on-screen part of the game is written in Javascript using HTML5 and some images from various classic computer games. If a key is pressed, the corresponding player jumps and the wheel will turn. When the wheel crosses the finish, the score is calculated from the time it took to finish.


the hardware

The human interface part consists of a mechanical part: the jump pads, and an electrical part: the arduino uno. For the jump pad, you'll need some

  • strips/slats of wood
  • two squares of plywood
  • two sheets of conductive tape
  • some wire to solder on to it

For creating the link from jump pad to computer, an arduino uno is programmed as a keyboard interface This allows one to send up to 6 keystrokes at a time (as part of the USB HID class payload)


the firmware

There are actually two parts of firmware

The first part reads some inputs set as pullup. If the contact breaks from ground, the corresponding key down is sent, followed by a key up after 500ms.

The second part is updating the controller AVR: an Atmega16u2. First, on needs to create the hex file.

  • Download the files from harlequin-tech's arduino-usb github page (either by downloading the firmwares as a zip, or git checkout
  • verify the AVR controller chip; in our case our arduino uno has a ATMEGA16u2
  • Open the makefile and make sure the MCU = set correct (in our case we had to change atmega8u2 into atmega16u2)
  • `make`, and remember the name of the *.hex file
  • You probably want to create an arduino-usbserial hex file for the reversing process as well or you won't be able to program the uno itself via usb

Next, you need to download it into the controller. You can do this in two ways.

using Atmel's FLIP

NOTE: not verified; Prodigity was able to use this method on a windows machine.

To program with Atmel's FLexible In-system Programmer, you'll need java x86 runtimes (jre). This part failed to run properly on xopr's machine.

Download FLIP on the atmel page Follow their instructions, and you'll be able to upload hex files if you reset the controller chip.

using an external programmer

We tested it with Da Syntax's AVRISP2, but we had to make sure which port it uses. After enabling some logging in the arduino IDE, we figured out it was 'usb'.

sudo avrdude -cavrispv2 -pm16u2 -Pusb -Uflash:w:Arduino-keyboard.hex

This command means: program with the AVRISP2 controller, for a processor ATMEGA16U2 via port 'usb' and write the flash with the given hex file.

todo

  • solve contact bounce for pads pulled to ground
  • add extra modes (inverse lines, wsad, arrows, function keys, shift keys)
  • use requestAnimationFrame in the game
  • use v-usb stack on a single AVR to get rid of the arduino (and make it more compact)