Introduction: Build a Big Piano

Many readers will remember a Tom Hanks movie from 1988 called "Big".

In the movie a young boy gets supernaturally transformed into a twenty-something man and finds out what it's like to be big.

Perhaps the most iconic scene of the movie has two of the characters dancing on a scaled up "Big Piano"- that's the scene everybody seems to remember.                                                                                                               

They turned the movie into a Broadway musical and later licensed the show to be performed in community theatre. My local community theatre (South Valley Civic Theatre in Morgan Hill, California) decided to do "Big the Musical" as a teen show, and the production staff approached us to build a Big Piano that could hold its own next to the movie version and give our show a "wow" moment.

Not many people need to build a Big Piano, and if you do it's likely you'll have specific goals and constraints different from the ones we faced. This instructable is less of a detailed plan and more of a set of notes explaining the problems we were trying to solve and the way we chose to solve them. I hope other Big Piano builders can learn from our experience.



Step 1: How Big Is the Big Piano?

The width of a piano is determined by human ergonomics and the pitch range of the music you need to play. In this case the piano has to be danced on and that means a white key big enough for a human foot to step on. That is: about 7" wide. The music the characters play on the piano has a 3 to 4 octave range. We went for four octaves. ie- 28 white keys, each 7" wide. We added 6" end caps to the piano So the overall length was (28 x 7) + 12 = 208".

The depth of the piano is more flexible. We wanted our piano to approximate the proportions of a real piano, and that's about a 7:1 depth to width ratio for white keys. To keep things simple we went for a overall depth  of 48".

The height is also flexible. We decided to light up the front of each key with a square of light. With some additional height details we ended up with an overall height of 12".

So all together the design target was 17 feet long, 4 feet deep and 1 foot high. That's big!

Step 2: Big Piano Design Choices

Once you've worked out how big the Big Piano should be, there are a few other design choices to be made:

Looks:  At a minimum the piano needs to look like a piano. For every octave there are 7 white keys and 5 black keys. The black keys are thinner than the white keys. We used 7" for the white keys and 4.5" for the black keys. If you look carefully you'll see that the black keys are not centered between the white keys (except for G#/Ab) )but are skewed to the sides. We skewed the black keys 1/3, 2/3 across the split between the white keys.

Lights: In the movie each individual piano keys lights up when played. Its a great look, and so far as we could tell it was done by making the keys from translucent acrylic. The acrylic has to be thick to support the actors dancing on it. Acrylic is expensive. a 1/2" x 4' x 8' sheet costs around $600. We wanted to build our Big Piano for less than $2000 - so having the entire key light up was not going to happen. Instead we opted for making just the front of the key light up. We still use translucent acrylic sheet to act as a light diffuser, but we use a  lot less of it- and because it's not structural we can use the thin stuff - 1/8".

Play-ability: Should the piano be playable? It doesn't have to be. You can imagine a piano in the orchestra pit playing the music while the actors dance the notes on the Big Piano. You can even rig up the lights on the piano to match the notes being played. So long as the actors know to put their foot on the right key at the right time, nobody will know they are not actually playing. We considered that option, and while it is definitely easier, we decided to make our piano actually playable. That is: when an actor steps on a key, the note gets played and the light turns on. It's a more authentic look, and it definitely adds to the cool factor of the end result.

Playable black keys: Do the black keys need to be playable? The music in the score doesn't demand it. It's all C-major. It would be cool to have all of the keys playable but it isn't necessary, it adds to the complexity, and we opted not to do it.


Step 3: Other Design Considerations

Along with the main design goals, other factors had to be considered:

* Budget: With 28 white keys, any money spent on a single key will be multiplied by 28. Add to that the non-key overhead of the piano and it's not hard to spend a lot of money.  Commercial versions of the big piano sell for around $20k and our total budget was < $2k - so you have to opt for an inexpensive design.

