Technology

Serial Communication Between Max/MSP and Arduino Using the ‘Serial’ Object

July 13th, 2010

I needed a script to send multiple values from Max/MSP to an Arduino to control a few components. After researching for a viable solution for my application, I had discovered that it is really easy to interface Max/MSP with an Arduino microcontroller by simply using the ‘serial‘ object built-in into Max/MSP’s objects library.

Screenshot of Arduino to Max/MSP patch

Screenshot of Arduino to Max/MSP patch

arduino-to-max.maxpat (Save Link As…)

I put together a clean serial Max patch which simply uses the ‘serial‘ and ‘unpack‘ objects to get analog and/or digital values coming from Arduino into Max/MSP. This solutions makes it really easy to get serial values from your Arduino into Max/MSP by splitting up the different readings and outputting them into number-boxes.

To make the Max/MSP and Arduino serial patch work, you will also need to copy and paste a really simple Arduino syntax into a new Arduino sketch I put together below. You may alternatively download the Max/MSP and Arduino sketch.

int val1 = 0;
int val2 = 0;
int val3 = 0;

void setup()
{
  // start serial port at 9600 bps:
  Serial.begin(9600);
}

void loop()
{
  // read analog input, divide by 4 to make the range 0-255:
  val1 = analogRead(0);
  val2 = analogRead(1);
  val3 = digitalRead(2); 

  Serial.print(val1, DEC);
  Serial.print(" ");
  Serial.print(val2, DEC);
  Serial.print(" ");
  Serial.print(val3, DEC);
  Serial.print("\r");
  // pause for 10 milliseconds:
  delay(10);
}

Like any Arduino interface you build, you will need to identify the pin numbers you are using from your Arduino, and determine whether the inputs you are using are sending digital or analog values. The below example is setup to read an analog value from pin ’1′ and a digital value from pin ’2′.

 val2 = analogRead(1);
 val3 = digitalRead(2);

The Arduino sketch and Max/MSP patch I put together is setup to recognize three inputs, two analog input values on pins ’0′ and ’1′, and one digital input value on pin ’2′. There is no limit in how many values you can send to Max/MSP from Arduino, on the software side, so feel free to add additional pin recognition lines into the Arduino sketch if your interface requires additional inputs. If you are adding additional inputs, it is important to make sure that the Serial.print(“\r”); line always appears at the end of the loop function, directly before the delay function. This line of code simply let’s Arduino know that we are at the end of the loop.

Max/MSP Unpack Object

For every additional serial value you arrange to send to Max from Arduino, you will also need to add an additional ’0′ symbol into the unpack object’s input list inside the Max patch. When you input a new symbol into the ‘unpack’ object, a new outlet will appear beneath the object, which outputs your inputs serial value corresponding to the pin you identified it with in your Arduino sketch. Once you are done tweaking your Arduino sketch, don’t forget to upload it onto your Arduino board!

That’s it! I connected a toggle switch onto the ‘serial’ object. Press the switch to either turn serial communication on or off between Max/MSP and Arduino.

For instructions on getting started with using an Arduino and a breadboard, I recommend visiting ITP’s Physical Computing resource page, which has many descriptive and illustrative tutorials on getting set up with an Arduino.

The Funny Side of Technology

March 25th, 2010
Image courtesy of Bekathwia

Image courtesy of Bekathwia

I think it is safe to say that for most of us, our relationship with technology is a love-hate affair. Tech gadgets that start out as luxuries quickly become must-have necessities. I have become hooked on invention, ingenuity, and innovative products over the past few weeks while doing research for my thesis at ITP. The question I keep asking myself is whether these problem-solving products actually make the world a better place?

Read more »

10 Interactive Video Art Projects that Get Physical with Screens

February 8th, 2010

People have always loved watching screens. The video screen has surged where people love this window onto a whole new world of possibility and opportunity. We are increasingly feeling this attraction with screens. Over the past decade we have seen the emergence of more and more screens with serious multimedia capabilities. Today, we use screens for informing, communicating, entertaining, and connecting. The following are ten of my favorite interactive video art projects that I believe make strong emotional connections with people using screens.

1. Potent Objects
Potent Objects playfully examines the way we ascribe emotion to inanimate technologies. The work parallels current research in ‘affective computing,’ in which the capability of sensing and conveying emotion is built into computing devices. (Work by Camille Utterback)

