Wednesday, January 9, 2013

Apollo 13: What is the Matrix?


Seriously. Who else did not see this joke coming a mile away?


Welp. It's the post I know a lot of you have been waiting for as it deals with one of the more advancing wiring techniques of the project. Perhaps the one I've been the most vague on? The one I've mentioned here and there but always put off. But fear not! I am going to do everything within my writing capacity to ensure you finish this article knowing exactly what I did and more importantly how you can replicate it.

Plus! Take solace in this - this is close to actually completing wrapping the project because the faders and knobs are ready to be connected to the Livid Builder Brain. "But of course they are, the builder brain has all those analog inputs. You just connect all the ground terminal together and wire them to a ground on the Brain. You do the same for the 5V high pins. Then annoyingly enough, you wire all the wipers interdependently to each analog input on the builder brain. But you have at the very least 36 buttons dedicated to clip launch!


The Button Matrix
So the problem is the Brain has a limited number of input pins. You require a lot more than what's available. The solution is wiring these buttons in matrix. Any chefs out there? We're about to create an electronic button weave.

Now, as some information worth sharing - wiring in matrix is not a new concept, it's not foreign to electronics, and it's especially the "norm" when it comes to musical instruments. So don't be scared! Matrices also exist in electronic pianos. Because it's really just crazy stupid easier to wire. Seriously. Again, electronic button weave. That's what we're doing.


The LP15 has 4 pins for the button, and 2 pins for the led. The builder brain supports an LED matrix AND button matrix. So stew on this for second, because if you think it means we are going to wire two matrices you are 100% correct. We'll do the "button" aspect first and leave the powering the LED thing as the last remainder of the project.





In the post where I outline the parts list for this (specifically drawing attention to the LP15 and it's four gold "fangs") we're going to be focusing on those. The four gold fangs, truthfully - are the four pins that make this button work. A button is actually a type of switch. When the switch is "closed" the electrical connection is made. When it is "open" there will be no flow of electricity. That being said, if you are choosing to deviate from my choice in buttons, take special note here. I am using Normally Open buttons, with the shorthand as "NO". Could you imagine if you picked normally closed? Ableton probably wouldn't work out so well for you as 36 clips are going to attempt to all fire at the same time!!! Better yet, think about this like a doorbell. The doorbell is a Normally Open switch (it's a pushbutton) and when you push the button - the electrical connection is made. When released it stops ringing. Alright, so now imagine a Normally Closed doorbell!

But the question is, "I have four pins on the button and I really only need two to make the electrical connection...so uhh, what about these other ones?" I used fangs as the choice word because these things are going to snap/clip into the perf board. Once snapped in, we can solder and secure these things in place.

Pins 1 and 2 are on the same "rail" that is to say they are internally connected inside of the switch. The same thing goes for pins 3 and 4, they are also on the same rail. So to make the button work we need solder to pin 1 or 2 AND pin 3 or 4. So why four pins? I'll be honest I have no idea. So the button can clip into a board? Maybe it's a fail-safe of some sort in case one pin goes bad? Perhaps you want to wire the button to two identical functions? I'll be honest, I have no idea. Anyway, picture time.


Alright so the above photo, assuming you are looking at the LP15's underside has a pin layout identical to what you see above. Four "fangs" flanked by two long leads. The flanking leads are the two pins responsible for powering the LED. As I've said, this is wired a in a "matrix" configuration and I've been putting off that explanation up until now. Not to mention, you need 2 matrices - 1 for data and 1 for LED power. But, once you wire one matrix wiring the other will make perfect sense.

So in the above sketch of mine, I've laid out 36 buttons in a 6 by 6 grid. I have 25 individual wires connecting all the "positive" leads of the buttons. They connect a single column of 6 buttons (going up and down). So yes - lots of soldering here. For the sake of following along (assuming you yourself have embarked on this identical journey, and are currently holding a LP15 in your hand) position the button in your hand so that it matches the above layout in the photo with pins 3 and 1 on the top; and pins 4 and 2 on the bottom. You may need to get a magnifying glass but rest assured the pin numbers are marked on these things just in crazy tiny print. Holding it correctly you will in in fact see 3 and 1 on the top, with 4 and 2 on the bottom.