* Store-ability/Portability: Our theatre doesn't have much wing space and it doesn't have a below stage lift to bring set elements into position. The piano has to be portable enough to be taken on and off stage. We were also tight on back stage space. We made our piano fold-able so we could store it efficiently while it wasn't in a scene.

* Weight: We rely primarily on human muscle to move our set pieces. A 17 foot plywood piano is quite heavy- but we needed to keep it light to meet the portability requirement.

* Skills: For our Big Piano we used a number of skills.

Design- Work out a practical design that trades off  various conflicting goals.
Carpentry - Build the mechanics of the piano.
Electronics - Build a micro-controller and associated interface circuitry.
Software - Program the micro-controller to perform the task we want.

Even if you are lucky enough to have one or two people who can do it all, it's a big job, and it's best if the work can be structured so people with differing skill levels can make a contribution.

Step 4: Making the Keys Light Up

The plan was to have a 7"x7" acrylic square at the front of each piano key light up when the performer stood on the key. As an extra bonus, each note within the octave would have a unique color so the audience could easily see when notes an octave apart were being played.

The trend these days is to use LEDs in any new lighting application, and this is no exception. We wanted colored lights and we wanted them to be controllable via a micro-controller. A quick survey of the market led us to discover individually controllable RGB LED modules that can be daisy chained together.  The module we chose has 4 LEDs per module, and each LED is an RGB LED. That is: It's a red, green and blue LED in a single package. Each module has an LED driver chip that provides a simple digital interface for controlling the module. There are 4 inputs to each module:

* 12V power
* Data (5V TTL)
* Clock (5V TTL)
* Ground

Each module has the same outputs so it can be connected to the next module in the chain.

The way these modules work is interesting. At one end there are data and clock lines. The color of each module is specified using 24 bits of RGB data. After 24 bits are clocked into a module, it goes into pass-through mode, and any subsequent bits are transferred down the line to the next module. When the clock line goes inactive for some period of time each module reverts to the initial state where it will accept new data.  By clocking out Nx24 bits the color of N led modules can be controlled. 

To control the data and clock lines I used the SPI (serial peripheral interconnect) bus of the micro-controller. The atmega328p has SPI bus hardware support, so to maximize efficiency I used this rather than a bit-banged approach. 

For the Big Piano we decided to use 2 modules per key to get enough light output. That gave us 56 modules in total. The data was clocked at around 4MHz, so the entire LED chain took around 0.34ms to setup. An interrupt service routine is called every 17ms giving a refresh rate of around 60Hz.

The power consumed by the LED modules depends on the color displayed. The worst case is full white (255,255,255). Experimentally that consumes about 1.38 W/module. In this application we were dealing with around 8 modules on at any time, so I wasn't worried about maxing out current, but power consumption may be a limiting factor in some applications.

Resources:

Adafruit has a good tutorial on driving the RGB LED modules.
https://www.adafruit.com/products/683

If you want to pay less for the modules you can buy them directly from Chinese vendors:
Search for "WS2801 LED RGB"
http://www.aliexpress.com/

Big Piano Firmware. LED Driver.
https://github.com/deadsy/bigpiano/blob/master/src/led.cpp
https://github.com/deadsy/bigpiano/blob/master/src/led.h




Step 5: Which Keys Have Been Pressed?

There are 28 white keys on the piano we need to keep track of. A naive approach would wire each key to an individual input of the micro-controller. That would work if the micro-controller had enough IO pins, but typically they don't. The atmega328p certainly doesn't. It would also mean 29 wires (28 + 1 common) connected to the switches. That's more work and material than we would like, so can we do better?

People have faced this problem in the past, and a common solution is matrix scanning. The key insight is that we want to know the key states (up/down) but we don't need to know them at the same instant. By scanning the keys over time (albeit very quickly in human terms) we can reduce the amount of hardware we need.

