Monday, October 21, 2019

3D Printed Stargate: The Journey

On August 17, 2017, my Dad texted me this link of a 3D printed Stargate with lights and movement:

https://www.thingiverse.com/thing:1603423

...thus inspiring my foray into the world of 3D printing. My Dad started 3D printing several years ago, and my friend Peter even longer ago than that, so while I'd seen printers in action before, for whatever reason it never held much pull on me. I'm sure partly that was because I already had enough other hobbies that I really didn't need "one more thing" on which to spend my time (and money). At least, until I saw that moving / light-up Stargate model.

I knew very little about 3D printing, except that prints could take an incredibly long time. Years ago I remember when a friend and I asked Peter to print a Star Trek: Deep Space 9 station, and after the first couple layers were down, he told us it would take another 24 hours to finish! That was basically the extent of my knowledge. (I chuckle as I write that now, because many of my prints nowadays take 24+ hours).

Over the past couple years as Dad has gotten into printing, he's created some gorgeous gifts for my Mom and also for my wife (for instance: a vase and roses for Valentine's Day, and a Beauty and the Beast jewelry container), and has offered to print things for me, too. Knowing practically nothing of the time and effort that it takes to get quality prints, I sent him a bunch of links for stuff I'd like, like tokens for one of my favorite board games, and paint racks for my miniature painting paints (unbeknownst to me until later, getting the paint racks to print successfully was no small endeavor in experimentation, and even once Dad had the right settings, it still took a day to print each rack). It's been so much fun watching Dad get into this hobby, and to see Mom cheering him on and sharing in the successes and not-so-successes.

After realizing that thingiverse.com held a treasure trove of Things I'd like to print, and feeling like I'd be taking advantage of my Dad if I kept asking him to print dozens and dozens of links, I decided I'd get my own printer. Besides all the other random things I wanted to print, my ultimate goal was to print that working Stargate. I asked Dad and other friends who had printers for their recommendations, and bought a Creality CR-10 in August 2018.

I came into the hobby rather naively (optimistically?), and grossly underestimated how much time 3D printing takes. I don't mean the printing itself, I mean all the behind-the-scenes overhead, like getting a level print bed (I'm convinced this is impossible), cleaning up from failed prints, replacing clogged nozzles, upgrading bits of hardware, configuring a print server (OctoPrint), or installing new firmware (which took the better part of a full day for me to figure out). When the printer is working, it's great! But there are just so many random things that come up that will suck away hours at a time. I wasn't prepared for that going into it, and definitely more than once thought "I'm never going to get this working." But Dad was always there to answer my questions and send me video tutorials and other links to help. And even over a year later I'm still asking him questions (see earlier comments about the firmware - Dad helped me a TON in navigating that experience!).

Each of these pieces took ~24 hours to print

Back to the Stargate project itself. According to the webpage, it has 117 parts, and some I could see were very finely detailed, so I spent a few months getting the hang of printing in general (and tweaking my settings to get better quality prints) before starting in on a project that complex. I started experimenting with my first Stargate pieces in December 2018, opting to start with the most intricate first: the backside of the gate. Each piece took roughly 24 hours to print, then I'd write a number on it, change another setting or two and try again, keeping notes along the way so I could track what gave the best results. It took me roughly three weeks to fine-tune my settings for the high level of detail, with lots of "that's not quite good enough" results along the way.

After going through an entire spool of filament just on my experiments, I started printing parts "for real" sometime right before Christmas. Since I'd honed my high-precision settings already, printing the real pieces was fairly straight-forward, albeit time-consuming. The creator had written "total estimated print time: 112 hours," but I don't know what settings he used that could possibly print that quickly, since (for instance) each of my nine back-side-of-gate pieces took 12+ hours a piece. All told it took me three or four weeks to print everything.

Before trimming/cleaning
After trimming/cleaning

