• Generating Nice Threads In OpenSCAD

    05/26/2018 at 23:52 9 comments

    [Hello future reader. This article refers to OpenSCAD 2018.05.05, please check if it still applies later on]

    3D printing internal and external threads is interesting for many reasons.

    Unlike gears that invariably wear rapidly and cannot measure up compared to cast or subtractively machined parts, they are pretty functional and allow the common maker to interface with custom and standardized bolts, pipes, valves, soda bottles and canisters - and that's on top of the liberty to create your own threaded mating components within the confines of your design.

    The generalized approach presented here supports arbitrary thread geometries and numbers of starts.

    Shown below are single start inside and outside threads as well as a swivel nut with a "faster" 3-start thread, all modelled to match commercial water bottles - the small one is "PCO-1881" known from 1.5L soda bottles, the larger one is "48-41" for 3-5L jugs:

    Only right-hand threads are supported but left-handed threads are easy to get by applying mirror([0,1,0]) to the output. That's the OpenSCAD way :)

    While the core idea of a straight thread - the helical profile wrapped onto a cylinder - is rather straight forward, generating nice geometry that does not disintegrate along the way from model rendering thru .stl export to the slicer tool deserves a little bit of attention.

    What do I mean by "nice geometry"?

    • "embossed threads" on a curved surface or
    • manifold additive threads (demonstrated here, imho more universal)
    • regular mesh / regular connectivity of trangles / quadrilaterals (no crazy pointy aspect ratios and cell size changes)
    • low polygon count and accurate / efficient reproduction of the thread profile
    • geometry matched to the rest of the model

    in short, what we don't want is unnecessary structure, gaps, holes and mismatch of resolution of the threads and the rest of the geometry.

    What I'm going to walk you through here is a way to create helical thread forms just like the ones you'd strip when overtightening a bolt:


    Since OpenSCAD is am open source work in progress, users do not necessarily work with a version that has the latest features, documentation may not be up to date and forum posts claiming "it cannot be done" are repeatedly being invalidated by software revisions, adding to the confusion.

    Let's go over what doesn't work (hopefully gaining some insights), then look at my proposed approach. If you just want the answers, please scroll down :)


    As an example: without an operator that creates dedicated helical structures people are using linear_extrude() with twist to get something helical:

    The problem here is that like fanning a deck of cards you'll end up with tucked-in faces and serrated outsides - as seen on Thingiverse:

    And here's another one with a bit of discussion from 2014:



    Unfortunately as of now rotate_extrude() which should be closer to creating helical objects has learned partial rotations (not supported in 2015 builds for Windows) but cannot create helical extrusions. There's also no special treatment for the ends.

    One could create a...

    Read more »

  • Kaleidoscopes of Sorts

    05/25/2018 at 23:39 0 comments

    I was looking for a way to image a credit card-sized area the other day. The only catch is that it would fundamentally be the sidewall of a < 8 mm wide duct and I haven't really seen a type of borescope that would be capable of imaging under these conditions.

    Organic Photodiodes

    It seems we're living in the early days of organic photodiodes (OPDs) and image sensors so maybe we'll get to see combined flat panel illuminator - lightfield camera foils which you can stick into the gap between capacitors, heat sinks and other stuff that's in the way to read part numbers and have a look at possible faults, but such a future is not there yet.





    On the geometrical optics side of things, Travis (Microsoft Research, 2012) presented a paper on wedge optics for imaging and projection: 


    Defects and apologies aside, the fact that everything is in focus despite the different optical path lengths across the object (Fig. 21 is slightly misleading) eposes the small acceptance angle at every given point of the imaged area so light collection efficiency will be a bit of a struggle or a trade-off with image contrast.

    All things being equal this will be a good starting point to cobble together a demonstrator. Think machining a PMMA wedge on a sine plate.

    Light Pipes

    If you've ever taken apart a DLP projector you may have come across a beam homogenizer / rectangular light pipe / mixing rod


    they come in two basic flavours: total internal reflection and boxed first surface mirror and for non-imaging elements they have some interesting properties.

    In the paper from Zhang 2013 it is pointed out that looking back through a light pipe, the real source is seen surrounded by an array of virtual sources (hence virtual sources array). It's not easy to make out in the illustration below but another way of looking at it is that light emitted at increasingly oblique angles ends up in increasingly "higher order" virtual images farther away from the center.


    In fact one can image the entrance aperture plane of the light pipe along with the array of virtual source images and consider it a scrambled integral light field image (ordinary light field images don't have the additional mirroring).

    Here's the collimating lens and light homogenizer assembly from an IBM DLP projector:

    in the magnesium casting there are four mirrors glues into a rectangular tunnel shape followed by a collimating lens assembly. Since in a direct imaging scenario the angle at which the enters (aka the "source" in the context above) is equal to the angle at which the camera has to capture it, a rather wide angle macro lens is required.  Using the collimating lens to image a ceiling light though should deliver the basic idea of what they mean by "virtual sources array":

    So in essence this could be an easy way to implement light field microscopy if it were not for the awful out of the box working distance.

    What Zhang et al. are proposing is a means to transform a light source with a large solid angle into a well-behaved array of small solid angle fractions of the source which are sufficiently controllable to be fed through polarizing beam splitters and half-wave plates to achieve near-100% yield instead of <50% by just discarding the wrong polarization component.

    Going full circle this might be another way of looking at the combined wedge optics /...

    Read more »

  • cursed applications: linear actuators

    04/23/2018 at 22:34 0 comments

    Physics hates these problems.

    The future may smile weakly but this is 2018, a time where one would assume that most, if not all mechanical problems can be considered solved and everything has just been reduced to a "make more, faster, cheaper" game.

    Fear not, there are still many problems lacking "proper" solutions. From temperature measurements over 2d surfaces one cannot stare at with a thermal camera to (spatially resolved) force measurements INSIDE solids (not the neutron scattering approach to Gigapascal pressures, mind you, just down-to-earth Megapascals), residual stress to even seemingly simple mechanical building blocks like linear actuators, what we have as of now just doesn't seem right.

    Fujifilm Prescale paper for example is one of those "good enough" solutions where you pick a pressure range, slap a sheet of material on your contraption, clamp it down, tear it apart again and see if you hit the target. You get one shot.

    On the high tech side of things, residual stress analysis is a crazy destructive mashup of x-ray diffraction and electropolishing. Undoubtedly cool but time consuming and expensive. Random pick for further reading:


    While the measurement applications tend to massively interfere with the finished product (like breaking electrical and thermal paths and corrupting mechanical stability), things like actuators which actively have to do something don't seem to get to a stage with proper implementations. Actuators often rely on a fundamentally rotational motion converted into a linear one and the piezo driven structures inherently need to convert sub-micrometer motions to macroscopic vibrations and associated displacements.

    Linear actuators - or: why artifical muscles aren't there yet

    I don't claim any authority in the field of actuator principles but have accumulated a certain amount of frustration in my time by reading about "breakthrough" actuator designs time and again that turned out to be just another piece of rubber tubing in a mesh to keep it from balooning out of control. Or maybe it's a bit like lithium ion batteries that creep towards a brighter future so slow it feels like regression despite significant yet underappreciated technological advances.

    Since we're interested in small actuators and low force, yet elegant motions (think: cats :D) a gasoline powered hydraulic compressor of the Boston Dynamics kind is out of the question.

    As candiate technologies there are electroactive polymers which are as elusive as their development kits, piezoelectric polymers (polyvinylidene fluoride and its copolymer with trifluoroethylene) where the TrFE compound is about the price of silver by volume, coiled carbon fiber muscles one might rather call renewable asbestos and electroosmotic implementations that need kilovolt driving voltages to perform their dance over the course of ten seconds.

    The only technology I actually find at least a bit magical is that of ultrasonic piezo motors because they are nice and quiet and create well behaved motion. My first contact with this technology dates back to a broken Canon USM lens I took apart to find that a ring hat vibrated loose, removing motor preload.

    The type of ultrasonic motor used in photographic lenses with larger elements is a traveling wave ring type one as depicted here:

    Usually there are two, at most three phases connected to the ring to generate a propagating shear wave. It's rather a vibration mode of the ring which is held in place by a thing spring washer. Unfortunately this principle does not exactly lend itself to linear drive applications.

    One step up the ladder there are stick-slip drives which are driven by a sawtooth / asymmetric triangle voltage waveform and use the inertia of the central shaft to unstick and reposition...

    Read more »