Last weekend I got around to populating and testing the piano valve control board. Unfortunately it did not work when initially powered on, I was able to track this down with a scope to problems with the level shift circuit between the pi and the shift registers. Rather than troubleshoot this farther I ended up re-designing and re-etching the board to replace my transistor array level shifter with an off-the-shelf level shifter sub-board. I also took this opportunity to #1 redesign the solenoid wire connections so that a pin header connection could be used rather than having the wires directly soldered to the board and #2 add a connector to the edge of the board to use the pi’s pin header connection.
In the mean time I had also created a 3d printed enclosure to hold the board on the back of the valve bank. This was important as it allowed the final solenoid wire lengths to be determined and I soldered all the solenoid wires onto a pin header. I also 3d printed a support ring to stabilize the pin header and hot glued it all together to act as a single strain relieved connector.
This weekend I was able to finish and test the re-design. All channels seem to be working OK and I’m able to control the piano keys individually from a tablet using a python script. I have some python scripts working that successfully decode the MIDI files, but I haven’t connected the dots between this and the hardware yet, that’ll be the next step along with hopefully adding a web interface.
The Piano controller will be based around a Raspberry Pi Zero W. I had originally considered using a spare Arduino, however since the project will require a lot of file handling and a web server, having a full general purpose OS is much easier than shoe-horning it all into the Arduino. The Raspberry Pi also has a wifi adapter built-in, simplifying wiring.
Unfortunately the Raspberry Pi doesn’t have the ~90 outputs that are needed to control the piano’s valves. This is a common problem in electronics and micro controllers – it’s assumed that the designer/integrator is going to provide their own output channels that are most suitable for their device. Instead, the Pi has several low voltage/current outputs that can be switched extremely quickly. I’ll connect these outputs to shift registers, clock all 88 valve bits into the shift register’s ‘memory’, and then send a signal to latch these new values to the outputs. This will be repeated quickly enough (~1000 times each second) that for my purposes the ‘remote’ outputs at the shift registers will appear to instantly follow the valve output commands from software.
74HC595 is an extremely common 8-bit shift register that many examples are based on, unfortunately it’s limited to 35mA outputs at 5V. This could still have worked, but would have required adding a transistor switching circuit to each output to achieve the 200mA @ 12V that the valves require. Going that route would have meant half of the design or more would have been dedicated to individual transistors/resistors, leaving a lot of room for errors during the build. To avoid this I found the MIC5891; this is essentially the same device as the 74HC595 but with built-in output drivers that can provide up to 500mA at up to 50V for each channel. The MIC5891 also has built-in protection for switching the valve’s inductive load, so this selection also avoided the need to add external protection diodes. The only minor problem created by the MIC5891 is that its inputs are all 5V and the Pi outputs 3.3V; this is resolved by a simple FET level shifter.
Once the MIC5891’s arrived I did a quick breadboard test with the PI powering a single shift register with some LEDs. In this test the MIC actually accepted the PI’s 3.3V signals, but I wouldn’t trust this to be reliable and will still include the level shifter on the full board.
To finish the design I added a few FET switches which will allow me to eventually route spare outputs on the Pi through this board to a satellite board that will control the vacuum pump (On/Off/Speed). I also added a 12V to 5V DC-DC power supply so that I can bring a single 12V supply into the control board and have it power everything, including 5V back out to the Pi. This was all drawn up in CircuitMaker.
Creating the actual board consisted of printing the circuit design onto toner transfer paper, with scaling 1:1 and with the top layer mirror-imaged. I cut the board blank to size and drilled small holes that I had added to the design as alignment points. The board was then cleaned carefully with fine steel wool and denatured alcohol and then I ironed the transfer paper onto the board. When the board had mostly cooled I pulled off the transfer paper revealing the design. In the past I had used photo paper for transferring toner; this was my first time using purpose-made toner transfer paper and it definitely was much better – the board only required minor touch-up with a fine tip marker prior to etching. After etching in Ferric Chloride, steel wool and denatured alcohol were used to clean the toner/marker from the board.
The next steps are to drill all the pin holes and to fully tin the board to increase the ampacity of the traces and prevent corrosion, I’ll do this prior to populating and testing the board.
This weekend I had a chance to test the completed valve bank.
Testing revealed that some of the keys did not actuate with their corresponding valve open. On these keys when the valve (while turned ON/open) was removed from the manifold the key would strike immediately, pointing to lack of airflow through the valve as the cause. I can’t explain why this occurs on only some of the keys but the piano turns 100yrs old next year, so the inconsistency isn’t surprising. The piano could perhaps be adjusted to make these keys work the same as the rest, but I could more easily just provide more airflow via multiple valves per key – this is the approach I took. To connect multiple valves per key I created a few hollow standoffs that fit inside the valve holes in the manifold . The standoffs then have holes on their sides to allow connecting the extra valves on a 2nd layer above the rest. The end of the hole that was drilled to hollow the standoff was sealed with hot glue. Two valves solved the problem for most of the offending keys, but one extra special key required 4(!) valves in a ‘+’ configuration.
With the mechanical parts complete I’ve taken the first steps to construction of a raspberry-pi based controller that will use shift registers to power the solenoids. The raspberry pi and associated circuitry will be small enough to fit on the back of the valve manifold in the area where the paper roll would normally be. It has wireless connectivity and I plan to have it host a webpage where it can be controlled by phone/tablet. I’m bread boarding this first to prove the concept with one shift register, then once testing is complete I’ll create a circuit board to hold all 11.
I did a quick test tonight to check/confirm the feasibility of using the ebay solenoid valves I got a while back to control the player piano. I connected one of the valves to a 12V battery pack and a push button, and then held it in front of one hole of the piano’s tracker bar while the rest were taped closed. When I pressed the button, the valve opened, and the piano played the key! With this successful test I can move forward with designing an adapter to connect all 88 valves to the tracker bar.
It was only a matter of time before this happened – the player piano (original post) is a real workout to play manually. Since it works on vacuum, I had set aside the motor from an old vacuum cleaner for potential use in powering the piano. Tonight I built a small box to contain the vacuum motor and connect it to the piano. The box is made from MDF, partly because I had scrap that needed to be used, and partly because it’s very heavy & sound absorbing. I made the big fitting by cutting/milling a square from scrap, I then bored a hole in it on the lathe and welded it to a scrap of pipe.
One very large hose goes to the manifold powering all the key bellows, and another smaller hose powers the vacuum motor for the tracker/scroll mechanism. I didn’t notice the smaller connection at first, so I had to go back and tap a fitting into the connection for the large hose; there’s still enough room for both to connect though.
Overall it seems to work great, this effort was definitely a quick proof-of-concept though and I’ll need to go back and fix/test a few things:
#1 – Motor controller to slow down the vacuum motor. Currently it has way more vacuum than is actually needed and slowing down should reduce noise from the motor.
#2 – Ensure cooling is OK. Especially after slowing the motor down I need to test that air flow is good enough to keep the motor consistently cool.
#3 – Mount in piano base and complete further noise insulation.
#4 – Tee hoses (and potentially add check valves) so that manual operation still works.
Beyond that I do have plans to eventually (could be tomorrow, could be in 5yrs) automate the player mechanism using some small pneumatic solenoids I found on ebay. These would tee off of each line from the tracker bar and when they open it would simulate a hole in the paper passing by. With this it would then be computer controlled and able to play anything. By default these are off/closed, so the paper mechanism would still work fine, in computer-controlled mode I’d just need to block off the tracker bar holes with some tape.
Christina has had an eye out for a piano for a while. Interestingly the standard price for used pianos is ‘free, must be able to move’. With this in mind we were shopping on ease of moving – looking at the surroundings in the listing photos to determine where it likely was (i.e. garage vs inside) was almost as important as the piano itself. The right one popped up this week, so this weekend we took the trip to pick it up. I had a particular interest in this one also since it’s a player piano. Player pianos are one of the earliest (the earliest?) wide-spread programmable automated ‘machines’; it’s fascinating to see how these were designed to be built using mostly hand-made parts and to operate without electricity.
Moving: Pianos are the archetype of things that are difficult to move. The trick, as usual, is letting the equipment/physics do the work. At the pickup side it was already in a garage; after backing up near it I jacked the tongue of the trailer up so the ramp/bed formed an even & shallow slope. I was ready with the winch at this point, but because their driveway sloped away it actually rolled onto the trailer without needing it. To unload, I backed the trailer around the back of the house to the back door and then raised it up on jack stands until it was about even with the threshold. We then put a 4×4 timber across the bottom of door frame of a nearby interior door and used this as an anchor point to winch the piano inside with ratchet straps. Once it landed on the tile floor it was easy to push around.
Rebuild: As near as we can tell from the serial number the piano seems to have been built in 1920. It was also signed inside with a 1996 date, likely associated with a rebuild. The good news is that everything seems to be in place and after sealing a few vacuum leaks it was able to play automatically; It definitely had/has room for improvement though. I was able to make it sound noticeably cleaner by dialing in the correct ‘capstan’ height on the back of the keys. The next priority is getting the keys working more consistently; several of the keys (~40) were missing felt from their front hole. The front hole felt prevents the key from wobbling side-to-side. Several keys (~20) also had cracks where the back hole goes through the key. The back hole is where the key pivots, so these cracks allowed the keys to tilt side-to-side. Felt was added to the front holes and the cracked back hole parts were glued back in place; this resolved the loose key problems. For just a few keys (3) the cracked part is missing and I’ll need to create and glue in a repair piece. Once I’m finished rebuilding the keys I can then go through and set the key level and adjust the hammer action. Along the way I’ll also be coming up with an electric vacuum pump – pumping with the pedals is a work out!