Picture
Just realized I shot the image being using on the cover of a book called Practical Arduino. I forgot all about it until I saw the book in SparkFun's break room.
 
Snake 2.5 03/14/2010
 
Updated a few more things, recorded this video. As usual here is the source code.
simplesnake_2_5.zip
File Size: 224 kb
File Type: zip
Download File

Here is a compiled version for windows. This is untested.
application.windows.zip
File Size: 2071 kb
File Type: zip
Download File

 
Snake 2.1 03/10/2010
 
Picture
simplesnake_2_1.zip
File Size: 228 kb
File Type: zip
Download File

A few more updates, added a few changes to MSAFluid to allow each snake to leave a different color particle trail.

Also changed the way snakes are controlled and how multiple serial controllers are handled.

The multiplier(block size) changes depending on how many people are playing.

Next on the list of fixes...changing multiplayer restart to allow for 1rst, 2nd, 3rd, 4th place.
 
 
Picture
I wrote this simple Processing sketch to illustrate how simple SparkFun's USB RFID Reader is to use.
Picture


The USB RFID Reader works with the ID-2, ID-12 and ID-20 RFID readers depending on how much range you need.
Picture


When an RFID is placed next to the reader it beeps and send the RFID's number via serial. If you have the Arduino software installed you can simply open up the serial monitor and see the RFID number.
This Processing sketch displays the product photo of the RFID being scanned...obviously this only works if you put the RFID number into the program, since every RFID number is different.
rfid_reader_2.zip
File Size: 247 kb
File Type: zip
Download File

Picture
 
 
Picture
I've been working on a little snake game for Maker Faire. It's made in Processing using MSAFluid, Minim, OpenGL and is controllable via a Simon board or WiiMote.

Here is the source code for anyone who wants to check it out.
Picture
Connect an FTDI to the Simon board, reprogram it to send serial "1-4" for each of the buttons and use as a controller for Snake.

simplesnake_1_2.zip
File Size: 135 kb
File Type: zip
Download File

UPDATE:
Work a bit more on this today, made it a bit more 3d looking.
simplesnake_1_5.zip
File Size: 229 kb
File Type: zip
Download File

Picture
The serial side of things is commented out in this version. but you can use wasd and ijkl to control the players with your keyboard.
simplesnake_1_7.zip
File Size: 656 kb
File Type: zip
Download File

 
 
alcoholsensor.pde
File Size: 2 kb
File Type: pde
Download File

My little sister turned 21 recently, so I started working with the MQ-3 alcohol sensor from SparkFun to see if I could make a portable breathalyzer that runs off a 9v battery, can plug into to a computer via usb and that has some sort of indicator lights to show how drunk one might be.

<insert photo here>
  
It has 6 LEDs which fade up in order depending on the level of alcohol it senses. I also can be plugged into a computer running a processing sketch that shows a more accurate fullscreen readout and displays 170 different images from the internet also depending on the drunk level.


Parts list:
Arduino Mini Pro (5v 16mhz version)
MQ-3 Alcohol Sensor
(2) Red LEDs
(2) Yellow LEDs
(2) Green LEDs
SPST switch
9v battery
9v battery connector
(3) 330k resistors
10k resistor
Right angle headers
FTDI USB->Arduino (5v version)
USB cord

The MQ-3 is a little strange, it definitely needs 5volts, much less and it won't function correctly. Because the sensor has a heating element it's values are easily skewed with hot or cold temperatures blowing on it. The MQ-3 has a burn in period of about 24 hours to give you accurate readings. Also I noticed that the MQ-3 alcohol sensor responds to a few other things like Rock Star energy drinks!

Other than the redundant pins the MQ-3 is pretty straight forward and easy to use. Simply hook up 5v to all 3 of the pins on one side, then hook up a ground (middle pin) and a 10k resistor to ground and finally the last pin goes to the Arduino's analog input. The pin with the 10k resistor to ground can be swapped with the pin going to the Arduino analog input.

The LEDs are taking up all of the PWM lines so they can be faded in sequence. Since the input from the MQ-3 sensor ranges from 0-1023, each LED covers a different range for example green1 covers 0-170 and green2 covers 170-340 and so on adding 170 each time.

There are also 170 images that are cycled through in the Processing sketch.
 
