Building Anandamidi, part 4

This is the last post about Anandamidi, I promise! So, in case you forgot, this is the remaining stuff to finish the controller:

  1. Painting the case
  2. Interfacing Arduino with separate USB MIDI chip on separate PCB (Altmustech AU-123)

1) Painting the case

Fairly easy part. I’ve simply bought black spray for wood and sprayed the case 3-4 times. Looks really cool!

OLYMPUS DIGITAL CAMERA

Thing I haven’t mentioned before is the cable plate and the cable itself. I bought several of these USB cables off eBay:OLYMPUS DIGITAL CAMERA

I’ve cut off the mini-b part of cable and replaced it with 4 cables with female headers on them, so that I can simply plug it to USB MIDI or serial conversion board. Since just screwing that cable directly on wooden case would look rather ugly, I’ve also designed a cable plate board, made from same Gravoply board as the main plate.

OLYMPUS DIGITAL CAMERAMuch nicer, although I’m not too happy with screws on that plate (I haven’t had anything else). Right, let’s move on to #2.

2) USB MIDI board

OLYMPUS DIGITAL CAMERAThere were more than several issues with this thing, as usual. After I received the PCBs, I asked a friend to help me solder that MIDI chip, since I’ve never soldered SMD component before, plus I don’t have necessary equipment for that job. After we soldered everything, connecting the board to PC did nothing. No errors, no anything. Checked everything few times, but I couldn’t find the error. Grrr! Since that didn’t work, I’ve decided to give the controller to the guy for whom I was building it without that board. Instead, there’s simple CP2102 serial module inside the Anandamidi at the moment. Everything is the same, except that way you need to install drivers (atleast if you’re on Windows), install virtual midi port and an app which converts serial messages from Arduino to MIDI. Couple of extra unnecessary layers, but it works without issues. After I got home, I spent few more days trying to figure out where I did mistake. Eventually, I figured I used capacitors far too large to be put in parallel with 12MHz crystal which MIDI chip needs. I bought 22µF tantalum caps, simply because the official documentation said only “22” for two crystal caps, so I assumed they meant microfarads. Did I mention how expensive tantalum caps are? Very. Tantalum caps are very expensive. Oh well. What I needed was 22pF caps, so after I bought them, suddenly everything worked. Hooray! Windows happily reported it found new USB MIDI device. Awesome. Unfortunately, issues didn’t end here.

Testing the board

For first try, I only connected TX pin from Arduino to RX pin to that board, so I was only able to send data from Arduino to PC. It worked without any issue whatsoever, so I assumed sending MIDI data to that chip would work as well. Wrong. I’ve tried to send some  MIDI messages to Arduino via that chip, only to get some gibberish values. Checked everything more than dozen of times, didn’t find anything wrong. So, I went back to reading the AU-123 documentation (after things don’t work, RTFM, right?) and noticed something interesting:

ScreenShot022

Active high? What the hell is that? Apparently, pins on microcontrollers can be either active high or active low. Active high means that HIGH signal (usually +5V) represents binary 1 and vice versa. Active low is exactly the opposite: +5V signal represents binary 0 and 0V represents binary 1. After some more investigation, I learned that USART pins on AVRs are active low, meaning that I need inverter if I want to interface them with active high signals. That was also the reason I got gibberish value on Arduino end without the inversion. Obviously, there’s more than several ways to invert digital signal. First I tried with NAND gates (74HCT00 chip) – worked! I simply connected one input of single NAND gate to +5V, and other input was the TX pin from AU-123 chip. Output from gate was inverted, so I connected it directly to Arduino RX pin. While this solution works, that chip contains 4 NAND gates and has 16 pins, and I only need one input on gate, so it’s a waste of chip. Instead, I went with transistor solution (2n2222):

9102

Really simple schematic and works just like the NAND gate solution. Finally, the MIDI USB board is fully fuctional.

Controller demo

Since everything works, here’s a video with Anandamidi, and my first controller, Tannin. Note that this was recorded before the case was painted. Enjoy.

Advertisements

Building Anandamidi, part 3

Like last time I posted here, there’s been much progress. In fact, the controller is already working, even though everything isn’t finished yet. So, let’s start where we finished last time. Faders!

Placing faders

As I’ve already stated, I had some issues with placing the faders. Main source of issues was that I didn’t have any 2mm screws to screw them to the plate. As I’ve found out, those tiny screws are incredibly hard to find, at least in my area, so I had to figure out something else.

