All posts tagged Raspberry Pi

New Yorker Sidewalk Projection

Andrew Baker and I created the visuals for the poetry segment of The New Yorker Presents pilot, by projecting archival video onto a sidewalk, stoop, and fence.

stoopshoot

The segment is an excerpt from Matthew Dickman’s poem “King”, which begins:

… So I put on my black-white
checkered Vans, the exact pair of shoes
my older brother wore when he was still a citizen in the world,
and I go out, I go out into the street
with my map of the dead and look for him…

The poem is recited by Andrew Garfield in a studio setting, intercut with home movie footage of a different young man and older brother who had passed away. Director Dave Snyder wanted to give the video a stylized treatment, so I suggested going out into the street, literally, as described in the text.

Here’s my projector rig booting up on the sidewalk:

And here’s a quick clip of the final product from the show’s trailer:

We shot the video with a 5DMkIII on a slider, with Zeiss and Canon lenses.

I also edited the final segment. The entire episode is streaming in the 2015 batch of Amazon Original Series pilots, which you can watch here. Watch the entire trailer and read more about The New Yorker Presents on the Jigsaw Productions website.

Self-Contained Projector Rig

piprojector

I was recently asked to provide a video projection for the Proteus Gowanus ball, and assembled my most compact, self-contained projector rig to date. It involves Velcroing a Raspberry Pi computer to my homemade projector mount, which can be clamped anywhere with standard film grip gear. When plugged in, 1080p video plays in a loop. The projector is small but bright, a 3,000 lumen Optoma TW-1692.

Getting the video to start and loop automatically was fairly simple, but required several stops on the internet:

I used this script to loop video files in a folder. I put mine in one called /media.

I added -r four lines from the end, as suggested in one of the comments. The video was getting squished toward the bottom of my projector, and this fixed that.

omxplayer -r $entry > /dev/null

Then I made the script (named videoplayer.sh) executable with the command:
sudo chmod +x /home/pi/videoplayer.sh

To run the video loop, if you’re in the same directory, type
nano ./videoloop

That worked, but I had to reboot the Raspberry Pi to get it to stop. !IMPORTANT! Before making it start automatically, make sure that you can edit rc.local from another computer via SSH while the script is running. Adafruit has a good overview of this here. That way, you can remove the following autostart line from rc.local when you want your Pi back.

To run the script on boot:
sudo nano /etc/rc.local
Before the final “exit 0” line, insert this line:

/home/pi/videoplayer &

Change the path accordingly. I left the script in the home directory, although I may move it at some point.

I loaded the video onto the device, strapped everything together — projector, mount, Raspberry Pi (in a Pibow Timber case), multiplug, USB power adapter, HDMI cable, safety cable, extension cord — plugged it in, and it ran. Just like that.

Asteroids Controller with Raspberry Pi

The 1979 arcade version of Atari Asteroids is a beautiful thing.

A white triangle battles lethal polygons on the glowing phosphors of a vector display. The two-note pulse of the music is syncopated by the “pew pew pew” of your effort to stay alive. The controls are as minimal as the graphics, and yet the game itself is complex, never the same twice.

I am a fan.

Years ago, I wired up parts from a scrapped Asteroids machine to control a computer via USB. It’s a beast. So when I had access to the resources at NYU’s ITP Camp, I decided to learn some new tools and make a refined desktop version. This one is designed for a tiny Raspberry Pi computer running an arcade machine emulator (MAME), so all you need to provide is power in and audio/video out.

Asteroids Pi

I’ve included links to design files throughout this page — be sure to open the PDFs in a program that can handle layers. Or, here’s a zipped folder with all the files in one place:

DesktopAsteroidsPlans.zip

The Design

First up, I made vector artwork of the Atari Asteroids control panel by tracing a photo in Illustrator. (I’d actually done this a few years ago for a different project).

measuring

Asteroids Control Art

asteroids_controls.pdf (editable PDF)
asteroids_controls_cs3.ai (Illustrator file)

I decided how small the face could be and still have a comfortable layout, and how tall the controller needed to be to house all the components. From there I sketched up the basic design, and started fabrication with the frame.

The Frame

The acrylic faceplate wraps around 3/4″ plywood end caps, which are connected with two 1.5″ x .5″ plywood rails.

The end pieces have 3/8″ grooves for the acrylic and rails. The CNC machine (robot miller) carved these first, before making a deeper pass to cut the outer shape.

CNC_asteroids_sides.pdf

CNC1
CNC2
CNC3

That done, it needed some good old cabinet art. I made a black and white vector image from the original arcade marquee, and etched that with the laser cutter in raster mode.

asteroidsmarquee_BW_vectors.svg
LASER_asteroids_sideart.pdf

Image link: marquee art
Image link: screen bezel art

marquee
sides etched

Finally, I carved out the rails with a table-mounted router. Nothing computer-driven here, but I did make a diagram. The slots are for removable acrylic shelves.

SHOP_asteroids_rails

The Faceplate