In our case we arranged the keys in 4 rows (octaves) and 7 columns (white key notes). We scan the columns (notes) one at a time and see which of those notes are active within the octaves. After doing 7 scans (for each note) we will know the state for each of the 28 keys. We specify the note to scan using 3 outputs (8 possibilities - we only need 7 notes) and 4 inputs (4 octaves). We need 7 wires for the notes and 4 wires for the octaves. We can solve the problem using 7 IO pins and 11 wires. This is a big improvement.

There are a few details:

* Key Ghosting: Because of the matrix nature of the key wiring it is possible for multiple keys presses to be interpreted erroneously as the pressing of a key that isn't being pressed. By adding a diode to each switch we prevent current from flowing backwards in the matrix and stop this from happening.

* Column/Note Selection: We only need to select 1 note at a time (out of 7) and we are short on IO pins, so the best way to handle this is to use a 3:8 decoder. We used a 74LS138. That has an active low output, so the circuitry is perhaps less intuitive than having a +5V driven output.

* Input Circuitry: The inputs on the atmega328p can be configured to have internal pull up resistors. That's good. It saves us from having to wire them ourselves.

* Key De-Bouncing: Mechanical keys don't close or open cleanly. They bounce quickly between open and closed states over a relatively long (miiliseconds) period of time. We solved this problem by filtering the key events in software. Put simply we don't recognize a key up/down event until that state has persisted on the switch for some number of scans. We can tune that number up or down to make the key less or more "touchy".

Resources:

An interesting discussion of key scanning and key velocity sensing on commercial keyboards. 
http://www.openmusiclabs.com/learning/digital/input-matrix-scanning/keyboard/

Big Piano Firmware. Keyboard matrix Driver.
https://github.com/deadsy/bigpiano/blob/master/src/key.cpp
https://github.com/deadsy/bigpiano/blob/master/src/key.h

Step 6: How to Make Sound

This show is a musical so there is already an orchestra pit full of instruments - including a digital piano. The easiest way to make a Big Piano sound like a piano is to hook it up to a digital piano, and the easiest way to do that is with MIDI.

MIDI is a serial protocol invented in the early 1980s to allow a digital musical instrument to control other digital musical instrument(s). It's similar to an RS232 serial port except:

* It has a strange baud rate (31250 baud) .
* It uses a current loop instead of voltage signalling (to avoid hum-inducing ground loops).

Fortunately there is an Arduino shield that implements a MIDI hardware interface, add to that some serial port software and you have a working MIDI interface.

For our purposes we only need to generate two types of MIDI messages:

Note ON: Generated when a key is pressed. This tells the piano to start the note.
Note OFF: Generated when a key is released. This tells the piano to stop the note.

Each MIDI command consists of 3 bytes:

* The command (note on/off)
* The note velocity (how fast the note is pressed/released)
* The note (which particular key has been pressed/released)

The choice for note velocity raises questions. Some keyboards can detect how fast you press the key- and this changes the quality (mostly volume) of the sound generated. The Big Piano can't detect the key velocity- so we used a pre-defined, constant note velocity. This makes the piano playing less nuanced than it otherwise would be, but this is less of a problem for a piano played with feet.

Resources:

Sparkfun makes the MIDI shield I used.
https://www.sparkfun.com/products/9598

Big Piano Firmware. MIDI and UART driver.
https://github.com/deadsy/bigpiano/blob/master/src/midi.cpp
https://github.com/deadsy/bigpiano/blob/master/src/midi.h
https://github.com/deadsy/bigpiano/blob/master/src/uart.cpp
https://github.com/deadsy/bigpiano/blob/master/src/uart.h

Step 7: Controlling It All (...with an Arduino)

It's an obvious choice to use a micro-controller to tie all of these functions together, and the "Arduino" micro-controllers and their associated shield boards provide a cheap, available, and well supported platform for building things like this.