10295343_462167303929905_355654997282426842_o

Above each fader, there is really thin piece of plastic board super-glued to its surface. Couple of mm away there is standard 3mm hole. To make it more stable (otherwise that plastic would’ve fallen off) there are wooden holders screwed really tight so that there’s no way anything can happen with faders. Wooden pieces on left/right fader are shown here only for reference, as I designed PCB to fit between those two faders, but more on that later. Pretty dirty hack, as it involves extra stuff like wooden pieces, plastic and superglue. And, as the only real constant in universe says “thou shalt not use superglue without supergluing thyself”, I managed to spill some glue on my sweat suit. 😦 So yeah, building MIDI controllers is dangerous. You have been warned.

Worth of mention is that all of this would never happen if I had those damn small screws! I eventually ordered bag of them from eBay, when I finished all this, since eBay shipping times are getting horrible lately, and I wanted to get this done as soon as possible.

PCB

I’ve done PCB schematic in EAGLE CAD, my so-far favourite PCB design application. The board houses Arduino Pro Mini, two resistors for LED rows in matrix, 16 diodes for buttons in matrix to enable multi-press, 4051 multiplexer for potentiometers and couple of capacitors to make everything run more smoothly. There’s also lot of pin headers for wiring LEDs, buttons and fader. Pretty simple schematic, but prone to errors like everything. After all, what is a project without issues? There were three issues in total with PCB, but luckily, all are solved.

OLYMPUS DIGITAL CAMERA

OLYMPUS DIGITAL CAMERA

1) The board dimensions

PCB has been designed to fit between left and right fader, to make wiring more efficient and easier. Unfortunately, I completely forgot that I have to pay attention to board height, as those 3 mm screws actually set the height limit. To my good fortune, lower dimensions were okay and upper  needed a bit of trimming with sandpaper. Luckily, I’ve checked the design in EAGLE with upper few mm cut off, to see if that would mess with ground planes. It didn’t! One issue solved.

OLYMPUS DIGITAL CAMERA

2) Button matrix and diodes wiring

This issue popped out after I’ve finished wiring all the buttons. So, I connected the controller in PC to check if everything is OK with buttons. Yes, they all worked, but eight left buttons registered as only four buttons, and same thing happened on the right side. Basically, pressing buttons next to each other showed up as same button. A bit of inspective work later, I found out I made really stupid mistake of connecting two buttons under same row and column on PCB design. Ugh!

OLYMPUS DIGITAL CAMERAThe fix consisted of soldering four buttons on the left to right side of PCB and vice versa. Not too much of a problem, but after that I had 8 wires in total soldered directly to PCB, which really broke my modular design, as I wanted each component to be un-pluggable.

3) Ground issues

This is probably the last time I’m ever going to build something with PCB without protective layers. Only reason I did it this time is because I ordered PCB from local shop from which I can get PCB done in a few days, but the prices are absurdly high compared to ITead studio, for example (I found out about that site after I already sent PCB to production, of course). Ordering 10 of those boards from ITead with protective layers, silks etc. would’ve costed me LESS than single board I used here, without any of those layers, just plain double-layered board. Ugh. Lesson learned. Anyways, after I connected pretty-much everything, the LEDs started to behave weirdly, as well as two buttons (their presses showed up like pressing couple of buttons instead of only one). Again, some investigation revelead that one of my columns in matrix-setup was connected to ground. The reason it did is because after I soldered PCB to faders, one tiny bit of PCB surface touched a piece of metal part on fader, short-circuiting that column line to ground. With protective layers this would’ve never happened. What I had to do was to un-solder faders, disconnect every wire from PCB and also to un-solder those 8 wires from issue #2 (somehow I knew sooner or later I would have to do that, things just DON’T work at first, second or third try). After that I’ve put some isolation tape across whole bottom of both faders, and also on PCB to places where I connect faders, just to be sure. Messy bussiness again, but I fixed it.

After solving all the issues with PCB, everything worked. Below the board there are two wooden pieces, put there so that I can screw the four screws to secure both the board and faders, and also to avoid bending of PCB.

The box

After I finally solved all the issues with electronics, I was still left with couple of other things. The first was the case. It’s a fairly simple wooden case, and the guy who did it has done pretty good job. Things can always be better, but sometimes they don’t have to be.

OLYMPUS DIGITAL CAMERA

Remaining stuff:

  1. Painting the case (black!)
  2. Interfacing Arduino with separate USB MIDI chip on separate PCB

More on that next time!