Writers Winter Escape 2017

I just got back from my first writers conference and it was amazing!  It was the second year of the Seymour Agency’s Writers Winter Escape.  A huge thank you to the organizers and everyone who participated.  I’ve done one-day writers workshops/retreats before, but nothing as intense and rewarding as this one.

The highlights:

  • I learned a lot, including how to come up with a high concept pitch.
  • I met some really great editors and agents and other writers.
  • I think I found a critique buddy.
  • I pitched my current novel and my ‘play project’ and have requests from agents and editors for the full manuscript. Exciting!!!

And it took place on a cruise ship. We left from Miami and stopped at Nassau and Cozumel. My mom came with me; when I was in workshops, she was enjoying some down time reading by the pool. We did some excursions the days we were in port. The best (by far) was the Amazing Secret River.

It is a river cave system that was discovered in 2006 and first opened to tours in 2008. We took a ferry from Cozumel to the mainland and then a shuttle into the jungle. They equipped us with wetsuits, life vests, water shoes, walking sticks, helmets, and headlamps before we hiked further into the jungle. We participated in a cleansing ritual with incense made from the sap of a local tree before climbing down into the cave.

Mom & Me.  Glad we had the walking sticks.

Mom & Me. Glad we had the walking sticks.

There are four different tours, and we did the route called Enchanting. As soon as we were down in the cave, it wasn’t far to the first pool of water. There were steps leading down into it. The water was cool, but I didn’t think it was that cold. We kept moving and the wetsuits kept us warm.

From the entrance, we waded, and swam, and floated our way through the cave system. Most of the rock formations were named after food. There was Cauliflower and Broccoli, Popcorn, Bacon, and Cheetos. Swimming around and doing the little bit of dry-land hiking worked up my appetite. (This was a full day excursion and they fed us a delicious lunch of homemade tortillas, chicken, tortilla-lime soup, and salad after we got back from the caves.)

Floating through the secret river

Floating through the secret river

The journey through the caves was magical, and our tour guide, Diana was fantastic and knowledgeable. The cave system was recently discovered, and researchers are still studying it. They keep the groups small, so there were only twelve of us.   The thing I liked the most was that they didn’t add anything to the caves besides the rough-cut steps going down into it and the wooden steps and handrail at the first pool. The only light was from our headlamps. There were thin strings looping between rock formations to lead the way. There was no dramatic lighting like you see in some caves. There were no handrails. No plank walkways. It was natural.

I cannot recommend this tour enough. I’m planning on doing this conference again next year, and if we make the same stops, I will do this tour again. Diana said next time I should request the Happiness tour, and if I can’t remember its name, that I should tell them that I want to go to ‘The Heart.’

They don’t let you take anything into the cave, and it’s not just a way to make money by selling pictures. You really need to pay attention to the tour guide, as some of the passageways are treacherous. You really do need both hands to move around safely. The photographer that was along with our group took some great pictures.

The USB came with a bunch of 'postcard' pictures - they're all amazing

The USB came with a bunch of ‘postcard’ pictures – they’re all amazing

We bought the pictures. When my mom went to pay for them, she was really confused when the girl handed her a keychain. She didn’t realize that it had a USB drive in it that had the pictures loaded onto it. They also included a bunch of wildlife pictures and pictures of the caverns. The entire excursion was well worth it.

It was a full day trip, and a lot of people stayed back on the boat to get some writing done. Part of me wishes I had done the same thing, since now I have some polishing to do before sending out the requested manuscripts, but the caves were magical, and I can write anywhere.

Elementary Cellular Automaton Circuit

I like blinky lights.  I also like projects that have some physical aspect in the real world.  So, when assigned a project of my choice in CS441 (Computer Architecture) I decided to build a programmable elementary cellular automaton.

A cellular automaton is a grid, a collection of states, and a collection of rules for moving between those states.  (Wikipedia is a great place to get started learning about cellular automata.  Follow the links and you’ll learn about all kinds of neat things, including Conway’s Game of Life.)  A cell in an elementary cellular automaton has only two states: on and off in the case of an LED.  Its rules for the next state are dependent on the cell’s current state, and the current states of its left and right neighbor.  There are therefore 2^8 (256) possible rules for elementary cellular automata, which are exhaustively enumerated in Stephen Wolfram’s A New Kind of Science.

