Wednesday, May 18, 2011

Cannibalism at it's finest

It's no secret that I used to run a laser gun club on campus. So you must be asking yourself, our avid readers, what has become of my old guns? Great question!

We're cannibalizing them

Om nom nom.

My original plan was to simply sell them, but they are getting old, very banged up and a tad unreliable. Even if I was to find a seller, I would only maybe get $60, maybe $100? for the whole set.

However these guns already have buttons, good IR sensors, great emitters, tons of leds, and speakers. Seeing as I was only expecting 6-10 dollars per gun, the easy access of these parts (plus the shells!) plus the cost of the parts easily makes it the better choice to consume them.

Hongwei already has made great progress using these new parts, as we were having interference with the other parts we purchased. 

Tuesday, May 10, 2011

Let there be sound!

Just started playing around making sounds with the arduino. Wrote a quick function to output a frequency at a length to the board.


void sound(int freq, int millisec)
{
   int period;
   long cycles;
   long i;
   period = (500000 / freq);
   cycles = ((long)freq * (long)millisec) / 1000;
   for (i=0; i<= cycles; i++){
       digitalWrite(SPKR_PIN, HIGH);
       delayMicroseconds(period);
       digitalWrite(SPKR_PIN, LOW);
       delayMicroseconds(period);
   }
}

Works great, however too simplistic. Looking into a library which translates wav files into arrays. I should be able to modify this function to feed those arrays through to make some sweet sweet music.

Thursday, May 5, 2011

Alright champs and champettes, next for another installment!

One of the pain points we mentioned earlier was actually starting a match. The problem with the old guns is once you turn them on they are "hot" meaning they can damage other guns. So while you are trying to get everyone on the right teams, or answering questions, people are firing around, making everyone needing to restart their guns over and over again.

Hongwei and I are pretty smart dudes and we have solved this problem. We designed the OS of the guns to have 3 sections: Pre-game, Game time, and Post-game. Crazy original and exciting, I know. This post will be covering how we fixed the problems in the pre game.

Let's do this!

We divided the pre-game into 4 screens. Stats, Team selection, Game time selection, and Begin Game screen. You progress through these screens using the trigger, and modify the variables on screen using the two controls buttons by the screen.
The stats screen has 3 sections. Name and owner!

Health, gun type, and fire type!

The business screen. Rate of fire, Reload time, Damage per shot, and clip size.

Pulling the trigger on any of these screens will progress you through the game time selection screen, and then team selection. and finally you come to the confirmation screen.

Do you feel lucky?

Here the control buttons change your choice. Pulling the trigger on "yes" starts the game, pulling on "no" (which it is defaulted too) will simply loop you back to the stats screen. 

The defaults for the games are the most common settings we've used (10 minute games with no teams), therefore to start up your standard game it takes a few trigger pulls, one control button press and your ready to go.

This may read like it's complex, but it's quite intuitive. I've had about half a dozen people take a dry run at it with no prompting and they picked up the control scheme in seconds. The UI is very "reversable" meaning you can easily get back to a state you were once in, while still making it clear how to start a game.

Overall I'm pretty happy with it. 

Wednesday, May 4, 2011

Hardware

This is probably the only time I'll ever use my Electrical Engineering degree outside school. Scott already talked about the slick OS design. Here are some hardware details:

  • The "lasers" are IR (infrared) LEDS, which are picked up by IR receivers. Para Light Corp were kind enough to provide us with high power IRLEDs that have ranges of up to 100m!
  • The main display is a HD44780 LCD module, which is supported natively by Arduino.
  • Normal LEDs everywhere for sexiness, muzzle flashes, and ... well sexiness.
  • An optional discrete laser pointer attachment as a laser sight.
  • A few more buttons and switches complete the build.

Pretty simple. The trick is fitting all that into each different shell design.


Some schematics

I'm calling her Wendy

One of the main motivations for this project is just to create something tangible and cool. A gun each of us designed ourselves, on a platform of our own making, that we'll later get to actually use!

University is all about theory, but it feels great to get hands on once in a while.


This is my future sniper rifle, and I'm calling her Wendy.

Come at me bros



Progress.

I herd u liek progress bars.

The Brain

For the Brain of the guns we're using the Arudino platform. Really cool little devices. Right now we have a pro mini which we're using to test on, but we're ordering the bigger and better Uno for the prototypes and production guns.