NatureOfCodeWeek2

Week 2

This week we looked at Vectors and Forces. I also added a simple example of OpenGL texture mapping.

Accelerated Mover

Mover Swarm

What may not be obvious at the end of the Mover Swarm video is that I’m dragging the mouse to affect the acceleration, which results in the slower plumes.

3D Mover Swarm

February 13, 2013 Nature of Code

NatureOfCodeWeek1

This semester I’m taking Nature of Code, which is a class taught by Dan Shiffman that explores the “evolutionary properties in nature and software.” You don’t have to be a student at NYU to follow along, because Dan is taking a unique approach to this class by recording all of the lessons as videos and posting them online. You can watch the videos as the semester progresses at the course website.

The structure of the course is pretty open-ended, so I’ve decided to do my coursework in iOS using OpenGL ES 2. This gives me an opportunity to learn more about shaders and also port some of Dan’s examples into a new language. All of my code will be published on github in my Nature of Code repository.

 

 

Week 1

Much of this week was spent creating a “universal” (iPhone and iPad) app that will accommodate the sketches for the rest of the semester. It still needs some polish, but it’s a good place to start. The initial sketches address our first topic: randomness. Here are a couple videos that show them in action:

Random Walker

Perlin Walker

February 6, 2013 Nature of Code

I updated the light painting app mentioned in the previous post so it uses my phone’s movement to scrub over an image of Mona Lisa. These are 15 second exposures.


December 27, 2012 Leisure

Today I wrote a quick app for my phone that changes the screen color when it detects a sudden change in motion. Here are a few long-exposure photos I took of me waving it around in a dark room.

December 26, 2012 Leisure

Black Hats / White Walls is a proposed gallery space for my “Cabinets of Wonder” final. Today my class will be presenting our case-statements to people in the NYC museum world. I’ve included my slides below.

UPDATE: Thanks for all of the great feedback from our visitors, ITP staff and students!

December 13, 2012 Cabinets of Wonder

magpi_nerdy

This is a follow-up to a previous post describing Magpi Radio. Read that first if you’re curious about the project. In this post I’ll describe the technical details of Magpi Radio (with a link to the code) and show some process.

Hardware

As you can see in the system diagram the brains of Magpi Radio is a Raspberry Pi computer. These are small, cheap linux computers that pack a lot of horse power, making them perfect for internet-of-thingsy projects like this. Here are some of the benefits of the Pi when picking your hardware:

Speed: The Pi runs at 700 mhz with 512 MB of RAM. I never experienced any latency when making this project.

Audio: Playing audio files is a breeze through the audio jack and supports pretty much any format you throw at it.

Programming: You’re not limited to a specific library or language. I wrote the Magpi software in Ruby to leverage the excellent Twitter gems (twitter and tweetstream).

You’ll also notice an Arduino in the diagram, which handled the physical interface (the knobs and light). The reason I used the Arduino in addition to the Pi is because the Pi doesn’t have great support for analog io. I was able to read the volume potentiometer with an ADC chip through the GPIO pins, but because there’s only 1 PWM pin I wasn’t able to control the RBG LED. (If you’re interested in using the Pi’s GPIO pins for sensor io, I’d recommend the WiringPi lib).

So the Arduino was connected to the Raspberry Pi with a USB cable to provide serial communication and power. This ended up being quite a challenge, but I eventually stumbled onto this post that solves the problem of communicating with the Arduino over USB.

A simpler version of this project could be run without the Arduino and I’d be interested to hear if anyone tries it.

Software

There are 3 main software components for Magpi Radio:

Arduino Program: This code reads the knobs and controls the LED RGB. It’s also responsible for the serial communication with the Raspberry Pi.

Ruby Script: This is the main program running on the Raspberry Pi. It’s 3 primary responsibilities are taking serial data from the Arduino, communicating with Twitter and Audio playback. Since all of these tasks are fairly needy, they’re run on different threads so they don’t block each other.