Potent Objects by Camille Utterback

Read more »

Rusty Business Documentation

December 21st, 2009

Presented at the ITP Winter Show 2009 and NIME 2009, Rusty Business is a video sequencer that produces electronically controlled cartoon antics using large inflatable hammers.

[flickr album=72157623072000888 num=18 size=Square]

A database of slapstick comedy gags are executed when inflatable hammers hit push button switches. The interactions performed by the users handling of the hammer produces a unique visual and auditory experience onto the projected montage displays. Every hit from the inflatable hammer triggers a different, unexpected and shocking reaction from the character, conveying his struggles with work, sickness and modern day insanities.

Read more »

A Simple Cup

April 22nd, 2009

Visualizing the impact a simple cup can have on our environment

According to sustainabilityissexy.com, over 6.5 million trees are consumed each year to produce the 16 billion disposable coffee cups that are being thrown away out into landfills. For about every 50,000 paper coffee cups produced, a tree is destroyed.

DESCRIPTION
A Simple Cup visualizes the impact disposable coffee cups have on our environment by simulating a real-time growing forest on a web site every time a mug of coffee is placed onto a networked coffee cup coaster. The interactive visualization encourages coffee drinkers to drink out of their coffee mugs by rewarding them with saved trees and energy onto a virtual ecosystem (that may be accessed globally online) every time they don’t drink out of disposable paper cups when they have a cup of coffee. Hypothetically, if a significant amount of coffee drinkers had one of these networked mug coasters next to their desks, they would be able to each contribute and collectively grow this forest together, visualizing how much natural resources have been saved over time.

The objective of A Simple Cup is to raise awareness over the impact disposable coffee cup production has on our environment’s natural resources. The project does this by encouraging coffee drinkers to stop drinking coffee out of disposable cups and instead make a valuable contribution to our environment. On the web site’s visualization, one mug of coffee is equivalent to 50,000 paper cups, which claims the life of about one pine tree. In addition to visualizing trees, the butterflies in the forest each represent one home that could be potentially powered in a year.

Read more »

Data Visualizations from the Museum of Natural History

March 24th, 2009
RAP (Robot Action Painter) - creates original paintings using a combination of random decisions and responses to its environment

RAP (Robot Action Painter) - creates original paintings using a combination of random decisions and responses to its environment

Last week I visited the Museum of Natural History in New York City and was amazed with all the data visualizations they put together for their displays. Ever since my visit to the museum, I have become addicted to designing my own data visualizations for different types of data sets. Click here to view some of the visualizations I photographed during my journey through the Museum of Natural History.

Read more »

Puck Music: Electronic Hockey Puck

March 10th, 2009

Puck Music is a soundscape composed using hockey pucks and hockey sticks. Each hockey stick acts as a different musical instrument when they move the hockey pucks on the floor. I am presently working on this piece for my Dataflow Programming class at ITP.

The following are some images of the puck’s construction and the Pure Data syntax that I am using to program them:

Read more »

Reading and Writing to the VDIP1 USB Host Controller using Arduino

March 4th, 2009

The VDIP1 USB host controller is a worthwhile extension module for anyone working with the Arduino microcontroller. The ability to integrate USB inputs/outputs with your Arduino microcontroller means that you can interface it with practically any USB device, creating even more exciting possibilities with Arduino. Another valuable integration feature that the module can provide is the ability to increase Arduino’s memory capacity using any USB memory drive.

Read more »

HIV Test Package Design

February 10th, 2009

The Joy of Technology

December 23rd, 2008

The Joy of Technology is a playful video installation that uses both humor and drama to emphasize our intimate relationship with technology. The satirical character inside the cardboard television set responds to the user’s operation of technology. An electronic razor grows hairs on his face, a pencil sharpener rotates him and tears his shirt, a stapler pokes staples onto his forehead and leaves shatters all over the television glass, and a blow-dryer rotates the screen. All these actions affect the character’s overall appearance once all the technologies are shut off. In addition, the character can also be placed into different settings by turning the television’s rotating knob. Some of the programming that the character is placed into includes a news broadcast, a courtroom and outdoor settings.

Read more »