I used 1/4″ clear acrylic for the faceplate to show off the components. The control panel file has layers for raster etching (the artwork) and vector cutting (edges and button holes) with a laser cutter. The plans are flopped so the art is etched on the inside.

There are also 3 shelves that slide into the grooves in the wood. The smaller ones have mounting holes for a breakout board and terminal.

LASER_asteroids_faceplate.pdf
LASER_asteroids_shelves.pdf

LASER_asteroids_faceplate

cut acrylic

ITP has a large strip heater for bending acrylic. I heated up the laser-cut piece along one seam, holding it just above the heater. I flipped it over every minute or so to heat it evenly and prevent warping or blistering.

bending acrylic

Eventually it was soft enough to flex slowly. I put the shorter edge on the table, and holding the sheet evenly, pressed it forward. Holding a piece of wood along the seam helped start the crease straight. I had to re-heat the fold throughout the process, using the heater on the outside and a heat gun along the inside.

I matched the folds to the curve of the plywood end pieces. There was eyeballing involved. It’s not perfect but it’s secure, shiny, and strong.

bent acrylic
assembled1

Assembly and Wiring

I finished the wood with Briwax and glued it all together. The faceplate’s curved shape is enough to hold it in place, but it’s still easy to remove by lifting up on the front edge.

I wired up the buttons with quick disconnects and it looked like this:

final
21_final

The buttons are from an original Asteroids arcade machine, so they’re the old leaf switch type. You can’t get much simpler: a spring-loaded plunger presses two pieces of metal together. This was standard in arcade games until the mid-1980s, when they were replaced with micro-switches. The leaf switch is easier for rapid-fire and finesse. The micro-switch is more compact and goes “click.”

24_final

I scrounged my old buttons at Vintage Arcade Superstore in Glendale, California. The leaf switch buttons were meant for a thin metal plate, and just barely fit around the 1/4″ acrylic. A major supplier of new parts is Suzo-Happ.

I also got two original cone-shaped Atari start buttons. They’re supposed to blink when you insert a coin, but the old parts box I went through didn’t have any with working lights.

A micro-switch inside a hole on the front signals that a coin’s been inserted.

25_final

I wired the buttons to a small Perma-Proto Raspberry Pi Breadboard from Adafruit (details below), which was mounted to the acrylic shelf with 1/4″ standoffs. I also ran wires to a terminal on the other end, in case I ever want to attach the buttons to something other than a Raspberry Pi.

19_final
20_final

When it’s all put together, the Raspberry Pi computer sits on the large center shelf, with access for video, audio, and power cables running out the back.

26_final

Raspberry Pi

The Raspberry Pi is a tiny, inexpensive ($30 or $40, depending on the model), project-friendly Linux computer that came out in early 2013.

Adafruit has an excellent tutorial on setting up a Raspberry Pi to play classic arcade games, written by Phillip Burgess. It leads you through setting up a RasPi from scratch, installing a MAME (Multi Arcade Machine Emulator), and getting arcade buttons to work.

I modified the button wiring plan to suit the Asteroids controls. The buttons are wired to the RasPi like this:

Raspberry Pi pin, Asteroids function
#17, Hyper-Space
MOSI (GPIO 10), Thrust
MISO (GPIO 9), Right
#23, Fire
#24, insert coin
#25 (GPIO 25), Left
#4 (GPIO 4), Two Players
CE1 (GPIO 7), One Player
GND, ground rail

And I changed the appropriate lines of the “retrogame” utility code to this:

struct {
        int pin;
        int key;
} io[] = {
//        Input    Output (from /usr/include/linux/input.h)

        {  17,      KEY_SPACE     },
        {  10,      KEY_LEFTALT     },
        {  9,      KEY_RIGHT     },
        {  23,      KEY_LEFTCTRL     },
        {  24,      KEY_5     },
        {  25,      KEY_LEFT     },
        {  4,      KEY_2     },
        {  7,      KEY_1     }
};

Instructions for doing this are in the tutorial.

At some point I might add two more internal switches to trigger KEY_ESC and KEY_ENTER, to quit and shutdown (using an alias/shortcut) with just the controller.

I had a bit of trouble getting the MAME ROM (game file) to work. In the end, I had to unzip the Asteroids Rev. 2 folder, change the file extensions so the names matched the missing file names that the MAME asked for, re-compress the folder, and put that zipped file into the roms folder on the RasPi. The MAME complains that two of the files are funky, but it seems to run fine.

Finally, once everything was working, I set the RasPi to boot directly into Mame4All when it’s turned on. Instructions are here. Since everything is stored on a cheap SD card, I have one dedicated to Asteroids.

Hello World, Goodbye Asteroid

It works!

I mainly built this to learn some new tools. Maybe next I’ll learn Python and write a new game for five buttons, or maybe I’ll use it to run live visuals.

As for now, it’s time to break out a projector and throw a rooftop Asteroids party.

For more Asteroids love, check out AtariAsteroids.net. (I run the site. Like I said, I’m a fan).