Again, to reiterate - a single column of these I've connected all pin 3's together running top to bottom. You could alternatively connect pins 4 top to bottom if you wanted as these pins are once again on the same rail.


Diodes. Yes, you need more stuff to continue.
These things are an interesting electrical solution to a problem you have probably never even considered.

All of our inputs thus far (knobs/faders) each have their own unique data pin running to them. The Builder Brain can uniquely identify them. But the button matrix - lot of inputs on a very selective number of pins. How does anything know you pushed the button you did? It's almost as though you need to know where the power "dies" out. The inherit problem is that looking at a 6x6 grid, if you push button 4 in column 4 (looking left to right) you are effectively cancelling out the power/data to the buttons that make up the grid to that button. A 4x4 grid is now dim and you've now just pushed all of those buttons. Something you definitely don't want to do in the middle of your next Ableton set.

So how can we signal which button is pressed with electricity? Fortunately, diodes solve this problem. How do they do this? They only allow current to flow in a single direction! The matrix (and more importantly Brain) can identify where in the matrix the button has been depressed. With that said, you're going to need 36 diodes (conveniently available from Livid Instruments store front). Let's look at the next photo for what part of this has to happen next.

Note: This photo does not have all pin 3's connected, photo was 
taken before that solder task to emphasize the diodes.

You can see that I've soldered diodes to all pin 1's. Now, based on my photo (and my memory now that I'm thinking about it). I soldered all the diodes first. Then I soldered all of pin 3's together with individual wires. K, now we're back on track.

Oh! Before I forget and you ask - diodes do have a wrong and right wiring! Unlike the entire rest of this project if you got wires flipped backwards it would just result in an opposite expected effect, with diodes, direction is everything! However, assuming someone would see this picture and think "I'm going to replicate what Adam did step by step, picture by picture" Then good news. Those diodes are positioned 100% correctly. While you can easily find this on a quick Google search, I've been told there is something reassuring about hearing it from a real person (as opposed to fake ones). The black ring (it may just be any color ring) around the diode represents the - negative side of the diode or where power is coming out of

So at this point, the 3rd pin on every button is connected top to bottom and the 1st pin merely has a diode soldered to it. Better yet, here's a picture!


Now you'll notice one other thing near the top. I didn't just stop on the 6 button panel I created. I actually kept wiring "up" for the Record and Cue buttons. Given the Builder Brain can support a 48 button matrix, i might as well make use of this fact and keep on wiring. Plus - it's simple. Just keep connecting pin 3 top to bottom. If anything, it may help visualizing this not as a 6x6 matrix, but a 6x8 matrix. But it's not complicated. if you can wire a 6x6, you can do 6x8 or any combination thereof. It may take some thought, it may take some failure, but you can do it!

When the red wire finally reaches the top of the column, it connects into a ribbon cable that is in turn connected to the Brain's button matrix pins.

Note: I'd click on the photo if I were you.

Alright so the above photo completes the first matrix! The matrix that allow you to to actually push buttons and have them send MIDI signals.

boom.

To provide a bit more detail (and ease for the sake of following) you'll notice I changed color for the rows. The black wire now connects the rows (pin 1) to each other, left to right. On the right hand side if you look closely, you'll notice some really funky wiring on my behalf. But I think it makes the most sense when you are new to electronics. There is a junction of the diode, a resistor that connects to ground (pick any ground cable you have running back to the board), and a black wire running to the matrix cable (which plugs into the Brain). This junction is absolutely necessary. The resistor is killing off/absorbing any excess voltage in the matrix when a button (or several) are pressed (and then is grounded) and the black wire running off to the matrix cable is obviously conveying data as to the location of what button was pushed.

If you don't believe this junction is necessary (e.g. you are looking to experiment to see what happens and by all means. Do it. That's how you learn things!) and you either are wondering what happens or worse decide to not wire it - button presses will generate RANDOM midi data. Maybe you turned a knob? Pushed another button...or 7. This is the result of excess electricity in the circuit incorrectly signaling back to the Brain.