The first part of the project, which was due back in March, was to create it using just the basic logic gates NOT, AND, and OR.  I used Logisim, an open source tool for designing and simulating circuits, since it was free and easy to use (we used it in CS441 to design and simulate a simple CPU).  Each cell in the cellular automaton has four inputs: its left neighbor’s state, its right neighbor’s state, its own state, and the program.   There are 2^3 (8) possible inputs to the cell based on its state and the states of its neighbors.  Three of the inputs (left neighbor, right neighbor, and self) are run through inverters (NOT gates) to cover all possible input combinations.  These inputs are ANDed together with the program and are then run through the OR gate to determine whether or not the output LED should be on or off.

I also added an individual set switch for each cell, so that its starting state could be modified.  The cells have a common clock and reset button.   I made a subcircuit out of three NOTs, eight 4-input ANDs, and one 8-input OR gate and then combined eight of these subcircuits into one main circuit.  I looped the cells around so that the one on the far right was the left hand neighbor to the one on the far left, and the one on the far left was the right hand neighbor to the one on the far right, forming a ring.

It worked!  This was the easy part of the project, since with Logisim simulation I didn’t have to take into account timing and propagation through the circuit.  (All of the Logism files for this project are available on my github repository, and you can download Logism from its website.)

Logisim is a great tool for simulation, but I needed something a bit heavier to design the PCB for the project.  KiCAD to the rescue!  There are countless PCB design tools available, some free, and some paid.  They all have learning curves.  I used KiCAD because Gregg had some experience using it and so I could go to a real live person for help when it was needed.

First thing with KiCAD was to once again, design the circuit.  But, because this is a real-life circuit and not a simulation, there were new issues to take into account: propagation delay, something to drive the LEDs, and pull ups and pull downs for the switches.  So, a dual D flip-flop was added to hold on to the value of the cell and not propagate it through the circuit until the rising clock edge.  A MOSFET and resistors were added to drive the LED, and a pull up and pull down resistor were added to the set switch.  The program board also needed some pull ups and pull downs, which I’ll get to later.  Right now, I’m just talking about each individual cell’s circuit board.

I wanted the cellular automaton to be modular, so I added some right-angle male and female headers to the design so that I could get the power, ground, clock, reset, the program, and the output of the cell to each of its neighbors.  The nice thing about KiCAD was that I just had to label all of the inputs and outputs on the circuit diagram and it connected them for me (as long as all the names matched-there were a couple of typos that needed to be fixed during the process!).

Now I had to assign actual components, and their footprints (footprints are important! They designate on the circuit board where the copper is going to go, and therefore where you’re going to solder each pin of each component), to the circuit diagram.  Time to go shopping!

First, the most important part of the project: some BIGBIGBIG LEDs.  Ah, the choices.  I decided on 10mm diffuse green ones, so that you could see the light even when not looking at it straight-on (they’re LUMEX SSL-LX100133GC).  I got dual 4-input ANDs (Texas Instruments SN74HC21D), an inverter (XNP 74HC14D-it’s got six inputs, but I’m ignoring three of them), an 8-input OR (Texas Instruments CD4078BM96), and a dual D flip-flop (XNP 74HC74D).  All of these parts were sourced from Mouser.com.  I was able to find footprint libraries for all of these components (and the resistors, which were already on hand), so I didn’t have to do any design work there, though there was a lot of consulting datasheets to make sure all the pins were labeled correctly.

Footprints assigned, pins checked, time to get to work on the PCB.  Oh, and what a rat’s nest to untangle!  (Rat’s nest is a technical term, and it fits!!!)

This screen shot was taken after a little bit of work had already been done.  Those white lines mark connections between components that need to be made.  And this was where the biggest learning curve was for me and KiCAD.  I had to move components into place and run tracks and vias to make all those connections.  Once a connection was properly made, the little white line would disappear, diminishing the rat’s nest little by little.  One of the things I liked about KiCAD was that it wouldn’t let me place a track or a via if it intersected another one for a different connection, and while this was a little bit of a pain, it was nice to have the program checking my work for me.