In reading and re-reading the original Stargate model page, I started looking at the builds other people had posted of their Stargate construction projects. One person's in particular stood out to me because he'd expanded upon the original design to add a web page interface for dialing the gate, a speaker to play sound effects, as well as designed a custom circuit board for the electronics. He also had a more thorough set of instructions. Based on his revised design, I started ordering electronics, which was it's own very stressful journey owing to the fact I haven't done anything electronics-y since 9th grade electronics class. I remember reading the lists of required parts and thinking, "I have no clue…" - what on earth is a PCB, LDR, or a Buck Converter? (The answers, I learned, are: "printed circuit board", "light dependent resistor", and something that changes voltage so you don't fry your electronics).

The PCB/printed circuit board came from a manufacturing facility in China, as did all the surface mount resistors, transistors, LEDs, and the like. Dad warned me in advance "are you sure you want to do that…" because as it turns out (I should say, as he already knew, and I was about to find out), the surface mount electronics are TINY!

Electronics in hand, in early January I started visiting Dad for electronics workshops. He got out his soldering equipment, including fine-point tips and tools for holding those miniature transistors in place. Dad asked me again if I was sure I wanted to use the PCB and tiny tiny tiny electronics vs a breadboard with larger, easier-to-handle pieces; I persisted because 1) the PCBs came in a minimum order of 10, so even if I messed a few up in learning, it didn't matter, and 2) I really wanted all the electronics to fit internal to the Stargate vs having to house them externally somehow. We went to work. My first solders were ugly, but functional; by the end though I could definitely see a difference in my soldering quality.

By March 2nd, we'd connected together the Raspberry Pi, motor control circuit board, and Stargate PCB + buck converter, and connected the thing to the motors that would spin the gate and lock/unlock the top chevron; My Mom captured a video of me running a test program on the Pi that would just spin the motor, and me looking very excited and saying, "I drew a star!"



What on earth does THAT mean? It's an old family story - when my Dad was first getting into computer programming (in the early days of personal computers), he excitedly called my Mom into the room so he could show her that he'd drawn a star on the computer screen. My Mom lovingly said (or maybe just thought to herself), "so? If you give me a paper and pencil I can draw a star for you," until Dad explained more about how complicated the programming was, etc. Since then, it's been a comical story my parents tell whenever something looks easy but in fact took an incredible amount of time/effort. As was the case with drawing my "star"[gate].

The next day, I hit what I'll affectionally call one of my most frustrating "roadblocks" :

You might notice in the photo that the hole from the backside of one piece doesn't line up with the hole on the left side of the front piece. It's hard to explain in words, but if you look at this next picture, you can see the Stargate pieces glue together in an overlap pattern:

...and I'd superglued the overlap going the wrong direction. Had I used the original designs for these pieces, it wouldn't have happened, but because I wanted fewer visible seams on the gate I opted to use double-sized pieces that someone had posted; I never pieced together (pun intended) that these might need to be glued in a particular way. So, this was a major bummer, because it meant needing to re-print everything you see in that photo, and I was almost out of filament, and the company was out of stock of that color for the next month. Re-printing took over a week (and luckily I had just enough filament left!), and it gave me an opportunity to tweak my settings yet again to get a slightly better quality. Long after the fact, I thought of a way I easily could have worked around my gluing goof (aka, just using one or two normal-sized pieces to fix the off-set), but, I'm still happier with the end result of re-printing.

Between March and September I procrastinated, and I can cite a very specific reason why: I procrastinated because of my fear of failure. In this time period, I was having difficulty getting the gate symbols to spin smoothly - I could spin the ring by hand, but it would "stick" whenever I tried putting it on top of the motors (not enough torque, I guess). I was terrified of gluing everything together and then not being able to spin the symbols, and having to start over. My own perfectionism was my enemy.



Finally I spent an afternoon "just doing it": I bought and sprayed a plastics lubricant in the track, shaved off some plastic from the symbol ring clips that were catching on the edge of the track (the symbol ring is five pieces glued together in a ring, with small "clips" between pieces that help hold them together), filed down the backs of those joins, and got the whole thing to spin smoothly with the motors. Whew!!

