Making Procedurally Generating Spalting Patterns

I did this a while back, but someone had an interest in this on hackaday so I tried to dig up my old code.

The goal is to generate wood grain patterns for laser cutting/CNC of plywood. Mainly, I wanted to have something similar to spalted maple laser etched onto the plain birch veneered plywood. The thing that inspired this project was this post of speaker boxes on imgur I came across. The design looked really cool, and while spalted maple is expensive, birch plywood is relatively cheap.

My first step was to procedurally create a random pattern.  Similar to the imgur post, I looked at creating camouflage. I found a great example code on openprocessing by ThingOnItsOwn that used perlin noise to create a camouflage pattern. I tweaked the values a bit experimentally, then stretched the entire design to make the final design look more like woodgrain.

The next step was to just capture the edges of these blob shapes from the first pattern. I came across this example from Richard Bourne It is forked from this example from R. Luke DuBois.   Honestly I was being lazy because I had written edge detection code in college as it is standard image processing, but I knew someone else had it already in processing. Instead of using for loops, this version manually calculates out the kernel.

This leaves me with a result that looks pretty realistic.

Camo:

Spalting:

This creates a PNG filetype which can be used to add texture to a 3D print in the slicer. The slicer will adjust the print to incorporate the texture in 3D giving it a woodgrain-like effect. You technically could use this as-is on a laser cutter to create spalting like my inspiration, however being raster data, it would take the laser a long time. It’d have to scan the laser (the thickness of a human hair) across the entire area of the panel you are applying the texture on. To make this faster, you can vectorize the PNG in inkscape or other software to outline the dark areas of the PNG.  This will cut fast as it is a vector (the laser would just have to draw the lines the same way your hand would. That would save a lot of time.

If anyone wants to add vectorizing to my code, please do! You can clone my github and put it on P5.js. I was going to add it, but I got lazy again. I even asked ChatGPT3 to help combine this code with something like potrace or imagetracerjs but it produced code that looked great, some even compiled after a few tweaks, but never worked.

Ultimate List of Tips, Tricks, and Tutorials for Fab Lab Students

This post is a not on a lot of techniques for using different types of machines and processes for making stuff. I’ve had this for years but decided to finally publish it. I’ll add to it periodically, but I figured others might find it useful as well. RIGHT-CLICK to open in new windows.

Laser Cutting:

Embedded Systems, Microcontrollers, and Arduino

Circuit Board design and Fabrication:

3D Printing:

Casting and Mould Making:

CNC:

Machines:

Mechanical:

Metal-Bending:

Miscellaneous:

 

 

================================================

My favorite Fabrication-related researchers:

Dr. Stephanie Meuller at MIT’s research group

Dr. Patrick Baudisch at Hasso Plattner Institute Human computer interaction reserach group

 

Teaching Research:

Sketchnoting basics

Graphic Recording

Sketchnote travel journal to get started

Control Theory:

Brian Douglas’s awesome youtube channel explains Control with some great examples.

Kat Kim has another great channel on Controls as well as other Electrical and Computer engineering examples and lectures

George Gillard has a great whitepaper explaining PID controls

Another great PID example is from this Reddit thread

Learning Math concepts:

MathVault – Learn higher-level (college-level) math concepts more intuitively

BetterExplained.com ADEPT model for learning math intuitively

Good sources of materials:

XXXXXXXXXXX    Todo when I’m not so busy or lazy: XXXXXXXXXXXXX

Add sections for PCL shapelock and other named plastics to ultimate FabLab list.

Also add cardboard modeling guy and nibbler tool

Add anodizing alum and titanium, bluing/blacking steel,

And interesting research I like with lasers  hydrographics and uv printers and metal hologram art

How to export to a CNC from KiCAD and Fab Mods

So, while working on a new board design I decided to learn KiCAD a bit more. I’ve detailed the board design and files in an upcoming post so keep an eye out for that one. Here’s I’m just documenting the process to make a board by exporting the design from KicAD and generating cut files in Fab Mods.

I came across a LOT of different methods looking at other Fab Academy students. Some had weird scaling issues or other problems.  I’m showing how to use two different methods for producing and SVG file.  Export–>SVG and plot as an SVG.  I also show two ways of generating cut files, whether you are making Gcode for a generic CNC or you’re making an RML file for a Roland SRM-20.  Note, I’m using KiCAD 5.4 on Windows 10 here.

In the examples below I’m using Quintin’s SAMD11C board found here.

 

Method 1: Export SVG directly from KiCAD to Mods

 

Method 2: Export an SVG using the “plot” function then convert to PNG for Mods:

 

Caveats and other important details:

I have rebuilt my shapeoko V1 as a PCB mill and so the difference between this and an SRM -20 Roland PCB mill is just what program you select from mods when you are creating the cut file.

If you aren’t running the websocket for fab Mods, you’ll need to replace the “websocket” module of the Roland programs with a “file save” as shown below:

 

Once you’ve exported the file you can follow this procedure on a Roland or other CNC machine to mill the board.

 

Once you populate the board, you can program this particular one with an Atmel ICE. Here’s the connections for that:

Connect up the atmel ICE programmer to the SAMD board. I used figure 3-8 from the atmel ice manual to figure out the pinout because we are using the Serial-Wire debug (SWD) pinout.

Pin 1 is Target Voltage (Vcc), pin 2 is SWDIO, pin 3 is GND, and pin 4 is SWDCLK. Pin 10 (Reset) is the back corner you can’t see.

Tips for Mounting Stock Material for CNCing

Holding a workpiece is always an annoyance. You want to flatten a sheet of plywood so there’s no part of it bowing upward because that will throw off your cut depths. Nothing is worse than thinking you have a tab holding a part in place only to find out that the tab was too thin or nonexistent when the interior piece starts getting all chewed up and flopping around, breaking stuff. On close inspection you can see that on your final couple of passes, the tab was cut too thin or clean through because the wood was bowed upwards. Without a vacuum table, there’s only so much you can do, but I’ve found a few ways that seems to work great. Screwing or clamping the wood to the spoilboard is OK, but it makes certain areas no-go zones for your bit. My methods will help you use up every square millimeter of the wood if you’d like.

Dealing with the Wood Itself:

The wood itself is always as straight as I could find, but it’s never perfect. I lay it on my machine such that the cupped edges stick up in the air. Then I mount down the edges.  There shouldn’t be a bubble in the middle because the curve was originally downward to begin with and since I affix the edges (where all the stress to move upward is) it lays pretty well.

image

Traditional Method using screws:

Sally from Shopbot showed me a nifty trick. If you do use screws to secure your stock to the machine you want to make sure your toolpaths will never touch the screws (lest you break your bit or mill your screw head off). Sally’s trick is to add these screw holes to your design.

  1. Lay your stock on the machine and center it but don’t mount it.
  2. Open your cutfile and add small circles (1/8th – 1/4th inch diameter) about 1/16th inch deep to the design. These are the locations of your screws. Make sure they won’t interfere with any cutpaths and that they will be in a good position to secure the stock.
  3. Export just these circles as a cut path and cut them.
  4. When finished, add screws in these locations (The black circles in the image below)
    image
  5. Delete these added circles from the design
  6. Cut your design file as normal.

This method works great, however if the stock is bowed or there are small clearances in the cutpath of your design, or if you aren’t using tabs to support interior pieces this method might not work for you so try the other ones listed below.

Masking Tape and Cyanoacrylate (CA) Glue (Super Glue):

I stole idea this from a few places. Machining metal parts you can straight-up super glue them into place on your vice. Make sure the faces are clean of oil and debris first of course. When finished, you can simply dissolve the glue with a heat gun to remove your part.

The problem with wood is that if you superglue it, it can make it all nasty looking for the next few steps of the project. And what if you wanted a nice natural finish? The solution is to use masking tape. You’ll lay down a piece of wide masking tape to the spoilboard, then apply another to the stock material. Lay down a line of CA glue on the piece on the spoilboard and spray the piece on your stick with CA activator. As soon as you touch the two that piece is going to stay in place pretty well.

This method works best with smaller material that isn’t very tall. It also allows you to cut pieces on top of the tape without the need for tabs.

Masking Tape and Hot Glue:

For larger pieces of stock I’ve found the use of wide masking tape and hot glue to hold large sheets fairly well. You might think hot glue isn’t a good choice, but I’ve used hot glue to hold down guitar body blanks on my large planing jig while I router-planed them to thickness without any issue. These were solid poplar about 1 and 3/4 inch thick. I simply use a high temp glue gun and a harder (rather than flexible) glue.  I’ve also used it to mount 1/4” plywood on my CNC machine for tons of engravings and through cuts to great success.

On the CNC machine, I used masking tape to lay down on the spoilboard since I was doing a bunch of cuts. After a few pieces of plywood were cut the glue makes it hard to get a flat surface so you can just pull it up and put down new tape to glue to. The masking tape sticks to my spoilboard on my machine making an outline of where the wood will go with a bit of overlap so that the wood lays on top of about 1/2 the wide of the tape. Align the tape with the router head, not the machine itself. Move the router 10 inches at a time and make sure the middle of the tape is right under the bit. Here you can see the 1.5-2inch wide masking tape just under the wood:

image

The Endmill (the Bit):

An additional tip for keeping the material flat is to always use Down Cut endmills or compression bits on pretty much all plywood cuts. These endmills have the spirals cut backwards such that the normal spinning of the bit puts pressure in a downward motion as opposed to upward. Compression bits actually have regular flutes on the top, but reverse flutes the rest of the way up to give a nice finish on the both sides of the cut. This isn’t a great thing to use for deep narrow pockets, but for plywood stuff it works very well for making sure the material doesn’t raise up when you are cutting.

Can you think of any other tips or tricks I haven’t listed here? Leave a comment and let me know about it!

Making Guitar Body Blanks for Cheap

I’ve wanted to use my CNC machine to build some guitars, but I didn’t want to spend a fortune on body blanks to ruin while learning and perfecting the process. I decided the cheapest option was to make a bunch myself. (Video at the end)

I went to Wurth wood in Charlotte. I had decided on poplar as a species due to its cost. Wurth has rough-cut wood which comes in various lengths, widths, and an odd way of measuring thickness. I wanted my body blanks to be about 1.75” thick, about 20 inches tall and about 15 inches wide.  I knew I’d have to glue two pieces together to get the width I wanted.  When I say that the wood from a saw mill comes in various widths, I mean it. There’s no standard width. Any random width they could cut from a tree is what you get.

They also count thicknesses funny. Everything is measures as 1/4 in increments. This is normal for 1/4”, 1/2”, and 3/4” but gets weird beyond that. A 1 inch thick board is called 4/4 for instance. I knew I’d have to plane the wood down to get the desired thickness of 1.75” so I went with a couple 8/4 boards.

They price the wood by the “board foot” which is a volume measurement. For instance, if you have a 1-inch thick panel of 1ft x 1ft, then you have 1 board-feet of wood there. The formula for board-feet is

(width in inches x Length in inches x thickness in inches) / 144 = board-feet

With the wood I got, it was just over 7 inches wide, 8/4 thick and in all was 160-ish inches long. For this I spent about $65. I calculated that I could make 6 guitar body blanks from this. That’s a bit more than $10 each which is FAR cheaper than anything I found online anywhere!

The next step (after getting the wood home of course) was to cut and flatten it. I cross-cut the wood with my circular saw to about 20″ in tall pieces. To make them flat and smooth I had to plane them, but I don’t own (nor can I afford) a planer. The solution is simple. Build a sled and use a router to face off the surface of the wood. The process is simple. Starting with the leftmost picture, you can see the rough wood is warped and cupped a bit. I’ll use my router to flatten the top (2nd pic from the left). Then I’ll flip it so the flat side is down, and use my router to again plane it flat on the other side (rightmost pic). You can’t do this just by eye though. I needed to build a jig to hold the wood and a planing sled to hold my router.

image

To build the sled, I used some scrap pieces of stuff I had laying around. It was just big enough to fit the wood into it. I used a 2ft by 2ft-ish piece of 1/2 inch plywood and four straight and flat pieces of 1×2. I used wood glue and tacked the 1x2s into place with brads to make two walls. The walls height needed to be higher than the wood was planing.

Next I had a piece of scrap 1/2” MDF. I drilled a hole in the middle a bit bigger than my planing bit on my router, and 3 mounting holes in the pattern that matched my router base. The size of this piece of MDF isn’t terribly important except that it needs to be long enough that the router can be all the way on one side of the jig and the MDF still spans the entire jig. Here’s what I mean:

image

Here you can see the rough wood blank height (which is about 2 and 1/8th inches thick) is just smaller than the right-side wall of the jig (which I made  2 and 1/4 inches tall).  You can see that the bottom edge of the rough wood is hot glued to the jig so it won’t move. I did this with the two shortest edges and that was all I needed.

image

I found that going vertical allowed me to see the depth of cut.  I took about 1/16th to 1/8th of an inch depth cut per complete pass, lowering the router in its base each successive pass if needed.  Once I planed down one side, I used a chisel to remove the hot glue holding the board to the jig.

image

Once I finished one side, I left the router at its current height and sat it to the side while flipping the board. This kept the router at the correct height to start on the other side. I then used a chisel to carefully release the hot glue holding the piece down and flipped it. This method will flatten any board on both sides. You can also rout the edges of the board using this jig to get 90 degree angles on 3 side before flipping the piece. Here’s  video describing the process:

I actually used the scariest router bit in the world on my router table to get the edges straight though.

image

Once the edges are straight, I slathered on some wood glue and clamped them together. I had to use tie-down straps as clamps. To keep the straps from getting glued to the wood I put paper towel between the strap and the wood where the seam was.

image

The next step was to rout the guitar body shape on the CNC machine about 1/4 inch deep, and then rout the cavities for the neck pocket and the electronics. I’d then use my bandsaw to cut the path of the body blank and use the scariest router bit in the world to clean the edges up. I actually hadn’t do this yet. In fact, I made these blanks in 2017 and they have sat in the garage since.

Things that stopped me are:

  1. My bandsaw is garbage and can’t cut a straight vertical line to save its life, regardless of how tight the blade is or how slow I go.
  2. I’m scared of the router bit. Routers are a lot like honey badgers in that they don’t give a ….  well you know the rest. They’ll cut chunks out of you much faster than you can imagine and with the giant  2.5″ bit I had, it could easily be deadly.
  3. You have to build the guitar based on a neck and I’ve never bought a neck to design it around
  4. I sold the CNC machine… But that’s no real excuse, I could use the Shopbot at Charlotte Latin if needed, or just do it by hand. HOnestly, doing it by hand is how most folks do it and it is a lot faster than me figuring out how to CNC it. I’m terrible with CAD…
  5. I’m lazy and this was so much work that I don’t want to screw up all 6 of them then have to do all this again. I simply don’t have the time to.