Skip to main content


developerWorks  >  Open source  >

Building an Arduino-based laser game, Part 2: Firing the gun

Jump-start your electronics projects with the open source hardware and software platform Arduino

developerWorks

Level: Intermediate

Duane O'Brien , PHP developer, Freelance

10 Feb 2009

Register now or sign in using your IBM ID and password.

Arduino is an inexpensive, easy-to-use electronics platform. The entire platform, both the hardware and the software, is completely open source, and the language is loosely based on C/C++. Arduino was built for makers, tinkerers, and artists who want to take the plunge into creating interactive physical objects. This three-part series starts with basic Arduino hardware and uses it to create an interactive laser game called "'Duino tag," where players can play tag using devices built nearly from scratch. Here in Part 2 of this "Building an Arduino-based laser game" series, you'll build and test the receiver part of the 'Duino Tag gun.

In this tutorial

To follow along, you don't need any electronics experience, although experience working with electronic components can certainly serve you well. If you've worked with microcontrollers, you'll have an edge, but keep in mind that the Arduino platform is well suited for people without that experience. Above all, you should be willing to stretch your skills. Working with electronics and microcontrollers can be rewarding. Most software engineers don't get a chance to write code for devices that interface with the physical world, and Arduino provides a low-cost entry point into working with interactive devices.

This tutorial focuses on shaping the game. Now that you know the Arduino basics, you'll spend most of this tutorial building and testing a receiver for the 'Duino Tag gun. You'll get your hands dirty working with the code. We've got a bit of a chicken-and-egg problem: We can't actually test the receiver without having something to transmit, and we can't actually test transmission without having something to receive it. Fortunately, you'll learn a pretty easy solution for that.


Prerequisites

See System requirements below.


System requirements

For this tutorial, you need a few tools and supplies. See Part 1 for a list, including the Arduino hardware and software. Following are the basic items needed.

Infrared LED
Just about any would do, but the brighter the better.
Infrared sensor
This series was written using a TSOP2138YA Infrared Sensor (from All Electronics).
100-ohm resistor
The markings for this resistor are brown-black-brown.
0.1uF capacitor
You will need a capacitor of 0.1uF.
Switch
You need a single pole momentary switch.
A piezo element
You want one with leads already soldered.
Wire
Get 22 gauge, solid or stranded.

You also need a way to connect your components, either using a breadboard or soldering things together.

To get around the chicken-and-egg problem, you need either a universal remote or a Sony Electronics-brand remote of some kind. The example in this series used a remote from a Sony combo VHS/DVD player and was successfully tested with a universal remote from a cable box.

As mentioned in Part 1, this project is more fun if you're working with other people building their own 'Duino Tag guns. It is also much easier to test your work if you have two guns to work with. If you decide to work alone, you may find Parts 2 and 3 easier if you build two guns yourself. This is especially true for Part 3, when we pull the whole thing together.



Formats

html, pdf


Share this....

digg Digg this story del.icio.us del.icio.us Slashdot Slashdot it!


Back to top


Document options

Document options requiring JavaScript are not displayed


My developerWorks needs you!

Connect to your technical community


More in this series:
Building an Arduino-based laser game