Categories
Uncategorized

Accelerometer Art

Accelerometer Art

Accelerometer Art

Accelerometer Art

At MilwaukeeDevHouse5 Matt and I played with Arduinos, so here, with the fairly uninspiring name of “Accelerometer Art” I present three screen shots of a Processing application displaying data from an ADXL335 accelerometer connected to my MacBook via an Arduino.

Here’s the code that runs on the Arduino…

/*
 * Accelerometer.pde
 */

#define aref_voltage 3.3

int xpin = 1;
int ypin = 2;
int zpin = 3;

void setup(void) {
  Serial.begin(9600);   
  analogReference(EXTERNAL);
}

void loop(void) {
  int xval = (analogRead(xpin));
  int yval = (analogRead(ypin));
  int zval = (analogRead(zpin));

  Serial.print (xval);
  Serial.print (" ");
  Serial.print (yval);
  Serial.print (" ");
  Serial.print (zval);
  Serial.print (" \n");
  
  delay(10);
}

And here’s the code that runs in Processing…

/*
 * Accelerometer_Graph.pde
 */

import processing.serial.*;

Serial myPort;
int xPos = 0;
int yPos = 0;
int zPos = 0;

void setup () {
  size(1024, 768);
  println(Serial.list());
  myPort = new Serial(this, Serial.list()[0], 9600);
  myPort.bufferUntil('\n');
  background(0);
}

void draw () {
  // everything happens in the serialEvent()
}

void serialEvent (Serial myPort) {
  String inString = myPort.readStringUntil('\n');

  String[] nums = split(inString, ' ');
  String inStringx = nums[0];
  String inStringy = nums[1];
  String inStringz = nums[2];


  if (inStringx != null) {
    inStringx = trim(inStringx);
    float inBytex = float(inStringx);
    inBytex = map(inBytex, 0, 1023, 0, height);

    stroke(255,0,0);
    point(xPos, height - inBytex);
    strokeWeight(3);

    if (xPos >= width) {
      xPos = 1;
      background(0);
    }
    else {
      xPos = xPos + 1;
    }
  }

  if (inStringy != null) {
    inStringy = trim(inStringy);
    float inBytey = float(inStringy);
    inBytey = map(inBytey, 0, 1023, 0, height);

    stroke(0,255,0);
    point(yPos, height - inBytey);
    strokeWeight(3);

    if (yPos >= width) {
      yPos = 2;
      background(0);
    }
    else {
      yPos = yPos + 1;
    }
  }

  if (inStringz != null) {
    inStringz = trim(inStringz);
    float inBytez = float(inStringz);
    inBytez = map(inBytez, 0, 1023, 0, height);

    stroke(0,0,255);
    point(zPos, height - inBytez);
    strokeWeight(3);

    if (zPos >= width) {
      zPos = 3;
      background(0);
    }
    else {
      zPos = zPos + 1;
    }
  }
}

void keyPressed() {
  if (int(key) == 113) {
    exit();
  }
}

The Processing code was based on an example from Tom Igoe which he placed in the public domain. (Thanks Tom!)

I heavily violated the DRY rule with this code, so it should really be re-written to be more efficient. Besides all that, it does actually work, as you can see from the awesome graphics above. (Thanks to Matt Gauger for helping with the code, and yes, he scolded me for violating the DRY rule.)

This was a great first step into Processing for me, and I look forward to improving this code, as well as explore some other ideas I have for graphing data.

(If you’ve got any pointers to great tutorials, blogs, or web sites focusing on Processing, let me know!)

Categories
Uncategorized

MilwaukeeDevHouse5 Time Lapse

Time Lapse Bot was at Bucketworks for MilwaukeeDevHouse5 on December 3rd, 2010. If you weren’t there, well, at least you can enjoy this video.

This video is released under a Creative Commons Attribution License. The music titled “cyber seeds” is from cypher tales via Jamendo and has a Creative Commons Attribution License. You can also find this video at blip.tv as well as Vimeo. Enjoy!

Categories
Uncategorized

MKEDH5

MilwaukeeDevHouse5 is Friday, December 3rd, 2010… Details at Web414.com

See Also: MilwaukeeDevHouse5 – Hack the Bucket! and BarCamp ReCap at Web414 and maybe even Design Inspiration.

Come ready to think, discuss, and take action… Your ideas? We want them!

Categories
Uncategorized

MilwaukeeDevHouse4 Time Lapse

MilwaukeeDevHouse happened and you missed it… or you didn’t. Either way, you can watch this video that Time Lapse Bot and I created…

We used a real MiniDV camera this time, so we got double the resolution of the old camera, which is nice. We also had Sam Dodge doing a bit of Time Lapse Bot camera operation, so that’s cool…

I love how these time lapse videos encapsulate the events… I’m also in talks with SmallSharpTools.com to do another Time Lapse Bot upgrade, which will result in greater roaming capabilities of the unit.

You can also watch on blip.tv or grab the hires version if you like. Just adhere to the Creative Commons license and be cool…

Stay Tuned!

Categories
Uncategorized

BarCampMilwaukee4 Portraits at MKEDH4

Remember at BarCampMilwaukee4 when I took your photo? Well, I still need to edit all the shots, and I’ll be doing it at MilwaukeeDevHouse4 on Saturday, November 7th, 2009…

Oh yeah, you’re invited! MilwaukeeDevHouse is a hackathon-type event where we encourage you to come and work on something. Maybe some project you’ve had on the back burner for a while… maybe you need to upgrade your WordPress blog, test out some new Drupal modules, work on a Joomla theme, build a robot, or… edit 80+ photos. Hopefully I can also work on “The Faces of BarCamp” project as well…

facesofbc

Think of MilwaukeeDevHouse as a party where you can get some work done, but don’t have to. You can just hang out, socialize, and eat & drink if you like… it’s like a social network, but in real life. (You’re not limited to 140 characters, unless you want to be.) It’s a chance to learn something new and meet some new people. It’s full of “newness” or something!

Our pals at Bucketworks and Insomniac Development LLC will provide snacks and libations, and we thank them for that.

(P.S. I’ve been told this is a “pants optional” event, but I’m not sure what that means. Also, Time Lapse Bot will be there. Are these two things related!?!?)