Best way to make GUIs and Executables in Python for Windows, Mac and Linux

Typically when making a program, I want users to have a familiar experience: a single .EXE file instead of some weird scripts that requires other programs to run. There are a few different ways of accomplishing this using python,. On this page I’ll explain the simplest way I’ve found to get this result, and how to debug if you run into problems with this method.

I wrote about using pySimeplGui for making dead simple GUI interfaces for python code before, and even have a simple example project,. Check those two articles out for that aspect.

As for creating the .EXE file, there are several packages that will allow you to create executables of your python scripts. The reason to do this is that you don’t want end users to have to install python  (simplified usage of your app) or you don’t want anyone seeing the actual python code. The way they work is that they create a self-extracting zip file that has your code, all associated libraries (including DLLs), and most crucially, they have a small bootloader that is a python interpreter executable. There are several available such as cx_Freeze, bbFreeze, Py2App, Py2Exe, Pyinsaller, or you can create your own from scratch  (See a chart comparing them here).

There are some problems with these tools. Several of these are not currently updated. Some don’t allow you to create a “One File” solution, meaning they require additional folders of files, etc. which in my view isn’t a true executable experience from the user perspective.  For some reason, there’s a known issue with some of these which makes the resulting executable get incorrectly flagged as a virus by virus software. There are some ways around this however.

I’ve tried out a few of these and given my recent experience with PySimuleGui, and the features I wanted, I settled on pyinstaller.

PysimpleGUI has its own interface for pysintaller to simplify things called pysinstaller-exemaker.

For some reason, my resulting executables kept getting flagged with false virus warnings on windows. I tested in Virus Total which runs multiple virus scanners at once on your file. Sure enough, lots came back with false positives.

I found two ways to fix this problem. As with most things, there’s the easy way, and then there’s the right way.

The easy way requires specific versions of python and pyinstaller on your machine.

The other way to prevent false positive virus scans is to recompile pyinstaller’s bootloader from scratch. While I did this (and explain it below), it is non-trivial.

The Easy Way: Install Correct Versions:

The easiest way to not have the virus issue is to use the correct versions of pyhton and pyinstaller as described on a no-dead link on yuriss.com.  This Completely solved the problem and is SOOO simple!  Basically you just install the correct version of python (Version 3.7.4) from python.org. If getting the windows version, make sure it is the 64-bit version, other users seem to have had issues with the 32-bit version.

Once this is installed, you can use pip on the command line to install Pyinstaller 3.4:

 pip install pyinstaller==3.4

The Right Way: Recompiling pyinstaller’s bootloader from scratch

This may be needed for future version of python or pyinstaller. Since I already went through the headache of figuring out how to do it, I’m documenting it here.

If using a version of pyinstaller that throws the virus warnings, you can’t just go to the folder PIP installed it to and compile it there. That’d be too easy of course! (This took me a long time to figure out)… If you try to do that, it’ll fail with cryptic errors.  The reason is that the file path is too long.

To overcome this, you have to perform the following steps:

  1. Clone pyinstaller’s source to a folder in your C drive, then
  2. Rebuild the bootloaders,
  3. Install pyinstaller with pip,
  4. Overwrite your pip installation with your newly built bootloader files…

Duh, obvious right?! (omgwtfwhyisthisalwayssohard!?)

Details for the steps are below:

Step 1: Open a powershell as admin and go to C:\\

cd c:\\

Download the source of pyinstaller. This will create its own folder for pyinstall:
>pre>git clone https://github.com/pyinstaller/pyinstaller

Step 2: Cd into the bootloader’s build folder:

cd .\\PyInstaller\\bootloader\\

Then run the script to reinstall. If you get an error telling you there’s no such thing as ./waf then you are in the wrong folder.

python ./waf all

Step 3: Once this is done, you can go back to vscode or wherever and install pyinstaller from pip

pip install pyinstaller

Step 4: Then navigate to python’s site packages, and copy the newly built bootloaders into the appropriate place. NOTE: PyInstaller is case sensitive here, so be careful. We’ll first make a backup of the original bootloader folder:

 mv C:\\Users\\ALaptop\\AppData\\Roaming\\Python\\Python38\\site-packages\\PyInstaller C:\\Users\\ALaptop\\AppData\\Roaming\\Python\\Python38\\site-packages\\PyInstaller.bak

Then copy in our freshly compiled bootloader:

mv C:\\PyInstaller\\bootloader C:\\Users\\ALaptop\\AppData\\Roaming\\Python\\Python38\\site-packages\\PyInstaller