KiCAD also has some nice auditing tools, so once I thought I was done, I ran them to double check the work.  And then I went back and made some corrections, and then ran the audits again.  Wash, rinse, repeat.  Finally, everything checked out, so I added the copper fill for the top and bottom board layers.  And, because I had all the empty room on the back of the board, I decided to put my name on it.  So, I designed a little bit of text in Inkscape and imported it into KiCAD as a silkscreen for the back of the board.  Hell, if I spent this much time working on it, I was at least going to put my name on it!

I uploaded the PCB gerber files to OSHPark for printing.  Again, KiCAD makes this process relatively simple and straightforward.  If I ever design a circuit board for ‘fun’ again, I’ll probably use KiCAD.  And then I waited…and waited…and waited for the boards to arrive.

The boards arrived and it was time to solder…and solder…and solder.  There were something like 150 solder points on each board, and I had nine boards, so that’s 1350 solder points in total.  Wow.  A couple of hours at a time stretched over a couple of days.  It wasn’t so bad.  Next time, though, I’ll see about hunting down some solder paste and throwing it into an oven instead of doing all those little solders by hand.

And now it was time for the control board.  This was how I was going to get power, ground, clock, reset, and the program to all the individual cellular automaton boards.  I had an 8-position DIP switch for the program (with 2^8 positions on the DIP switch, we can get all 2^8 possible elementary cellular automata programs), just needed to connect some pull up and pull down resistors to make that work.  The tactile switch for the reset button also only needed a pull up and pull down resistor.  You can read more about pull ups and pull downs on wikipedia and here and more about MOSFETS here and here.

I decided to take the easy way out on the power, ground, and clock, and just pulled off of that from an Arduino.  The clock is a simple program that just sets the pin high for 500ms and then low for 500ms, giving us a 1Hz clock signal.  The clock rate can be changed in software, but I haven’t yet tried to see just how fast I can make it go…Yet.

So, with everything wired in and connected, the control board plugs in to the leftmost cell with some right angle headers.  Plug in the Arduino, set the program on the DIP switch, set initial cell(s), and watch the blinky lights!

(Note that a ton of testing was done throughout this process.  I just thought it would get repetitive to say “And then I tested it” to end every paragraph.  So, for the sake of narrative flow, I cut it.)

What I would have done differently: In a future iteration of the project (it is labeled v0.1 after all!) I would like to put some screw holes in the circuit boards so they can be easily mounted.  I would also like to see if I can make the circuit board a little smaller.  At $5.00/in^2 for three boards from OSH Park, it can get a little expensive.  It would also be interesting (and save a ton of board space) to redesign the circuit using a MUX instead of all the logic gates, or to use NANDs and NORs instead, since those use fewer transistors.  Another change would be to silkscreen the top layer of the board with labels for each component, because consulting the circuit diagram and PCB design in software got a little tedious for the first board.

Generating Support Structures for 3D Printing for CS480

For my second project for CS480, 3D Printing & Robotics I decided to implement the algorithms that select points and generate support bridges from the paper Bridging the Gap by Dumas, et al.  My selection of this topic was influenced by my decision to implement a neural network to generate support material for my master’s project. Bridging the Gap addresses the question of how to support overhangs in Fused Deposition Modeling 3D Printing using a minimal amount of material while maintaining stability of the model during the printing process.  The completion of implementing the algorithms provided in the paper means the completion of the beginning of my master’s project.

There are two basic approaches for selecting points that need support from a model to be printed.  They can be selected from an STL file by looking at facets with downward facing normals at angles that are above a steepness threshold.  The other method is to look at a binary difference of gcode slices; those points that do not have anything beneath them will require support.

There are many way to generate supports.  Old slicers used thick vertical walls.  Newer slicers, such as Slic3r and KISSlicer, modified these into sparser vertical walls with thick interface layers between the support and the model.  Other methods include tree-like branching structures such as those utilized in Formlabs SLA and MeshMixer, low-mass lattice structures, and low-mass bridging structures.

The method described in Bridging the gap employs the binary difference in gcode for point selection, and then generates a low-mass bridging structure to support those points.

