Skip to content

Level-up your OpenSCAD skills

Inspired by Joe Walnes’ tweet and post on OpenSCAD, here’s some tricks that i’ve used in OpenSCAD.


For 3D printing, it is often helpful to design parts assembled but to be able to easily lay them flat for printing. Another Kwartzlabber Dave has been using this technique for quite a while. He uses if statements. Compared to the following technique, if statements are long winded and restrictive.

To use optional assembly, define a variable that takes on values {0, 1}.

// Assemble: 0 for printing, 1 for visualization

Then, specify transforms for each, for example:

module placed_brick() {
    rotate(assemble*[90,-90,0]) {
        toybrick(2, 4);

The assemble transformation will apply only when assemble=1. The (1-assemble) transformation will apply only when assemble=0.

The idea came from a concept presented in Andrew Ng’s Machine Learning course, applied to a different domain. In both cases, the goal was to replace a conditional function with one that is a standard (non-conditional) function. In machine learning, this technique is applied to the cost function for logistic regression. Here, we can choose one of two transforms to apply by having the other one multiply to 0.

This technique will work for both translations and rotations.


A very similar trick can be used for movement. With y animatronic eye, it is helpful to see the lids open, closed, and sometimes in between. In this case, i want to move from 0 to 45 degrees. Also note how the tricks are combined so the transformation only applies when assemble is specified.

Instead of closed range [0, 1] it would also be possible to used degrees directly, if desired.

// Lid opening: range [0, 1]


module lid_upper() {

This isn’t animation, but does let you easily see the parts in different poses. Of course, if you do want to animate you can use $t. For details, see the Instructable on animation in OpenSCAD.

Define what matters

In quickly building models, it is sometimes easy to loose track of what matters. Sometimes you just add parts based on what is already drawn. Define what matters and work from there.

A good example occurred when building my eye. In this case, the distance from the edge to the screw hole is critical as it must align with another model. This wasn’t obvious in my initial drawing, since i wasn’t yet even sure how i would mount it or what i would connect the parts to. As the model progressed, the interfaces between the parts became critical. (Starting to sound a lot like software…) So i refactored the calculations to make the distance from the plate edge to the mounting hole a parameter rather than have it fall out of calculations (like the hole being half way from the center of the alignment block to the extent of the bracket — neither of these other dimensions are important).


Here, you’ve learned how to optionally assemble the model, create a bit of movement, and define the model in terms of what’s important. Hope this helps you in your own OpenSCAD modeling!

Posted in Make, Robotics.

Tagged with , , , , , , .

Aye eye

I’ve been making some good progress with the eye. After it is printed (thanks for helping Russ!), it was evident that some design tweaks were needed.

The eye mounting plate didn’t print well. I’ve removed some complexity and flipped it so that it sits on the platform mostly. The gimbal had some parts that were too thin. There were also lots of bugs in the calculations which became evident once parts were resized. The lids printed surprisingly well given the overhangs and complexity.

Here’s a rendering of what it is like:



New OpenSCAD files posted:


Posted in Make, Robotics.

Tagged with , , .

Book: Raspberry Pi Robotics Projects

This book is more like a basic blog than a project book. It is really targeted at someone who knows nothing about Raspberry Pi, robotics, or programming. The first 60 pages could have been omitted with a reference to a getting started book. Many of the coding example were really screenshots — it seems like the author couldn’t figure out how to embed code examples.

There are a few helpful instructions for audio and speech processing in chapter 3. Maybe i thought this because it is one of the few things in this book i haven’t actually done yet…

The book glosses over most topics of robotics, but doesn’t go into enough details of any of these. For example, it goes over how to hook up robotics legs and make these move; it falls short of even mentioning how to make these move in a useful way (training, inverse kinematics, poses, synchronization, etc).

By chapter 10, it finally mentions some more interesting topics, like ROS.

On the upside, it does introduce a lot of good ideas, products for makers, and links to open source software.

My rating: 4/10


amazon page

Google Books page

Posted in Books.

Tagged with , , , .

Animatronic eyes

There are quite a few animatronic eyes on Thingiverse. Though these only include the stl files, not the original design files. Here’s a sampling:

There are a few problems using these directly for this project. Some thoughts:

  • These aren’t resizeable to the desired dimensions for this creature. The ET one is close.
  • These often add mechanical complexity to save a motor; often the eyes must be the same vertical rotation and the blink happens to both eyes at once. It is desirable for this creation to be able to control these independently; for example, rotating the eyes in opposite directions would give a cartoonish dazed look.
  • The base plate is often 3D printed. It would be easier and more reliable to laser cut this.

We unfortunately lost the design files for our original prototype a few months ago due to a computer failure. So over the past week or so, i’ve been working from scratch to redesign it based on what we know so far…

Posted in Make, Robotics, Uncategorized.

Tagged with , , .

Book: Make: Fun!

Recounts modern history of games and toys, and provides lots of ideas and some instructions on how to make your own, as well as how to make tools to make things. All-round an interesting read

My rating: 8/10



amazon page

Google Books page

Posted in Books, Make.

Tagged with , , , .

Animatronics: robotics progress

So, i’ve been making slow but steady progress… not fast enough to warrant more frequent blog posts. Some accomplishments:

  • use multiple ROS nodes to synchronize and control movement; both blinks and eye rolls are currently performed
  • optionally activate motor controller, which is the Adafruit Servo Hat
  • use the Raspberry Pi camera and OpenCV to locate faces and broadcast this on a ROS topic
  • connect ROS on a VirtualBox VM to a master running on a Raspberry Pi
  • create an overly-simplistic URDF model of the head with eyes — no moving joints yet


Using OpenCV Haar Cascades filter is pretty compute intensive for the Raspberry Pi, and it would be good to at least decouple the camera IO from the image processing.


There’s a tutorial for how to use ROS with multiple machines. Here’s the brief summary: connect them over IP and on the other nodes, export this variable:

export ROS_MASTER_URI=http://your_ros_master_ip:11311

Now you can skip a tutorial!

Yet to-do (short term)

  • figure out how to use tf2 to transform the seen face to eye direction
  • convert eye direction to servo position
  • build a head, mount eyes and camera
  • use a ROS camera source to decouple the IO from the OpenCV processing, which can speed up

Posted in Make, Robotics.

Tagged with , , , , , , , .


A while back, i was looking for a herbicide to kill those pesky weeds in the interlock and driveway cracks. Boiling water did a good job, but for anything more than a couple small patches, i proved too time consuming. And dangerous, carting boiling water around. Most herbicides are bad for the environment, and usually persons too. I saw at a hardware store one day a large bottle of one for paths. It was about 30$, cheaper than others like Round-up (which is selective and not effective on growing varieties of weeds, and also possibly carcinogenic). What was in the kill-all bottle? Acetic acid. Otherwise known as vinegar. You can pick up the same stuff for less than 4$ for 4L at the grocery.

However, simply spraying this on will not quite lead to the desired effect. The problem is that it doesn’t really stick or get absorbed. A friend told me that it needs a surfactant in order to be effective, but since it isn’t food, there is no regulation requiring the disclosure of additional ingredients on the label.

Some searching online also suggested adding salt to increase the effectiveness. Here’s the current mix i use:

  • 4L pickling vinegar (7% acetic acid)
  • 250 mL fine table salt
  • 15 mL dish soap

Pour all into a large spray bottle, close it, and shake well to mix.

Make sure you buy sprayer labeled “bleach”. Others will break down in the acidic environment.

The mixture is non-selective, but has no residual action. Which means it is good for the environment. But needs to be reapplied as new weeds come out. It will kill any plants covers, and stray sprays may damage foliage unintentionally. It is best to use this in paths and driveways away from the plants you want to grow. It may have unintended side-effects, like the desire to eat fish and chips.

Posted in Garden, Make.

Tagged with , , , .

Book: Make Family Projects for Smart Objects

This book was a pretty quick read. Unless of course you actually make each project, which is sort of the point. It is a good intro to various Arduino and IoT projects for those with beginner and intermediate knowledge. Experts may find it a bit slow, but still helpful if they don’t know particular components.
My rating: 6/10


amazon page
Google Books page

Posted in Books.

Tagged with , , , , .

Book: Idoru

The most interesting thing about this book is that it was written before the internet was popular… that the author predicted both the popularity of a global computer network, the dark web, and AI. If it was written now, the book would be merely futurist fiction. But then, it must have been oddly prescient.
It was a hard start, not having read the first book. But it soon became understandable – – both the characters and the jargon create created for all the futuristic technology and social differences.
The ending was a bit choppy and weak.
My rating: 8/10


amazon page
Google Books page

Posted in Books.

Tagged with , .

Book: Make Edible Inventions

This is really a family book – – for parents and kids. It has many interesting  projects that are food related… but don’t expect much in the way of recipes. The best part is the interesting tidbits of history of foods and food technology.

My rating: 7/10


amazon page
Google Books page

Posted in Books.

Tagged with , , .