-
Enclosures
01/16/2014 at 01:22 • 0 commentsNow we couldn't very well let 500 hackers mess around with a bunch of open wires, so we needed to make a little enclosure for our control system. The simplest way to do this was to grab an off the shelf project enclosure from Radioshack.
We had to drill a bunch of holes to fit our various components, this proved to be a bigger challenge than we had first anticipated since we inevitably didn't have the right size drill bits. After a bit of procrastination we bit the bullet and drilled 4 holes for the big dome switch, the rotary encoder, rotary switch and the clear button. However... it turns out we didn't expect the plastic to melt while drilling in the way it did, leaving us with holes bigger than they were expected to be.
For the big dome, we found that the clamp nut fell straight through the hole, making it impossible to secure the dome switch properly. So we dived into our parts box looking for something we could use as a washer. Thankfully we found this perfectly sized hard drive disk platter which did the job nicely:
Next we found that the arcade button fell through the hole at certain angles. This was really annoying as it was almost exactly the right size, but not quite. Thankfully though we'd bought two of these switches so we wound the clamping nut tightly onto the shaft and pushed it through the hole which after a bit of action with the dremel was now a perfect fit. We then used the nut from the second button to clamp it all into place. It seems good and solid now:
Then it was just a case of putting all the additional wiring in place and fixing the Arduino and protoboards into place and securing the rotary encoder and switch.
Thankfully this was the last major problem we had and now the case looks great. We still need to buy a knob for that rotary switch, but I think this will do...the HackADay sticker really finishes it off don't you think?
-
A little Arduino goes a long way...
01/16/2014 at 01:10 • 0 commentsYes yes, I know, Arduinos are lame. But... they are incredibly handy for getting certain things done really quickly.
For the control system we need to emulate a USB keyboard, it just so happens the Arduino Micro is especially good at this. With a simple line of code you can easily send arbitrary keypresses to your computer without any effort at all. So we're going to use one for our system.
We're going to hook a few basic components to our Arduino, we've already covered the Big Dome button. Besides changing color we want to be able to modify brush width. This is a value from 2 to 128, so we decided a rotary encoder would be best, so we grabbed one of these Illuminated Rotary Encoders from SparkFun. These let us not only read a continuous stream of values, but they also have an embedded RGB LED that we can use to provide some feedback.
These encoders are actually a little complex to read, they only require two pins but you need to read their values very carefully to determine which way the encoder has been rotated. Here's a quick snippet of code showing how to use them:
/* Rotary encoder read example */
#define ENC_A 2
#define ENC_B 3
#define ENC_PORT PIND
#define MASK 0x03
void setup()
{
/* Setup encoder pins as inputs */
pinMode(ENC_A, INPUT);
digitalWrite(ENC_A, HIGH);
pinMode(ENC_B, INPUT);
digitalWrite(ENC_B, HIGH);
Serial.begin (115200);
Serial.println("Start");
}
void loop(){
int tmpdata = brushSize();
Serial.println(tmpdata, DEC);
}
int brushSize()
{
static uint8_t counter = 2; //this variable will be changed by encoder input
int8_t tmpdata;
tmpdata = read_encoder();
if( tmpdata ) {
counter += tmpdata;
if (counter < 2)
counter=2;
if (counter > 254 )
counter = 254;
}
return counter/2+1;
}
/* returns change in encoder state (-1,0,1) */
int8_t read_encoder()
{
static int8_t enc_states[] = {
0,-1,1,0,1,0,0,-1,-1,0,0,1,0,1,-1,0 };
static uint8_t old_AB = 0;
/**/
old_AB <<= 2; //remember previous state
old_AB |= ( ENC_PORT & MASK ); //add current state
return ( enc_states[( old_AB & 0x0f )]);
}We also want to be able to modify brush shape, for this we have 6 values, so we grabbed a basic rotary switch from RadioShack. This switch would really require us to use 6 pins, one for each position, unfortunately we don't really have that many pins and it would vastly complicate our reading of the values anyway, so we came up with a quick hack using a simple voltage divider circuit and one of the analog pins to read a different voltage at each pin position.
Here's the code for reading the value based on a selection of resistor values, dead simple right?
int getBrush() {
int val = analogRead(BRUSH_SWITCH_PIN);
if (val > 950)
return 0;
else if (val > 700)
return 1;
else if(val > 450)
return 2;
else if(val > 250)
return 3;
else if(val > 75)
return 4;
else
return 5;
}Finally we added one of these simple arcade style buttons so we can clear the display.
-
An RGB button...
01/16/2014 at 00:55 • 0 commentsI really like these big dome buttons from SparkFun, but they don't come in an RGB flavour. This is really annoying as they would be ideal for the color control on our system.
Not to worry though, a couple of minutes with some snips and a soldering iron and this can be easily solved. First disassemble the button and extract out the LED holder and the metal clips that connect to the LED pins. These are easily pulled out with some pliers. After you've pulled the metal clips out drill 4 small holes in the plastic for your LED channels.
Now snip out channels to these holes with a pair of snips. You should now be able to put your wide angle RGB led into place and bend the pins to hold it all secure.
If you did it right you should be able to put the microswitch back into place without it impacting the pins.
Now you solder 4 wires to the RGB LED pins and you are good to go!
-
GRL!
01/16/2014 at 00:45 • 0 commentsIn 2002 the Graffiti Research Lab put together the rather excellent L.A.S.E.R. Tag system which allows you to draw virtual graffiti with nothing more than a camera, a projector and a laser pointer. They've done really awesome things with this showing it off around the world, virtually defacing buildings everywhere.
In the planning stages of the HackADay Gathering meetup we decided we needed something for all the hackers to play with and someone floated the idea of setting up the laser tag system in the space. This didn't seem like enough of a hack to me so I decided we should build a control system for it to make it easier to use.
Unfortunately we couldn't get a working copy of the Laser Tag source so we have had to improvise. Most options in the system are available through a cursor navigated menu system, so we thought we could quickly use an Arduino to simulate a USB keyboard and send the appropriate keypresses. So we're going to put together a control box with a couple of buttons and switches to control the main features of the software, Brush Color, Brush Size and Brush Shape.