My little sister needs a sample player for a show in just a couple of days. Can I make it happen?
Let's build it! I decided to build it on perfboard, since I don't have a PCB mill.
First, I laid the whole thing out in Fritzing so that I could see how best to use my perfboard to handle a Teensy (with Megsy expansion) and the screen and keyboard.
I tried to keep the arrangement more or less the same between the schematic and the perfboard.
I determined that if I used two 28 pin sockets, Teensy and Megsy would fit nicely. I think Fritzing only had 30 pin sockets, which is why there are a couple of extra pins at the bottom. Similarly, the screen needs a 14 pin straight socket, but Fritzing only had 8 pin, so I used two of them and had two extra pins.
In real life, I had 28 pin sockets available, for Teensy/Megsy, but only 8 pin sockets, so the two extra pins displayed on the screen socket were indeed a problem.
Also, note that I used the far right side of the socket for the screen. That was a bad decision that would bite me later...
In order to clear the buttons, I needed to drill a few more holes, so I just went at it with a screwdriver.
So I wired it up! I didn't have headers with the right number of pins for the screen, so I used two smaller ones. Unfortunately, I chose the wrong side to wire it up to, the screen overlaps the buttons a bit... GAH!
You can see on the back where the keypad is wired up, and you can see the Teensy and Teensy 3.1 wired up on the back side of the board. I actually used my Megsy project for the Teensy here, giving myself access to even the tiny pads on the bottom of the board.
Does it work? You betcha!
So I cut the board with a Dremel so that the buttons wouldn't be covered by the screen.
I took some scrap that we had salvaged from the bend tests for Twister to build our case in. But it needed some holes for buttons and screen and mounting, so I designed a template in Solidworks. This was done extremely quickly... show is the next day!
Then, I used the laser cutter at MAG Lab in Pomona to cut it.
After cutting, it came out like this. (Actually, this is the 2nd one cut from the same bit of bent acrylic. We had to cut it in half.)
We also need some holes for the audio jack and USB port, so I drilled those in the side with a drill press and a step drill. I learned my lesson from earlier times... the step drill is the only way to drill acrylic.
So we put it all together...
Looks good, but looks can be deceiving...
The switch PCB is riding up on the edge of the screen PCB... both have to be mounted flush with the panel, and I didn't account for the added width of the screen from the bottom PCB. D'oh!
I'm running out of time and material to make changes, but I've got one more bent piece of acrylic with me, maybe try that?
I want to be really careful to line it up right. I know, I'll use some scrap cardboard on a low power setting to determine where the beam will be...
After a couple of tries, I think I have it lined up right... lets give it a go!
Looks nice, but...
It seems like I had even more trouble despite my efforts. The holes were too close to the edge of the case for decent mounting...
Looking at it now, that isn't as terrible as I thought. So I went back to the first draft and determined to make it work...
So I put the PCB in the grinder in my shop and made it fit.
Looks good... but you know there is a giant *but* coming...
What are all those spots on the left of the screen?
Oh, that is just the touch sensitivity going bonkers at this crazy pressure on the right side... I have code in to let you draw on the screen to test the touch stuff...
Well, the touch screen isn't necessary for the show, so I guess it will have to do.
So I give the box to Tina and she goes off to do the show, and amazingly it behaves fine. Mission accomplished!
But I still have "unfinished business" with it....
Today, I want to fix up the touch before I take it out to 23b, so I disassemble the thing to grind the board again.
I had attached the buttons on one side with some double-backed foam tape, so I had to use some Goo Gone to get the residue off.
Then...Read more »
I spent a little time in Fritzing to lay out my keypad just to be sure the spacing was good and make sure I had the right idea before wiring it up. Fritzing has many problems, but it is wonderful for laying out pretty circuit diagrams and breadboard/protoboard stuff.
Having convinced myself that i had wasted enough time, I sat down and actually wired the thing up. It didn't completely fail to resemble what I drew, but it wasn't exactly the same either.
Finally, I wired the whole thing up and did a test:
It's a trap!... I mean, it's alive!
Satisfied in a job well done, I went to bed. When I woke up in the morning, magical elves had snuck in and somehow debugged the TFT display!
While the screen isn't currently doing anything important, I will want it eventually, so I need to wire this up in a more permanent way. And I need it for Saturday... if only I had access to a PCB mill...
So, the first thing to do was to get the Teensy 3.1 on the protoboard and make sure it works. I'd already soldered one up in my Megsy project, breaking out all of the extra pads on the bottom for easy access.
It had never been tested, but no time like the present, right.
The long circuit board and pins attached to nothing but tiny pads on the board caused some troubles inserting and removing, tho.
But I managed to get the pins back into place and reinsert it.
I also soldered on the Teensy audio board shield (cape, whatever they call it?) and loaded up the WavFilePlayer example and it worked as expected! Yay!
I then tried to add one of the TFT touchscreens that PJRC sells, thinking I could use the touch capabilities as pads and save having to add switches.
While the screen itself worked, the touch capabilities have caused me some problems. At first, I had the pins defined wrong in the software, and it was giving me a lot of false positives. Now, unless the board is at PRECISELY the correct angle, the touch doesn't work at all. When it IS at the right angle, it works great! Checking with the Ohmmeter says everything is fine, so my only thought is that perhaps one of the connections is a bad idea? Touch works well enough when I swap it out in the NanoEgg Synthesizer project board, so I'm not sure what to do here. I tried rewiring the whole thing, but no change. Hmmm.
Well, I can get back to that. Time is a wastin'!
So, let's add some switches and see if I can trigger the samples and get good latency that way. It took me a little bit to get the switches configured correctly for some reason, but I eventually had success, and switches trigger samples correctly.
At first I wired the switches as direct pushbuttons, but that means that each switch takes a whole pin on the Teensy, and while I could probably get 10 or 11 switches crammed in with all of the other stuff, I'd really like to eventually have a 4x4 matrix, or 16 buttons. So I'd like to arrange it like a keypad, and there is a lovely library for that that I have already made some nice modifications to for better handling of callbacks.
So I wired up one row in the breadboard and tested it out and it was great!
I modified the structure of the calls to the audio library so that I could play any pad at the same time instead of just one sample at a time and it seems to work. I had to add some stop calls to keep it from overloading and failing to play audio, and there may need to be some more work there, but it seems good so far.
So I decided to use one of my protoboards and build a DIY keypad, as my other keypad is stuck in the NanoEgg, and the ones I ordered from China will be here sometime before the end of June...
But it turns out that the force required to get the oversized pins on the buttons through the round holes on my protoboard is enough to destroy them by mangling the little metal disc inside.
I tried rebending it and such, but no amount of mangling I could do could get it to spring back reliably again. After destroying two of these, I decided that maybe I should use something else...
I've got some really tiny buttons that I've never used before, so I may give those a shot for the keypad.
While trying to test them to see what pins do what, I noticed something interesting about these buttons:
OMG! They have LEDs in them! I didn't even know!
Hmmm, how in the hell am I going to find any free pins to wire up LEDs? I'll have to save that for later.
So I guess I need to lay out a keypad. I have exactly 16 of these buttons. I think I'll give Fritzing another shot, as it does good visualizations of protoboard...