Code


28
Apr 10

Augmented Reality – Hippo

Here’s some augmented reality work I did here in Vancouver with Tangible Interaction for Telus. Model and animation by Daniel Vasquez. The download is for the Mac OSX 10.5 and above.

Download the app from the Telus site.


19
Mar 10

FLARToolKit

A test of FLARToolKit, the Flash port of NyARToolKit, a java port of ARToolKit. Loads collada data, with Papervision doing the 3D work in Flash.

ARToolKit in Flash test with Collada from Jay Pozo on Vimeo.


13
Mar 10

ARToolKitPlus

Been working on getting ARToolKitPlus working with some collada data. Here’s a test with markers on my iPhone. Thanks to Theo Watson for the OF 0061 demo.

ARToolKitPlus test from Jay Pozo on Vimeo.


30
Dec 09

Arduino MIDI controller

A project that I’ve been working will use ultrasonic range finders to determine the locations of people in a space to send MIDI signals back to Ableton Live to trigger tracks of sound. This prototype sends one of four byte strings that make up a MIDI controller command, based on the distance from the sensor. It’s made up of an Arduino, a Maxbotix EZ1, a MIDI to USB cable and some RGB LEDs for visual feedback.

Arduino MIDI Controller

Simply put, if you’re within 8 inches of the sensor, one measure of music on the computer plays and the LEDs show one color. Greater than 16 inches, a different measure plays and the LEDs change to a different color. More than 24 inches away from the sensor and you get yet a different measure of music and color on the rgb LEDs. In the end I hope to scale the spatial awareness of this to intervals within 10 feet, with the LEDs lighting 1′x2′ plexiglass panels with the sensors mounted below the panels, facing into a space.

For now, here’s some Arduino code if anybody’s interested in playing with it:

/*

CTYSND - a spatial musical instrument
Author: Jay Pozo

http://www.jaymatter.com

December 2009

for more info about MIDI messages, go here:

http://www.midi.org/techspecs/midimessages.php

*/

// data pin for the range finder sensor
const int sensorPin1 = 6;

byte firstNote = 0x01;
byte secondNote = 0x02;
byte thirdNote = 0x03;

// commandByte: 0x90 is a note
// 0xB1 is a controller change on channel 2
byte commandByte = 0xB1;

// the third byte sends the velocity. In this case, 0x7F is max of 127
byte thirdByte = 0x7F;
byte lastNotePlayed;

long sensor1Pulse;
long distance1; // in inches

// pins for the colored led panels
// this will have to change later, probably through a shift register to support 8 sets of LEDs
int redPin1 = 9;
int greenPin1 = 10;
int bluePin1 = 11;

// our ranges, in inches
int rangeStart = 0;
int rangeStep1 = 8;
int rangeStep2 = 16;
int rangeStep3 = 24;

void setup() {

Serial.begin(31250);

pinMode(redPin1, OUTPUT);
pinMode(greenPin1, OUTPUT);
pinMode(bluePin1, OUTPUT);

pinMode(sensorPin1, INPUT);
}

void loop() {

sensor1Pulse = pulseIn(sensorPin1, HIGH);
distance1 = sensor1Pulse/147; // distance is in inches (see documentation of sensor for value of 147)

if ( distance1 > rangeStart && distance1 < rangeStep1 )
{
analogWrite(redPin1, 255);
analogWrite(greenPin1, 255);
analogWrite(bluePin1, 255);
if (lastNotePlayed != firstNote)
{
noteOn(commandByte, firstNote, thirdByte);
lastNotePlayed = firstNote;
}

}

if ( distance1 > rangeStep1 && distance1 < rangeStep2 )
{
analogWrite(redPin1, 255);
analogWrite(greenPin1, 0);
analogWrite(bluePin1, 255);
if (lastNotePlayed != secondNote)
{
noteOn(commandByte, secondNote, thirdByte);
lastNotePlayed = secondNote;
}

}

if ( distance1 > rangeStep2 && distance1 < rangeStep3 )
{
analogWrite(redPin1, 255);
analogWrite(greenPin1, 255);
analogWrite(bluePin1, 0);
if (lastNotePlayed != thirdNote)
{
noteOn(commandByte, thirdNote, thirdByte);
lastNotePlayed = thirdNote;
}

}

if (distance1 > rangeStep3 )
{
analogWrite(redPin1, 0);
analogWrite(greenPin1, 0);
analogWrite(bluePin1, 255);

// noteOff();

}

delay(300);
}

void noteOff()
{
Serial.print(0xFC,BYTE);
}

void noteOn(int cmd, int pitch, int velocity) {
Serial.print(cmd, BYTE);
Serial.print(pitch, BYTE);
Serial.print(velocity, BYTE);
}


22
Sep 09

Parallax RFID -> Flash

Parallax RFID and tags

