All posts tagged xbee

Azimuth Video Installation

Azimuth is a video capture and playback installation with simple wireless controllers. It’s based on the Déjà View Master, modified for the art show “Being and Time.”

The basic layout is a webcam feeding into a Mac Mini running a Max/Jitter patch, controlled by three wireless Arduino-based devices, and displayed on two monitors: a Zenith television on a table, and a projector mounted under the table, projecting onto the floor.


The screen normally displays a frozen image of the empty room. As you turn the clock-like controller, you scrub back and forward through a constantly-recording half-hour video buffer. The frames flash on screen as long as you’re moving the hand, but it fades back to the frozen frame when movement stops.

To add an element of unpredictability, it sometimes scrubs through a pre-recorded video of walking to the venue, or operates normally but with the image sliding off the TV and onto the floor via the projector.

Jitter works by using a matrix of pixel information to manipulate video. In Azimuth, the video buffer is accomplished by recording sequentially-numbered Jitter binary files (each matrix file is one video frame) to a hard drive, and separately reading the matrix files back and displaying them. Once the maximum number of frames has been written, the counter resets and writes over the first frames, letting you record in a loop.

Here are the basic components of this operation, set to record one minute at 15 fps (900 frames), and read back and display other frames, chosen by the number box on the right.


Grab this Max patch here


There is more math involved in keeping track of the current frame and rolling back through zero.

The projection on the floor is black, but image appears where the camera picks up movement. The patch subtracts the 8-bit value of each pixel of the previous frame from the current frame: where the pixels are the same, the value will be zero. Where the value is different, it will light up. It’s like velociraptor vision.


The button controller swaps the output monitors, putting the frame differencing on the TV screen and the freeze frame on the floor via the projector. The frame differencing is quite popular: the kids love dancing in front of it. But it has a practical function too. Part of the Max patch adds up the value of all the cells in the frame to determine whether anyone is in the room. The more movement, the higher the total value. If the number stays below a set threshold for more than a few minutes, it will assume that the room is empty and update the freeze-frame.

The other control box has a knob, which switches between five channels. Some channels read back from other matrix “banks,” where the five-digit matrix file begins with a different number. The main video loop is 10000-17200 (add 10000 to the counter value, max of 7200 for 30 minutes at 15 fps), a busy time saved from the show’s opening is 20000-27200 (add 20000), a pre-recorded movie of riding the subway and walking to the venue is 50000-53400, and so on. Another channel adds vertical roll to the live video feed, like an old TV. All adjust the brightness and color in some way.

Any controller will take over whatever’s happening in screen, and the result of pressing the button or knob will time out and revert to the empty frame if left alone.


The boxes are all handmade oak frames with laser-cut semi-transparent acrylic front and back, echoing the Zenith television.

The big box has a rotary encoder with a clock hand attached, so it can spin continuously in either direction. The encoder is connected to a Teensy 3.0 microcontroller which runs Arduino code. It sends one command repeatedly if turned clockwise, and another command if turned counterclockwise, via a serial connection with an XBee wifi radio and adapter.

It’s powered by a 2,500mAh lipo battery (the Teensy and XBee operate at 3.3v), and uses Sparkfun’s Wake on Shake as a power switch. This device is brilliant. It has a gyroscope, and turns on if there’s any movement. It then stays on as long as there is power going to the wake pin — this comes from one of the Teensy pins, which is programmed to stay on for 15 minutes after the last time the controller’s been used.

I used a breadboard with power rails removed to hold the Teensy and XBee, since it provides a flush, solid connection. Double-sided tape, industrial strength Velcro, and hot glue keep everything in place. The back panel is held on with machine screws.


The smaller boxes are similar, but use an Adafruit Trinket for the logic. One has a 10k linear potentiometer, and the other uses an arcade button. Each has a panel-mount power switch on the bottom of the box.


The receiver uses a Teensy 3.1, which relays incoming serial messages from the XBee to the Mac Mini over USB. I’d normally send a serial connection directly into Max, but since this installation needs to run reliably without supervision, I set the Teensy to appear as a standard keyboard. Messages from the controllers are sent as keystrokes, and the Max patch responds accordingly. This also made programming easier, since I could emulate controller action with keystrokes.