Augmented Tanks 12/21/2009
 
Picture
Projected Image
Augmented Tanks is a game I've been working on for a while now...and am still working on.

Building off of my solar powered iPhone controlled Arduino tank, I've added an infrared LED to my robot so that it can be tracked and also modified the tank's control system so that it now uses two XY grids and a fire button.

The first XY grid now controls the tanks direction and the second controls the tanks aim. There is also a large button spanning the entire top part of the interface which fires the weapon.
Picture
iPhone interface for tank control
doublexy.touchosc
File Size: 0 kb
File Type: touchosc
Download File

The goal of the game is simple, shoot tanks on the opposite team until your team has reached a total of 10 kills. Each time a member of your team is killed you get -1 point.

There are ammo pickups and each tank starts out with a shield that can take 10 hits before the tank is dead.

Right now every bullet fired is tracked with a firedfromID and teamID so that each bullet knows to go through team mates and only damage the opposite team. Also it help to keep track of kills so that at the end of the game statistics can be shown.
Picture
Currently in Progress:

Of course fun part of this is building the actual tanks/robots and controller. I'm still working out the details of what the tanks will be made out of, early tests were simply using Ardubots driven by SparkFun customers during our little meetup/class. How the controller communicated to the server running Processing is pretty important in order to be able to keep all the signals real-time and so that when a bot is killed it's IR led will be turned off for a few seconds and controls disabled.

The students were using xBee modules with unique channels to control each robot via serial commands send by their laptops, but that may be changing...or getting a bit more complicated since they all need to connect to the server via one xbee.
 
bologame10.zip
File Size: 149 kb
File Type: zip
Download File

 
 
Picture
Picture


I just finished installing some hardware for SparkFun's robot tracking system. It's sort of a mixed reality system combining home made robots and hacked together control systems, IR tracking and sweet high res projections from above.

It uses a modded PS3 eye, an ultra-short throw projector mounted above the ceiling, Community Core Vision and Processing running MSAFluid.

The robots can consist of pretty much anything, all that the robots need to be tracked is a simple IR LED pointing upward towards the modded PS3 webcam which now only sees infrared. In this case Tim has attached a small throwy style cell battery, resistor, switch and IR LED together and literally just taped it to his robot.

Tim's sumo robot recently competed and placed at Robothon in Seattle, but now is controlled via a hacked Wiichuck connected to an Arduino and xbee for wireless control.

The InfraRed tracking is done by the PS3 eye with the IR blocking filter removed and an IR filter that ONLY allows infrared light. The result is an all black image with only the IR LED showing up in the webcam. The webcam is directly above projected image hidden in the ceiling.

Community Core Vision is a great piece of free software with a calibration system which has mainly been used for multi-touch screen, but it can also be used for other types of tracking. CCV can output the tracked points via Open Sound Control to Processing...just like TouchOSC in my last project. Or it can output to Flash, which is also really cool, but I don't know much Flash.

Processing can read the OSC signals and interpret them in any number of ways. My favorite easy to tweak demo is Memo's MegaSuperAwesomeFluid TUIO particle system. I just barely modded Memo's code to fit the size of the projection and the speed of the particles emitted from the front of the robot.

That's about it for now, there is definitely more to come. Also if anyone wants to come check out this project or just hack some electronics with us...SparkFun is having a free electronics hacking meetup tomorrow, Dec 5th from 9:30am-2pm in Boulder, CO. Hope to see you there!
 
 
Picture
iPhone Controlled Tank
Picture
iPhone Controlled Tank
Picture
Solar Panel Charger
Using the super awesome TouchOSC app for the iPhone connected to Processing for converting Open Sound Control signals into serial commands send out via USB to an Xbee...I am able to drive a small tank.

The tank is entirely made from SparkFun parts:
Arduino
Ardumoto
Dual Motor GearBox
Stackable Arduino Headers
Super Awesome Tank Treads
LiPoly Battery Charger
Batteries
Small Solar Panel
XBees
XBee USB board
XBee Explorer board
Also used a number of misc jumper wires, rubber bands, a block of wood and a few small pieces of aluminum (from the back of a PC).

Of course you will need an iPhone to get everything running exactly as I have setup, but you don't need to use an iPhone to control your tank, you could use a midi controller, a multi-touch screen, a random hardware controller, or really anything that can send serial, OSC or anything into Processing.