Say Server: This is an optional Ruby script run as a cgi-executable on my OS X web server. It converts a string of text into an audio file that the radio then plays. This can be handled a few different ways, but I added this layer because the OS X text-to-speech program (“say”) was the highest quality solution I could find and it also gave me control over the voice. If you don’t want to run this program, it defaults to using tts-api.com (which is also using the OS X “say” program but doesn’t give you voice control), and falls back on eSpeak if the tts server isn’t available.

I’ve made all of the software for Magpi Radio available on github. Instructions for running it can be found in the README.

Process

Here are some photos of the construction of Magpi Radio.

The guts, splayed out on my desktop.

The bowl, pre-lobotomy.

The bowl, post-surgery. The speaker holes were created with a drill-press and the eye-sockets and beak were done with a Dremel.

Getting aquatinted.

Mounting the knobs took a bit of head scratching, but Tom suggested using Sugru, which ended up being the perfect solution.

This is pretty much what it looks like on the inside. I wrapped the Pi in a static-free bag because I was getting some short circuits when the components bumped into each other. You can see the top of the Sugru (white and black blobs) behind the wires.

The @magpiradio Twitter feed.

Finished product. It all fit inside!

The Internet of things.

 

December 9, 2012 Physical Computing

magpiradio_banner

After a semester at ITP, I’ve found that one of the most popular themes is synesthesia. Students like to use technology to translate colors into sound, words into images, light into motion, etc.. All of the projects I’ve worked on in Physical Computing do this on one level or another—the very act of converting data into electricity is a sort of synesthesia.

For my final project, I’ve reformatted Twitter as a radio. It’s called Magpi Radio:

Objectives

I had two objectives for my final project. First, I wanted to create a physical manifestation of a piece of software. I’ve been interested in this idea since the original iPod was released—it was the first time I considered an electronic device as a meatspace expression of software. iTunes and iPod were two interfaces to the same content. I chose Twitter as the software because there’s an endless amount of content and it’s a robust platform that makes two-way communication very easy.

Second, I wanted to think of this project through the lens of product design. How could I piggyback on the user’s understanding of existing interfaces to make it’s function obvious? I chose the radio metaphor for this reason. One knob is power/volume, and the other knob is the channel. More complex use-cases (like content organization and settings) can be handled through Twitter, which allows the behavior to be extensible.

Behavior

A quick overview of what it does; Magpi Radio uses text-to-speech to read tweets coming in from various channels. Volume and power are controlled by the knob on the left. Channels can be selected by turning the knob on the right. As you click through channels, the beak changes color so you have a “glanceable” indication of it’s state. Pressing the knob on the right will favorite the last tweet, indicated by a red pulsing beak.

There are two kinds of channels; lists and streams. Lists use the REST API to read tweets from lists that have been created on the @magpiradio account. For example, “News,” “Humor,” and “Weird.”  Streams read tweets in real-time that are filtered by criteria. The “Nearby” channel reads tweets that have been geo-tagged in your immediate vicinity, like a social police-scanner. The “@magpiradio”  channel reads tweets sent to the radio, and the “Requests” channel pivots based on search terms that you send the radio.

The Hardware

Magpi Radio is enclosed in a Crate & Barrel bowl that’s received some love from the wood shop. The beak is made from a diffuse silicon sheet that I found attached to an ice-cube tray. This diagram describes the electronics that do the heavy lifting:

 

I’ve added details about the process and code in another post.

December 9, 2012 Physical Computing

I’ve posted the slides from by presentation in Waving at The Machines titled “The Odd Economy of The Machines.”

The talk is an attempt to highlight the complexity that’s inherent in our interactions with the Machines. Recognizing the layers of indirection that reveal themselves in these interactions often adds a strange value.

Here are the titles and any relevant links for the slides in the PDF:

• Cloaca
http://gizmodo.com/5145287/cloaca-no5-is-a-monster-pooping-machine

• Minecraft as a canvas
http://ludolik.deviantart.com/