* Software Build Environment and Tools: Our build environment is Linux, AVR gcc, AVR libc and Make. The code is nominally C++, but the code doesn't use any C++ features - it's effectively C. We use the TinyUSB ISP and avrdude to push the compiled binary into the device. Note- We're embedded firmware programmers from way back, and find the Arduino software environment to be silly. So we don't use it. We love the hardware called Arduino, but in reality it's just an Atmel micro-controller on a board. We don't use the Arduino boot loader, IDE or libraries. If you like that stuff, more power to you, whatever gets the job done- for us it just gets in the way. 

* Debugging: The atmega328p has a single serial port, and the MIDI hardware uses it, so it can't be used for debugging. We like some form of output for debugging, so we added a 16x2 LCD to the system. It's a generic HD44780 type device, and we hooked it up in 4 bit mode so it would use a minimal number of IO pins. Add the appropriate driver code and you can send printf's to the LCD.

* Power Supply: The Arduino needs +5V and the LED modules need +12V.  A cheap, easy and capable solution is to re-purpose a power supply from an old PC. Most PC power supplies have a plethora of wires coming from them. Most of these can be removed. One thing you need to watch out for is the "power on" signal. This is a signal from the mother board to the PS that is used for things like wake-on-lan. The motherboard grounds it to tell the PS to turn on. If it's not grounded the PS will remain off - so we grounded it for an always on power supply.

* Electrical Noise: The wires for the keyboard matrix and the LED module daisy chain are 17 feet long. They operate at frequencies in the low MHz. The MIDI cable to the piano in the pit is about 30 feet long. Electrical noise is a concern. A live theatrical performance has radio mics, DMX controlled lighting dimmers, and other sources of electrical noise. Fortunately the base design did not have a problem with noise and we didn't need to do anything special to fix noise problems. We did start off with the mindset that noise might be a problem, and because of this we limited circuit frequencies and ensured we had reasonable noise margin in the key scanning circuitry.

Resources:

Big Piano Firmware.
Look at main.cpp for the top level loop that integrates the functional elements.
https://github.com/deadsy/bigpiano/blob/master/src/main.cpp

Look at lcd.cpp and lcd.h for the HD44780 LCD driver.
https://github.com/deadsy/bigpiano/blob/master/src/lcd.cpp
https://github.com/deadsy/bigpiano/blob/master/src/lcd.h

Step 8: Designing and Building the Piano Body

The Big Piano is big, but it has to be light, strong, cheap and portable. It's an interesting mix of conflicting goals, and the trick is to navigate within the constraints and hopefully come out of the other side with a piano that works well. I suppose if you had a background in building whole body interactive musical instruments this would be old territory, but we don't. We put a lot of mental effort in trying to anticipate problems and giving ourselves multiple options so that we would have a plan B alternative if plan A didn't work out.

* Technology: At our theatre we mostly build things with wood. We can build things with metal, but that runs into weight and budget constraints. In our idle moments we thought a fiberglass piano with injected foam might be strong and wonderfully light, but we didn't have the time or capability for that. So wood is the main material. Wood also has the advantage that it is grokked to some degree by just about everybody.

* Material selection: 3/4" plywood was rejected as being too heavy and stronger than we needed. Prior experience suggested that properly engineered 1/2" plywood can be both strong and relatively light - so 1/2" CDX plywood was our main material. Edge joints between pieces of plywood were backed with screwed-n-glued furring strips.

For storage we already knew we needed to fold up our piano. That meant the piano was made in two 8.5 foot halves with hinges between them. Each half had 2 octaves of keys and were essentially copies of each other. We've had prior experience building model aircraft wings from wood, and we saw parallels between wings and the Big Piano. Just as wings have spars, we decided to build each keyboard half with 3 box beams running the length of the piano half.

The back box beam:
* makes up the back of the piano
* supports the back of the black key
* provides the hinge point for the white keys

The middle box beam:
* provides support for the front of the black key
* provides a stop for white key travel

The front box beam:
* contains per key light compartments on the front
* provides a stop for white key travel
* provides a space for key switch mounting on the rear side