The LED Matrix
Here's the good news. YOU ALREADY KNOW HOW TO DO THIS! Seriously, just repeat the above steps but use the silver pins jutting out that connect power to the LED's and then back to the cable that connects to the LED matrix on the Brain.

Not feeling confident about wiring another matrix, let alone on top of your already existing one? That's ok. Unlike the button matrix where you'll have to constantly be testing to ensure signals and proper secure wiring, the LED matrix is as simple as connecting power and just making sure the LED (inside the button) lights up.

Looking at the below pictures, my color coded wire is set to match + and - alike. Red is + and black is -. Pin 5 is positive and Pin 6 is negative. So in my LED matrix I've connected a 120oHm resistor to pin 5, pin 5 to the next pin 5 and then repeated the process on another two buttons. The buttons were then connected pin 6 to pin 6 on adjacent column. Pin 6 then runs out of the circuit to ground.

Grab a 9V battery. You have a perfect test awaiting.




I think I got excited in my wiring, because I can't find a lit up version of a 2x2 matrix. I think I just saw two other buttons and kept going. Below you'll see a 2x3 matrix powered by a 9V battery.


I genuinely hope no one is offended when I say I don't have a thorough process photo documenting the LED matrix wiring as when i was doing it - completely took it for granted that if I had successfully wired my data matrix - that getting the buttons to light correctly was a plus. But, it was one that I immediately had the knowledge for given I'd only minutes before completed the data matrix.

The only thing worth mentioning is the 120ohm resistor at the start of each column for the LED matrix. I remember when I first received the demo package of 5 of these things and I very eagerly and stupidly wired one directly to a battery. It was the brightest green I'd ever seen until it instantly turned red, popped, and made an unexpectedly loud noise. So - don't do that.



Wasn't perfect the first time around. Seriously. I got the whole thing lit except two buttons!? Are you kidding me??!!!! Oh well, "back to the soldering table" I told myself. Until I realized "Oh yeah, the whole thing pretty much works. I should maybe just play around on it for 1 or 18 hours."


And so...
Wire a few more buttons for data and lighting. Touch up the paint a little bit. Maybe drop it from 1 foot off the ground...start writing a blog about how I built this thing.

Come to think of it, I've been looking back and at my notes. I may only have 2 if not only a single ONE remaining post left. I have to type out loud here to double check.

Build the box.
Cut the faceplate.
Ordered the parts.
Connected the knobs, faders.
Wired a button matrix.
Wired an led matrix.
Put the thing together.
Started a blog that highlighted all of my notes and thoughts of the build process.


Hrm.
Well. I probably should tell everybody about what happened in October of 2012 then...


Monday, October 8, 2012

Apollo 13: Basic Wiring

*deep breath*

YOWZA, it's been since nam since I last posted and for that I sincerely apologize. As I said in the post before this, I had Maker Faire coming up fast on the schedule so I was rather tied up. Then before I knew it, I was off researching my next project, one thing led to another...and then within the past week a friend posts on my facebook wall "Hey congratulations on making this site!" I thought, "What site? Why would I be on a website?"

But then I saw this in my then minimized browser window...