Note: Now to use pysimplegui-exemaker, you must edit your computer’s %PATH environment variable to locate pyinstall. Click the windows key on the keyboard, type “environment” and click to open the first suggestion. This window will pop up that has a button towards the bottom named “Environment Variables” that you must click. In the top window pane, find “path” or “PATH” and doubleclick that line to edit it. You’ll now be able to enter a new value. You want to add the path to where pip installs its scripts.  In my case, I pasted in the following:

 C:\\Users\\ALaptop\\AppData\\Roaming\\Python\\Python38\\Scripts

Then test it out:

python -m pysimplegui-exemaker.pysimplegui-exemaker #<--If you use pysimplegui's exemaker (NOT a typo, must exactly this way) OR

pyinstall --onefile ./myProgram.py #<-- If you just use pyinstaller directly

Tada! No more virus warnings!!!!

 

Check out my other post about how to replace the default python icon in your executable files.

Using VSCode and Mkdocs to make a static website

For FabAcademy, students have to post each of their assignments on a website. The website must be a static HTML site hosted on Gitlab (though this method works for github too).  There are a lot of ways to generate static sites, but maybe one of the simplest seems to be to use mkdocs.

I made a video tutorial showing the steps required to get up and running quickly with this method. Just a couple of tweaks required here… In the video I apparently missed a couple of steps. If you have trouble getting python from within VScode’s terminal to work, you need to set the path in VSCode’s settings as well as the PATH environment variable in windows.  VSCode’s tutorial on installing python and selecting the proper python interpreter shares some steps to help you debug if you have this issue.

The second thing you might have to do is set your name and email in git. Try this:

git config --global user.email "<your email here>" 
git config --global user.name "<your name here>"

The other steps in the video should get you going.

 

Setting OBS to Start and Stop Recording Automatically

(Video at the end…) OBS is a great tool for capturing screencasts for classes and such. I also use it sometimes to capture zoom and webex chats when I want the entire screen recorded full-sized. (By default those apps record and show other things like chat on the screen which isn’t useful for me). Sometimes I’m in class when my webchats start, so I wanted to automate the recording setup just like you used to be able to do with old VHS tapes on a VCR.  Simply program the start time and the stop time (assuming your VCR didn’t just flash 12:00 forever because you never figured out how to set the clock on the thing).  Of course you have to have your chat already started and opened on the screen you wish to record before you start OBS or you won’t record anything but a blank desktop with no sound… ask me how I know.  it works better with dual monitors and muting the external microphone inputs.

OBS has a STOP feature built-in. Simply open OBS and go to Tools–>Output Timer and you can set a time limit for how long you want it to record for.  I also check the box for “start every time” when I set it up this way.

The tricky part is STARTING the recording. Since OBS doesn’t run as a background process, it can’t just open itself and do whatever it wants. That’s just not safe. The work-around for this is to create a Windows Task that will do it for you. Windows Tasks are incredibly helpful. It’s like a cron job on linux. Even windows itself uses this tool for checking for updates and running virus scans for you.  To access it, simply click your windows icon and type “task scheduler”

Once it loads, you’ll need to doubleclick the “Task Schedule Library” in the left pane. If you don’t doubleclick it, then you won’t have the ability to create a task. Kind of a bad design in my opinion, but easy enough to work around.

