Introduction: The UCube: Design & Print 3D Objects by Flipping Switches

This instructable goes through how to design and print a variety of 3D models using a system called the 'UCube'.  
Note:  I would love to eventually publish detailed instructions on how to make your own UCube, but since the design is still changing and improving, this post will gloss over a lot of those details and focus on how you can model and print 3D objects just by flipping a few switches.

This project was designed and built at the Craft Technology Lab at the University of Colorado Boulder: http://l3d.cs.colorado.edu/~ctg/Craft_Tech.html

Here's a brief video overview of (some) what the UCube can do:

Step 1: The Basics

The UCube has two parts: the physical modeling board, and the complimentary software.  The modeling board consists of a grid of sockets into which vertical poles are placed.  The poles have switches on them that, when plugged in and activated, send an (x.y.z) coordinate (from an Arduino) to the software on an attached computer (written in Processing).  

The software then displays the active points on the computer screen.  From the software, there are several actions you can take to form shapes and models.  You can take the convex hull of the shape (imagine wrapping a piece of paper around the set of points, and that's pretty much the convex hull), the wireframe of the convex hull, make a spline through the points, and create a path through a sequence of points.  There is also an 'edit' mode whereby you can tweak the vertices of your model to include points outside of the normal point grid (off the integer lattice).  When you're satisfied, you can export your model as an .STL file and print it on a 3D printer.

The pictures in this section follow a simple use-case for the UCube: defining the vertices of a model on the physical interface, selecting the convex hull of the active points through the software, exporting the .STL file of your model, and printing it out on a 3D printer. 

The next sections will go through more complex modeling techniques and features of the UCube system. (You can do much more than make a cube). 


Step 2: More Complex Modeling

The last step showed only one class of models we can make with the UCube.  This section will go over how to model and print more complex shapes using the knot function of the software - this will let us make shapes like Tetris blocks, a Soma Cube puzzle, or mathematical knots.  

The knot mode allows you to record a sequence of selected points on the UCube and draw a 3D path connecting those points.  First, you select the 'knot' button from the sidebar (shown in pictures in the step).  Next, activate (in sequence) the points you want the knot to follow - the software will build the knot in real time on the screen.  If you make a mistake or change your mind, you can hit the 'clear knot' button and start again.   If you want a closed loop kind of knot, click the 'close knot' button when you're done modeling.  You're now ready to export your knot to and STL file and print it out!  Sweet!

Step 3: Other Functionality

In addition to solid shapes and knots, the UCube software has some additional functionality that increases it's flexibility and expressiveness.  As mentioned earlier, the UCube can model splines through a path of points (like the knot, but with curves and without a 3D mesh to print out).  The UCube also has an 'edit' mode whereby you can tweak the points of your shape by clicking and dragging them on screen.  This allows the modeling of shapes with vertices that lie outside the structured grid of points that the switches default to.

Step 4: Notes on Building Your Own UCube

By no means is this a closed-source project - I just hesitate to put everything on here since it's still a work in progress and plenty of things will change.  

Much of the code and documentation can be found at http://benatwork.cc - and this is where future updates will live, until I've finalized the project enough to write an end-to-end tutorial to post here.  

Without getting into too much detail, here's the gist:

1. Each possible coordinate (my first board was small, a 4x4x4 array, meaning 64 possible xyz coordinates) is a pin on your Arduino Mega (you could use shift registers as well).  Since we're using buttons, they're all digital ins.  

2. You have to map each pin to the coordinate on your board (e.g. pin 2 might be (0,0,0)).  

3. When you plug in a button to that pin and turn it on (e.g. pin == HIGH) send out the coordinates of that pin via Serial.print statements. Put in some delimiting characters so you can split the string in Processing (I printed commas between the points and a semicolon at the end of each xyz coordinate). 

4. In Processing, read in the set of points using the serial library.  Break apart the string so you have an array of discrete xyz coordinates, and draw them to the screen.

5.  Once you have the set of 3D coordinates, the rest of the fancy stuff is doing one or more things with that set of points. 

I've included some process pics here just for fun. Send me a message or comment here if you have any questions or feedback, I'm happy to answer.