Parallax USB RFID

Watch the video demo here.

This tutorial assumes that you’ve got Processing and the Parallax RFID reader running as per the Parallax -> Arduino document here: http://docs.google.com/View?id=dg895rd7_534c58v2g7

Continue reading →


1
May 09

Chicago: The Sustainable Windy City

Chicago

Lots of good music has come out of Chicago – the “greatest blues label” Chess Records, Common, Kanye West, all come out of Chi-city.  Frank Gehry’s got a small outdoor venue built in a park there.  There’s also been some really great sustainable urban development led by Mayor Daley including park improvements, green rooftops.  The latest (well, I’ve only just read about it but it’s been going on for two years) are “green alleys“.  Porous concrete helps water reach the subsoil, recycled materials are used to make some of the concrete.  The city has even compiled a handbook outlining possible layouts for a green alley.  They’re supposed to be “more inviting” – and maybe they will be with their light reflective paving stones and rain gardens.  I’ve always found a certain charm in alleys, the behind-the-scenes space between businesses, houses and other buildings – heck, I grew up playing in some of the finest alleys in East Vancouver.  It will be interesting to see if there is a change in the use of these generally avoided/ignored city spaces, especially in dense urban areas.


9
Mar 09

Papervision

PV3D

Working the ParticleField class in PV3D with some mouse-influenced movement.


9
Feb 09

Remote Torrent

Let’s say you have a file server that serves media on your local network, and perhaps downloads torrents day and night.  And let’s say that you get the sudden inspiration while you’re sitting at school or in the coffee shop to download Terminator 2 or The Breakfast Club, something totally legal.  You’re not going to start that bad boy on your laptop and risk the school’s computer services department locking you out.  Besides, if  you have a 22″ HDMI monitor, you might be keen on a 720p file that might take close to 20 hours to download.

So what do you do? (Mac users only):

1. Setup Transmission to watch a folder for new torrent files. (Preferences > Transfers)

2. Setup an email account dedicated to receiving torrent files.

3. Setup Apple Mail to receive mail on that account.

4. Setup a Rule to handle attachments

5. Save and use this applescript to make the magic happen (substitute your watch folder in transmission where noted):

using terms from application "Mail"
on perform mail action with messages theMessages for rule theRule
tell application "Mail"
repeat with oneMessage in theMessages
set {mail attachment:theAttachments} to oneMessage
repeat with oneAttachment in mail attachments of oneMessage
save oneAttachment in ("Your:Volume:") & (name of oneAttachment)
end repeat
end repeat
end tell
end perform mail action with messages
end using terms from

Make sure to check those quotes.  Sometimes WordPress likes to change them and it’ll screw your applescript up.

6. Download a torrent file on ANY computer, and email it as an attachment to the email address you setup in step 2.

7. Don’t download anything you’re not supposed to, and enjoy!


23
Sep 08

Google weather api

There are a ton of ways to get your current and forecasted weather on the web. Yahoo, Accuweather, The Weather Network and even Google. It’s kind of annoying how none of these are accurate, but then again, predicting weather has never been easy. Correct or not, there is a Google weather api that you can use to get XML formatted weather. Hopefully I’m not the only one that finds this exciting. You can retrieve the current weather with temperatures in Celsius and Farenheit, plus the four day forecast. Great for Flash applications, iPhone apps, and Arduino driven weather-at-a-glance devices (stay tuned for that one). Wheeeee!

Vancouver’s Weather:

http://www.google.com/ig/api?weather=Vancouver,BC

(Make sure you “view source” to see the XML)


23
Sep 08

iPhone webpage know-how

Here’s some more information vital to making sure you maximize your viewers’ experience when developing for the mobile web, specifically for the iPhone:

Default viewable size (when the iPhone is vertical):

320 pixels wide x 356 pixels tall from the top of the bottom toolbar to the bottom of the address bar.

Optimal vertical screen (with address bar hidden):

320 pixels wide x 412 pixels tall from the top of the bottom toolbar to the very top of the screen.

The way to get the optimum 320 x 412 pixels is to have your page auto-scroll up far enough to hide the address bar. This is achieved with a bit of javascript in your body tag:

<body onload=”setTimeout(function() { window.scrollTo(0, 1) }, 100);”></body>

Scrolling up the address bar can introduce some issues with usability however, as you are hiding the address bar field and the stop/refresh button, so be aware of this.

That’s all for now. I’m accumulating iPhone information as I move along with this project that may or may not get referenced here. Stay tuned.


21
Sep 08

iPhone redirect

Here’s a javascript snippet to get your site to redirect visitors using the iPhone browser:

var agent=navigator.userAgent.toLowerCase();
var is_iphone = (agent.indexOf(‘iphone’)!=-1);
if(is_iphone) { window.location =”http://jaymatter.mobi” }