Bridging the Gap provides pseudocode for three algorithms:

  • Algorithm 1: Point Selection

  • Algorithm 2: Generation of Scaffolding

  • Algorithm 3: Bridge Selection

Algorithm 1: Point Selection

Input: Gcode file of sliced model

Output: Points requiring support

  • Parse Gcode into Point vectors

  • Convert Points to desired resolution.  Here, I assume a 0.5mm extrusion width and a 0.2mm layer height, as these are the settings on my printer that work the best.

  • Initialize Pixel vectors from the converted Point vector

  • Using a modified Bresenham’s Line Algorithm draw lines between point n and n+1

  • Compare pixel layer n (processed model) to pixel layer n+1 (point model)

  • Check neighbors pixel layer n (point model) to pixel layer n (processed model)

  • List points that need support in a new Point vector

In preparation for integrating the neural network in future work, I did not follow their point selection algorithm strictly.  Unlike Dumas, et al. I do not distinguish between perimeter and infill lines, and I do not implement any part of their stability algorithm, in which they ensure that the center of mass is within a base of support.  I am hoping to work the center of mass stability into the evaluation of the results output by the neural networks.

Algorithm 2: Generation of Scaffolding

Input: Points that require support, Sweep directions, Required bridges (from previous executions of the algorithm)

Output: A valid bridge structure

  • Initialize active elements with points that require support and required bridges

  • Initialize best_bridge to null

  • For each sweep direction:

    • Create anchoring segments for each active element along the sweep direction

    • Create set of segments crossing sweep plane and initialize it to null

    • Put events from anchoring segment generation into queue

    • While the queue is not empty

      • Pop the leftmost event from the queue

      • Put all anchoring segments associated with the event into the set of segments crossing the sweep plane

      • Call algorithm 3 (select best_bridge) from segments crossing the sweep plane

      • If the score of the selected bridge > the score of the best bridge, then the selected_bridge becomes the best_bridge

      • Remove segments associated with supported events from the set of segments crossing the sweep plane

  • If the best_bridge is null, then return

  • Snap all the elements supported by best_bridge to the bridge

    • The snapping function creates a vertical pillar from the bridge to the object above it that it supports and creates a bridge beam between the endpoints of the bridge

  • Add the bridge’s endpoints to the set of active elements

Algorithm 3: Bridge Selection

Called by Algorithm 2 to select the best_bridge from a set of event segments

Input: Segments intersecting the sweep plane at the current event

Output: Best bridge

  • Sort event segments by z-height

  • For each z-height, calculate the distance between event segments

    • If the distance between two events is <= max_distance, then add the events to the supported container

    • Check for collisions between the supported events and the object, if there are collisions, then break

    • Evaluate the gain and score from the bridge created by the events in the supported container

      • Bridge gain = (k -2)h – w

        • where k = number of events supported, h is the height of the bridge and w is the length of the bridge

      • Bridge score = gain- k * lmax

        • where k = number events supported, and lmax is the maximum length of the structure connecting an element above it to the bridge

    • If gain > 0 and score > best_score, then the current_bridge is the best_bridge

  • Return the best_bridge to Algorithm 2

Final Geometry

The final geometry is a set of OpenScad cylinder and cube primitives produced by the snap function in Algorithm 2 and passed to OpenScad as parameters for these primitives.

Opportunities for Future Work

There are several aspects of this project that could have been done differently.  I would have liked to experiment with different cross sections of pillars, to determine which printed better and which were more stable.  Along a similar vein, I would have liked to experiment with different maximum distances between elements.  Time constraints kept me from delving deeper into the experimental aspects of this project.

Next Steps

Algorithm 1 is generating points that need support, and Algorithm 3 has been tested and is returning the best bridge from the events passed to it.  Unfortunately, Algorithm 2 has not been fully tested, and because of this, I was unable to get the different modules integrated in time for the final turn-in.  The next steps for me, as I continue on my master’s project, are to finish testing Algorithm 2 and ensure it is operating correctly.  Then I need to get the modules fully integrated and test the integration, as well as do a major refactoring of the code.  Then, run the gcode for a non-test model through the code and print it to see what happens.  If everything goes well, the final steps are to re-implement the code for parallel processing (using OpenMP) and integrate the neural networks and the evaluation tools to evaluate the scaffolding structures produced by the neural networks.