Click Action–>Create Basic Task to open the wizard for you. It’ll walk you through the steps for setting the trigger you want. (In my case, I just want it to be a timed trigger at a certain date, but you can have it repeating, or based on a user’s action, or even every time you login. I set the time for about 5 minutes before the start time of my webchat.

 

Then it asks for what action it should perform when this task is triggered.  This is where we will tell it to open OBS and start the recording. To figure out what to type here, you’ll click your windows icon and type “OBS” but instead of opening it, right-click the icon and select “open file location” This will open the start menu folder.  Right click the OBS icon and click “properties”

Copy and paste the “Target” to the task Scheduler’s “”Program/Script” box.

Then copy and paste the “Start- in” path to the Task Scheduler’s “start in” box. But you have to remove the quotation marks on this one or it will not work!

Finally, you’ll need to type in some arguments for the Task Scheduler. Type:

--startrecording -m

 

The -m is there to allow multiple OBS windows to run at the same time in case for some reason you forget to close the previous one. Without this in the command, OBS will just give an error if another window is already opened.

Click OK to finish this task.  You will then be able to find your new task in the Scheduler’s window. If it is a long time before your trigger point, you can test it by right-clicking and selecting “run” and it should immediately open OBS and start recording.  If this doesn’t happen, then go back and make sure you don’t have quotation marks on the “Start in” function of the task.

I had a bit of trouble setting this up on my older laptop for some reason. I just could not get it to run directly from Task Scheduler. Instead, I wrote a windows batch script with the command in it, then passed the path to it as an argument to the “cmd” command (the windows command terminal/console).  Worked like a charm. First, open notepad and enter the following:

"C:\ProgramData\Microsoft\Windows\Start Menu\Programs\OBS Studio\OBS Studio (64bit).lnk" --startrecording -m

and save this file as “obsScript.bat”  The icon should change from a notepad file to a script icon as shown below.

If you can’t get it to change even by adding “.bat” to the file name, then you need to show file extensions in windows. Open any folder, click View–>Show filename Extensions as shown below then change the filename.

Once this batch script is created, simply create a task for it like we tried to do above, but the path to the program/script should point to our new batch script.

Remember, you can always doubleclick the task in the schedule window to edit the different features. The command itself is listed under the “Actions” and the time is set under the “Triggers” tab.

When you run it, you should see the black command window pop up with the command, then OBS should start.

COMMON QUESTIONS:

Question: I want it to stream instead of record
Answer: Then use –startstreaming instead of –startrecording

Question: How can I make it record multiple times without opening a new window each time?
Answer: There are a couple of ways to do this.  The easiest is to close the window first.

Question: How do I make it automatically close the OBS window when done recording?
Answer: Schedule a “taskkill” command in the scheduler. This is like using the task manager to kill an app. You’ll need to know the time that you want it to end.  The command might be:

taskkill \IM obs.exe

If that doesn’t work, add a “\F” to the end of that line to force-close the program.

Question: How can I start a recording automatically when a call stats on zoom or other services?
Answer: You might be able to do this in TaskScheduler, but I did find a solution script for the program AutoHotKey on the OBS forum that checks to see if zoom is started.

Question: It doesn’t work, even with the batch script. What do?
Answer: You need to be in an Admin account in windows for it to work.

Question: I only have one screen. Wheen OBS starts it hides the content I am trying to record. What d?
Answer: In OBS Open Settings, under General tab > System Tray, select “Minimize to system tray when started”

Here’s the video showing the whole setup. You’re welcome!

 

SAMD11C Multi-use board

I finally got a chance to play with the SAMD11C chips FabAcademy has been recommending for a while. I also wanted to learn to use KiCAD a bit more so I made a multi-use board with the SAMD11C which can be used for UART, UPDI programmer, and as a FreeDAP board. You can find all of my files for this project, including the firmware at my FabAcademy gitlab page.

I will be making a modification of the board Quentin designed.

I designed the board in KiCAD by modifying another of Quentin’s boards, the SAMD11C dev kit with USB-A connector.

To fabricate a PCB, I’ll use the Roland SRM-20 mill as well as my shapeoko/X-carve using Fab Mods.

The steps in this project are:

  1. Download my board files, code, and hex from here.
  2. Mill the PCB with Roland or other CNC
  3. Populate (stuff) the board with components
  4. Flash firmware to the chip
  5. Use this new board as a programmer or USB/UART

Milling a board on the SRM-20 through Fab Mods:

I’ve posted a more detailed explanation of exporting from KiCAD to a milling machine in this previous post.  Be sure to check that out when you get to that part of the process.

Go to http://mods.cba.mit.edu/

Right click anywhere on the screen and select “program” then “open server program” and search for Roland→SRM-20 → PCB png. To use any other CNC (Shapeoko, Xcarve, 3018, etc.) you can select G-code→ mill 2D PCB png. This will accept in a PNG image file and generate the cut file you will send to your machine.

clip_image001

Then we’ll modify this to save a file for us.

clip_image002

 

If your X, Y, and Z, look like the GIF above, you’ll do an “air cut”.  An “air cut” is a test that runs the same code, just offset in the Z axis  (and this case X and Y as well) just to make sure everything will cut as you would expect. Then you’ll regenerate your cut file by changing the X, Y and Z defaults to 0s in mods before exporting your cutfile again.

 

Once the board is cut, it must be populated… Break out the old iron and solder up the design. If you don’t have a switch like the one I used, you can simply install some male headers and use a jumper to select the voltage. The SAMD doesn’t have a lot of external accessories which makes this part a good bit easier than say some of the older FabISP designs.

Once populated, the board needs to have firmware flashed to it. For this step, I will use the Atmel ICE programmer and a windows computer.

First download windows version of edbg which is the debugger tool we’ll use to download the firmware.

https://taradov.com/bin/edbg/

I downloaded it to my desktop.

Then download the binary of the firmware. I am using the SAMD11C arduino bootloader core firmware so I can use the chip with the Arduino IDE and libraries. (This bootloader seems to eat up a good bit of memory, even on these ARM devices).

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.

Above you can see the specific pins for programming the firmware with the Atmel ICE. Pin 1 is Target Voltage (Vcc), pin 2 is SWDIO, pin 3 is GND, and pin 4 is SWDCLK. Pin 10 is the Reset.

Here are the pins and usage of the board:

Finally you’ll need to open the command prompt in windows, cd to the directory you downloaded these files to and run the following command (assuming you went with the 2nd firmware option above):

edbg-windows-r24.exe -bpv -e -t samd11 -f sam_ba_Generic_D11C14A_SAMD11C14A.bin

You should see:

Debugger: ATMEL Atmel-ICE CMSIS-DAP J42700050854 01.00.0021 (SJ)

Clock frequency: 16.0 MHz

Target: SAM D11C14A (Rev B)

Erasing... done.

Programming.... done.

Verification.... done.

The first time I did it I got this error:

Debugger: ATMEL Atmel-ICE CMSIS-DAP J42700050854 01.00.0021 (SJ)

Clock frequency: 16.0 MHz

Error: invalid response during transfer (count = 0/1, status = 0)

I unplugged everything, replugged it and tried again and it worked.

This firmware only allows arduino to program the chip via USB. Let’s now install the correct board info to arduino so we can do that.

In the arduino software, go to File→Preferences and click the icon next to “Additional Boards” and paste the following:

https://www.mattairtech.com/software/arduino/package_MattairTech_index.json

 

Then you need to install the SAMD boards. In Arduino go to Tools→Boards→Board manager

Search for “SAMD” and install the “MattairTech” one only.

Once this is installed (it will take a bit of time) We can write some arduino code to run on our new board. Let’s start with a blinky program. Looking at the pinout of the SAMD11C, we can choose a pin to connect an LED to on a breadboard.

(Image source: https://gitlab.fabcloud.org/pub/helloworld/index/-/tree/master/SAMDino.%20Hello%20SAMD11C14 )

 

You better make sure that you always use “INTERNAL_USB_CALIBRATED_OSCILLATOR” when you plan to keep this plugged into the USB port for power, or “INTERNAL_OSCILLATOR” when you want tit to be standalone. If you select the other two options, you’ll have to reprogram the firmware with the ICE or a DAP.  It basically bricks the chip if you tell it to use an external crystal but don’t add a xtal to your design.

Arduino file to be serial print to test. The pinout is simple. Each output uses the same pin number as the SAMD chip output. This is unlike a normal Arduino.

ATsamD11C14A Arduino pinout

   0 -------------------
  5 | A5                 A4 | 4
  8 | A8 (XIN)        A2 | 2
  9 | A9 (XOUT)   Vdd |
14 | A14             Gnd |
15 | A15             A25 | 25
28 | A28/RST     A24 | 24
30 | A30            A31 | 31
    -------------------

 

You can download this code to test your board (whether you have a working LED or not). Once this uploads, open the serial terminal and you should see “hello”

void setup() {
   SerialUSB.begin(0);
}

void loop() {
      SerialUSB.println("hello"); //Send stuff from USB to serial port
} //end loop

If you want to test to make sure that your board can now be programmed from the Arduino IDE, you can flash the built-in LED on pin 2 with this code:

int led = 2;

// the setup routine runs once when you press reset:
void setup() {
  // initialize the digital pin as an output.
  pinMode(led, OUTPUT);
}

void loop() {
  digitalWrite(led, HIGH);   // turn the LED on (HIGH is the voltage level)
  delay(1000);               // wait for a second
  digitalWrite(led, LOW);    // turn the LED off by making the voltage LOW
  delay(1000);               // wait for a second
}

 


The following Arduino file makes this board into a UPDI programmer when you add a jumper to the appropriate pins (see above). Simply take data from the USB serial port and put it on the output serial port and vice versa.

 

void setup() { 
SerialUSB.begin(0); 
Serial1.begin(57600, SERIAL_8E2); //Adjust baud rate and use SERIAL_8N1 for regular serial port usage 
} 

void loop() { 
  if (SerialUSB.available()){ 
    Serial1.write((char) SerialUSB.read()); //Send stuff from Serial port to USB 
   } 
  if (Serial1.available()) { 
    SerialUSB.write((char) Serial1.read()); //Send stuff from USB to serial port 
   } 
} //end loop

 

 

Program a target board over UPDI:

Once you have downloaded the above serial code to your board, you can use it to program attiny412 or attiny1614 chips over UPDI.

  1. First, you want to get a Attiny board. Here’s a great simple board to try.
  2. Get the code from that link to blink the LED on pin 0.
  3. Most important part==>In arduino, change the chip to the attiny412!!! If you don’t do this, you’ll accidently reprogram the samd which you don’t want to do. If that happens, go back and put the serial UPDI code above back on the samd.
  4. Change the “programmer” to “SerialUPDI – SLOQ: 57600 baud, any platform…”
  5. Wire up the samd board as shown below. The white wire is the jumper described above to put the board into UPDI mode. The other wires connect to a target board.

 

To program other samd chips with this board:

If you want to use this to program other SAMD boards, you’ll need to download this Free-DAP firmware and flash it to this board using the edbg program as explained above. This now becomes a programmer for other boards (called target boards). Connect up the target board to this one correctly (follow pink pin names as shown in the explanation below) and then you can program the target SAMD board with some firmware using edbg as well.

Note that the pinout for the programmer for a target samd board.

 

FUTURE WORK:

I’d like to take a page from Adafruit’s book and make the Free-Dap project into an Arduino project. Though I I’m pretty sure you can’t flash a bootloader to a SAMD using avrdude (hence the use of edbg). Adafruit’s solution is to have you load the bootloader to an SD card connected to the target board, then the arduino project just dumps the data from the card into the target board’s FLASH. Instead, I think I’d rather take a note from how pyupdi.exe was added to the Arduino IDE and simply include edbg.exe with it instead.

I’d like to make this same board also program ISP chips like the attiny45 or bare Atmega328s, but it isn’t a priority. It should be possible to do this through the ArduinoISP file but…. meh.

 

 

Milling a Dollhouse Design from Etsy

For our daughter’s birthday, we noticed how much she seems to enjoy dollhouses so we decided to build one for her. She has plenty of dolls she could use with one, by she doesn’t have the house itself. We have always made her gifts (Last year was a ukulele — yea, yea, we know she’s way too young for it yet… give it time) and we really didn’t want to buy a dollhouse made out of a whole barrel’s worth of oil.  Since I’m no CAD star, we looked online for good plans to use.

We came across this Etsy seller and in particular this design. For less than $15 we got the plans which can be used for either a router or a laser cutter and either 5mm or 6mm plywood. For $20-30 we got the flattest and prettiest sheet of quarter-inch plywood from home depot and had it cut in 2′ x 4’ sections to fit in my car and my machine.

At the bottom of this article I have a bullet checklist with a quick reference of all my tips for this project.

My machine is the Xcarve which has the cutting area of about 32”x 31” and the dollhouse plans are HUGE in comparison, so I have to make separate panels for each piece and can’t cut all in one go.  I found that the Xcarve is nowhere as good as a shopbot in terms of precision and rigidity so I ended up doing a lot of small test cuts rather than large cuts anyway.

The first hurdle I had was that while the plans I bought came with 4 different file formats, (Abode Illustrator, AutoCAD dxf, CorelDraw, and SVG) When I imported the SVG into Easel, it garbled some parts. Some parts were solid shapes and I could not simply select to cut the outline of the shape. The problem was that Easel likes to have “closed” so the lines used for decoration (like the shingles) wouldn’t cut.

I’ve only cut a couple of projects with Easel which I find much simpler to use than other CAM/Gcode-sending software, but haven’t had tons of luck with external CAM. This led me to hunt for a better option. I had seen online that MakerCAM could do open vectors, but I found it tedious.

I ended up using Carbide Create (originally for the Shapeoko 3) which is adequate for the most part.

The workflow is as follows:

Open SVG in Carbide Create –> build toolpaths –> export Gcode file –> import gcode into Easel –>Send to machine.

If you use another machine or controller software, just replace the last 2 steps with your software.

I found the default feeds and speeds in Easel were way too conservative.  For each toolpath, I tested on the smallest part of the dollhouse, the windows; which I needed a bunch of anyway. Playing with the SVG showed that the dollhouse design had dogbones in the interior corners (as it should) and those were approximately 1/8” in diameter which gave me the size endmill I needed to use.

You can check out this official series of videos for basics in Carbide Create.

The order you cut the line in the design actually matters. You want to cut all decorative engraving first, then interior cuts, and finally the outlines. Select all the design elements you want engraved (if your design has any) and create a toolpath for them. In my case all the open shapes in my SVG file (which Carbide Crete shows as pink) are what I want to engrave. Holding Ctrl, I click each line I want, then click the “Contour” button near the top left of the screen.  This opens the “toolpaths” section which you can always get back to by clicking the green “toolpaths” button at the top of the screen. I select a 1/8” (0.125”) flat endmill for my tool. In my case, I created my own tool to play around with it. Then to override the incredibly conservative default feed rates, uncheck “Set speeds and feed automatically” so you can type in the boxes below.

Since I’m using a 0.125” endmill, the typical stepover and stepdown rule of thumb is these should be no more than 0.5*endmill width which in my case is 0.056” each for the maximum speed. I am using a 4-flute 1/8” bit at 10,000RPM, so I should be able to fly through these cuts. The default feedrate is 12.5 inches per minute (IPM). Easel’s default for a single-flute 1/8” is 40IPM.   Since my bit as 4 times as many cutting edges, it’s able to remove material about 4 times as fast as a single flute  but I set the feed rate to 40IPM. The 10,000RPM is too fast for what I’m trying to do, but that’s as slow as my router will go.

Override Defaults

The next step is to set up the type of cut, max depth, and if you want to add tabs. Since these are superficial cuts, I want to just have the center of my endmill follow the path of the line so I use “no offset”. Since I’m starting my bit at the top of the material, I leave “Startdepth” to 0.000in. I only want an engraving so I use 0.06 inches depth. My material’s thickness is 0.21in so this should be a nice relief. It is also deep enough to not have issues with my unlevel machine. As long as I get the impression of the lines  it is OK if they aren’t all the exact same depth, though this is something I should fix in the future. There is no need for tabs on this cutting path so I ignored that option for now.

At this point you can try to see the simulation of the cut, but as of the version I am using the simulation is not very accurate as shown in the full simulation of the part below. Several lines are completely missing (which actually did cut just fine) and the engraved contours have random jagged areas (which don’t appear in the real cut). I recommend avoiding the simulation in this software at this time.

image

I saved the engraved cuts as “siding” which you can see highlighted in red below.

details1

The next set of cuts are all the interior cuts such as the doorway and the slots. Holding Ctrl, click each item you want, then set up a cut for the interior (the default selection). Don’t forget to change the stepover and feedrate, otherwise it’ll take you many times longer to finish the cut. For the larger areas (not the slots) I added tabs. Tabs on these pieces are areas that don’t cut completely through so the interior part doesn’t wobble around and break stuff when it is cut out. To add tabs, in the toolpath simply click “Edit tabs” and then click on your shape where you want tabs. Tabs appear on your drawing as a little box with an ‘X’ in it. I recommend only having a few tabs (the fewer you have to clean up later) and placing them strategically. For instance, due to the unlevel-ness of my machine, sometimes my tabs are only as thick as the bottom facing of the plywood which is sometimes not strong enough to function as expected. This also depended on the grain direction and direction of the cut. For instance, the tab on the left side of the doorway broke because the grain of the facing ply was vertical and so was the direction of the cut. I also tweaked the tab size to make it hold better and easier to cut when the cut finishes. image

I saved this as “InnerCuts” which is shown in red below:

interior cuts

Finally I made the toolpaths for the exterior cuts. I used all the same depth and stepover settings as with the inner cuts. I added some tabs and this toolpath as “outside cuts.” I honestly changed up the cutting speed to up to about 55in/minute and didn’t really see any detrimental results. You can play with these settings to see what works best for your job and set up.

Once all the toolpaths are set up they need to be exported as g-code. While you can export them all as one file, and they would execute top to bottom, I strongly discourage this. Export each one separately because if something happens and you need to recut (maybe you didn’t go deep enough on the first try, etc.) you can always go back to 0,0,0 on your machine and make tweaks to the starting position as needed and try again.

I imported the gcode files into Easel.com to send to my xcarve. You can import gcode by going to File—> Import gcode.

image

I loaded the three files in the same order as I had created them. Engrave, then interior cuts, then exterior cuts. Each one is automatically loaded into its own “workpiece” as shown at the bottom of the screen. In this example, I actually only did the bottom wall because I forgot to save screenshots from the workflow above. Just note that whatever you set up in your toolpath should be shown in Easel.

image

Midway through the project, Inventables added the easily-accessible Jog feature to Easel which I found to be incredibly helpful. Since then, there are lots of new features that have been added.

I loaded the wood onto my machine. I was using 2’ft x 4ft sheets of 1/4″in Sande ply. We actually bought two 4ft. by 8ft sheets at the orange big box hardware shop and had them cut it to the smaller size for us to fit in the car.

The xcarve can’t cut the full 4ft length, but I loaded it into the machine without shortening it. This is because once I cut a full-size panel, I then flipped the plywood around and cut another piece on the previously unreachable area.

To mount the plywood, I use the same method I used for manually planning guitar blanks in the past with great success. After laying down the plywood on the machine with the bowed par facing the table (bowed edges flexing upward)and getting it relatively straight and in line with the X and Y motion of the router I laid down a strip of 2” masking tape on my spoilboard halfway under the wood running the length of the board. A tip here is don’t align to your rails or you’ll have a bad time.

After realigning the plywood, I go back and glue the edge of the board to the tape using a high-temp hot glue. To flatten out and bowing the in wood I use my free hand to apply pressure an hold until the glue is hardened, or you can set some clean heady books on it. You don’t really want the glue under the wood, just along the edges. Since we laid the bowed part of the wood into the table, that’ll make it easier to not have a ”bubble” in the middle of our wood that would mess up any cut depth there.

Throw your 1/8” downcut endmill into the collet and you’re about ready to cut. You want to use a downcut endmill because it if there is any bow or warping to the wood, as it cuts the force of the flutes will put downward to help flatten the wood. This also leaves a much nicer finish on the top of the wood. Sadly, I didn’t find all this out until after I made all my cuts and as you can see below, had to manually use a razor blade on all edges to clean them up.

Once the glue is set, I turn on the machine and click “Carve” in Easel. I can then jog the router to the bottom left corner just to the interior of the wood by about the size of my bit on each axis. This will give me a margin of error incase I didn’t align my tape very well.

After zeroing X, Y, and Z, I jog the z down slowly until the bit presses about 0.1” into the wood. This will help me realign if I need to hit the E-stop and lose my home coordinates.

I quickly turn the router on and off to make a small indention here. If something catastrophic happens and I hit the E-stop or lose power and my machine forgets its location, I can manually adjust my X and Y locations until the bit  fits snuggly into this divot and I know I’m pretty close to my original zeros. I zero the X and Y axes at this spot. Lift the bit and move over the wood just next to this divot (I usually move X to the right 1”) and bring the Z axis to touch the top of the wood. I actually put a little pressure on the wood by a couple 0.001” movements.

Part of the workflow in Easel allows you to zero the Z axis by itself after you confirm your location and material thickness. I zero the Z axis at this point. Then in the Job menu, I bring the bit up a touch and move back to X=0 (move X back to the left 1”). Then you are ready to cut.

It’s loud, so wear ear protection. Also wear a dustmask with the appropriate particulate filters. I have a dust boot on my machine, so I set that up. The vacuums I have for my dust boot consist of a household vacuum we’ve had for like 15years that recently lost a wheel and a tiny shop vac. Neither of these were designed to run for hours on end in 90+ degree weather (in the garage with the door open in the middle of NC summer). They both overheat during the cuts so I cycle them out as often as I can. I also run my air filter the whole time and for a few house after I am finished. You might think that with the door of the garage opened you wouldn’t need this but you’d be wrong.

While cutting, if something isn’t right, it is always best to hit the Stop button unless there’s a serious emergency (like someone getting hurt). If you hit the normal stop button (wither in Easel or on the Xcontroller) the Xcarve will finish its current cut, raise the bit to the safe height and bring it back to X0,Y0, Z(safe Height). This way, you can make simple modifications to either the code and try again without losing your position. If you hit the E-stop button, the machine completely cuts off and disconnects from the computer. This will lose your current position.  You’ll have to try tot manually set up your X, Y, Z which is never quite correct. That’s why we made that divot in the beginning though. Just in case you hit E-stop you can jog the bit back into that divot, raise the bit, move over and set the Z height again just as before and you’ll be kinda close.

Once all 3 cuts are finished, your part is still stuck in the workpiece because of the tabs. The easiest way to remove the tabs is to use a chisel. Place the flat side of the chisel against the part you’d like to keep and give it a stern whack with a mallet or hammer. This should break the tab and leave you with a relatively clean edge.

To remove your stock material from the table, simply pull upward near the end of one edge and the hot glue should peel off the tape. You can reuse this tape a few times before having to reposition it.

Once I had cut all the dollhouse parts, I cleaned up the edges with a box cutter and razor blades and sanded everything with 220 grit sand paper  on my orbital sander to flatten it a bit. The 1/4” ply is slightly thicker than the metric 5mm of the design do for the tabs to fie correctly into the slots, I had to make sure to sand these a bit more. It’s ok if they fit a little loose too because when you add shellac it thickens the piece, then you can put on the twist-knobs to tighten the tabs to the faces of the part with the slot.  This really is a genius design and works well if you sand it enough.

After the initial fit, I went back and had to sharpen the interior angles of all the tabs so they’d fit flush with the slots. Without this the design would never work.

I used my box cutter and some tiny files for this. You don’t want any overhangs because when you seal it in the next step, anything that is a soft burr of wood becomes a tiny razor blade or needle when the sealant dries on it.

Take everything outside and shellac it because Sande Ply smells horrible!  I think it is formaldehyde in the glue. I sat all the pieces out in the sun for a couple of days (each side getting 1 full day of sun) in the 90+ degree heat which drove off the majority of the stank. I needed to seal it though to prevent exposing my kid to VOCs. Shellac is a natural ingredient made from bug poop dissolved in ethyl alcohol. It is FDA approved (used to coat pills for decades) and often used for baby cribs. Seemed like a great option. I had bought a half-pint of shellac and did it by hand which took forever and didn’t look great. I recommend you buy spray cans of it for fast even coats. Three or more light coats work best for sealing. Make sure to sand with 200 grit paper between each sanding and let it dry for a couple hours between coats. The result slightly darkens the wood, smooths the surface finish, and most importantly, completely seals all the pores of the wood so no chemicals will get in or out of it.

We had to sand the tabs a bit more before it fit back together, and not all the toggles cinched without breaking the tabs. No big deal, that’s why Ii have glue.

This project took quite a while to complete, mainly because of the finishing steps. It took a full 3 days of figuring out my workflow and cutting on the machine (I messed up a few times too in the learning process of course), another couple of weeks for clean up and sealing as I only worked on it on the weekends.

The final result: My daughter absolutely love it! She immediately began playing with it as soon as I brought it in the house. It isn’t the most ornate, or even well-built but I’m proud of it.

Ok, so here’s the cheatsheet for this project:

  • Get plans for the design. Either make it yourself (which could easily be several posts in itself) or buy them.
  • Carbide Create is a great offline tool for generating toolpaths.
    • Make sure to change the step over and depth EVERY TIME you create a toolpath unless you are immortal and time is meaningless to you.
    • Make sure to check the the start depth and ending depth before exporting the gcode
    • Change tabs to make sense. I did 0.3” thick and 0.118 tall since my stock material bowed a bit and I was using a 1/4” chisel.
    • Export each cut separately
  • Import gcode into Easel in this order: Engrave –> inside –> outside cuts.
  • Lay down wood on work area with the bowed part down (edged bending upward) and align 2” masking tape just under the edges
  • Use high temp hot glue to secure edges of wood to tape using weight to keep it flat if needed
  • Use a downcut endmill for best results and to help prevent the wood pulling upward in the flutes.
  • Move router to bottom left corner where bit is just fully inside the edges of the wood and jog Z down a bit. Turn on the router and adjust Z until you create a divot in the wood. This will serve as your way to recapture the 0,0 of the job if E-stop or power failure.
  • Zero X and Y axes to this point.
  • Move Z up and move X—>1” and use Easel’s Carve workflow to set the height of the material (which Zeros the Z axis)
  • Move the X back over the divot
  • Carve the piece.
  • Rinse and repeat with each cut
  • When finished, use a chisel with the flat side on the part you want to keep to remove tabs.
  • Sand with an orbital sander with 200 grit to remove all the burrs and sharp edges.
  • May need to use razor blades or hand-sand to get some tight spots
  • Go ahead and make interior cuts of the tabs square for a better fitment
  • Sand tabs more than you think you should. They would fit loosely in the slots and the toggles should turn easily when you put the house together.
  • Let wood sit in hot sun for a day on each side with ventilation underneath (I have a slatted patio table) to remove the formaldehyde stank.
  • Spray with shellac (don’t brush it on unless you have to for tiny detailed spots), let dry a couple hours, sand with 200 grit.
  • Rinse and repeat until all parts are sealed well.
  • Put it together and enjoy.
Protected by CleanTalk Anti-Spam