JANET LIUHow to Make (almost) Anything

##[Final Project Link](https://docs.google.com/presentation/d/1rbn-UgYx9PsK98j7RIXRmxPOGq48uhap2KwyKwCN0zc/edit?usp=sharing) ## Settlers of Catan [Settlers of Catan](https://www.catan.com/) is a board game that I used to play a lot in high school with my friends. When the pandemic hit, I would also play [online](https://colonist.io/) just to pass the time and hang out with friends across the continent. Now, I want to make a fancier version of Catan that is both artistic and functional. ## Game Pieces and Setup Catan has a main board that is built by a bunch of smaller hexagonal pieces (blue hexagon below). Each piece is one of 6 resources: lumber, wool, brick, ore, grain, and desert. These pieces are randomly shuffled and placed with every new game. The desert piece is always in the center, and desert gives you no resources. On top of the pieces are a bunch of smaller circular pieces (blue circle) with numbers on them. These number indicate the rarity of the resources, as determined by the rolls of two die. On the outside of the hexagons, there are also ports (green square). These ports allow players to trade in resources for other resources. For example, a player with access to the port may be able to trade in two wool resource cards for one wood resource card. <figure><img src="../images/full/14/catan_board.jpeg" width="500"/> </figure> Aside from the board itself, each player also has settlements, cities, and roads (all in magenta). Each of the three pieces take different resources to build, with cities (bezeled rectangle) being settlement (hexagon) upgrades. Roads (rectangle) need the fewest resources to build, and at least two roads need to be between each settlement or city. Lastly, there is a robber piece (green oval). The robber "steals" all the resources from whichever hexagon it is placed on, so players cannot get that hexagon's resources. Whenever a player rolls a 7, they get to move the robber to a different hexagon. ## Vision for Catan My vision for Catan was to create a playable board game that computerized all of the randomization. I also wanted to create a more 3D and artistic board. The idea was to have a plywood base with insets in it for the hexagonal pieces, roads, cities, settlements, and ports. Each hexagon would have a set of 12 LEDs that determined resource rarity and type. The rarity would be determined by how many of the LEDs were lit, and the type woudl be determined by the color of the LED lit. This information would all be controlled by a mastermind microchip that randomized the location and rarity of each resource. I wanted to cast the hexagonal pieces out of resin, putting little 3D printed pieces and shapes in it to signify which resource the hexagons were. The players would put the hexagons into their appropriate slot before playing, dependent on the LED color generated by the microchip. The other game pieces (ship, robber, settlement, city, road) would all be 3D printed. I envisioned these pieces slotting into the plywood base, so they wouldn't shuffle around if the board got accidently knocked (a common problem with the original board game). The robber would be a black hexagon cap that covered the entire hexagonal piece, blocking out the light from underneath + the resource visuals itself. All of the electronics would be easily turned on by one power button, with power coming from a wall outlet or battery. I want to also try to have a reset button, which will control when the lights get re-randomized. ## Who's Done What? There's been a lot of versions of Catan that people have built online. I spent a long time surfing reddit and youtube and looking at everyone's cool takes! I took inspiration for my own resin parts from two different people: [resin pieces](https://www.youtube.com/watch?v=IrLPylv0vwo&t=45s) and [relief pieces](https://imgur.com/gallery/suKRm). I didn't quite like the look of the resin pieces (a little to dark and formal for my tastes), and I didn't quite like the scratchy exposed look of the relief pieces. I wanted to combine the two a bit and have a clear resin piece that would expose the light underneath, but also have smaller 3D pieces/diorama elements embedded in the resin to depict the resources. Sam March made a [super cool version of Catan](https://www.youtube.com/watch?v=-KFn-UJvDVc&t=606s) that I modeled a lot off of. He didn't do any of the [electronics](https://www.youtube.com/watch?v=BDRLvolLdK4) production himself, and I didn't quite like the design he made personally. It was as bit large/clunky for my tastes, and it didn't have some of the modifications I wanted to add (computerized random numbers, slotted game pieces, artistic aesthetic, etc.). But, I loved looking through his process and definitely took inspiration from that. ## Materials * 3/4" Sande Plywood -- Home Depot, $32.09 for a 2' x 4' slab. * PLA filament -- already in the lab * Electronic components * ESP32 WROOM 32E microchip * Resistors (5 0 ohm, 2 10k ohm, 1 1k ohm) * Capacitors (1 uF and 10 uF) * Voltage Regulator, 5V to 3.3V, 1A current * 2 push buttons, 1 slide switch * 1 red-orange LED * 1 FTDI 6pin connector * 2x5.5mm female barrel jack connector * 1 Micro SD Socket * 5V, 2 Amp wall outlet barrel plug * Acrylic -- already in the lab ## [CAD](https://cad.onshape.com/documents/38cc6fa6ebed775eb3fb7383/w/dcd583897a332bb734303bff/e/8f3257afcfdd68cf72393b41?renderMode=0&uiState=61898518ccde8f0c5eacb365) I began by designing everything in Onshape. Again, I have experience with Onshape and it's all online, which made moving between computers convenient (when I had use programs on the shop computers). I started out by designing the individual hexagon insets. There were two nested pockets in the hexagon. The lower one was for the electronics/LEDs to rest, and the upper one was for the resin pieces to rest on. I also slotted a hole in the center for wires to pass through. When I first designed it, I actually created the wrong number of sides, making a pentagon instad of a hexagon. <figure><img src="../images/full/14/clown_pent.png" width="500"/> </figure> After realizing my issue, I redid everything as a hexagon (this took a lot quicker than before). I also filleted all the corners to make it machinable (since fit actually matters for the inserted resin parts and electronics). Below is a labelled photo that depicts my initial vision. <figure><img src="../images/full/14/labelled_piece_hex.jpeg" width="500"/> </figure> After I had the individual hexagon designed, I stuck it all in one large assembly. I also designed in context a part that bordered all the hexagons and contained the ship slots. <figure><img src="../images/full/14/full_board.png" width="500"/> </figure> Then, I went to town on designing the hexagon and smaller pieces. The hexagon itself was really easy to make, since I could just design it in context and use the existing slot. Initially, I thought I would leave the center of the hexagon without any 3D printed pieces in it, so I could have 12 LEDs in a circle to depict rarity. After talking to Rob about my LED options and taking a look at how much space I had in the hexagon piece (it's about 2.1" from side to side), I decided instead to space 12 neopixels evenly around the hexagon, and distribute the 3D printed parts evenly throughout the entire hexagon. The robber hat and road was also designed in context, and also pretty easy to design! The other three pieces were a bit more complex. I decided to make a little hut for the settlement, and then a castle for the city. The boat was split into two parts, so I could detach the pole and thread on a fabric/paper flag with the port trades on them. Here are all the smaller pieces in the board, assembled to make sure that they didn't intersect with each other: <figure><img src="../images/full/14/checking_tolerances.png" width="500"/> </figure> After actually soldering on all the LEDs, I realized that it looked a little ugly. I then created these covers to hide the LED wiring, with holes to let the LED light through. <figure><img src="../images/full/14/with_withoutpaper.png" width="500"/> </figure> Lastly, I designed an encasing for the PCB electronics board. First, I milled out and created all of the electronics board. Then, I measured approximate areas and depths to sketch out the enclosuer in cad. This took a lot of different iterations, especially since I had to create a movable button to press the button on the PCB board. Joon also gave me a really help recommendation to actually print the button part, which invovled creating 2 pieces. This allowed my part to be printedd on a flat face, as opposed to a raised button edge. After a lot of trial and error (like 5 different prints), I finally found a way to design it that worked for me. Noteably, I attached the button enclosure at the very bottom with one layer of 3d printed material. Then, after the printing was complete I was able to successfully remove the material with a thumbtack and make the button move. Joon's recommendation | Final CAD | :---------------:|:---------------: ![](../images/full/14/joon_3dprint_recs.png) | ![](../images/full/14/button_cad.png) ## PCB Design and Production <figure><img src="../images/full/11/good_board.png" width="500"/> </figure> For comprehensive documentation of my PCB design and production process, see [week 11](../11_network_com/index.html). ## 3D Printing 3D printing the parts took a lot of time, but was fairly straight forward after some time. I was able to figure out the best face to print all my parts on, and Joon showed me how to add brims to my more delicate pieces to make my prints safer to print. My 3D printed game pieces are below, I tried using dark blue and gold filament, but they came out a little weird/uneven. The gold especially was uneven. blue game pieces | gold game pieces | :---------------:|:---------------: ![](../images/full/14/uggo_blue.png) | ![](../images/full/14/uggo_gold.png) After reprinting the blue game pieces and using a different face, I had game pieces I was really happy with. I also printed out the boats for the harbor trade values: final game pieces | boat | :---------------:|:---------------: ![](../images/full/14/3d_print_fits.png) | ![](../images/full/14/boat_with_stick.png) Next, here is the moving electronics enclosure with the button: <video width="500" controls> <source src="../images/full/14/button_press_success.mov" type="video/mp4"> </video> And here is the electronics cover protecting the electronic LED wiring and the robber hat coving the acrylic resource pieces: electronics cover | robber hat | :---------------:|:---------------: ![](../images/full/14/with_withoutpaper.png) | ![](../images/full/14/robber_hat.png) ## Machining To machine my plywood board, I created a drawing in Onshape to export as a DXF file. Then, I put that file in Rhino so I could join all the line segments together and place them on separate layers. Finally, I took the Rhino-processed DXF file into Aspire to create the toolpaths. I ended up creating three different toolpaths. The first one was with a 1/8th endmill, and cut out all of the pockets and main shapes. The second one was with a 1/16th ball endmill. I needed to use a smaller endmill becuase I needed to create profile cuts. This second cut was a little trick, since my geometry wasn't exactly a pocket or a strict profile. Instead, I wanted to cut between two different lines. To do so, I ended up doing an exterior profile on one side of the lines and an interior profile on the other lines. The 1/8th endmill would have been too thick to use for these profile cuts. Lastly, I switched back to the 1/8th endmill to cut out the outline (with tabs). Here are the final toolpaths: first go around, 1/8th | second go around, 1/16th | last go around, 1/8th | :---------------:|:---------------:|:---------------: ![](../images/full/14/eigth_cuts.png) | ![](../images/full/14/sixteenth_toolpath.png) | ![](../images/full/14/eigth_outline.png) Here is the board through the different phases of machining and finishing: testing the 3d print fits | sanded with 320 grit | first rub with tung oil finish | second rub with tung oil finish | :---------------:|:---------------:|:---------------:|:---------------: ![](../images/full/14/3d_print_fits.png) | ![](../images/full/14/sanded320grit.png) | ![](../images/full/14/first_rub.png) | ![](../images/full/14/second_rub.png) ## Assembly Now that I had my plywood milled out, I had to solder in all of the LEDs. This took so much time, since this meant cutting out each neopixel, soldering all 57 together across different hexagons and parts of the board. I used the shop's rainbow wire to do this, since I wanted the wire running between hexagons to be pretty secure and stuck together. I also made some soldering mistakes when I turned hexagonal lines, since I wired the D-in and D-out pins on the Neopixels incorrectly. After running some test code to light up all the Neopixels, I quickly found my problem and resoldered things on correctly. Here is the final wired board: wired | lit and working! :---------------:|:---------------: ![](../images/full/14/wired.png) | ![](../images/full/14/lit_n_working.png) ## Electronics Testing and [Programming](../code/final_project_code.ino) I first tested the Neopixels to see how the brightness looked. My initial idea was to have the brightness of the LED denote how rare the resources were (with darker LEDs being more rare). This turned out to be a failure, since the LEDs did not have nearly enough gradation to actually see this. Especially when the LED colors were all mixed among one another, it was hard to tell which color was actually darker or lighter. There was also the issue where a lot of the colors at "low brightnesses" would look just like shades of blue, becoming indistinguishable from one another (this happened with the white, green, and purple colors). After a lot of testing different colors, formulas for brightnesses, etc, I realized this just wouldn't work. Thus, I switched to using Firebase to display this dice rarity information. See [week 12](../12/index.html) for more info. <figure><img src="../images/full/14/diff_brightness_led.png" width="500"/> </figure> Then, I tested writing to the MicroSD and all 57 Neopixels using [this](../code/microsd_test.ino) and [this](../code/neopix_testing.ino) code. The MicroSD code was pulled from [here](https://randomnerdtutorials.com/esp32-microsd-card-arduino/), with modifications to test using the onboard button. These both turned out to be successes! Randomizing the neopixels took a lot of time and troubleshooting. I created various dictionaries to store the color information, deal with randomization of placements, etc. I had an issue where my dictionary was missing an element, which threw off all my Neopixel displays. Here, you can see how there are multiple dark hexagons when there are only supposed to be one: <figure><img src="../images/full/14/issues.png" width="500"/> </figure> Finally, I got it to work and all the LEDs were correctly randomized with the right number of resources! <figure><img src="../images/full/14/functional_prog.png" width="500"/> </figure> Then, I had to write the board setup data to the MicroSD. This way, if power got accidently cut out or we wanted to pause the game, you could pick up with the previous board setup. This turned out to be pretty difficult, since the code I had tested with read/wrote in arrays of characters. However, my board setup was all stored in arrays of integers of unsigned 32 bit longs. To write to the file then, I iterated through my arrays and converted the int/longs into char * arrays. I ended up writing each hexagon position's data as a separate line. Then, I decided to modify the reading function to both read data and set the Neopixels at the same time. This also required more modifications, since I had to read it as a char * and covert into the right data structure. Lastly, I decided to check for different types of button presses to determine if the users were trying to reset the board or roll the dice. If the user pressed the button for 3+ seconds, then that became a board reset and I re-randomized all of the hexagons. Otherwise, if it was a shorter press, this denoted a dice roll. I randomly rolled the die. If I rolled a 7 for the robber, then I turned off all the lights for 3 seconds before turning them all back on. This allows the user to see exactly what resources people have and strategically place the robber down. If the desert was rolled, the entire board was reset with all the lights on except the desert hexagon. If any other number was rolled, all the lights were turned off except for the resources with that number. In this way, users don't have to search for the dice rolls and can just follow the lights. Since using LED brightness to denote rarity did not work out, I ended up connecting to Firebase and uploading the dice roll data there (with the key of the hexagon position). See [week 12](../12_int_app_prog/index.html) for the full information. ## Acrylic Hexagon Pieces At first, I wanted to make the hexagonal resource pieces using resin. Check out my [molding week page](../08/index.html) to see my prototypes. However, I realized I did not have enough time to really wait for all the resin to cast. So, I decided to switch to acrylics instead. I didn't want to just cut out plain acrylic hexagons. I designed some simple line art to etch into each of the acrylic pieces: <figure><img src="../images/full/14/hex_art.png" width="1000"/> </figure> To actually etch it and be able to scale it to the right size, I vectorized my art. I imported my PNG file into Illustrator and used their line art image processing tool. This got rid of some of the detail, but was good enough for the etching. After using Illustrator, I exported the files as DXF into the laser cutter program. Inside the laser cutter program, I created two layers. One was for the etching, and one was to cut out the actual piece. I tested the different settings to see which was best for etching and cutting. I landed on 8mm/sec and 100% power for the outline cutting (8mm/sec based off of the datasheet and my acrylic thickness), and 200mm/sec and 10% power for my etchings. Finally, after cutting them all out, I did a lot of testing to see how the LED light shone through. Shining the LEDs directly through the acrylic made the etchings really hard to see, and didn't look the greates. I tried spray painting the back of the hexagons with paint to diffuse the light, and also used paper to see how that refracted the light. Here are some of my tests: with and without paper | spray painted red and with paper :---------------:|:---------------: ![](../images/full/14/with_withoutpaper.png) | ![](../images/full/14/red_test_paper.png) I ended up not spray painting the back sinc we didn't really have colors I liked. I did add papers below every electronic cover to diffuse the light more. <figure><img src="../images/full/14/full_board_eleccover.png" width="500"/> </figure> Then, I decided to actually paint/color the acrylic etchings to make them stand out. Without painting them, the etching just blended into the LED light/diffused it very messily so you couldn't really see the art. To do so, I just used some paints we had around the shop (one was a resin paint, and one was screen printing fabric paint). I rubbed the paint into the etchings, and then rubbed it off the top surface. This was a way longer and laborious process than I expected, and I don't know if the kinds of paints I used were the best. I ended up using a lot of acetone to remove the surface paint, and ended up with my different hex pieces! <figure><img src="../images/full/14/hexes.png" width="500"/> </figure> ## Final Result