The three box beams are then "stitched" together with cross members:

* Each piano half has 10 static black keys. Mounting them between the back and middle box beams holds those two elements rigidly with respect to each other.

* 2 pieces of 18" x 48" plywood at each end, on the bottom, between all three beams, holds everything together. We were concerned that we didn't have enough cross bracing, but in reality it was fine.

That's the bulk of the structure. Each piano half has a 6" end cap. Structurally these are just cosmetic, but on one half it provides a cavity for housing the power supply and micro-controller.

Resources:

Big Piano CAD Drawing.
https://github.com/deadsy/bigpiano/blob/master/cad/bfp.dxf


Step 9: Making the Keys Work

If you built a Big Piano using some sort of touch sensor on the keys, then they could be mechanically static- but that's not we did. Since we chose to use simple push button switches to recognize the key presses, the keys need to move, and their mechanical design becomes the "key" problem in building the Big Piano. 

The first thing we did was prototype a single key so we could solve any mechanical problems and work out a design that could be scaled up to the full 28 keys. The single key prototype was very valuable and saved us from making mistakes on a bigger scale. We discovered several things:

* Each key needs to be reinforced to handle the playing load. An un-reinforced key will flex too much and would probably break in use. We eventually built the keys from 1/2" plywood and reinforced them with either 3 or 4 furring strips running the length of the keys. With that reinforcement (and suitable supports) the keys can handle a 200 lb person jumping on them.

* Keys need to be restrained in both up and down motion. It's obvious the key motion needs to be stopped as the key is being pressed down. Less obviously the key should also be restrained in the upwards direction. If you don't restrain it you end up with a "sproingggg" type noise/action as the key returns.

* Keys need to be padded. Wood on wood is too noisy. Just like the felt in a real piano, the Big Piano makes liberal use of foam tape to pad any surfaces that collide with each other. It keeps the noise down and makes the key action feel better.

Key Hinging:

Initially we pursued the simple/obvious choice for key hinging. This was to put a door hinge at the far end of the key and to support each key with two springs between the bottom of the key and it's mechanical support. This approach can work but it has some disadvantages:

* Metal hinges tend to be noisy and a single hinge (all we have space for) will allow side to side play on the key.
* Hinges and springs are expensive and the cost is subject to x28 scaling.

We decided to try a more risky approach (mostly to keep cost down). We decided to use the mechanical springiness of the wood itself to form both the hinge and the spring for each key. A tongue of wood at the end of each key is left un-reinforced and acts like a wooden ruler held on the edge of a desk.


















Step 10: After the Final Curtain ...

Room(s) For Improvement:

We didn't have any significant "oh, we should have done it that way" regrets. There are lots of ways to build a Big Piano, but not too many that cost less than $2000. Having said that there are always a few left over ideas.

* The (non-musical) key noise was too high. You could probably fix that with more padding and some sort of sound deadening material in the box beams.
* Because the keys were made individually, the spacing between them was somewhat irregular, and there were some issues with keys rubbing each other. That could be fixed by making all of the keys in a piano half from a single sheet of plywood. Think of a comb or the tuned metal teeth in a music box and you'll know what I mean.
* We should have spent a few more dollars to buy plywood with a better surface finish for the keys. It looked OK with painted CDX, but a smooth glossy surface would look even more like a real piano.

What We Got Right:

* We met our budget goals.
* The piano was easily moved. 2 people could do it. The 4-5 people we had did it easily.
* The piano occupied a relatively small storage space. No one complained the piano was taking too much space or was in the way.
* The piano was rugged. We did 10 shows and only replaced a single switch.
* The piano was reliable and easy to use. When we plugged it in it just worked.
* Making the piano playable was the right decision, even if it was more work. The audience was looking for theatre fakery and was impressed when there wasn't any.
* Most importantly- the piano was a hit. The piano scene always received big applause. Kids from the audience were given the chance to play on it after the show, and it was good to see them having fun with it.