Arduino


7
Nov 10

The Followers

The Followers by Makiko Yoshii and Jay Pozo from Granville Island Works on Vimeo.


I worked on this project with Makiko Yoshi during the Cultural Olympiad at Emily Carr University, held during the Vancouver 2010 Winter Olympics. Makiko’s beautifully built case contained a pair of Arduino driven motor controllers and a pair of 12V motors. The Arduino monitored the robot’s direction in relation to the metal train tracks in the ground in front of Emily Carr University, adjusting to turn slowly, giving the impression of a meandering, searching being wandering down the road.


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);
}


21
Dec 09

The Importance of Prototyping

I’ve been working with an art student at Emily Carr University to design and build one piece of a bigger art project, Code.lab. Makiko’s project is to build a “robot” that follows the metal railroad tracks that run around Granville Island and in front of ECU. We first looked at line following robots to inform some of our decisions around the form for the sensors, the motor and wheel arrangement, and the general shape of the final artifact. Makiko’s desire to shape the aesthetic to her artistic vision is definitely helping with material and part choice, but the various versions of prototypes that we built together helped to create objects that we could discuss and use as a platform for ideation.

Mindstorms Line Follower

The first real prototype, past sketches, was a Lego Mindstorms line follower. We were able to observe how an optic line follower worked, with a single sensor on the front of the robot detecting the black color of the line against a white surface.

The next version was an arduino based line follower that we thought we would use Hall-Effect sensors to detect the metal rail tracks with. We took a small prototyping step here to test the Hall-Effect sensors which we discovered were overkill for what we wanted to do. In the end we chose to use rare earth magnets mounted on the arms of contact switches to detect the metal tracks.

Prototypes informed our choice of wheel clearance relative to the robot chassis, helped us determine that the sensors should be mounted on the front of the robot. Testing versions of code helped me come up with the final code that drives the servos to follow the metal tracks.

Every prototyping step helped us refine an abstract thought to a more certain form, a form that functions in a way that is close to what we had originally envisioned. Versions of the parts of this project let us look closely at our problem space and also exposed problems that we had no idea existed. We were able to physically discuss and evaluate our design decisions, considering Makiko’s artistic vision and the pragmatic need to make this robot move and follow the tracks. We are now at a prototype version which is very close to the final form – new parts in the coming weeks will bring us to the final scale. It will be interesting to see what the final form looks like come February when the final exhibit opens to the public. Stay tuned for more of our progress.


8
Apr 08

Low Budget Rockband

So I hooked up four piezo sensors to my Arduino board and got some help from Tod E. Kurt’s tutorial on handling piezo data.

Arduino Drumkit

The Arduino board sends data over a local serial port, which is in turn received from a script written in Processing. The Processing script plays one of four wav files, depending on which piezo sensor was hit. I added four cork potholders and the result: a fun way to kill some time on campus while waiting for my next class.


6
Apr 08

Arduino and Wii Nunchuk

With some help from Tod E. Kurt, I got a Wii nunchuk to talk to my Arduino board. Here’s a diagram of the nunchuk pins and how to connect them to the Arduino.

Wii nunchuk pinouts

The next trick will be to get the data into Flash to do something interesting, like move around in a 3D environment.

Papervision 3D anyone?


1
Mar 08

Arduino

I’ve been spending lots of time with the Arduino board lately. Arduino is a prototyping tool that lets you send data from sensors, switches and other physical interfaces, to your computer. The IDE is based on Processing. I’ll post some projects as they come along.