The receiver is housed in a spare Raspberry Pi case with a hole cut in the top for the XBee. I also added a kill button to stop the patch from running and quit Max by sending another keystroke. The Mac Mini is set to launch the Azimuth patch on startup, so between that and the kill button, no keyboard or mouse is needed from day to day.

Arduino code for the controllers and receiver is here.


The Mac Mini connects to the Zenith TV via a series of adapters: mini display port to VGA, VGA to RCA, and RCA to RF (on channel 3). The projector is configured as the second monitor, with a direct HDMI connection. I don’t recommend working on a complex Max patch on a 640 x 480 screen.

All in all, the installation runs well. Video is stored on a solid state laptop hard drive in a USB 3 enclosure, and most of the video processing happens on the GPU using the Gen object ( in Jitter. Some people were tentative when using the controllers, but others dove in and had a good time.

Deja View Master

The Déjà View Master is an interactive video installation for situations where people and their attention wander over the course of an evening. The audience uses a clock-like wooden controller to rewind surveillance video back from a live feed to some-time-before.


There are two parts: a surveillance camera and TV monitor, recording video on a Mac running a Max/Jitter patch, and a wireless wooden controller sending position data to the computer, to move the playhead.


Recording and Playing

The Max/Jitter patch takes video from a USB webcam and writes the camera feed to a hard drive as matrix files (.jxf), one per frame, while simultaneously reading them back for display on an external monitor (via a cheap VGA to RCA adapter). The files are numbered serially, overwriting the earlier files once a limit (time or drive space) is reached.

This is basically just doing what a DVR does, although it took a bit of figuring to get it running on an updating loop in Max.

The current frame (“now”) is set by a counter which resets at the maximum frame count. When the controller is set to display “now,” the live feed is actually reading the “now”-1 frame. As you dial the controller backward, it subtracts an appropriate number of frames from the current record frame, rolling backward through zero, until the earliest point of the recording is reached at “now”+1.

I added a video effect which becomes more visible the farther back in time you go — initially it was a feedback loop which caused motion blur, but I finally went with more visible and less processor-intensive black-and-white, with increased brightness and contrast. I’d still like to add a blur or luma increase during scrubbing, independent of distance from present, but that’s for a future version.

The matrix files recorded to a solid state USB 3 hard drive. I also added a rotate 180 degrees function (jit.rota) for when the incoming webcam is clamped upside down to the ceiling.



The controller is the fun part. It’s a wooden box resembling a clock, with a wooden hand which controls the playback.

The design was inspired by the Pimoroni Timber Raspberry Pi enclosure, using stacks of laser cut wood. I used 1/8″ ply, which ended up taking close to an hour of laser time. It turned out well, but I might go for a different approach next time.

The face and back are 1/32″ veneer finished with Briwax, which allow two hidden LEDs to shine through (“now” and “before” indicators).

The clock hand is attached to a linear 10k potentiometer, which is wired to a Teensy 3.0 development board running standard Arduino code (take a look at the code here), powered by an 850 Ah lipo battery (it’s a 3.3V system). The Teensy sends serial data to the Max patch via a pair of XBee radios; the receiver XBee is attached to the recording computer with an FTDI cable and XBee adapter kit. The whole thing is mounted on an Adafruit perma-proto board.


George Del Barrio invited me to premiere the Déjà View Master at Vanderbilt Republic’s 2013 Art From The Heart photography show and event, curated by Renwick Heronimo. I had it set on a 70-minute loop, with the camera clamped to the ceiling, and monitor behind a transparent corrugated wall.

I may experiment with other controllers in future versions. The original idea was to use the position of a beer on a bar as the playhead, but I could see that ending with spillage. The wooden controller is pretty intuitive, as long as it’s obviously associated with the monitor. Another alternative to the current design is to use a radial encoder, so the hand can keep spinning as you wind through time.

Also check out the Photographic Monument that I programmed with Mark Kleback for the show.

[UPDATE 3/23/14: The Déjà View Master has evolved into Azimuth for the “Being and Time” art show.]