Introduction: Using Processing With Ember
One of the things that interests me most about Ember, is the fact that the input files are a stack of PNGs. This means that one can essentially feed the printer images without the need for solid body modelling, STLs or slicing! It's a pretty cool side to the machine and one that can be explored using Processing.
Processing is a Java based, open source programming language that uses a graphical programming model, allowing the user an easy way to quickly create images.This Instructable will take you through my first foray into using Processing, from drawing a simple image to creating a stack of PNGs to mimic hair and then printing them on Ember. It's quite an easy language to get into if you have any prior programming experience and there are lots of resources online to help you muddle through those first few sketches!
Note: this Instructable will all be from the perspective of using a Mac.
Step 1: Download and Install Processing
First off, you'll need to download and install Processing. Processing is available for Mac, Windows and Linux; it can be found here.
Once downloaded, unzip the contents and copy across the Processing icon into your location of choice. Double click on the icon and you'll open up your first sketch.
If you've ever written Arduino code, the integrated development environment (IDE), will look instantly recognisable!
Next we talk about how to structure your code and a quick example
Step 2: Your First Sketch - a Few Basic Things
So, let's dive straight in.
Keeping in mind that we'll be printing parts on Ember we need to remember that the native resolution of the DLP projector is 1280 x 800 and therefore need to set up the image size accordingly, defined by the size() function.
Also remember that we only want to expose areas we wish to cure, therefore we should set the default background() colour to 0, which gives us a black background.
Have a go at defining your setup function and see what happens when you compile and run. To do this, simply click the play button and when finished, hit the stop button.
Hint: a black image 1280 x 800 pixels should pop up!
Processing has a fantastic online community but also some great resources and one of the best cheat sheets I've ever seen.
Step 3: Your First Sketch - Drawing a Circle
Now we've defined the setup function and have the basic constraints in place, let's move on to drawing something.
In processing the draw() function allows us to graphically visualise our code. Again a few considerations:
noSmooth() - we use this declaration to remove anti-aliasing. Anti-aliasing is a filtering technique which employs grey-scale to smooth the edges of non-orthogonal lines. For general image processing, this absolutely fine for the human eye and in fact, is preferred. However, as Ember will print exactly what's exposed, control over each pixel matters. In truth, we need to do more testing in anti-aliasing to see what affect it has.
noStroke() - this declaration removes borders, which again would otherwise be printed.
The cheat sheet shown on the previous step has all of the different drawing declarations and functions available. Googling the shape you want to draw is also a quick way to find the relevant syntax. In this example, I wanted to draw a circle 100 pixels in diameter in the centre of the image.
A little bit of simple maths and using the ellipse() function https://processing.org/reference/ellipse_.html and away we go!
Step 4: Generating Hair
Hair-like structures are essentially lots of closely bunched strands. Something very hard, if not impossible to model using solid body CAD. The STL would also be very bloated and take a long while to slice. Direct image generation and direct PNG printing on Ember really comes into its own at this point!
In this example, I've just created an ordered matrix of rectangles that vary in pixel size from 8x8 to 4x4 pixels linearly, over 40mm. The attached code is pretty well commented for you to follow, hack and use as you wish.
One quick note, is that Ember expects the images to follow the format slice_1.png, slice_2.png..., slice_XXXX.png. When saving images ensure that this convention is followed.
Step 5: Preparing the Files to Print - Printsettings
Now we've generated the stack of PNGs we'll need assign a settings file that will tell Ember everything it needs to know to successfully print. Attached is the printsettings file that was used.
Another way to generate the file is to head over to http://www.emberprinter.com/ and to attach and slice a mock part, with the print settings you want. You can download the file, extract and copy over the printsettings file to your PNG stack.
Step 6: Preparing the Files to Print - Compressing
Attached is the complete Tarball ready for sending to Ember.
Step 7: Uploading Files Onto Ember
Now we have the correctly compiled tarball, we're ready to upload the print file onto Ember.
- Connect your computer to the USB mini port at the front of Ember
- Open your browser; Chrome and Safari work well
- Enter the IP address of the printer: 192.168.7.2
- Choose, "Load Print File"
- Select the file you wish to send across and click "Load"
Look over at your Ember to see the control panel LED indicators cycle through until it shows the file has successfully loaded and asks you to start the print.
Before starting, be sure to go through your pre-print checklist!
Step 8: The Results!
And here are the results and as you can see, the brushes came out great.
I initially tested using our PR48, but found that it was too weak for printing long, thin strands. Instead I used the MakerJuice G+ in black that I've recently been experimenting with.
For more on resin selection and exposure settings check out b-adzima's Instructable
The settings file in Step 5 has the correct exposure times for both PR48 and MakerJuice G+
And as a fun twist, I ended up using the part as a paint brush, which performed pretty well.
I also took some microscope images to see how the tapering looks up close. The code stepped from 8x8 pixels to 4x4, which translates to 400µm to 200µm features. You can see these are realised as discrete steps, as expected and that the tip hits 200µm bang on! Note, the gauge is decimated at 100µm intervals.
Now we've covered the basics of using Processing and how to go from code, to generating images and printing with them, why don't you explore some more? I know I will.