• Mapvertisements
http://lenpenzo.com/blog/id15798-giant-advertisements-that-can-be-seen-from-high-in-the-sky.html

• LOL CODE
http://lolcode.com/

• “Why by realistic?”
http://blog.mutewatch.com/2011/07/07/why-be-realistic/

• Pencil balancing robot
http://blog.makezine.com/2011/01/20/pencil-balancing-robot/

• Cat organ
http://en.wikipedia.org/wiki/Cat_organ

• David Byrne – Playing the Building
http://www.youtube.com/watch?v=0pFvOphr9MA

• Supernova Sonata
http://vimeo.com/23927216

• Linux.fm
http://www.linux.fm/

• Singletone hashtags

• Nano guitar
http://www.news.cornell.edu/releases/july97/guitar.ltb.html

• Nano smiley face
http://nanotechweb.org/cws/article/tech/24445

• Rat brains robot
http://www.youtube.com/watch?v=1QPiF4-iu6g

• Instagram ride

• Skype family portraits
http://www.nytimes.com/interactive/2012/06/03/magazine/skype-portraits.html

• Screenshots

• Twitter weather report
http://twitter.com/drnic/status/261547325284028416

• Front-facing camera mirror

• JSNES
http://fir.sh/projects/jsnes/

• Music with machines
http://www.makeuseof.com/tag/making-music-tech-hardware-8-great-youtube-videos/

• Raspberry Pi supercomputer
http://www.engadget.com/2012/09/13/supercomputer-built-from-raspberry-pi-and-lego/

• The Johnny Cash Project
http://www.thejohnnycashproject.com/

• Speaking Piano
http://createdigitalmusic.com/2009/10/the-speaking-piano-and-transforming-audio-to-midi/

• Paintings for satellites
http://www.kickstarter.com/projects/1145342167/paintings-for-satellites

• MS Paintings
http://www.labnol.org/software/ms-paint-tips/9305/

• CSS iPhone
http://codepen.io/dylnhdsn/pen/iphone

• ASCII Star Wars
http://www.asciimation.co.nz/

December 8, 2012 Waving At The Machines

station_map_banner

Ever been asked which subway stop you live by? This map redraws New York City neighborhoods according to the closest station. Let the naming begin.

 

 

To design this map I created a JavaScript tool that divides a space into regions that each contain a single point. Make your own neighborhoods. (Tested in Chrome)

November 15, 2012 Waving At The Machines

lasercat_laptop

For our Physical Computing midterm, Max Ma, Harry How and I set out to create a remote controlled car that follows a laser beam. Why? Because Max needed a companion to replace his cat that’s living in China.

The Setup

We’ve got a webcam hanging above the room that’s wired to a laptop running a Cinder app. The app uses OpenCV to track the position of the car in relation to the laser beam and sends steering instructions to the car wirelessly via XBee chips.

We originally tried using IR to transmit the instructions to the car but we found it much slower and less reliable. Switching to the XBees introduced a couple of additional challenges (e.g. debugging without the serial output) but ultimately it was the right tool for the job.

Here are a few videos of the steps we took to construct the end-product:

Color Tracking

This video shows the initial state of the app that’s just doing color tracking. The sliders on the left let us configure the exact color ranges that we’re interested in. We also ended up using an excellent little utility called uvc-ctrl that allows us to control the exposure, focus and white balance of our video feed.

Vehicle Simulation

We then added a simulated car to the app for play testing and to accommodate the car model in the software design.

Steering Tests

We made a quick-and-dirty app to test sending steering directions to the car. Steering is accomplished not pivoting the wheels, but by rotating the wheels in opposition to each other. This gives us a very tight turning radius which is easier to model in the software.

Successful Loop

Finally we tied it all together and Laser Cat was born. The vehicle is moving a little slowly in this video because the batteries are getting low. We were all a little tired at this point.

 

All of the code required to run Laser Cat is available on github: https://github.com/wdlindmeier/lasercat

November 8, 2012 Physical Computing