The code (which will be in continuous flux) for this project is available on my github: github.com/atupek/3DProject


Dumas, Jérémie, Jean Hergel, and Sylvain Lefebvre. “Bridging the gap: automated steady scaffoldings for 3d printing.” ACM Transactions on Graphics (TOG) 33.4 (2014): 98.

Hussein, Ahmed, et al. “Advanced lattice support structures for metal additive manufacturing.” Journal of Materials Processing Technology 213.7 (2013): 1019-1026.

40,000 Words! 5 Days Early!!!

I’m five days ahead of schedule with NaNoWriMo this year!  It’s hard to believe that I’ve been able to keep up this lead that I started early in the month, considering how busy I’ve been with school stuff.  The story is going really well, I’ve gotten my character into some trouble, and I’ve even met a sidekick that I didn’t know she had.  It has been an interesting journey of story-discovery, and there is no way I’m going to be able to wrap up everything in another 10,000 words.  Which is great, because ‘real’ novels are longer than 50,000 words.  I’m still having fun, not feeling too much pressure to finish on time, and this unusual-for-me method of writing scenes as they come to me, and not in chronological order, is working really well.

And, because no post is complete without a picture, check out my awesome progress data & graph from last night!

These last 10K words to 50,000 is going to be snap, but I’ll keep working (under less pressure) until I feel like I’ve got the first draft fleshed out enough.  Still many, many, many scenes to write!

22,222 Words

22,222 words on day nine and I am four days ahead of schedule!  Check out that awesome slope!

So now that I’m ahead, it means I can slack off a bit.  Or not.  I do have the wiggle-room, though!  (And, if I keep up this pace, I’ll hit the halfway point tomorrow!  Bring on the 25K!)

I think I’ve gotten past the 20K slog, but I’m not sure.  I’m starting to think that I need to take a day and work out some kind of an outline, or at least a checklist of scenes that I need to write.  I’ve been going about this year’s NaNoWriMo in a method that is unconventional for me.  I haven’t been writing the story chronologically.  Instead, I’ve been writing whatever scene or part interests me at a given time.  I have a beginning, though not a very polished beginning scene, and I know what needs to happen at the end, but I haven’t written that yet.  I have a whole bunch of unconnected middle scenes in no particular order.

The storyline is definitely starting to solidify.  I’m wondering if now is the time to start thinking about it and planning, as opposed to flying by the seat of my pants…

10,000 Words on NaNoWriMo Day 4

I hit 10,000 words on my NaNoWriMo novel last night, so I’m 20% of the way there and I’ve given myself a nice head start.  I’m over a day ahead of schedule, which means I can take some time off if I need it (which I’m sure I will, later in the month!)

I started this year’s nano-novel with an idea of a character and a little bit of her backstory, but not much else.  Now, at 10K, I’ve got some overarching conflict to base the plot on, some characters for her to interact with, and I think I’ve also found the villian among those new characters.  I’m very excited about it.

10,000 words in four days.  I know you can do the math, but I feel like I need to state it: That’s 2500 words a day on average!  In itself, that isn’t far from where I was years ago when I was writing regularly.  Unforutnatly, grad school got in the way of that.  I didn’t do NaNoWriMo last year, and it was the first year I missed since I started participating in NaNoWriMo back in 2002.  So, missing last year really hurt.  I haven’t been able to do much regular writing, either, for the last couple of years.

But the words have just been flowing for the last couple of days!  It has been hard for me to stop myself from writing and work on all those other little things that I need to get done (like my master’s project…).  It scares me that I let go of writing for so long, and I’m really glad to be back.

Sure, this novel totally sucks, I mean, it took almost 10,000 words for me to find some conflict, but it’s a shitty rough draft.  I’m just letting the words and ideas flow and at the end of the month, I’ll see what I have to chip away from it and what, if any, good nuggets I find within it!

3D Printing Chocolate for CS480

For my first CS480 3D Printing and Robotics project, I decided to make RichRap’s Universal Paste Extruder to print chocolate using my Prusa I3 3D printer.

Universal Paste Extruder

RichRap's Universal Paste Extruder