Next challenge: the LEDs. There are nine chevrons around the gate, and each has three surface mount LEDs. I had an evening of despair after struggling for over an hour to solder together three LEDs and their wires onto the tiny LED holder I'd printed. I had no idea at the time how to test if my soldering was even good, and I learned the *wrong* way to test is to plug directly into 12V power. "Pop!" went the first LED. I nearly cried. I couldn't imagine taking over an hour to solder each of the chevrons. I texted my Dad and he said he had tools that would help (like self-closing tweezers and the fine point soldering iron he'd had me use before). Got together with him a couple days later and boy did having the right tools make all the difference. In only a couple hours at most, I'd soldered nine sets of LEDs, and also the two strings of LEDs for the ramp.

I'd printed LED holders someone designed for the Stargate that would position them exactly under each chevron, and twisted the wires so the LEDs lined up, then glued in place. Prior to gluing, I soldered each of the LED sets to longer wires that would run out the bottom of the gate and connect to power+ground (thanks to my Dad who supplied the super thin wire!), and test connected everything into the wires coming from the PCB. I also modified the webpage and server code so I could easily turn on/off each of the LEDs using a touchscreen I'd bought for the Raspberry Pi. This made it SUPER easy to figure out which light was plugged in where later on.

With all LEDs working, I began the exciting task of putting the wires and LEDs into their final position and gluing down the top pieces of the gate. I tested each as I went and surprisingly / thankfully ran into no issues.

That is, until I glued the last piece down and was faced with a bundle of wires sticking out the bottom of the gate. Around this time, I realized I'd never marked which two of the eleven wires were supposed to plug into 12V power. Oops. Paranoid about frying my LEDs now that everything was superglued, I managed to use a multimeter to figure out which wires I wanted (fortunately I hadn't glued the chevron covers on, so I could still stick a probe in to touch the LED wires inside each chevron). I then marked said wires with electrical tape so I wouldn't lose them again :)

After testing all the LEDs "one last time," I started final assembly of the ramp base, taking time to run all the wires nicely through the little wire holders, and of course finagling/weaving all the gate wires through the base.

Fully assembled, I booted the Pi and told it to "home" the gate - if you'll recall my construction goof earlier concerning the small hole, this allows an LED to shine through the gate to the light sensor / LDR on the other side, but only when a particular symbol is lined up; that way the software knows the gate is at "home."

As the gate spun and spun, I discovered two issues. The first is that, despite all my efforts for a smoothly spinning track, the gate was catching in two specific spots. My worst fear. My best guess is I didn't file/smooth out the bottom side of the track enough, and/or that I hadn't trimmed off the printing brim from the gear teeth. I took the gate off, sprayed a ton of plastic lubricant in through the bottom opening and manually spun the ring to get it all around; I also propped the gate up slightly off its base, just a few millimeters, so it didn't sit as tightly on the gear. Between those two remedies, the gate began to spin fully around without catching.

But it kept spinning. And spinning. And never found "home". This was my second issue: I'd assembled the LED and LDR pieces on the wrong side of the gate, and because the see-through-hole was offset from center, the light was in the wrong place and couldn't shine through. It wasn't a huge deal, but still tedious to remove the gate again, unscrew/move/re-attach/re-wire the LED and LDR pieces. Even after lining everything up correctly, though, the LED I had wasn't powerful enough to trigger the sensor, so I went back to my local Radio Shack (whom I lovingly call "Dad") and he had a brighter LED he gave me, which worked more gooder.

Had a couple more issues come up, like the motors spinning in reverse direction (easily fixed by swapping two wires around), and the top chevron not moving up and down smoothly (eventually "fixed" by spraying in a TON of that plastic lubricant), but otherwise, at long last, the gate was finished! I took a video and sent it to my parents, and also of course grabbed Alissa and said "come see! Come see!!"

I'm really proud of how this turned out. I enjoy projects (like this one) that are at the edge of my current abilities; I had a lot of confidence on the software side, but not a lot / any experience on the electronics side of things, but with my Dad there to guide me, it became much more manageable. I've learned a LOT from where I started, and am feeling more confident to tackle other 3D printing + electronics type projects (next up: a Star Trek Next Generation warp core). Things I worried about early on (like the seams showing between pieces of the ring) aren't nearly as visible as I thought they'd be. And I was able to make modifications to the code that I'll publish back to Thingiverse, that might help a future builder when they build their Stargate. If I do say so myself, this thing's pretty darn cool.

Lastly, if you're wondering how much it cost... I'll admit the number surprised me. Here's a rough breakdown:

  • Filament: three rolls at $18 each, plus a couple other colors that I only used a bit of, so let's say $60
  • Raspberry Pi 3 B+: $56
  • Motors, motor circuit board, other electronics from Adafruit.com: $80
  • Touchscreen for Raspberry Pi: $80
  • HDMI cable: $8
  • Power adapter: 2 for $14, so $7
  • Printed circuit board from China: $20 ($2 for 10 boards, and $18 shipping…)
  • LEDs, transistors, resistors, and other various electronics from LCSC: $21
  • Superglue: $5
  • Wires, tools, solder, buck converter, other electronics and tools: free from the RadioShack of Dad

Grand total: $337. (Shhh don't tell Alissa! :)