You can read the article here, (http://createdigitalmusic.com/2012/10/diy-maven-apollo-13-is-a-beautiful-handmade-aluminum-ableton-live-controller/). To say the least, it's incredibly well written, flattering, and more than anything reminded me of the following...

I made a promise to write these posts, and I am going to do just that.
So let's get started. Ahem. K. I'm ready.


Basic Wiring: Faders and Knobs
If there is one thing that may scare a lot of people about this project (assuming you weren't frightened or scared off already) is dealing with first hand with electronics. My college curriculum had three electrical engineering courses thrown at me, and they only slightly provided some help throughout this entire debacle. Fortunately for you, electronics, circuits, and all of this stuff has become crazily cheap to do.

My first ever self assembled board.

What you're looking at in the above picture is the A/B send return board. There are two in the assembly of this project each containing 6 "mini faders" see the parts sections for these little guys.


The above photo shows what I'm up against. I need 2 boards with 6 mini faders on each of them. In addition to this, you also can see I have a single complete launch channel consisting of 6 buttons for 6 clips of audio and the two buttons above each channel - record and cue. When I in my first post that "I need to break this thing down into it's respective parts" I did that by breaking down what a single channel of control offered up to the software. 1 volume slider, 10 buttons (A/B cross fader assign, 6 launch, 2 rec/cue, channel on/off), 2 mini faders, and 4 knobs - totalling 17 unique controls per channel over the course of 6 channels.

But back to the boards, because buttons weren't something I was ready to tackle then. Those were more complex in wiring, linear and rotary potentiometers (faders and knobs) were something I was ready to do immediately and know I could quickly produce preliminary results with. The perf board used in all photos and this project was purchased from Radio Shack and has no copper coating - it is plain. But you can get copper coated ones, doesn't change the end result. In hindsight, it may have been easier to do with those.

Potentiometers here are types of analog controls and to break down what it is and how these things work, allow me the following picture I found by a Google search.

A rotary potentiometer

A rotary (knob) or linear (slider) potentiometers has (at the minimum) three pins for wiring. In the above example and in the case of every knob I've seen there is a pin dedicated to Off, Wiper, and On. I'm sure the words "On" and "Off" make instant sense to you, but wiper? What's that? The wiper is the pin that simply put - conveys the data. It's the thing providing the value. It's the thing saying how much or how little something is happening. But to get that value, we need to run electricity through the two other pins - in one and out the other.

Go full screen super size on this one so you can the melted solder. I used the tool to hold the knob in place so I could have a soldering iron in one hand and the wire/solder somehow held in the other. You can see here the pin layout I described. Wiper is middle!

Yup. Lot's of soldering. Also, this is where I realized that Version 4 of the faceplate couldn't work because the 8 random knobs running along the right of the mixer (left side in the picture) were facing out towards the eventual box edge!

Green is the wiper, i was gearing up for one of my first tests of a single channel of 4 knobs. No solder here, just tightly wound wire to wire.

Now the final wiring changed only slightly from the above picture, instead of pseudo-braiding each knobs wires together I braided a row of knobs ground, wipers, and lead (high) wires respectively. So that way I could distribute power to a single source, ground to a single, and run all my wipers to a similar central location.

Let's Talk About Electricity!
So applying this concept to an electrical circuit 5V flows into the first pin, the knob is turned all the way to left (off) the third pin has 0V coming out of it. You turn the dial a bit, suddenly the third pin is releasing energy. You turn it more and more, and eventually the electricity freely flows through the circuit until the whole 5V is coming out of the third pin. As you turn the dial the reistance in the circuit is decreasing, but the electrical output is increasing. Resistance should make sense in this example - you are resisting the flow of electricity.  Imagine turning a faucet on slowly. How bout that analogy? The Wiper pin is sending data to something. In the case of our MIDI controller it's sending it's resistance value outbound to the control board.

Enough of that, more wiring.


Fortunately these linear faders also have three pins, a low, a wiper, and a high. I'm intentionally color coding my wiring. Black is 0/off/ground(GND) and Red is hot/on/5v/. This also serves the added benefit that I don't put these things in backwards. I know what the "bottom" of the fader is. But it isn't the bottom because I soldered a black cable to the pin, its 0/gnd/off because the data sheet from the manufacturer tells me so.

It tells me on this 3 pin linear fader further away from the other two is high/on. The pin between the two further is the wiper, and the remaining one is the ground/off pin. Brilliantly simple. I want to add this is a generally safe assumption to make of faders pin layout.

Wait, 3 minimum? Faders can have more?
Yes they can. Because more complex, expensive faders may output to two different sources. They may take in multiple sources. Some are motorized and have extra pins to supply power to the motor. If I ever get crazy enough to do this project again, apart from a lot of things I'd do differently now that I have the knowledge is that I'd do motorized faders and call it Apollo 11.


In the above photo you can see the results. I have two wires coming off of each fader, the remaining pin (closest to the black wire/pin) is the wiper which I used green wire for. If I had access to radioactive looking yellow/green I probably would have used that in a heartbeat. Even though no one will see it when it's done for me I thought "Well, that'd be cool." But alas, didn't do it. Just used what was around me.

The wire is 18GA wire from Radio Shack. They sell it in packs of three featuring red, black, and green.


So what about those plastic things? Those white tubes jutting out from your board? What are those things? Why do you need them? Plus, why do you have knife out? The plastic things are Nylon Standoffs (https://www.sparkfun.com/products/10462). Try to visualize the following - I have a faceplate and components underneath it. Those components need to mount somehow. 3/4" nylon stand off sink these faders enough to shorten there rather crazy long physical fader and...well yeah, it puts some distance between the board and the faceplate. They are made out of nylon and help things stand off from a surface. So simply named right? I suppose, because when I first heard about them I had no idea why I'd need them. That link also features the page for matching screws.

The knife in the picture (blade is by Xikar, don't believe they make it anymore) has a fine point (obviously) - so I used it to widen the holes by twisting the blade around in the hole on the perf board to something I could poke a screw through and tighten the stand off onto. Crazy simple right?! But talk about a lot of widdling.

Regardless, the end result is the knobs are completely wired, the mini faders are mounted on the perf board and the pins poke through the back just enough to wire them. OH! Right, before someone is wondering how I "mounted" the fader into the perf board - I just used tinier holes so they had to snap more or less into place. This vs. the screws which I widdled large enough holes they simply just fell into.

Finally I should add the large faders used for the volume, master volume, and BPM are the same exact principle. 3 pins. Low, Wiper, High. Wired identically. Just bigger.




And so...
The faceplate exists. 
The box exists.
The first half of controls are wired and ready to be connected to power, ground, and respective wiper pins.
I have half of a functioning controller.
I can consider this project at 40% to 50% complete. 


Because this part I wanted to do. I wasn't scared of doing it whatsoever. I'll be honest, I was putting off something that had me concerned for the longest time...

How the hell do you wire all of these buttons AND make them light up?


Until next time everyone! Thanks for reading, thank you for your patience, and thank you as always for all your kind words.


You want to know what the matrix is? The matrix is...

Monday, July 30, 2012

Apollo 13: Writing on Hold!!!



I didn't post anything on Thursday, and I regret to inform everyone that nothing can be posted this week due to some time constraints.

This is 100% due to preparing for the Evanston Mini Maker Faire which I'll be presenting the Apollo 13 mixer at! I'll be taking plenty of pictures and recording whatever video I can! You can check out the Maker Faire at http://www.makerfaireevanston.com/ or if you are in the Chicago land area see the device for yourself.

I continue to receive lots of emails and I know many of you are still interested in this project - rest assured I will finish these posts. If it is insanely important, if you are starting it yourself, if you have questions please email me, I'm here to help!.....just not this week. I'm really booked.


BUT NEXT WEEK!

I'll continue writing, but I am really focused on shooting a 2nd video showing the thing in action and far less of a "here's what the buttons do" video. I've received enough requests for one that it certainly merits a video response. Thank you to everyone for all the continued support and kind words.


After an extended absence, the project continues at...

Tuesday, July 24, 2012

Apollo 13: The Case

Thank you Home Depot for this lovely sheet metal.


After figuring out the faceplate and all the parts I was going to use, I feel as though I very jokingly said "Well this should be easy NOW." But much like the faceplate, cutting it, designing it, and doing everything required to make it come into being - I found myself in a similar position with the box.

The Maven has an inherit tilt to (genius might I add) and it's all covered by those two fancy aesthetic choices preventing a clear view of how it possible assembles on the sides. When I first approached the problem of box design the problem that kept going through my head was "Either it's cut from a single peice and folded in such a way that it perfectly closes OR I cut it from three separate pieces." I'm sure the first choice is valid but I went with the second one for a few reasons.

1. I don't have access to a machine brake, I'm going to have to hand bend. That is going to be rough for my girl scout figure.

2. I don't nearly trust my measuring enough to accommodate for error with my hand bend of the metal.

3. I need something that is technically the easiest thing to re-produce if I wanted other people to do this. Even if it involved someone just hanging metal on a ledge and pounding it down with a hammer.

I purchased I believe a 24" by 24" sheet of 16 gauge steel from Home Depot. It comes coated in a layer of oil to prevent rust (this wasn't stainless steel) and has a decent thickness and weight to it. Perfect for adding some weight to this device. But walking out of the store with this giant sheet of metal in my hands, grinning with what was eventually going to happen I still arrived back at - "Well...how do I cut this stuff?"


Angle grinder! Perfect! That's what I'll use! Right?




Yeah...no that didn't work out so well. I don't know what I'm doing. All I know is this 2 inch cut took me like 30 minutes to do. It looks jacked up and oh right I've never used an angle grinder before. Better start over with some mineral oil, and a bandsaw.


Talk about an infinitely cleaner cut. Minus the damage on the right hand side. I guess I'll use the angle grinder to smooth that out? I have no idea, but I do know this flat sheet of metal is getting slide into this bending brake and getting bent.




If you are looking closely at the last picture here, you maybe wondering "Uhh, that doesn't fit. Sure you could bend the top and bottom but the width it's all off." To that I remind you, it was a 24" by 24" sheet.


Since I had never done anything like this before, I made my measurements for the 1/8" plastic faceplate and used the excess as my test bends/cuts/excess. Which is to say there is an extra shell/box/case for the board laying around. Just not as wide.


If you look closely at the above picture, you'll see the "mini" version of the box/case/shell resting inside the actual size one here. Additionally, the faceplate is going to have to rest/mount on something. Thus, i got some really thin sheet metal (still steel) to clamp down into a vice and hammer into right angles with.

Blue line is as you may have guessed, where the bend was made in the vice. However since this much thinner than 16ga steel, my bend could be far more perfect than the box used with the hand bending brake.


Above you can see the bent steel just resting between the top edge of the box and the faceplate. Eventually, i drilled into both of these parts and fastened them together.


Faceplate length + bend length 
total length of box.
I don't want to neglect the measurements on this post. The faceplate length (which is 17")  plus the bottom lip of the case (1.25") and top of the case (4") make up where to make the bends. Obviously, this part is open to interpretation and your own work. To me this just looked like the right degree of bend/tilt to the original Maven. Something tells me I'm probably 1" off when it comes to the back of the mixer. But i rather error on the positive side. After all I plan what if I want to build this thing out more? I mean the original Maven has some serious analog power.




Using a drill press I drilled two holes into the back of this (MIDI IN and MIDI OUT), since it was already bent, it was somewhat awkwardly positioned on the bench. I went with the closest diameter I could find to the plugs and filed what I needed too by hand.



Assembly.
Continuing on my drill press spree (I've never used one, wow are these things great) I began mounting the front and back lips to the case. This is what the faceplate will rest on and screw into eventually. The other thing I did between the original bend and more work, is scratch the absolute hell out of the case intentionally. Using a steel wool pad, I brushed all over this thing to remove whatever rust was starting to form and more importantly give the primer something to stick too. The primer I used was Flat Gray Rustoleum. Three coats over three days.


 I can not convey the level of excitement I felt when I put this on top of the box and it rested in place.








The Sides.
Since I decided not to build a box that would fold into itself, I'd cut the sides separately. This was done by simply laying the case on it's side against excess 16 gauge sheet metal and tracing it. Yeah. Tracing it. I error on the side of caution make sure that when I cut I'd have plenty of excess to cut and angle grind down. Even still, I'll need more steel right angles to hold the case together. Fortunately, those are insanely easy to make with the vice and a hammer.


After I made them, I drilled four holes into them and firmly pressed the case/sides together and with a marker dotted the holes. Walked over to the drill press, hoped for the best and drilled into the sides but more importantly - my completely so far good looking case. Fortunately - SUCCESS!












Is there an engineer crying yet?

Hiatus is over and the writing continues at...


This wraps another post...
As always I welcome comments, emails, instant messages, skype calls, tweets, facebook requests...and whatever means of communication you prefer. The goal again is to make this easy for anyone of any skill level to understand and replicate. Thank you once again and as always for reading, I look forward to the next post to continue to discuss this more in depth.