Here is the Source Code:
Source code for Arduino is from a Mechomaniac.com:

//-----------Start Arduino code ---------------

// Test program for SparkFun Ardumoto board
// Copyright (c) 2009 mechomaniac.com
 
// To use, connect the Arduino to a computer and send commands using a serial terminal.
// eg AR40#   motor A forwards with a speed of 40
 
#define PwmPinMotorA 10
#define PwmPinMotorB 11
#define DirectionPinMotorA 12
#define DirectionPinMotorB 13
#define SerialSpeed 9600
#define BufferLength 16
#define LineEnd '#'
 
char inputBuffer[BufferLength];
 
void setup()
{
  // motor pins must be outputs
  pinMode(PwmPinMotorA, OUTPUT);
  pinMode(PwmPinMotorB, OUTPUT);
  pinMode(DirectionPinMotorA, OUTPUT);
  pinMode(DirectionPinMotorB, OUTPUT);
 
  Serial.begin(SerialSpeed);
}
 
// process a command string
void HandleCommand(char* input, int length)
{
  Serial.println(input);
  if (length < 2) { // not a valid command
    return;
  }
  int value = 0;
  // calculate number following command
  if (length > 2) {
    value = atoi(&input[2]);
  }
  int* command = (int*)input;
  // check commands
  // note that the two bytes are swapped, ie 'RA' means command AR
  switch(*command) {
    case 'FA':
      // motor A forwards
      analogWrite(PwmPinMotorA, value);
      digitalWrite(DirectionPinMotorA, HIGH);
      break;
    case 'RA':
      // motor A reverse
      analogWrite(PwmPinMotorA, value);
      digitalWrite(DirectionPinMotorA, LOW);
      break;
    case 'FB':
      // motor B forwards
      analogWrite(PwmPinMotorB, value);
      digitalWrite(DirectionPinMotorB, LOW);
      break;
    case 'RB':
      // motor B reverse
      analogWrite(PwmPinMotorB, value);
      digitalWrite(DirectionPinMotorB, HIGH);
      break;
    default:
      break;
  } 
}
 
void loop()
{
  // get a command string form the serial port
  int inputLength = 0;
  do {
    while (!Serial.available()); // wait for input
    inputBuffer[inputLength] = Serial.read(); // read it in
  } while (inputBuffer[inputLength] != LineEnd && ++inputLength < BufferLength);
  inputBuffer[inputLength] = 0; //  add null terminator
  HandleCommand(inputBuffer, inputLength);
}

//----------- End Arduino code ---------------

Processing code:

//----------- Start Processing code ----------------

import oscP5.*;
import netP5.*;
import processing.serial.*;
Serial arduinoPort;
OscP5 oscP5;

float [] fader = new float [3];

void setup() {
  oscP5 = new OscP5(this,8000);
  arduinoPort = new Serial(this, Serial.list()[0], 9600);
}

void oscEvent(OscMessage theOscMessage) {

    String addr = theOscMessage.addrPattern();
   
       if(addr.indexOf("/1/fader") !=-1){
       String list[] = split(addr,'/');
     int  xfader = int(list[2].charAt(5) - 0x30);
     if(theOscMessage.get(0).floatValue() !=0){
     fader[xfader]  = theOscMessage.get(0).floatValue();
     }  
    }
}

void draw() {
//---------------------------------Motor A
 if(fader[1] > 0.65){
    arduinoPort.write("AF100#");
  }
   if(fader[1] < 0.35){
    arduinoPort.write("AR100#");
  }
  //--------------------------------Motor B
   if(fader[2] > 0.65){
    arduinoPort.write("BF100#");
  }
   if(fader[2] < 0.35){
    arduinoPort.write("BR100#");
  }
  //----------------------------stop commands
     if(fader[1] < 0.65 && fader[1] > 0.35 ){
    arduinoPort.write("AF0#");
  }
       if(fader[2] < 0.65 && fader[2] > 0.35 ){
    arduinoPort.write("BF0#");
  }
 
}

//---------------------- End Processing Code ------------------
 
 
Had fun today at work shooting the FreeDay Banner for SparkFun.com. Thanks TJ for always being willing to be photographed.
Picture
www.SparkFun.com