There are several pro’s for using this:

  • The design already exists!
  • The BOM (Bill of Materials) already exists!
  • There’s a video on how to assemble it!
  • It “works!”

However, there are a couple of issues…

  • It doesn’t fit the Prusa I3 – the mounting holes are off by just a bit (though this could just be an issue with the guy I got my printer from).
  • I don’t like the plunger cap design.
  • The design wastes a lot of material – it can be slimmed down.
  • The syringe is held in place by a rectangle that gets screwed into the side, sort of like a tension mount.

So, I revised it!  You can find my scad and stl files on Thingiverse at http://www.thingiverse.com/thing:1083345Original vs Revised

I nudged the mounting holes a little closer together, removed some unneeded materials, and re-designed the plunger cap so that the belt wasn’t flopping all over the place.  I also adjusted the height so that the syringe’s hole would be at my printer’s z=0 height, because I wanted to be able to make a quick transition between printing plastic and printing chocolate.

Of course, this wasn’t the end of the issues!  It was only the beginning:

  • The needle-lengths differ.  I had 15 gauge and 18 gauge needles, and their length differed by 10mm.  Solution: Design a height adaptor piece so that I could switch between needles quickly and without having to modify my z=0 setting.
  • The chocolate cools too quickly and solidifies, becoming jammed in the needle.  Solution: Throw out the needles and use only the syringe.  This requires redesigning the main extruder body, just to lower the syringe a little bit.
  • The X-carriage adaptor’s hole isn’t big enough for the syringe.  It has a diameter of 1.75mm for the filament.  Solution: Redesign the X-carriage.
  • Chocolate doesn’t adhere to wax paper, parchment paper, or regular paper.  Solution: Print on bread!  (Seriously.  I saw this a couple of months ago and wondered why they were printing on bread.  Turns out it wasn’t as crazy an idea as I originally thought.  It works!)

And the biggest issue of all: There was NOTHING in the assembly video about slicer settings.  Solution: EXPERIMENT!

  • Nozzle diameter = 2mm (same as the diameter of the syringe’s hole)
  • “Filament” diameter = 10mm (I had originally set this to 14.9mm, the diameter of the syringe, but it didn’t move fast enough and no chocolate was squeezed out.  After some experimentation, I settled on 10mm)
  • Layer height = 1.5mm (Triffid Hunter recommends not setting this at greater than 80% of your diameter)
  • Extrusion width = 2mm (same as the diameter of the “nozzle”)
  • Speed = 45mm/s (the standard speed I run my printer at for most things.  Seemed to work okay)

It WORKS!  Kind of.

The chocolate doesn’t cool fast enough for a second layer, and there are a couple of other things I would change.  Possible future improvements are:

  • The belt keeps slipping off the idler, so design a guide for it.
  • The print area is currently limited to the area of the bread.  Design something to hold multiple pieces of bread to the build platform.
  • Add a cooled bed to allow chocolate to solidify faster, and more fans to cool it as it is extruded to allow for multiple layers.  Perhaps some type of a cooled chamber
  • Use a heated pad around syringe/needle to keep chocolate hot and keep it from solidifying too soon?

Overall, theUniversal Paste Extruder is not great, it’s really more of a novelty. Other designs use heated pumps to keep chocolate at ‘just melted’ temperature until extruded.  Still, it was a fun project, and I’ve somewhat successfully 3D printed chocolate!

Sources & Software Used:

Universal Paste Extruder: http://www.thingiverse.com/thing:20733

Printing chocolate on bread: https://www.youtube.com/watch?v=FP06iB1qF8k

Batman Logo: http://www.thingiverse.com/thing:59886

Slicing info: http://reprap.org/wiki/Triffid_Hunter’s_Calibration_Guide

Slicing software: Slic3r V1.1.7

Design software: OpenSCAD V2015.03-1

Um…What Happened?

Not sure what happened, but it’s been a while (ummmm…a year and a half?) since I updated my blog.  Came back today, since I’m finally on summer vacation from school & work and discovered a database error.  All of my previous blog posts seem to have disappeared.  It’s just too much work to fix right now, and it’s not like a whole ton of people were reading the blog anyway.  So, we’re starting from a blank slate!  What fun!