Intro: My Experience With the MAGPI
In this instructable I'm going to talk about my experience building the Micro Arduino Gaming Platform Interface, a truly awesome little device which can be found here: https://www.instructables.com/id/Magpi-The-Micro-Ar...
I did a few things a little differently and I wanted to highlight a few of the issues I ran into while constructing the device.
Step 1: Buying the Parts
The parts list can be found in step 1 of the MAGPI instructable. I had acess to a 3D printer so it was no problem attempting to 3D print the parts. I was able to order everything from Adafruit that I needed as well, which arrived about a week later. The parts from Sparkfun (the Arduino Mini, the battery and the battery charger), however, were all sold out. To solve this I instead ordered the Arduino off amazon, where they luckily had three items left.
The place I bought the Arduino Pro Mini 3.3v can be found here: http://www.amazon.com/gp/product/B00JNYXC8Q/ref=ox...
The next problem required finding a new place to purchase the battery and charger. I searched just about everywhere and wound up reading a bunch of sites that seemed to be in German and Arabic, but those weren't really going to help, so I had to figure out something else. I went to Adafruit and searched for similar batteries that might be available and found that they did have in stock a similar battery, except it was 500 mAh instead of 400 mAh. This wasn't going to be a problem, though, so I went ahead and ordered it. The battery did end up being slightly too large, but I'll talk about that in just a little bit. Along with this, I also ordered the charger that went with it. This charger was slightly different as it was a USB connector instead of a micro-USB connector and did not have holes to connect to the positive and negative terminals of the battery. I'll talk about this later as well.
The battery: http://www.adafruit.com/products/1578
The charger: https://www.adafruit.com/products/1304
Now there was one last problematic issue for obtaining the parts and this involved the right angle male headers. I assumed we had some of them lying around (we did have absurd amounts of the straight ones), but, surprisingly, I found that we didn't have any right angle ones. To solve this I broke off a row of 6 then bent each one with a pair of needle-nose pliers, creating my own right angle male header.
After waiting the week to get the rest of my parts, I began constructing the MAGPI by attempting to 3D print the top, bottom and PCB.
Step 2: 3D Printing Is Hard
At least it's hard when you have absolutely no clue what you're doing. I had never used a 3D printer before but was told it was super simple. All I had to do was take the .stl files and upload them to the program "Up", then tell it to print. On the surface, of course, it actually is this simple, but I ran into a few problems while trying to put this together.
The first problem was that my 3D printer was not large enough to handle printing all three items at once. Luckily, the original creator of the MAGPI posted a comment where each of the three parts were split into three separate files and I was able to use these. The items were still a little too large to put them in horizontally/vertically, but I was able to rotate them at a 45 degree angle and they fit perfectly onto the printer.
Here are the .stl files for the three parts (you can also get these off the comments for the MAGPI):
Downloading these took no time at all and after positioning the files I told the program to just go ahead and print, happy that it should now work. Wrong, wrong, wrong. The program immediately started throwing errors at me about the image being out of range and that it would be unable to print anything. This made me extremely worried because I wanted to be able to print it, but no matter what I did I couldn't seem to figure out what was wrong. I figured there wasn't anything wrong with the code as others had obviously already used it before, so assumed something was wrong with my settings. I started just randomly changing things, but that didn't help. The final answer fell to Google, where searching for the error directed me to a page where they told me to alter the value for the Z printing. I later found out that the value (for whatever reason) was defaulted to 0; obviously the printer can't print layers of size 0 mm. I changed it to 2 mm and told it to go, where the printer had no problem starting it up. However, the time required to go through the printing was about 90 minutes, so I went and worked on some other stuff while waiting for it to print, assuming it would have no problem successfully printing the top. Sadly, I came back to realize the printer had stopped with about 30 minutes left.
The problem was that the top had begun to cool after sitting on the printer for so long and the cooling caused the material to contract, warping one of the sides and essentially making the entire piece worthless. I, of course, just assumed this was bad luck, but moved on to attempt to print the bottom and pcb before trying to top again because I figured I could deal with the warping problem later. The bottom began printing and didn't run into any problems, but I noticed there seemed to be able this random stuff added to the print as it went along. After about two hours (which I spent watching the printer because I didn't want it to warp on me again), the bottom was finished; however, it looked nothing like the picture. Apparently, to help print stuff correctly, 3D printers will add this thing called a raft to the bottom of the item. Essentially it helps successfully print the item and allows it to stick much more easily. On top of this, it also builds supports that help keep stuff off the ground and allows it to not completely fall over and crash, or simply sink into the middle of the item. I, of course, knew none of this. I just assumed this raft thing and supports were bad so I removed the raft and starting playing with the values for the Z heights in an attempt to allow the printer to print my stuff without this random stuff that were not part of my creation.
Needless to say, I then really began running into problems. I tried printing the PCB at a higher Z value without the raft and it ended up being completely unable to stick and would drag the already printed parts all over the board, completely unable to actually print the thing I wanted it to print. I probably tried 3-4 different things until, through dumb luck, it actually printed a completely functioning PCB. This was great; it meant I could definitely print things without the raft and I wouldn't have to deal with supports or anything. How wrong I was.
I then went back to the top while attempting to carve the raft and supports out of the bottom. I had spent at least 6 hours now trying to print these things and just wanted to get a working version. If I was able to successfully print the top without the raft or supports and I was able to successfully carve out the bottom and get rid of the raft and supports I could have everything done in no time at all. The printer, of course didn't like the concept of printing without the raft, however, and so took at least 4-5 tries until one set up actually stuck. I was ecstatic one finally worked, but not 10 minutes later, to my horror, I realized the warping was back.
One entire side of the top was being popped off the board and quite soon after the printer got caught in one of the holes and began dragging the entire object all around the board. I had to stop and, again, try printing this thing but also figure out how to deal with the stupid warping of my items. To fix this, I let the printer print a few layers then took just a couple pieces of tape and placed them on either side of the object. Although it caused a little disfunction at the area, the overall object was not hurt that badly and, with the warping problem mostly gone, I was able to get a copy of the top without a raft or supports. The copy was somewhat terrible because I hadn't had a raft, but after the 8-ish hours, I was just happy I had something with which to work. I then went to the bottom and printed it inverted, so this time the supports would actually sit outside the case and were far easier to remove. Without the raft, the copy wasn't phenomenal, but it certainly worked a lot better because it required so much less detail than the top.
Of course I then went online the next day and actually read about rafts and 3D printers and how to successfully print stuff. I learned how the raft works and what it does and how to remove it. With that in mind, I went back to my printer that afternoon and again tried printing the top (I kept the bottom and pcb because both were mostly fine). This time, the top looked fine but I had to remove the raft. Using a scraper and brute force, I was able to wedge the scraper between the raft and the top and, after a little fiddling, was able to pop the raft right off. The top looked perfect and I couldn't have been more happy. Thus ended my saga of 3D printing mishaps.
Step 3: Wiring Everything
This was the easy part. The creator did a wonderful job walking through the process of attaching the wires and soldering everything together. The buttons were a little tough because every time you press the button in the slots of the PCB, it would cause the button to press down; then, when you let go, it would let the button go and cause the button to just generally not sit well in the slots. I did my best to solve this by taping the buttons down on the opposite side, then getting the right length of wire for each section. I would then strip the wires and create loops at each end which could easily slide over the button leads and would stay there without too much trouble. I could then solder each wire. This didn't take very long and, although I messed up once, wasn't too much trouble. The only screw up I had involved soldering the wire in the wrong place, which then meant I had to unsolder the piece but, because of the way I had soldered it, made it extremely difficult to get the solder out from between the top of the button and the PCB. To solve this I just took a pair of wire cutters and cuts off both sides then poked a new hole through the PCB, attaching a new button. This is why you get more than the bare minimum as far as materials go.
After the buttons, I worked on the LCD and soldered all of that together. This was again pretty straightforward and I didn't run into many problems. The next step was soldering the right angle male headers to the Arduino, which was simple enough. Of course, I ran into a problem later because of this, but I'll talk about that once I get to that spot. Soldering each side separately worked really well, and making sure each side had each of the wires needed for the side connected before soldering was extremely effective and worked quite well. I would slip the wires through the holes then bend them over so they would stay in place. After putting a little solder around each, I would trim the excess wire then re-solder anything that needed it.
Step 4: Testing the Device
After mostly everything was wired up, it was time to test out the device. I wanted to make sure everything functioned, and that I would be able to use the device once it had been programmed. This meant I needed to use the FTDI adaptor and plug it into the right angle male header I had soldered to the Arduino. However, as I mentioned earlier, I ran into a problem with the male header. When I had bent the header I hadn't really considered the size of the pins. I just sort of went with what I had and assumed it would not be a problem. This, of course, resulted in the pins not being long enough to actually connect to the Arduino. I had to unsolder all the pins from the Arduino and make a new header to plug back in. The hard part in this case was gaining access to the Arduino as it was rather firmly attached to the PCB and LCD. With a little finesse and some solder wick, I was able to remove the male header. After that I cleaned out the rest of the solder with some more solder wick then wiggled the new male header into place. After soldering it, I was able to connect the FTDI adaptor to the Arduino and begin attempting to program the device.
The program was pulled directly from the original plans for the MAGPI.
Program is here: https://github.com/zippy/magpi
I re-named the folder that held the file to MAGPI then opened it up in my Arduino interface. The program required three different libraries after looking through it, so I grabbed two of them mentioned in the README.
First library: https://github.com/adafruit/Adafruit-GFX-Library
Second library: https://github.com/adafruit/Adafruit-PCD8544-Nokia...
I also renamed these. The last library wasn't on the README, but I could tell the library was called Bounce. With some help from Google I was able to find the library called Bounce2.
Bounce2 library: https://github.com/thomasfredericks/Bounce-Arduin...
However, the program called for just Bounce so I fiddled about with the previous versions of the Bounce library to try to get one that functioned with the code. None of them worked. Not all was lost, however, as I simply swapped the library out for the Bounce2 library and, luckily, everything worked perfectly anyway. The LCD screen lit up and the program began running. I was able to easily run each of the three games (Drawer, Catcher and Snake) as well as access the options menu. The only mistake I found was I had wired the right button to the left button pin of the Arduino and the left button to the right button pin. After playing with it and making sure nothing else was wrong, I delved into the code and changed it so the two pins were swapped. The versatility of the Arduino in this case was great; you can wire it up just about any way you want, you just need to alter the code slightly to fix any differences. The final step was inputting the battery and battery charger into the bottom of the case, and then snapping the pieces together.
Step 5: Wiring the Battery and Charger
This is when I ran into real problem. I hadn't purchased the same items required for the device, so the battery and charger both ended up being slightly too big. The charger wasn't too much of a problem as I was able to shave off the left side guard and it fit quite snugly into the area between the right guard and one of the button supports. The battery wasn't going to be able to flatly fit into the area, so I tried putting it in at a small angle. This seemed to work and, because of the angle, didn't move at all once the device was closed without needing to glue down the battery or anything.
The USB charger also had the issue where it had to stick out of the top of the Arduino. While the other charger called for a micro-USB charger, which would have allowed someone to slide a small cord into the hole on the device to plug in the charger, this was not going to work for my device. The charger needed to stick out slightly which would allow it to be directly plugged into a USB port - no cords required (although a USB-USB connector is nice). The switch and charger were then glued in place and the final step had to take place - soldering the switch and ground to the charger.
Now, if you look at the charger I was supposed to get, you can see that it has two nice little holes for positive and negative. This would have been great and made the soldering pretty straightforward. In my case, however, I had a different one and this one didn't want me to attempt such a simple process. Instead, I located the positive and negative wires on the battery and then carefully soldered the positive wire to the switch and the negative wire to the ground on the PCB. This was a little difficult but a little bit of careful soldering makes everything work out fine. With that in place, I folded the top part of the case onto the bottom part, snapping the case together.
Now the moment of truth was here - I had charged the battery and everything should have been wired up correctly. I only needed to hit the switch to make it turn on, and, when I did, it lit up exactly like I wanted it to. The battery had been successful and the charger worked out great, despite the small changes in items used. Now it was time to actually play with it.
Step 6: Playing With the MAGPI
I was able to try out each of the games. The Drawer, to me, seemed like a pretty neat little program and was honestly the most effective. The Catcher game was actually pretty difficult as the rockets thrust in the opposite direction of what you might expect (that's a designer's choice though so we can let it slide). The Uber Snake game played out just like one might expect, but it seemed to crash after about 10-15 rounds of eating a snack. I'm not actually totally sure as of now why this might be, but I'm probably going to look into the code to see if I can figure out the reason. Perhaps it just rather intentionally wants the game to end after a certain number are eaten. We'll see as I work through the code.
If I can, I want to go a little further with the device. I want to add a few more games (Tetris would be sweet), so we'll have to see what I can achieve in that regard. My ultimate goal would be to somehow actually add a Gameboy Emulator and run actual Gameboy games, but I feel like that might be outside the capabilities of the Arduino. We'll have to see what I can do.
Overall I really enjoyed the project, and I got a lot out of it. The Instructable was extremely well done, and I want to say thank you to Zippy314 for creating the device, as well as my advisors and assistants Dwight Whitaker, Tony Grigsby and Joseph Long for their help in creating my own MAGPI. I hope that my documentation of what I went through when creating my own MAGPI helps other who run into similar problems; best of luck to anyone who creates one.