<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:media="http://search.yahoo.com/mrss/"><channel><title><![CDATA[Buildbotics]]></title><description><![CDATA[Desktop manufacturing for everyone.]]></description><link>https://buildbotics.com/</link><image><url>https://buildbotics.com/favicon.png</url><title>Buildbotics</title><link>https://buildbotics.com/</link></image><generator>Ghost 2.27</generator><lastBuildDate>Sun, 19 Apr 2026 03:48:08 GMT</lastBuildDate><atom:link href="https://buildbotics.com/rss/" rel="self" type="application/rss+xml"/><ttl>60</ttl><item><title><![CDATA[Introduction to the Buildbotics CNC Controller API]]></title><description><![CDATA[Learn how to build your own user interface to the Buiildbotics CNC Controller.]]></description><link>https://buildbotics.com/introduction-to-the-buildbotics-cnc-controller-api/</link><guid isPermaLink="false">67c08970bf3d4a05071d9cdf</guid><category><![CDATA[Buildbotics CNC Controller]]></category><category><![CDATA[cnc]]></category><category><![CDATA[API]]></category><category><![CDATA[CNC API]]></category><category><![CDATA[App Development]]></category><category><![CDATA[howto]]></category><dc:creator><![CDATA[Doug Coffland]]></dc:creator><pubDate>Mon, 03 Mar 2025 00:11:30 GMT</pubDate><media:content url="https://buildbotics.com/content/images/2025/02/API-collage-2.png" medium="image"/><content:encoded><![CDATA[<!--kg-card-begin: markdown--><h1 id="introduction">Introduction</h1>
<img src="https://buildbotics.com/content/images/2025/02/API-collage-2.png" alt="Introduction to the Buildbotics CNC Controller API"><p>The user interface for the Buildbotics CNC Controller is really nice. It's easy to use and flexible. But, every user and application is different and the interface may not be optimal for every case.</p>
<p>Maybe you want to run it from your smart phone, but find the web interface to be too busy to all fit on a smart phone. Maybe you want more macro buttons. Maybe you want to limit the things a user can do. You get the picture, there always things that could be done differently or more efficiently for each unique user and application.</p>
<p>That's where the Buildbotics Applications Programming Interface (API) comes in. We recently published a full description of the API and quietly announced it. This describes how to use it.</p>
<p>Also, check out my blog post titled <a href="https://buildbotics.com/smart-phone-app/">Creating a CNC Jogging App for an Android Phone</a> to see a real life example.</p>
<!--kg-card-end: markdown--><!--kg-card-begin: embed--><figure class="kg-card kg-embed-card"><iframe width="200" height="113" src="https://www.youtube.com/embed/hYyX-Kz4OYA?feature=oembed" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" referrerpolicy="strict-origin-when-cross-origin" allowfullscreen title="Build your own Applications for the Buildbotics CNC Controller"></iframe></figure><!--kg-card-end: embed--><!--kg-card-begin: markdown--><h1 id="apioverview">API Overview</h1>
<p>Applications that use the API will connect to the <a href="http://buildbotics.com">Buildbotics Controller</a> via the hardwired Ethernet port or through the WiFi interface.</p>
<p>The API exposes <a href="https://github.com/buildbotics/bbctrl-firmware/blob/master/docs/api/Websocket_API.md">WebSocket</a> and <a href="https://api.buildbotics.com">HttpRequest</a> interfaces.</p>
<p>The <a href="https://github.com/buildbotics/bbctrl-firmware/blob/master/docs/api/Websocket_API.md">WebSocket</a> interface initially receives many state variables from the controller when the websocket is first opened and then subsequently receives those variables again whenever they change.</p>
<p>The <a href="https://github.com/buildbotics/bbctrl-firmware/blob/master/docs/api/Websocket_API.md">WebSocket</a> interface can also be used to run Manual Data Input (MDI) commands.</p>
<p>The <a href="https://api.buildbotics.com">HttpRequest</a> interface is used to send specific commands and send or receive information or files.</p>
<!--kg-card-end: markdown--><!--kg-card-begin: markdown--><h2 id="websocketinterface">WebSocket Interface</h2>
<p>Most applications need to monitor the state of the machine. That single interface will send back the state variables and their values and then send each variable again if it changes.</p>
<p>Here's some javascript code that will open a WebSocket with my Buildbotics CNC Controller and then handle the state messages as they arrive.</p>
<pre><code class="language-javascript">is_object(o) {return o !== null &amp;&amp; typeof o == 'object'},

update_state(state, update) {
  for (const [key, value] of Object.entries(update))
    if (is_object(value) &amp;&amp; is_object(state[key]))
      update_state(state[key], value)
    else state[key] = value
}

let state
let ws = new WebSocket('ws://192.168.12.243/websocket')

ws.onmessage(event) {
  let msg = JSON.parse(event.data)
  if (state == undefined) state = msg  // First message
  else update_state(state, msg)        // Update messages
}
</code></pre>
<p>The 'let state' line initializes a variable called state, which will ultimately maintain a list of all variables and their current value.</p>
<p>This piece of code opens a WebSocket with the Buildbotics Controller and puts it in 'ws'. The argument to WebSocket is a Uniform Resource Locator (URL). Replace '192.168.12.243' with the IP address for your controller.</p>
<p>Then, whenever a message arrives, the code in ws.onmessage is called with the message contained in the 'event' argument. 'msg' is then gleaned from the event. For the first message, the variable state is set to msg. Subsequent messages are passed to update_state.</p>
<p>update_state then finds all the variables and their values in 'msg' and updates state.</p>
<p>Now that you have the variables, you can monitor them and take whatever action desired based on their valued. For instance, you could add a line to update_state that raises an alert if the machine is estopped.</p>
<pre><code class="language-javascript">update_state(state, update) {
  for (const [key, value] of Object.entries(update))
    if (is_object(value) &amp;&amp; is_object(state[key]))
      update_state(state[key], value)
    else state[key] = value
    if (key === 'es' &amp;&amp; value == 0) alert('Machine Estopped!')
}
</code></pre>
<p>The variables and their definitions are documented in <a href="https://github.com/buildbotics/bbctrl-firmware/blob/master/docs/api/bbctrl-vars-schema.yaml">bbctrl-vars-schema</a>.</p>
<p>You can also send messages to the Buildbotics Controller via this same WebSocket. Any command that can be sent through the MDI interface on the Buildbotics Control page can also be sent through this WebSocket interface. For instance, if I want motor 0 to set to homed, I could use a command like this.</p>
<pre><code class="language-javascript">ws.send('0homed=1')
</code></pre>
<!--kg-card-end: markdown--><!--kg-card-begin: markdown--><h2 id="httprequestinterface">HttpRequest Interface</h2>
<p>The HttpRequest interface is used for sending and receiving files, loading and setting the configuration, telling the machine to run, stop, start, pause, jog, reboot, estop, and lots of other things. The <a href="https://api.buildbotics.com">Applications Programming Interface (API) document</a> provides a detailed list of the commands that the Buildbotics Controller accepts.</p>
<p>These commands use 'GET', 'PUT', and 'DEL' HttpRequests as described in the <a href="https://api.buildbotics.com">API</a>. The <a href="https://api.buildbotics.com">API</a> also specifies the URL for each command. The <a href="https://api.buildbotics.com">API</a> provides nice examples of how to send and receive each command in various technologies such as unix Shell, javascript, java, python and others.</p>
<p>In javascript, it's best to use fetch commands.</p>
<p>Here's an example of how to read the hostname in javascript.</p>
<pre><code class="language-javascript">try {
  const response = await fetch('http://192.168.12.243/api/hostname);
  if (response.ok) {
    const data = await response.json();
    console.log('got response', data);
   }
} catch (e) {
  console.log('error:', e);
}
</code></pre>
<p>Note that the javascript fetch command automatically assumes a 'GET' request if the request method is not specified.</p>
<p>Here's an example of using the controller to start jogging on the X axis at full speed.</p>
<pre><code class="language-javascript">try {
  const response = await fetch('http://192.168.12.243/api/jog', {
                        method: 'PUT',
                        body: JSON.stringify({'X': 1,'ts':Date.now()}),
                        headers: {
                        'Content-Type' : 'application/json',
                    },
  });
  if (response.ok) {
    return;
  }
} catch (e) {
}
</code></pre>
<p>Here's an example of how to write a file to the Buildbotics Controller.</p>
<pre><code>async writeRemoteFile(data, path, fileName) {    
  let fd = new FormData();
  let blob = new Blob([data], {type: 'text/plain'});
  let file = new File([blob], fileName);
  fd.append('file', file);
  let url = path + fileName;
  await fetch(url,{method :'PUT', body: fd})
}

writeRemoteFile('this is some file content',
                'http://192.168.12.243/api/fs/Home/',
                'newfile.txt')
</code></pre>
<!--kg-card-end: markdown--><!--kg-card-begin: markdown--><h1 id="conclusion">Conclusion</h1>
<p>The Buildbotics API can be used by developers to do pretty much anything you want. Remember, freedom comes with responsibility. It's certainly possible to mess things up on your Buildbotics CNC Controller royally using this interface. I recommend making a backup of your MicroSD card before you start.</p>
<p>If you are planning to do applications development on the Buildbotics CNC Controller, please consider joining our <a href="https://forum.buildbotics.com/viewforum.php?f=18">Applications Development forum</a>.</p>
<!--kg-card-end: markdown-->]]></content:encoded></item><item><title><![CDATA[Creating a CNC Jogging App for an Android Phone]]></title><description><![CDATA[Learn how to build a CNC jogging app for your smart phone.]]></description><link>https://buildbotics.com/smart-phone-app/</link><guid isPermaLink="false">67c0e967bf3d4a05071da02c</guid><category><![CDATA[Buildbotics CNC Controller]]></category><category><![CDATA[API]]></category><category><![CDATA[App Development]]></category><category><![CDATA[CNC Phone App]]></category><category><![CDATA[buildbotics]]></category><category><![CDATA[cnc controller]]></category><category><![CDATA[CNC Jogging]]></category><dc:creator><![CDATA[Doug Coffland]]></dc:creator><pubDate>Sun, 02 Mar 2025 17:42:09 GMT</pubDate><media:content url="https://buildbotics.com/content/images/2025/03/pixel_screen.JPG" medium="image"/><content:encoded><![CDATA[<!--kg-card-begin: image--><figure class="kg-card kg-image-card kg-card-hascaption"><img src="https://buildbotics.com/content/images/2025/02/pixel_screen.JPG" class="kg-image" alt="Creating a CNC Jogging App for an Android Phone"><figcaption>Buildbotics Jogging app running on Smart Phone</figcaption></figure><!--kg-card-end: image--><!--kg-card-begin: markdown--><h1 id="introduction">Introduction</h1>
<img src="https://buildbotics.com/content/images/2025/03/pixel_screen.JPG" alt="Creating a CNC Jogging App for an Android Phone"><p>This is a step-by-step procedure for creating an application for jogging  your Buildbotics CNC with an Android Phone. My development system is a desktop computer running <a href="https://www.debian.org/">debian linux</a> and my phone is a Pixel 8. This procedure utilizes the <a href="https://reactnative.dev/">React Native</a> applications development framework. Other combinations of development systems and android phones will be very similar.</p>
<p>Besides the phone and development system, all you'll need is a USB cable to connect your phone to your development computer.</p>
<p>Note - The development process for IOS phones should be similar, but I haven't tried that.</p>
<p>Check out my blog posting titled <a href="https://buildbotics.com/introduction-to-the-buildbotics-cnc-controller-api/">Introduction to the Buildbotics CNC Controller API</a> to learn about the Buildbotics API.</p>
<!--kg-card-end: markdown--><!--kg-card-begin: embed--><figure class="kg-card kg-embed-card"><iframe width="200" height="113" src="https://www.youtube.com/embed/hYyX-Kz4OYA?feature=oembed" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" referrerpolicy="strict-origin-when-cross-origin" allowfullscreen title="Build your own Applications for the Buildbotics CNC Controller"></iframe></figure><!--kg-card-end: embed--><!--kg-card-begin: markdown--><h2 id="step1setupyourcomputerfordevelopingreactnativeapplications">Step 1 - Set up your computer for developing react-native applications.</h2>
<ol>
<li>Open a terminal in the folder where you want the root folder for the app to reside.</li>
<li>Ensure that node.js and npm are installed on your system</li>
</ol>
<pre><code>sudo apt update
sudo apt install node.js
sudo apt install npm
</code></pre>
<ol start="3">
<li>Tell npm to put commands in ~/.global/bin. This only needs to be done once for your system. Then add the .npm-global/bin to your path.</li>
</ol>
<pre><code>npm config set prefix '~/.npm-global'
export PATH=$PATH:~/.npm-global/bin
</code></pre>
<p>Then, add the following line to your .bashrc file.</p>
<pre><code>export PATH=$PATH:~/.npm-global/bin
</code></pre>
<ol start="4">
<li>Download and install the command-line-tools from <a href="https://developer.android.com/studio">Android Developer Studio</a>. In my case, I downloaded the file called android-studio-2024.2.2.15-linux.tar.gz. Then, extract the files to the Android/Sdk directory under your home directory. Then add these lines to your .bashrc file.</li>
</ol>
<pre><code>    export ANDROID_HOME=$HOME/Android/Sdk
    export PATH=$PATH:$ANDROID_HOME/tools:$ANDROID_HOME/tools/bin:$ANDROID_HOME/platform-tools
</code></pre>
<ol start="5">
<li>Then reload your .bashrc file to ensure your current paths are correct.</li>
</ol>
<pre><code>source ~/.bashrc
</code></pre>
<!--kg-card-end: markdown--><!--kg-card-begin: markdown--><h2 id="step2prepareyourphone">Step 2 - Prepare your phone</h2>
<p>Enable developer options on your phone. In my case, I have a 'pixel 8' phone and the developer options can be enabled by going to Settings-&gt;About. Then tapping 'Build number' several times. Then, go to Settings-&gt;Developer options. I did not find a link directly to 'Developer options', but I did find it by searching for the word 'developer' in Settings. Then enable 'USB debugging'.</p>
<!--kg-card-end: markdown--><!--kg-card-begin: markdown--><h2 id="step3connectyourphonetoyourdevelopmentcomputer">Step 3 - Connect your phone to your development computer.</h2>
<p>In my case, this required a USB C to A cable. I didn't have one, so I had to go to a local store and buy one.</p>
<p>You may be prompted by your phone to confirm that you want to allow USB debugging.</p>
<!--kg-card-end: markdown--><!--kg-card-begin: markdown--><h2 id="step4makesuretheadbserverisrunningandseesyourphone">Step 4 - Make sure the ADB server is running and sees your phone.</h2>
<p>The Android Debugging Bridge (ADB) handles communications between your development computer and your android phone. Enter these commands from your terminal.</p>
<pre><code>    adb kill-server
    adb start-server
</code></pre>
<p>Verify that your development computer sees your phone by running the following command from your terminal. You may be prompted by your phone to accept the request.</p>
<pre><code>    adb devices
</code></pre>
<p>You should get a response like: '4A072DEJH001A2  device'.</p>
<p>If it says your device is 'unauthorized', check the phone for a prompt to authorize the connection, allow it, and run the command again.</p>
<!--kg-card-end: markdown--><!--kg-card-begin: markdown--><h2 id="step5createannewproject">Step 5 - Create an new project.</h2>
<p>From the directory where you want your new project directory to reside, enter the following commands.</p>
<pre><code>    npx @react-native-community/cli init Buildbotics
    cd Buildbotics
</code></pre>
<p>This will create a project in a directory called Buildbotics and then move into that directory.</p>
<p>Add the following section to the &quot;dependencies&quot; section in package.json file in the Buildbotics project root directory.</p>
<pre><code>  &quot;devDependencies&quot;: {
    &quot;@react-native-community/cli&quot;: &quot;latest&quot;
  },
</code></pre>
<p>Now you have a default project built. To actually run it:</p>
<ul>
<li>Open a separate terminal and start the 'Metro' server.</li>
</ul>
<pre><code>    npx react-native start
</code></pre>
<p>Then, in the original terminal run this command.</p>
<pre><code>    npx react-native run-android
</code></pre>
<p>After this command completes, the default app should appear on your phone.<br>
The next few steps will replace the default app with the Buildbotics app.</p>
<!--kg-card-end: markdown--><!--kg-card-begin: markdown--><h2 id="step6getthefilesforthisprojectfromgithub">Step 6 - Get the files for this project from github.</h2>
<p>The files that you will need for this project can be downloaded from my <a href="https://github.com/DougCoffland/Android-CNC-Jogger/tree/master">Android-CNC-jogger github repository</a>.</p>
<!--kg-card-end: markdown--><!--kg-card-begin: markdown--><h2 id="step7movethefilesintoyourprojectdirectory">Step 7 - Move the files into your project directory.</h2>
<ol>
<li>Copy buildbotics.ts from the github directory to the Buildbotics project root directory.</li>
<li>Copy the layout.tsx file from the github directory to the Buildbotics project root directory.</li>
<li>Copy the App.tsx file from the github directory to the Buildbotics project root directory, overwriting the existing App.tsx file.</li>
<li>Copy the assets folder from the github directory to the Buildbotics project root directory.</li>
<li>Copy the AndroidManifest.xml from the github directory to the Buildbotics project root at android/app/src/main/AndroidManifest.xml overwriting the existing AndroidManifest.xml.  This step tells your phone to allow cleartext communications.</li>
</ol>
<!--kg-card-end: markdown--><!--kg-card-begin: markdown--><h2 id="step8installalibraryfromreactnative">Step 8 - Install a library from react-native</h2>
<p>Run the following command to install the react-native-paper library. This library is needed to run the radio buttons at the bottom of the screen.</p>
<pre><code>    npm install react-native-paper
</code></pre>
<!--kg-card-end: markdown--><!--kg-card-begin: markdown--><h2 id="step9replacetheappicon">Step 9 - Replace the app icon</h2>
<p>It is recommended to use an icon that is 1024x1024. An image that meets this recommendation can now be found in the assets/images/icon.png directory.<br>
<img src="https://buildbotics.com/content/images/2025/02/icon.png" alt="Creating a CNC Jogging App for an Android Phone" width="100" height="100"><br>
You actually have to make several copies of this and place them in different folders. This is because the icon size depends on the size and model of the android phone.</p>
<p>I happen to have ImageMagick installed on my debian trixie and it comes with a command-line command called convert. With this, I created the following script:</p>
<pre><code>convert $1 -resize 48x48 ./android/app/src/main/res/mipmap-mdpi/ic_launcher.png 
convert $1 -resize 48x48 ./android/app/src/main/res/mipmap-mdpi/ic_launcher_round.png
convert $1 -resize 72x72 ./android/app/src/main/res/mipmap-hdpi/ic_launcher.png 
convert $1 -resize 72x72 ./android/app/src/main/res/mipmap-hdpi/ic_launcher_round.png
convert $1 -resize 96x96 ./android/app/src/main/res/mipmap-xhdpi/ic_launcher.png 
convert $1 -resize 96x96 ./android/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png
convert $1 -resize 144x144 ./android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png 
convert $1 -resize 144x144 ./android/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png
convert $1 -resize 192x192 ./android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png 
convert $1 -resize 192x192 ./android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png    
</code></pre>
<p>Then, I saved the script as 'make_icons' in my ~/.local/bin folder which s part of my path.</p>
<p>Then, I ran the command from my project root dirctory like this:</p>
<pre><code>    make_icons ./assets/images/icon.png
</code></pre>
<!--kg-card-end: markdown--><!--kg-card-begin: markdown--><h2 id="step10startthemetroserver">Step 10 - Start the Metro server.</h2>
<p>The Metro server provides the web server interface for development and communicates with the app on the android phone. If it's already running, kill it and run the following command. Note, this command does not return until you kill it (^C on from the linux command line), so it's best to run it from a separate terminal window.</p>
<pre><code>    npx react-native start
</code></pre>
<!--kg-card-end: markdown--><!--kg-card-begin: markdown--><h2 id="step11buildtheappfortheandroid">Step 11 - Build the app for the android.</h2>
<p>The following command builds the app specifically for the android.</p>
<pre><code>    npx react-native run-android
</code></pre>
<!--kg-card-end: markdown--><!--kg-card-begin: markdown--><h2 id="step12testtheappindevelopmentmode">Step 12 - Test the app in development mode</h2>
<p>At this point the app should be displayed on the screen of your phone. It should look like this.<br>
<img src="https://buildbotics.com/content/images/2025/02/android-app.png" alt="Creating a CNC Jogging App for an Android Phone"></p>
<p>Now is a good time to try it out. Just enter the IP address for your Buildbotics CNC Controller in the input field at the top of the page and press the 'Connect' button. The host name should appear and the machine state (hopefully &quot;READY&quot;) should also appear. If so, click the big triangle buttons to jog your machine. Select the axis from the X, Y, and Z buttons at the bottom of the screen. Adjust the jogging speed with the up arrow and down arrow buttons near the top of the screen.</p>
<!--kg-card-end: markdown--><!--kg-card-begin: markdown--><h2 id="step13buildtheappforproductionanddisconnectfromthedevelopmentmachine">Step 13 - Build the app for production and disconnect from the development machine.</h2>
<p>Run the following commands to build the production app for the android phone.</p>
<pre><code>    cd android
    ./gradlew assembleRelease
</code></pre>
<p>Now, move back up to the Buildbotics project root directory and install the production app on your phone with the following command.</p>
<pre><code>    cd ..
    adb install android/app/build/outputs/apk/release/app-release.apk
</code></pre>
<p>That's it! Disconnect the phone from the USB cable. There should be a new icon on your screen that has the Buildbotics logo in it. Just touch that icon when you want to run the app.</p>
<!--kg-card-end: markdown--><!--kg-card-begin: markdown--><h1 id="conclusion">Conclusion</h1>
<p>As you know by now, we started from a default project, added a couple of source code files, replaced an existing file, and added a few images.</p>
<p>The source code files are written in <a href="https://www.typescriptlang.org/">TypeScript</a> which is Javascript with extensions for type checking. Check out this <a href="https://www.w3schools.com/typescript/">tutorial</a> if you want to learn more about TypeScript.</p>
<p>The source files are:</p>
<ul>
<li>buildbotics.ts - This file contains the code for interfacing with the Buildbotics Controller. Check out my blog post titled <a href="https://buildbotics.com/smart-phone-app/">Introduction to the Buildbotics CNC Controller API</a> to learn more about the Buildbotics Applications Programming Interface.</li>
<li>_layout.tsx - This file manages the layout and widgets that appear on the screen of the android phone.</li>
<li>app.tsx - This is the main app and manages communications between buildbotics.ts and _layout.tsx</li>
</ul>
<p>Please consider joining the buildbotics forum and contributing to the <a href="https://forum.buildbotics.com/viewforum.php?f=18">Applications Development</a> board.</p>
<!--kg-card-end: markdown-->]]></content:encoded></item><item><title><![CDATA[Integrating the PwnCNC Automatic Tool Changer with the Buildbotics Controller]]></title><description><![CDATA[How to upgrade your CNC Machine with an Automatic Tool Changer!]]></description><link>https://buildbotics.com/integrating-the-pwncnc-automatic-tool-changer-with-the-buildbotics-controller/</link><guid isPermaLink="false">6754debdbf3d4a05071d92cd</guid><category><![CDATA[ATC]]></category><category><![CDATA[Buildbotics CNC Controller]]></category><category><![CDATA[cnc]]></category><category><![CDATA[automatic tool change]]></category><category><![CDATA[pwncnc]]></category><category><![CDATA[Macro buttons, CNC, CNC machine]]></category><category><![CDATA[spindle]]></category><category><![CDATA[vfd]]></category><category><![CDATA[taig]]></category><dc:creator><![CDATA[Doug Coffland]]></dc:creator><pubDate>Wed, 18 Dec 2024 20:07:27 GMT</pubDate><media:content url="https://buildbotics.com/content/images/2024/12/thumbnail-1.png" medium="image"/><content:encoded><![CDATA[<!--kg-card-begin: markdown--><h1 id="introduction">Introduction</h1>
<img src="https://buildbotics.com/content/images/2024/12/thumbnail-1.png" alt="Integrating the PwnCNC Automatic Tool Changer with the Buildbotics Controller"><p>The good people over at <a href="https://pwncnc.com/">PwnCNC</a> are now offering a nice <a href="https://pwncnc.com/collections/everything/products/atc?_pos=11&amp;_fid=a6b00341d&amp;_ss=c">Automatic Tool Changing (ATC) System</a>, and one of my customers asked if it was compatible with the <a href="https://buildbotics.com">Buildbotics CNC Controller</a>. I didn't know for sure, so I sent an e-mail to PwnCNC and they readily agreed to loan me a system so I could try it out with the Buildbotics CNC Controller.</p>
<p>It works great with our latest hardware (V17) and latest software (V2.0.4). This table summarizes what you can expect with earlier versions of our hardware and software.</p>
<table>
<thead>
<tr>
<th>Hardware</th>
<th>Software</th>
<th>Result</th>
</tr>
</thead>
<tbody>
<tr>
<td>V17 or later</td>
<td>V2.0.4 or later</td>
<td>Excellent</td>
</tr>
<tr>
<td>-------------</td>
<td>----------------</td>
<td>---------------------</td>
</tr>
<tr>
<td>V17 or later</td>
<td>V2.0.3 or ealier</td>
<td>Good but limited</td>
</tr>
<tr>
<td>-------------</td>
<td>----------------</td>
<td>---------------------</td>
</tr>
<tr>
<td>V15</td>
<td>V1.0.3</td>
<td>Good but limited</td>
</tr>
<tr>
<td>-------------</td>
<td>----------------</td>
<td>---------------------</td>
</tr>
<tr>
<td>V14 or earlier</td>
<td>V1.0.3</td>
<td>Good but limited and requires external hardware</td>
</tr>
</tbody>
</table>
<p>This article describes how to integrate the PwnCNC ATC system with a Buildbotics CNC Controller that has V17 or later hardware and V2.0.4 or later software.</p>
<!--kg-card-end: markdown--><!--kg-card-begin: embed--><figure class="kg-card kg-embed-card"><iframe width="200" height="113" src="https://www.youtube.com/embed/mwm6LKPRgX4?feature=oembed" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" referrerpolicy="strict-origin-when-cross-origin" allowfullscreen title="Integrating the PwnCNC Automatic Tool Changer with the Buildbotics Controller"></iframe></figure><!--kg-card-end: embed--><!--kg-card-begin: markdown--><h2 id="overview">Overview</h2>
<p>The Buildbotics Controller connects to the PwnCNC Pneumatic Enclosure(PE) and the PwnCNC Variable Frequency Drive(VFD) through a DB25 breakout box that is connected to the back of the Controller.<img src="https://buildbotics.com/content/images/2024/12/bb-pe-and-vfd-overview.png" alt="Integrating the PwnCNC Automatic Tool Changer with the Buildbotics Controller"></p>
<p>I recommend getting the ATC System running in manual mode first. Then, connect and configure the Buildbotics CNC Controller. The major steps are:</p>
<ul>
<li>Install the PwnCNC ATC System on your machine for manual operation.</li>
<li>Connect the Buildbotics CNC Controller to the PwnCNC ATC System.</li>
<li>Install the tool holders.</li>
<li>Configure the Buildbotics CNC Controller.</li>
</ul>
<!--kg-card-end: markdown--><!--kg-card-begin: markdown--><h2 id="installingtheatcsystemformanualoperation">Installing the ATC System for manual operation</h2>
<p>Manual operation means that you can control the pneumatic chuck in the ATC spindle with a button. This makes tool changes much easier and faster, but still requires human intervention.</p>
<p>The PwnCNC ATC system comes with quite a few parts, and they describe them <a href="https://support.pwncnc.com/kb/article/429-atc-overall-diagram/">here</a>.</p>
<p>PwnCNC describes how to get the system running in manual mode <a href="https://www.youtube.com/watch?v=rbI98kMl0Cg">here</a>.</p>
<!--kg-card-end: markdown--><!--kg-card-begin: markdown--><h1 id="connectthebuildboticscnccontrollertothepwncncatcsystem">Connect the Buildbotics CNC Controller to the PwnCNC ATC System</h1>
<p>Both the VFD and PE connect to the BB Controller through a DB25 breakout box.<img src="https://buildbotics.com/content/images/2024/12/db25_breakout_box-2.png" alt="Integrating the PwnCNC Automatic Tool Changer with the Buildbotics Controller"><br>
The BB Controller communicates with the VFD using a Modbus/RS-485 connection. The connector on the VFD is compatible with a <a href="https://www.amazon.com/dp/B07V99W539?ref=ppx_yo2ov_dt_b_fed_asin_title">2-pin GX12 aviation plug</a>.</p>
<p>Plug the modbus cable into the Modbus connector on the VFD. <img src="https://buildbotics.com/content/images/2024/12/vfd-modbus-1.png" alt="Integrating the PwnCNC Automatic Tool Changer with the Buildbotics Controller"></p>
<p>Connect pin 13 (rs485a) on the DB25 breakout box to pin 1 on the VFD Modbus connector and connect pin 14 (rs485b) to pin 2 on the VFD modbus connector.</p>
<p>Note, it is recommended that the two RS485 wires be twisted at about 1 turn per inch to reduce noise interference.</p>
<p>PwnCNC provided this control cable for connecting to the PE.<img src="https://buildbotics.com/content/images/2024/12/ATC_Control_Cable.jpg" alt="Integrating the PwnCNC Automatic Tool Changer with the Buildbotics Controller"></p>
<p>They also provided this cable for extending the control cable to a another controller.<img src="https://buildbotics.com/content/images/2024/12/masso-ctrl-cable-1.png" alt="Integrating the PwnCNC Automatic Tool Changer with the Buildbotics Controller"></p>
<p>Plug the control cable into the Ctrl port on the PE and connect the extension cable to the control cable.<br>
<img src="https://buildbotics.com/content/images/2024/12/pe-ctrl-connector.png" alt="Integrating the PwnCNC Automatic Tool Changer with the Buildbotics Controller"></p>
<p>Connect the black wire (labeled Ground) from the extension to any of the ground wires on the DB25 breakout box. I chose pin 25.</p>
<p>The green wire (labeled Relay 1/Output 7) opens the air supply to the tool and dust outputs on the PE so a tool can be inserted. Connect the green wire to any unused digital output on the DB25 breakout box. I chose pin 15.</p>
<p>The red wire (labeled Relay 2/Output 8) opens the air supply to the addl output and can be used for other purposes. Connect the red wire to any unused digital output on the DB25 breakout box. I connected the red wire to pin 16 but am not using it in my system.</p>
<p>The extension has a yellow wire (labeled Drawbar/Input 7) that is connected to a red wire (labeled Power) This connection to power is not needed and you should cut the connection to the red (Power) wire, leaving the yellow wire intact.</p>
<p>Similarly, The extension has a white (labeled Tool Preset/Input 7) that is connected to a red wire (labeled power) This connection to power is not needed and you should cut the connection to the red (Power) wire, leaving the white wire intact.</p>
<h5 id="importanttheyellowandwhitewiresfromthepepresent24voltsdcwheninactiveandgroundwhenactiveifyourbuildboticscontrollerusesaboardthatisolderthanversion15adiodeisrequiredtoprotecttheinternalcircuitryfromthe24voltconnection">Important! - The yellow and white wires from the PE present 24Volts DC when inactive and ground when active. If your Buildbotics Controller uses a board that is older than Version 15, a diode is required to protect the internal circuitry from the 24 Volt connection.</h5>
<h5 id="theseconnectionsarenotabsolutelyrequiredtomaketheatcsystemandirecommendleavingthemoffforolderbuildboticscontrollershoweverifyouinsistonconnectingthemthenconnectlowdropshottkeydiodeseg1n4001inlinewiththeyellowandwhitewirestoprotectthecircuitsthediodecathodesshouldpointtowardthepe">These connections are not absolutely required to make the ATC system and I recommend leaving them off for older Buildbotics Controllers. However, if you insist on connecting them, then connect low drop shottkey diodes (e.g. 1N4001) in line with the yellow and white wires to protect the circuits. The diode cathodes should point toward the PE.</h5>
<h5 id="ifyoudontknowwhatversionofmainboardyourcontrollerutilizesyoucancontactbuildboticsat7075598539forthatinformation">If you don't know what version of main board your controller utilizes, you can contact Buildbotics at 707-559-8539 for that information.</h5>
<h5 id="youshouldalsobeawarethatconnectingtheyelloworwhitewiretoanypinotherthanadigitalinputwilldamagethebuildboticscontrollerevenifyouhaveversion15orlatermainboards">You should also be aware that connecting the yellow or white wire to any pin other than a digital input will damage the Buildbotics Controller even if you have Version 15, or later, main boards.</h5>
<p>Assuming your controller utilizes a Version 15 or later main board, then choose any unused digital input pin on the DB25 breakout board and connect the yellow wire to that pin. I chose pin 11 for the yellow wire.</p>
<p>Similarly, assuming your controller utilizes a Version 15 or later main board, then choose any unused digital input pin on the DB25 breakout board and connect the white wire to that pin. I chose pin 12 for the white wire.</p>
<!--kg-card-end: markdown--><!--kg-card-begin: markdown--><h1 id="installingthetoolholder">Installing the tool holder</h1>
<p>PwnCNC included four 3D printed tool holders with the system. I didn't want to drill holes in my table for this temporary installation, so I built this stand and screwed the 3D printed tool holders to the stand.<br>
<img src="https://buildbotics.com/content/images/2024/12/tool-holder.png" alt="Integrating the PwnCNC Automatic Tool Changer with the Buildbotics Controller"></p>
<p>Then, I used workpiece hold-down clamps to hold it in place.</p>
<!--kg-card-end: markdown--><!--kg-card-begin: markdown--><h1 id="configuringthebuildboticscontroller">Configuring the Buildbotics Controller</h1>
<p>With the system working in manual mode and all the connections intact, now is a good time to configure the Buildbotics Controller. To do this, we have to select the correct VFD, assign the digital I/O points, and tell the controller how to change tools, and how to park the last tool used at the end of a gcode program.</p>
<!--kg-card-end: markdown--><!--kg-card-begin: markdown--><h2 id="selectingthevfd">Selecting the VFD.</h2>
<p><img src="https://buildbotics.com/content/images/2024/12/tool-page.png" alt="Integrating the PwnCNC Automatic Tool Changer with the Buildbotics Controller"></p>
<p>Use the following steps to select the PwnCNC VFD.</p>
<ol>
<li>Go to the <a href="https://buildbotics.com/manual-v2-0-0/#tooltab">SETTINGS-&gt;Tool page</a> on the Buildbotics Controller.</li>
<li>If the 'Login' button is green, <a href="https://buildbotics.com/manual-v2-0-0/#loggingin">click it and log in</a>.</li>
<li>Select 'EM60' from the 'tool-type' drop-down menu.</li>
<li>Click the green 'Save' button.</li>
</ol>
<p>If everything is working correctly, the Status field should say 'Ok' and the Failures field should not be increasing.</p>
<p>If the status field does not say OK or the Failures field is increasing try the following things.</p>
<ol>
<li>Verify that the VFD is turned on.</li>
<li>Verify that the VFD is switched to 'Auto'.</li>
<li>Verify that the connections to the 'Modbus' connector on VFD is properly seated.</li>
<li>Verify that the pins 13 and 14 on the DB25 connector are securely connected.</li>
<li>Verify that the DB25 breakout box is plugged into the back of the Buldbotics Controller and properly seated.</li>
<li>Try reversing the connections between pin 13 and 14 on the DB25 breakout box.</li>
<li>Call Buildbotics at 707-559-8539.</li>
</ol>
<p>After the &quot;Status' field says 'Ok' and the Failures field has stopped increasing, you can test the interface. Here's how:</p>
<ol>
<li>Navigate to the <a href="https://buildbotics.com/manual-v2-0-0/#controlpage">CONTROL page</a> on the Buildbotics user interface.</li>
<li>Select the <a href="https://buildbotics.com/manual-v2-0-0/#tabbedsection">'MDI' tab</a>.</li>
<li>Enter M3S10000 and click play to turn the spindle clockwise at 10000 RPM.</li>
<li>Enter M4 and click play to cause the spindle to stop and go in reverse at 10000 rpm</li>
<li>Enter M5 to stop the spindle.</li>
</ol>
<!--kg-card-end: markdown--><!--kg-card-begin: markdown--><h2 id="configuringthedigitaliopoints">Configuring the digital I/O points</h2>
<p><img src="https://buildbotics.com/content/images/2024/12/io-page.png" alt="Integrating the PwnCNC Automatic Tool Changer with the Buildbotics Controller"><br>
Follow these steps to configure the digital inputs:</p>
<ol>
<li>Navigate to the <a href="https://buildbotics.com/manual-v2-0-0/#iotab">SETTINGS-&gt;I/O page</a>.</li>
<li>Find the pin that you connected to the yellow wire from the Ctrl extension cable. In my case, that is pin 11. Change the drop-down menu selection in the 'Function' column to 'input-0' and change the drop-down menu selection in the &quot;Mode' column to 'normally-open'.</li>
<li>Find the pin that you connected to the white wire from the Ctrl extension cable. In my case, that is pin 12. Change the drop-down menu selection in the 'Function' column to 'input-1' and change the drop-down menu selection in the &quot;Mode' column to 'normally-open'.</li>
<li>Click the green 'Save' button.</li>
</ol>
<p>You can test this connection by using the manual tool change button to insert and remove a tool from the spindle chuck.</p>
<p>The icons next the the digital input pins will reflect the state of the input.</p>
<p>Input0 should momentarily flash from red to green when you insert or remove a tool from the spindle chuck.</p>
<p>Input1 should be green when a tool is in the chuck and red otherwise.</p>
<p>If the manual changes are working but the icons are not reflecting the correct state, check the wiring between the Buildbotics Controller and the PE.</p>
<p>Follow these steps to configure the digital output ports.</p>
<ol>
<li>Find the pin that you connected to the green wire from the PE Ctrl cable extension. Pin 15 in my case. Then,select 'output-0' from the drop-down menu in the 'Function' column and select 'lo-hi' from the drop-down menu in the 'Mode' field.</li>
<li>Similarly, Find the pin that you connected to the red wire from the PE Ctrl cable extension. Pin 16 in my case. Then,select 'output-1' from the drop-down menu in the 'Function' column and select 'lo-hi' from the drop-down menu in the 'Mode' field.</li>
<li>Click 'Save'</li>
</ol>
<p>Use the following steps to test the digital outputs:</p>
<ol>
<li>Navigate to the <a href="https://buildbotics.com/manual-v2-0-0/#controlpage">CONTROL Page</a>.</li>
<li>Select the <a href="https://buildbotics.com/manual-v2-0-0/#tabbedsection">MDI tab</a>.</li>
<li>Enter 'M64 P0' and click play.</li>
<li>You should now get non-zero readings on the tool and dust guages on the PE and air should be blowing in the spindle.</li>
<li>Enter 'M65 P0' and click play.</li>
<li>The tool and dust guages should go to zero.</li>
<li>Enter 'M64 P1' and click play.</li>
<li>The 'addl' guage should be non-zero.</li>
<li>Enter 'M65 P1' guage should read zero again.</li>
</ol>
<p>If the guages don't respond properly, try the following things:</p>
<ol>
<li>Verify that the PE is turned on.</li>
<li>Verify that the air compressor is turned on and air is getting to the PE.</li>
<li>Look at the icons next to pins 15 and 16 on the <a href="https://buildbotics.com/manual-v2-0-0/#iotab">SETTINGS-&gt;I/O</a> page to make sure they are changing state. If not, check the configuration.</li>
<li>Check the wiring between the DB25 breakout box and the PE.</li>
</ol>
<!--kg-card-end: markdown--><!--kg-card-begin: markdown--><h2 id="tellingthebuildboticscontrollerhowtochangeatool">Telling the Buildbotics Controller how to change a tool</h2>
<p>In order for the Buildbotics Controller to automatically change tools, it needs to know where each tool is located, how long the tools are, what to do when a tool change is requested, and how to park the last tool at the end of the program.</p>
<!--kg-card-end: markdown--><!--kg-card-begin: markdown--><h3 id="locatingyourtoolholders">Locating your tool holders</h3>
<p>Use the following procedure to locate your tools.</p>
<ol>
<li><a href="https://buildbotics.com/manual-v2-0-0/#axistable">Clear all offsets</a>.</li>
<li><a href="https://buildbotics.com/manual-v2-0-0/#axistable">Home your machine</a> and do not set any offsets.</li>
<li>Use the <a href="https://buildbotics.com/manual-v2-0-0/#gamepad">gamepad</a> to jog your spingle to a height where it can move to any place on the table without running into anything. For me that height, which I'll call 'zSafe', is 200mm. Record the 'absolute' position of the Z axis.</li>
<li>Use the gamepad to jog the spindle into a position directly above the tool location for your reference tool. You should center it perfectly over your tool holder. My reference tool is tool 1 and it is simply one of the <a href="https://pwncnc.com/collections/all/products/iso20-tool-holder?_pos=19&amp;_fid=c09d2c36a&amp;_ss=c">ISO20 ER20 tool holders</a> that was provided by PwnCNC with no tool. Since there is no tool, its length will be zero.</li>
<li>Jog the Z axis to a position where it can safely drop the tool into the holder using the MTC button. Record the 'absolute' position of the Z axis. For me, that height is 43mm, which I'll call 'zDrop'.</li>
<li>Jog the Z axis to a position where the you can pick up the tool from the tool holder using the MTC button. Record the 'absolute' position of the Z axis. For me, that height is 11mm, which I'll call 'zPick''.</li>
<li>For each tool, find and record the 'absolute' positions for the X and Y axes.</li>
</ol>
<!--kg-card-end: markdown--><!--kg-card-begin: markdown--><h3 id="measuringthelengthofyourtools">Measuring the length of your tools</h3>
<p>Use this program to measure the length of each tool:</p>
<pre><code>%
M70
G21
M0 (MSG, insert the reference tool and attach the probe)
F100
G91
G38.2 Z-100
#31 = #5422
G0 Z50
M0 (MSG, insert tool to be measured)
G38.2 Z-100
#32 = [#5422 - #31]
G0 Z50
M0 (DEBUG, tool length is #32 mm)
M72
%
</code></pre>
<p>I recommend copying this code into a text file named something like 'measure_tool.ngc', <a href="https://buildbotics.com/manual-v2-0-0/#filespage">uploading that file to the BB Controller</a> and assigning it to a <a href="https://buildbotics.com/manual-v2-0-0/#macrobuttons">Macro button</a>.</p>
<p>Run the program using the following steps:</p>
<ol>
<li>Put a reference tool in the chuck. (I use one of the ISO20 ER20 tool holders with no tool as a reference.)</li>
<li>Connect your height probe and place it on the CNC work surface.</li>
<li>Jog the spindle into a place above your height probe.</li>
<li>Click the tool measurement macro button.</li>
<li>Connect the ground clip on the height probe to the reference tool.</li>
<li>Wait for the controller to touch the probe and prompt you to put the tool to be measured in the chuck.</li>
<li>Put the tool to be measured into the chuck.</li>
<li>Click 'Continue'.</li>
<li>Wait for the BB Controller to probe with the tool and display the length.</li>
</ol>
<p>The length displayed will be the difference between the reference tool and the tool to be measured, which is the information needed for each tool.</p>
<p>You can see this in action on my <a href="https://youtu.be/7Wam8yNA0X8">Youtube video that demonstrates the use of this tool measurement program</a>.</p>
<p>Also, check out my <a href="https://buildbotics.com/cnc-macro-buttons/">blog article titled CNC Macro Buttons</a> to see how to create a macro button.</p>
<!--kg-card-end: markdown--><!--kg-card-begin: markdown--><h3 id="tellingthecontrollerwhattodowhenatoolchangeisrequested">Telling the controller what to do when a tool change is requested</h3>
<p>This program will reside in the 'tool-change' box on the <a href="https://buildbotics.com/manual-v2-0-0/#generaltab">SETTINGS-&gt;General page</a>, and will be executed every time an 'M6TX' gcode command is encountered.</p>
<pre><code>g4 p1
(Runs on M6, tool change) 
M70
G21
#&lt;_zSafe&gt; = 200
#&lt;_zDrop&gt; = 43
#&lt;_zPick&gt; = 11

#&lt;_zDust&gt; = [#&lt;_zPick&gt; + 10]
#&lt;_tool_table&gt; = 2000 (store x location, y location, an tool length for each tool)

o&lt;_make_tool&gt; sub
  #[#&lt;_tool_table&gt; + [#1 * 3]] = #2 (x location)
  #[#&lt;_tool_table&gt; + [#1 * 3] + 1] = #3 (y location)
  #[#&lt;_tool_table&gt; + [#1 * 3] + 2] = #4 (z location)
o&lt;_make_tool&gt; endsub  

(tool table is arguments to _make_tool call, arguments are:)
(tool number, x park position, y park position, tool length)
o&lt;_make_tool&gt; call [1] [-390] [-525] [0]
o&lt;_make_tool&gt; call [2] [-390] [-465] [46.2]
o&lt;_make_tool&gt; call [3] [-390] [-405] [32.8]
o&lt;_make_tool&gt; call [4] [-390] [-345] [27]

M66 P1 L0
o100 if [#&lt;_x_homed&gt; NE 1 or #&lt;_y_homed&gt; NE 1 or #&lt;_z_homed&gt; NE 1]
	(MSG, Error: System must be homed for ATC Operation)
	M2
o100 elseif [#5399 EQ 1 AND #5400 EQ -1]
    (DEBUG, Error: Unidentified tool is in the chuck #5400)
o100 elseif [#5400 NE #&lt;_selected_tool&gt;]
    #&lt;xret&gt; = #5420
    #&lt;yret&gt; = #5421
    M5 (stop the tool and wait five seconds)
    G4 P5
    o101 if [#5400 NE -1]
        (park the old tool)
        G53 G0 Z#&lt;_zSafe&gt;
        G53 G0 X#[#&lt;_tool_table&gt; + [3 * #5400]]Y#[#&lt;_tool_table&gt; + [3 * #5400] + 1] 
        G53 G0 Z#&lt;_zDrop&gt;
        M64 P0
        G4 P2
        M65 P0
        G53 G0 Z#&lt;_zSafe&gt;
        #&lt;new_offset&gt; = [#5213 - #[#&lt;_tool_table&gt; + [3 * #5400] + 2]]
        G92 z[#&lt;_zSafe&gt; - #&lt;new_offset&gt;]
    o101 endif
    (get the new tool)
    #&lt;t&gt; = #&lt;_selected_tool&gt;
    G53 G0 Z#&lt;_zSafe&gt;
    G53 G0 X#[#&lt;_tool_table&gt; + [3 * #&lt;t&gt;]]Y#[#&lt;_tool_table&gt; + [3 * #&lt;t&gt;] + 1]
    G53 G0 Z#&lt;_zDust&gt;
    M64 P0
    F300
    G53 G1 Z#&lt;_zPick&gt;
    M65 P0
    G4 P2
    G53 G0 Z#&lt;_zSafe&gt;
    #&lt;new_offset&gt; = [#5213 + #[#&lt;_tool_table&gt; + [3 * #&lt;_selected_tool&gt;] + 2]]
    G92 z[#&lt;_zSafe&gt; - #&lt;new_offset&gt;]
    G0 X#&lt;xret&gt; Y#&lt;yret&gt;
o100 endif    

M6
M72
</code></pre>
<p>Use the following steps to modify this file with the values, tool numbers, tool locations, and tool lengths from previous steps.</p>
<ol>
<li>Copy the program into a text editor so you can easily edit it.</li>
<li>Change the value for zSafe on line 5 to the value you recorded for zSafe.</li>
<li>Change the value for zDrop on line 6 to the value you recorded for zDrop.</li>
<li>Change the value for zPick on line 7 to the value you recorded for zPick.</li>
<li>For each tool starting at line 20, modify the arguments with the tool number, x location, y location and tool length. For instance the second line (line 21 in the program) for my system shows that tool 2 is located at -390mm on the X axis, -465mm on the Y axis, and has a relative length of 46.2mm.</li>
<li>Copy all the contents of the file and paste them into the 'tool-change' textbox on the <a href="https://buildbotics.com/manual-v2-0-0/#generaltab">SETTINGS-&gt;General page</a> and then click 'Save'.</li>
</ol>
<!--kg-card-end: markdown--><!--kg-card-begin: markdown--><h3 id="parkingthetoolattheendoftheprogram">Parking the tool at the end of the program</h3>
<p>I like to park the tool and move the spindle to a convenient place at the end of a gcode program because:</p>
<ol>
<li>The last tool used by a program is retained by the system. However, if the controller is turned off, it loses this information. Then, if you try to run a program after turning the controller back on and the previous tool is still in the chuck, it could cause a crash. Parking the last tool at the end of the program and setting the tool to '0' avoids this problem.</li>
<li>I like to move the spindle to a position near my limit switches. This way, when I turn the controller off and back on, homing is much faster because the spindle is already close to it's home position. For me that position is Z=175, X=380, Y= -550.</li>
</ol>
<p>The following program drops the last tool used by the program into its tool holder and parks the spindle near the <a href="https://buildbotics.com/manual-v2-0-0/#motorstab">homing limit switches</a>.</p>
<pre><code>(Runs on M2, program end)
M70
G21
o200 if [#5400 GT 0]
    M5 (stop the spindle and wait 5 seconds)
    G4 P5
    (park the old tool)
    G53 G0 Z#&lt;_zSafe&gt;
    G53 G0 X#[#&lt;_tool_table&gt; + [3 * #5400]]Y#[#&lt;_tool_table&gt; + [3 * #5400] + 1] 
    G53 G0 Z#&lt;_zDrop&gt;
    M64 P0
    G4 P2
    M65 P0
    G53 G0 Z#&lt;_zSafe&gt;
    #&lt;new_offset&gt; = [#5213 - #[#&lt;_tool_table&gt; + [3 * #5400] + 2]]
    G92 z[#&lt;_zSafe&gt; - #&lt;new_offset&gt;]
o200 endif
M6T0
#5400 = -1
(park near the limit switches)
G53 G0 Z175
G53 G0 X380 Y-550
M72
M2
</code></pre>
<p>Use the following steps to modify this program with your preferred park position and load it into your Buildbotics Controller.</p>
<ol>
<li>Copy the program into a text editor so you can easily edit it.</li>
<li>Change the Z value on line 20 to your preferred Z axis park position.</li>
<li>Change the X and Y values on line 21 to your preferred X axis and Y axis park positions.</li>
<li>Copy and paste it into the 'program-end' textbox on the <a href="https://buildbotics.com/manual-v2-0-0/#generaltab">SETTINGS-&gt;General page</a> and then click 'Save'.</li>
</ol>
<!--kg-card-end: markdown--><!--kg-card-begin: markdown--><h2 id="relavantlinks">Relavant links</h2>
<p>Check out my <a href="https://youtu.be/mwm6LKPRgX4">video titled Integrating the PwnCNC Automatic Tool Changer with the Buildbotics Controller</a> to see the system actually doing a cut.</p>
<p>Also check out my <a href="https://youtu.be/7Wam8yNA0X8">video titled Measuring tools for an Automatic Tool Changer using a macro button on a Buildbotics Controller</a> to see the tool measurement macro in action.</p>
<p>Finally, check out my <a href="https://buildbotics.com/cnc-macro-buttons/">blog article titled CNC Macro Buttons</a> to see how to create a macro button.</p>
<!--kg-card-end: markdown-->]]></content:encoded></item><item><title><![CDATA[API Documentation]]></title><description><![CDATA[<!--kg-card-begin: html--><a href="https://github.com/buildbotics/bbctrl-firmware/blob/master/docs/api/README.md"><img src="https://buildbotics.com/content/images/size/w1000/2024/12/buildbotics-api-4.png"></a><!--kg-card-end: html--><p>Read the Buildbotics Controller's <a href="https://github.com/buildbotics/bbctrl-firmware/blob/master/docs/api/README.md">API documentation on GitHub</a>.</p>]]></description><link>https://buildbotics.com/api/</link><guid isPermaLink="false">6762fa9dbf3d4a05071d9c99</guid><dc:creator><![CDATA[Joseph Coffland]]></dc:creator><pubDate>Wed, 18 Dec 2024 16:39:38 GMT</pubDate><media:content url="https://buildbotics.com/content/images/2024/12/buildbotics-api-4.png" medium="image"/><content:encoded><![CDATA[<!--kg-card-begin: html--><a href="https://github.com/buildbotics/bbctrl-firmware/blob/master/docs/api/README.md"><img src="https://buildbotics.com/content/images/size/w1000/2024/12/buildbotics-api-4.png" alt="API Documentation"></a><!--kg-card-end: html--><img src="https://buildbotics.com/content/images/2024/12/buildbotics-api-4.png" alt="API Documentation"><p>Read the Buildbotics Controller's <a href="https://github.com/buildbotics/bbctrl-firmware/blob/master/docs/api/README.md">API documentation on GitHub</a>.</p>]]></content:encoded></item><item><title><![CDATA[CNC Macro Buttons]]></title><description><![CDATA[Macro buttons are great for repetitive task like probing, moving to fixed locations, and making high volume parts.]]></description><link>https://buildbotics.com/cnc-macro-buttons/</link><guid isPermaLink="false">66e7615dbf3d4a05071d912b</guid><category><![CDATA[Macro buttons, CNC, CNC machine]]></category><category><![CDATA[CNC probing]]></category><category><![CDATA[GCode programs]]></category><category><![CDATA[Convenience of Buildbotics]]></category><category><![CDATA[Buildbotics Controller]]></category><dc:creator><![CDATA[Doug Coffland]]></dc:creator><pubDate>Mon, 16 Sep 2024 20:58:03 GMT</pubDate><media:content url="https://buildbotics.com/content/images/2024/09/MacroAssignment-1.png" medium="image"/><content:encoded><![CDATA[<!--kg-card-begin: markdown--><img src="https://buildbotics.com/content/images/2024/09/MacroAssignment-1.png" alt="CNC Macro Buttons"><p>Macro Buttons are one of many features that set the <a href="https://www.buildbotics.com">Buildbotics CNC Controller</a> apart from other controllers.</p>
<p>In a 'nutshell', you can assign any GCode program to a button that appears on the Control page. Then, the associated program will execute each time you click the button.</p>
<!--kg-card-end: markdown--><!--kg-card-begin: image--><figure class="kg-card kg-image-card"><img src="https://buildbotics.com/content/images/2024/09/RunMacros.png" class="kg-image" alt="CNC Macro Buttons"></figure><!--kg-card-end: image--><!--kg-card-begin: markdown--><h2 id="assigningmacros">Assigning Macros</h2>
<p>Click the 'Macros' button on the CONTROL Page to add, delete or modify Macro buttons.</p>
 <figure><img src="https://buildbotics.com/content/images/2024/09/MacroAssignment.png" alt="CNC Macro Buttons"></figure>
<p>Click the 'trash' button to remove an existing Macro button.</p>
<p>To add a new Macro button:</p>
<ul>
<li>Click the '+ Add' button.</li>
<li>Select the color using the color selector.</li>
<li>Assign a name in the field next to the color selector.</li>
<li>Click the folder icon to select an existing GCode program.</li>
<li>Click the green 'Save' button to save your work.</li>
</ul>
<p>The new button will appear on the CONTROL page. Now each time that button is clicked, the associated program will execute.</p>
<!--kg-card-end: markdown--><!--kg-card-begin: markdown--><h2 id="example">Example</h2>
<p>A program was created to execute 3D probing in my <a href="https://buildbotics.com/probing-to-set-cnc-offsets/">Probing</a> article. Watch my <a href="https://youtu.be/VPaVzny_dKM">probing video</a> to see a macro button in use.</p>
<p>I saved that program as 3DProbeRick.gc on my local desktop computer and then uploaded it to the Buildbotics Controller via the web interface.</p>
<p>Then, I assigned the program to the pink Macro button shown above.</p>
<!--kg-card-end: markdown-->]]></content:encoded></item><item><title><![CDATA[Homing your CNC Machine]]></title><description><![CDATA[Homing your CNC machine is not necessary, but it helps. Read this article to find out why.]]></description><link>https://buildbotics.com/homing-your-cnc-machine/</link><guid isPermaLink="false">669af3a0bf3d4a05071d88ba</guid><category><![CDATA[cnc]]></category><category><![CDATA[CNC homing]]></category><category><![CDATA[CNC position]]></category><category><![CDATA[CNC offsets]]></category><category><![CDATA[limit switches]]></category><category><![CDATA[buildbotics]]></category><dc:creator><![CDATA[Doug Coffland]]></dc:creator><pubDate>Mon, 16 Sep 2024 20:55:14 GMT</pubDate><media:content url="https://buildbotics.com/content/images/2024/09/reed_switch.png" medium="image"/><content:encoded><![CDATA[<!--kg-card-begin: markdown--><img src="https://buildbotics.com/content/images/2024/09/reed_switch.png" alt="Homing your CNC Machine"><p>Homing allows your CNC Controller to learn about the boundaries of your CNC machine. In this article, I'll explain why it helps and how to set it up with a <a href="http://buildbotics.com">Buildbotics CNC Controller</a>.</p>
<h2 id="whybother">Why bother?</h2>
<p>Honestly, homing with a Buildbotics Controller is not absolutely necessary. But it does provide two important advantages.</p>
<p>First, it lets the controller know the boundaries of the physical machine. This prevents running into an endstop, which can be pretty hard on your machine.</p>
<p>Second, once a machine is homed, you can tell it to move to some specific absolute position and that absolute position will always be at the same place on the machine. For instance, you may have a jig on your table where you like to lay down a workpiece. If the machine is homed, that location will always be at the same absolute position. Check out my article on <a href="https://buildbotics.com/cnc-macro-buttons/">'Macro Buttons'</a> to see how to make things even easier.</p>
<p>You may have noticed that I am using the phrase 'absolute position'. The absolute position is the position relative to the machine boundaries. The cutting position or just 'position' can be different from the absolute position if the position offsets have been adjusted. Check out my article titled <a href="https://buildbotics.com/cnc-offsets/">'CNC Offsets (absolute position vs cutting position)'</a> to learn more about position offsets.</p>
<h2 id="whathardwareisneededforhoming">What hardware is needed for homing?</h2>
<p>Homing relies on the ability to trigger an event when an axis reaches a known position. On the Buildbotics Controller, that event is either opening or closing a switch. These switches are known as limit switches. There are several kinds of limit switches including magnetic reed switches, optical switches, proximity switches, and mechanical lever switches. The one thing that they have in common is that they provide a state change on a pair of wires that can be detected by the controller.</p>
<p>I usually use magnetic reed switches like the ones shown below because:</p>
<ul>
<li>They are easy to install.</li>
<li>They have no mechanical parts that can fail.</li>
<li>They're cheap.</li>
<li>They do not require power.</li>
<li>The activation position seems to be very consistent.</li>
<li>They never make physical contact. I can install them in a way that the magnet slides past the reed rather than running into it.</li>
</ul>
<p>The one drawback is that they don't work very well when cutting ferrous materials.</p>
<p>The reed switches change state when the magnet comes into close proximity with the reed relay.</p>
<!--kg-card-end: markdown--><!--kg-card-begin: image--><figure class="kg-card kg-image-card kg-card-hascaption"><img src="https://buildbotics.com/content/images/2024/07/reed_switch.png" class="kg-image" alt="Homing your CNC Machine"><figcaption>Magnetic Reed Switch</figcaption></figure><!--kg-card-end: image--><!--kg-card-begin: markdown--><h3 id="howdoyouconnecttheswitchtothebuildboticscontroller">How do you connect the switch to the Buildbotics Controller?</h3>
<p>Each limit switch gets connected to one of the digital inputs on the DB25 Breakout box. Simply pick any unused digital input pin. We'll configure the controller later.</p>
<p>If the  limit switch is passive (non-powered), simply connect one of the wires to digital input pin and the other wire to a ground pin.</p>
<p>If limit switch is powered, connect the positive wire to a digital input and the ground wire to one of the ground pins.</p>
<p>Then plug the DB25 breakout box into the back of the Buldbotics Controller.</p>
<!--kg-card-end: markdown--><!--kg-card-begin: image--><figure class="kg-card kg-image-card kg-card-hascaption"><img src="https://buildbotics.com/content/images/2024/07/db25_breakout_box.png" class="kg-image" alt="Homing your CNC Machine"><figcaption>DB25 Breakout Box that comes with the Buildbotics CNC Controller</figcaption></figure><!--kg-card-end: image--><!--kg-card-begin: markdown--><h2 id="howtoconfigurelimitswitchesinthebuildboticscontroller">How to configure limit switches in the Buildbotics Controller</h2>
<p>Limit switches are configured on the SETTINGS-&gt;I/O page on the Buildbotics Controller.</p>
<!--kg-card-end: markdown--><!--kg-card-begin: image--><figure class="kg-card kg-image-card kg-card-hascaption"><img src="https://buildbotics.com/content/images/2024/07/settings_io.png" class="kg-image" alt="Homing your CNC Machine"><figcaption>SETTINGS-&gt;I/O page on the Buildbotics Controller</figcaption></figure><!--kg-card-end: image--><!--kg-card-begin: markdown--><p>Do the following things for the digital input pin that you selected:</p>
<ul>
<li>Select the function from the pull-down menu in the Function column. For instance, if the switch is positioned at the maximum end of the axis served by motor port 0, then the function would be 'input-motor-0-max'</li>
<li>Select the mode from the pull-down menu in the Mode column. This will be 'normally-open' if the switch is open or presents a high signal when it is not active. It will be 'normally-closed' if the switch presents a low signal or is closed when it is not active.</li>
</ul>
<p>The icons in the State column report the current state of the switch and are really handy for troubleshooting your switch and connection.</p>
<ul>
<li>If the icon is green, the switch is active.</li>
<li>If the icon is red, the switch is not active.</li>
<li>If there is a '+' in the icon, the input is high or open.</li>
<li>If there is a '-' in the icon, the input is low or closed.</li>
</ul>
<p>You can operate the switch manually while watching the icon to make sure it's doing what you expect.</p>
<!--kg-card-end: markdown--><!--kg-card-begin: markdown--><h2 id="howtoconfigurehoming">How to configure homing</h2>
<p>Homing is configured on the SETTINGS-&gt;Motor pages.</p>
<!--kg-card-end: markdown--><!--kg-card-begin: image--><figure class="kg-card kg-image-card kg-card-hascaption"><img src="https://buildbotics.com/content/images/2024/07/homing_configuration.png" class="kg-image" alt="Homing your CNC Machine"><figcaption>Homing and Limit Switch configuration on the Buildbotics Controller</figcaption></figure><!--kg-card-end: image--><!--kg-card-begin: markdown--><p>Here's how to configure an axis for homing on the Buildbotics Controller:</p>
<ol>
<li>Go to the SETTINGS-&gt;Motor page for the motor port serving the axis and login.</li>
<li>Set the absolute position of the minimum and maximum soft limits for the axis. The image above is the configuration for my X axis. It has 830 mm of available travel and I like to set the absolute position right in the middle. As a result, I have set the lower soft limit to -415mm and the upper soft limit to +415mm.</li>
<li>If you mounted your limit switch at the maximum end of the axis, set the homing-mode to 'switch-max'. Or, if you mounted the limit switch at the minimum end of your axis, set it to 'switch-min'. My switch is at the maximum end, so it is set to 'switch-max'.</li>
<li>Set the 'search-velocity' to the speed at which the machine will search for the switch. If it's too fast, it may may not be able to stop in time and damage your machine. If it's too slow, it will take a long time to find the switch. I have my X-axis set to search at 2 meters per minute.</li>
<li>Once the switch changes state, the machine will back off by the distance assigned in the 'latch-backoff' field. My X-axis is set to back off my 15mm once the switch is found. This allows the switch to change back to it's inactive state before approaching again.</li>
<li>The 'latch-velocity' sets the speed at which the axis will approach the switch again. This slower speed will provide a more repeatable position where the switch activates. My X-axis is set to .5 meters per minute.</li>
<li>Set 'zero-backoff' to the distance that the axis backs away from the switch after the homing sequence is complete.</li>
</ol>
<p>When the homing sequence is complete, it will set the absolute position to the position defined in the soft limit. If the 'homing-mode' is 'switch-max', the absolute position will be set to the 'max-soft-limit' value. If the 'homing-mode' is 'switch-min', the absolute position will be set to the 'min-soft-limit' value. My X-axis is set to 'switch-max', so it comes to rest at the right end of my axis at an absolute position of +415mm.</p>
<!--kg-card-end: markdown--><!--kg-card-begin: markdown--><h2 id="howtohomethemachine">How to home the machine</h2>
<p>The homing buttons are located on the CONTROL page at the right side of the 'axis table'. Each axis can be homed individually by clicking the 'Home' button for that axis. Clicking the 'Home All' button initiates the homing sequence on all axes.</p>
<!--kg-card-end: markdown--><!--kg-card-begin: image--><figure class="kg-card kg-image-card"><img src="https://buildbotics.com/content/images/2024/07/axis_table.png" class="kg-image" alt="Homing your CNC Machine"></figure><!--kg-card-end: image--><!--kg-card-begin: markdown--><h2 id="summary">Summary</h2>
<p>Homing teaches the Controller where the boundaries of the physical machine are located. This provides the following advantages:</p>
<ul>
<li>Since the controller knows where the boundaries are located, it can prevent crashing into the endstops.</li>
<li>Commonly used locations on your machine will always be located in the same absolute position. This allows you to return to that exact position from any location after homing, even if the contoller is rebooted. Check out my article on <a href="https://buildbotics.com/cnc-macro-buttons/">'Macro Buttons'</a> to see how to make things even easier.</li>
</ul>
<!--kg-card-end: markdown-->]]></content:encoded></item><item><title><![CDATA[Probing to set CNC offsets]]></title><description><![CDATA[Learn how to use probing to set the offsets positions on your CNC machine.]]></description><link>https://buildbotics.com/probing-to-set-cnc-offsets/</link><guid isPermaLink="false">669adacfbf3d4a05071d8860</guid><category><![CDATA[CNC probing]]></category><category><![CDATA[CNC offsets]]></category><category><![CDATA[cnc]]></category><category><![CDATA[buildbotics]]></category><category><![CDATA[Buildbotics CNC Controller]]></category><dc:creator><![CDATA[Doug Coffland]]></dc:creator><pubDate>Mon, 16 Sep 2024 20:48:23 GMT</pubDate><media:content url="https://buildbotics.com/content/images/2024/09/3DProbe-2-1.jpg" medium="image"/><content:encoded><![CDATA[<!--kg-card-begin: markdown--><img src="https://buildbotics.com/content/images/2024/09/3DProbe-2-1.jpg" alt="Probing to set CNC offsets"><p>CNC machines 'probe' to find the workpiece and then set the <a href="https://buildbotics.com/cnc-offsets/">Offsets</a> accordingly. Probing is controlled using <a href="https://linuxcnc.org/docs/html/gcode/g-code.html#gcode">G-Code</a> commands on the <a href="https://www.buildbotics.com">Buildbotics CNC Controller</a>.</p>
<p>The most common use of probing is to adjust the offset for the z-axis after a bit is changed. This allows changing bits during the execution of a single GCode program.</p>
<p>This article describes how to use probing on a <a href="https://www.buildbotics.com">Buildbotics CNC Controller</a> but the concepts are also applicable to most other controllers.</p>
<p>Also, check out my video on <a href="https://youtu.be/VPaVzny_dKM">3D Probing</a>.</p>
<!--kg-card-end: markdown--><!--kg-card-begin: markdown--><h3 id="whatisacncprobe">What is a CNC probe?</h3>
<p>A probe is a simple device that provides a state change on a pair of wires when it comes in contact with the bit on your CNC machine. All you really need is a metal plate with a known height that has two wires connected. I use one like the one shown below, but it wouldn't be hard to make your own. These probes are readily available for just a few dollars.</p>
<!--kg-card-end: markdown--><!--kg-card-begin: image--><figure class="kg-card kg-image-card kg-card-hascaption"><img src="https://buildbotics.com/content/images/2024/09/touch_probe.png" class="kg-image" alt="Probing to set CNC offsets"><figcaption>Simple touch probe</figcaption></figure><!--kg-card-end: image--><!--kg-card-begin: markdown--><h2 id="howtoconnecttheprobetoyourcontroller">How to connect the probe to your controller</h2>
<p>Simply connect the wire that attaches to the metal plate to one of the digital inputs on the Buildbotics Controller and connect the other wire to one of the ground leads on the Buildbotics Controller. Both connections are made through the DB25 breakout box that comes with the controller.</p>
<!--kg-card-end: markdown--><!--kg-card-begin: image--><figure class="kg-card kg-image-card kg-card-hascaption"><img src="https://buildbotics.com/content/images/2024/09/db25_breakout_box.png" class="kg-image" alt="Probing to set CNC offsets"><figcaption>DB25 breakout box</figcaption></figure><!--kg-card-end: image--><!--kg-card-begin: markdown--><h2 id="howtoconfiguretheprobe">How to configure the probe.</h2>
<p>Go to the SETTINGS-&gt;I/O page to configure the input pin that you selected for the probe. Pin 22 is used in the image below. Set the function for the  pin to 'input-probe'. Then, set the Mode to 'normally-open'. Click the green 'Save' button to save your work.</p>
<figure>
<img src="https://buildbotics.com/content/images/2022/03/remappableIOtable.png" width="500/>
    <figcaption>The " ready screen" is displayed after the controller boots.< figcaption alt="Probing to set CNC offsets">
</figure>
<p>The icons in the State column report the current state of the input and are really handy for troubleshooting your probe and connections.</p>
<ul>
<li>If the icon is green with a '-' sign, the probe plate is touching the ground connection.</li>
<li>If the icon is red with a '+' sign, probe plate is not touching the ground connection.</li>
</ul>
<!--kg-card-end: markdown--><!--kg-card-begin: markdown--><h2 id="howtouseit">How to use it</h2>
<p>The probe provides a known height that allows you to determine height of the tip of the bit. For instance, my probe plate is 3/4&quot; (19.05mm) tall. If the bit is just touching the probe plate then it is 19.05 mm above the top surface of the workpiece. I always set up my GCode designs so that the top surface of the workpiece is set to 0. So, all I have to do is set the height to 19.05mm when the probe touches the workpiece.</p>
<p>Start by connecting the probe to the controller, placing the probe plate on the top surface of the workpiece, and moving the tool to a place just above the probe plate.</p>
<p>Issue the following GCode commands to use metric units and set the speed at which the tool will approach the probe.</p>
<pre><code>G21 (use metric units)
F100 (sets the feed rate to 100 mm/minute)
</code></pre>
<p>Then, issue the following command to tell the controller to move down towards the probe and stop when contact is made or fail if it moves down by 100mm without making contact.</p>
<pre><code>G38.2 Z-100 
</code></pre>
<p>Then, use the following command to set the Z-axis position to 19.05mm.</p>
<pre><code>G92 Z19.05
</code></pre>
<p>You can do these commands manually with from the MDI interface on the CONTROL page on the Buildbotics Controller, or you could put these commands into a <a href="https://buildbotics.com/cnc-macro-buttons/">Macro button</a>.</p>
<!--kg-card-end: markdown--><!--kg-card-begin: markdown--><h2 id="automatingtheprocess">Automating the process</h2>
<p>Lumping the GCode commands into a macro provides some convenience, but it still does not allow you to change bits while running a GCode program. You could issue the commands from within the GCode program, but the Buildbotics Controller provides a better way.</p>
<p>You can configure the Buildbotics Controller to automatically issue a block of commands every time a tool change is encountered. Simply enter the required commands into the 'tool-change' text box on the SETTINGS-&gt;General page.</p>
<figure>
<img src="https://buildbotics.com/content/images/2023/12/GeneralTab.png" width="500/>
    <figcaption>The " ready screen" is displayed after the controller boots.< figcaption alt="Probing to set CNC offsets">
</figure>
<div style="text-align: left"> 
<p>The following commands can be cut and pasted into the 'tool-change' text box and will handle most of your z-axis probing needs.</p>
<pre><code>M70 (save the current machine state. (e.g. feed rate and units)
G21 (metric units)
G90 (set the machine to &quot;absolute distance mode&quot;)
G0Z50 (raise the spindle to a height that makes it easy to change the bit)
G0 X-50Y-50 (make a rapid move to a good place to sit the probe plate)
M0 (MSG, Change bit and attach probe) (prompt the user to change the bit and attach the probe)
G91 (put the machine in &quot;incremental distance mode&quot;)
F100 (set the feed rate to a slow speed for probing)
G38.2 Z-100 (probe down until the plate is touched or until Z has moved by -100mm)
G92 Z19.05 (set the Z axis to the height of the probe plate)
G90 (set the machine to &quot;absolute distance mode&quot;)
G0 Z50 (raise the Z axis to a safe height where it is easy to remove the probe.)
M0 (MSG, Remove the probe) (prompt the user to remove the probe)
M72 (recover the original machine state(e.g. feed rate, distance mode, and units))
</code></pre>
<p>You can learn exactly how each of these commands work from the <a href="https://linuxcnc.org/docs/html/gcode/g-code.html#gcode">LinuxCNC GCode Documentation</a>.</p>
<!--kg-card-end: markdown--><!--kg-card-begin: markdown--><h2 id="3dprobing">3D Probing</h2>
<p>The Buildbotics Controller can probe on any or all four of its axes. 3D Probing is commonly used to find the corner of a workpiece and set the <a href="https://buildbotics.com/cnc-offsets/">offsets</a> on the X, Y, and Z axes from the result.</p>
<!--kg-card-end: markdown--><!--kg-card-begin: embed--><figure class="kg-card kg-embed-card"><iframe width="200" height="113" src="https://www.youtube.com/embed/VPaVzny_dKM?feature=oembed" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" referrerpolicy="strict-origin-when-cross-origin" allowfullscreen title="3D Probing on a CNC Machine"></iframe></figure><!--kg-card-end: embed--><!--kg-card-begin: markdown--><p>The following block of GCode will find the front, top, left corner of your workpiece and set the position to X=0, Y=0, Z=0. It works very much like the z-axis probing code but extends the same concepts to all three axes.</p>
<p>This program makes use of <a href="https://linuxcnc.org/docs/stable/html/gcode/overview.html#sec:overview-parameters">'named parameters'</a>.</p>
<pre><code>(to use this program, simple place the probe plate on the front, left corner of the workpiece)
( and move the bit over the circle at about 1&quot; above the plate, then run the program)

(All dimensions should be entered in millimeters)

#&lt;_x_outer_dim&gt; = 63.18 (Change to the outer size of the probe plate in the x direction)
#&lt;_x_inner_dim&gt; = 53.92 (Change to the size of the inset part probe plate in the x direction)
#&lt;_y_outer_dim&gt; = 63.28 (Change to the outer size of the probe plate in the y direction)
#&lt;_y_inner_dim&gt; = 54.34 (Change to the size of the inset part probe plate in the y direction)
#&lt;_height&gt; = 18.88 (change to the overall height of the probe plate)
#&lt;_inset_height&gt; = 14.9 (change to the height of the inset part of the probe plate)
#&lt;_circle_x&gt; = 10 (change to the approximate circle x position on the probe plate)
#&lt;_circle_y&gt; = 10 (change to the approximate circle y position on the probe plate)

M70 (push state)
G21 (Change to metric units)
M5 (stop the spindle)

(prompt the user to attach probe and confirm that it is over the circle)
M0 (MSG, Attach probe and confirm that the center of the bit is over the circle)

G92 X0Y0Z0 (set all offset positions to 0)
F100 (set the feed rate to 100 mm/min)

(the next set of commands determine z height)
G38.2 G91 Z-100 (probe z by as much as 100 mm)
G92 Z[#&lt;_inset_height&gt;] (set z-axis to the height of the probe)

(the next set of commands determine the radius of the bit)
G0 G90 Z[#&lt;_inset_height&gt; + 10] (raise z to 10 mm above the top of the probe plate)
G0 G91 X[#&lt;_x_outer_dim&gt; - #&lt;_circle_x&gt; + 20] (rapid x to approximately 20mm past the right side of the probe)
G1 G90 Z[#&lt;_inset_height&gt; - 5] (move to 5mm below the top surface of the probe plate)
M0 (MSG, align flute for x probe)
G38.2 G91 X-25 (probe by up to 25mm to the left to find the right edge of the probe plate)
#&lt;_right_side&gt; = [#&lt;_x&gt;]
G0 G91 X1 (back off by one mm)
G0 G90 Z[#&lt;_inset_height&gt; + 10] (rapid to safe height)
G0 G91 X[-1 - #&lt;_x_outer_dim&gt; - 20] (rapid to the 20 mm past the left edge of the probe plate)
G1 G90 Z[#&lt;_inset_height&gt; - 5] (move to 5mm below the top surface of the probe plate)
M0 (MSG, align flutes for x probe)
G38.2 G91 X25 (probe by up to 25mm to the right to find the for left edge of the probe plate)
#&lt;_left_side&gt; = [#&lt;_x&gt;]
#&lt;_diameter&gt; = [#&lt;_right_side&gt; - #&lt;_left_side&gt; - #&lt;_x_outer_dim&gt;]
#&lt;_radius&gt; = [#&lt;_diameter&gt; / 2]

(now set the x postion to be 0 - 'x outer dimension - x inner dimension' - radius)
G92 X[0 - #&lt;_x_outer_dim&gt; + #&lt;_x_inner_dim&gt; - #&lt;_radius&gt;]

(next set of commands probe y and set y position)
G0 G91 X-1 (back away by one mm)
G0 G90 Z[#&lt;_inset_height&gt; + 10] (rapid to safe height)
G0 G91 X[1 + #&lt;_radius&gt; + #&lt;_circle_x&gt;] Y[-#&lt;_circle_y&gt; - 20] (rapid to the circle x pos and 20 mm below the lower y edge)
G1 G90 Z[#&lt;_inset_height&gt; - 5] (move to 5mm below the top surface of the probe plate)
M0 (MSG, align flutes on [#&lt;_radius&gt;] bit for y probe)
G38.2 G91 Y25 (probe by up to 25mm to back to find the front edge of the probe plate)

(now set the y postion to be 0 - 'y outer dimension - y inner dimension' - radius)
G92 Y[0 - #&lt;_y_outer_dim&gt; + #&lt;_y_inner_dim&gt; - #&lt;_radius&gt;]
G0 G91 Y-1 ( back away by one mm)
G0 G90 Z[#&lt;_inset_height&gt; + 10] (rapid to safe height)
G0 X0 Y0(move to the front left corner of the workpiece)
M0 (MSG, Remove probe)
M72
</code></pre>
<p>You should measure the dimensions of your 3D probe and replace the dimensions at the top of the program with your actual dimensions.</p>
<p>Normally, you would not run a 3D probe sequence after every tool change, but you may want to enter this code into the 'start-block' on the SETTINGS-&gt;General page. The 'start-block' gets executed at the beginning of each GCode program.</p>
<p>You may also find it helpful to add the 3D probing sequence to a <a href="https://buildbotics.com/cnc-macro-buttons/">Macro button</a>.</p>
<!--kg-card-end: markdown--><!--kg-card-begin: markdown--><h2 id="summary">Summary</h2>
<ul>
<li>Probing provides an automated and repeatable method of setting CNC Offsets.</li>
<li>Probing enables the use of multiple bits in a single CNC Program.</li>
<li>Probing is mostly used to set the offset for the z-axis, but it can also be used to set offsets for all axes.</li>
<li>The Buildbotics Controller implements probing through GCode commands, which means it can easily be performed as a 'code block' that is triggered when a tool change is encountered in the program.</li>
</ul>
<p>Take a look a my article on <a href="https://buildbotics.com/cnc-macro-buttons/">Macros</a> where I assigned the 3D probing sequence to a macro button.</p>
<!--kg-card-end: markdown--><p></p><!--kg-card-begin: markdown--><h2 id="todo">Todo</h2>
<p>Add link to Macro button article</p>
<!--kg-card-end: markdown--></div>]]></content:encoded></item><item><title><![CDATA[CNC Offsets (absolute position vs cutting position)]]></title><description><![CDATA[Learn how to set the position on your CNC machine to match the position assumed by your GCode Programs]]></description><link>https://buildbotics.com/cnc-offsets/</link><guid isPermaLink="false">669ed6b9bf3d4a05071d8b07</guid><category><![CDATA[CNC offsets]]></category><category><![CDATA[CNC homing]]></category><category><![CDATA[CNC probing]]></category><category><![CDATA[Convenience of Buildbotics]]></category><category><![CDATA[GCode programs]]></category><category><![CDATA[homing]]></category><category><![CDATA[limit switches]]></category><dc:creator><![CDATA[Doug Coffland]]></dc:creator><pubDate>Mon, 16 Sep 2024 20:39:39 GMT</pubDate><media:content url="https://buildbotics.com/content/images/2024/09/offset_set.png" medium="image"/><content:encoded><![CDATA[<!--kg-card-begin: markdown--><img src="https://buildbotics.com/content/images/2024/09/offset_set.png" alt="CNC Offsets (absolute position vs cutting position)"><p>After the Buildbotics CNC Controller is booted, it simply assumes that the cutting head is located at the origin (all axis positions are set to zero). Homing the machine leaves the axes near their limit switches at known positions. Check out my article titled <a href="https://buildbotics.com/homing-your-cnc-machine/">'Homing your CNC machine'</a> to learn all about homing the Buildbotics Controller.</p>
<p>This is all great, but the CAD programs typically define the origin as a location on the workpiece. It's pretty safe to say that the GCode origin is different from the machine origin. That's where offsets come into play.</p>
<p>After homing, my machine thinks the origin is in the center of the table. The picture below shows that the machine origin is in the center of the machine but I laid the workpiece down near the front right side of the machine.</p>
<p>The GCode program expects the origin to be at the top, left, front corner of my workpiece.</p>
<!--kg-card-end: markdown--><!--kg-card-begin: image--><figure class="kg-card kg-image-card kg-card-hascaption"><img src="https://buildbotics.com/content/images/2024/07/absolute_origin_vs_workpiece_origin-3.png" class="kg-image" alt="CNC Offsets (absolute position vs cutting position)"><figcaption>Absolute Origin vs GCode Origin</figcaption></figure><!--kg-card-end: image--><!--kg-card-begin: markdown--><p>The goal is to adjust the offsets such that the machine origin is in the same place as the GCode origin.</p>
<p>One way is to jog the machine into position with the game pad and then set the offsets.</p>
<!--kg-card-end: markdown--><!--kg-card-begin: image--><figure class="kg-card kg-image-card kg-card-hascaption"><img src="https://buildbotics.com/content/images/2024/07/cutting_head_at_gcode_origin-1.png" class="kg-image" alt="CNC Offsets (absolute position vs cutting position)"><figcaption>Cutting head co-located with the GCode origin</figcaption></figure><!--kg-card-end: image--><!--kg-card-begin: markdown--><p>As you jog the tool around, you will notice that the 'Position' and 'Absolute' fields remain equal to each other and the Offset fields remain at zero. The next picture shows my display after jogging to the gcode origin.</p>
<!--kg-card-end: markdown--><!--kg-card-begin: image--><figure class="kg-card kg-image-card kg-card-hascaption"><img src="https://buildbotics.com/content/images/2024/07/offset_not_set.png" class="kg-image" alt="CNC Offsets (absolute position vs cutting position)"><figcaption>Offsets not set</figcaption></figure><!--kg-card-end: image--><!--kg-card-begin: markdown--><p>Now, click the top Zero offset button to set the current positions to zero. The picture below shows that the offsets have been set. Notice 'Absolute' remains the same but Position is now all zeros and Offset shows the difference between the two.</p>
<!--kg-card-end: markdown--><!--kg-card-begin: image--><figure class="kg-card kg-image-card"><img src="https://buildbotics.com/content/images/2024/07/offset_set.png" class="kg-image" alt="CNC Offsets (absolute position vs cutting position)"></figure><!--kg-card-end: image--><!--kg-card-begin: markdown--><h2 id="summary">Summary</h2>
<p>This article shows a brute force method of setting the offsets. It works pretty well until you need to change bits in the middle of a program.</p>
<p>This method requires that you take control of the machine to set the offsets. Many GCode programs require tool changes in the middle of the program and unless you have an automatic tool changer, the bit position is likely to be different each time you change it. In the method shown, you would have to run individual programs each time you want to use a different bit.</p>
<p>This problem is solved by initiating a probing sequence after each tool change. Check out my article titled <a href="https://buildbotics.com/probing-to-set-cnc-offsets/">'Probing to set CNC offsets'</a> and my <a href="https://youtu.be/VPaVzny_dKM">3D probing video</a>.</p>
<!--kg-card-end: markdown-->]]></content:encoded></item><item><title><![CDATA[Cutting on a Rotary Axis]]></title><description><![CDATA[Check out the first cut using a rotary axis on a home built CNC machine.]]></description><link>https://buildbotics.com/cutting-on-a-rotary-axis/</link><guid isPermaLink="false">65d8da26bf3d4a05071d8545</guid><category><![CDATA[cnc]]></category><category><![CDATA[CNC Router]]></category><category><![CDATA[Rotary axis]]></category><category><![CDATA[CNC rotary axis]]></category><category><![CDATA[buldbotics]]></category><category><![CDATA[camotics]]></category><category><![CDATA[cnc controller]]></category><category><![CDATA[DIY rotary axis]]></category><dc:creator><![CDATA[Doug Coffland]]></dc:creator><pubDate>Sat, 24 Feb 2024 04:07:24 GMT</pubDate><media:content url="https://buildbotics.com/content/images/2024/02/Doug-s-homebuilt-CNC-with-rotary-axis-1.jpg" medium="image"/><content:encoded><![CDATA[<!--kg-card-begin: markdown--><h2 id="introduction">Introduction</h2>
<img src="https://buildbotics.com/content/images/2024/02/Doug-s-homebuilt-CNC-with-rotary-axis-1.jpg" alt="Cutting on a Rotary Axis"><p>This article describes how I set up a rotary axis on my homemade CNC machine. This article describes the setup using my <a href="https://buildbotics.com">Buildbotics CNC Controller</a>, but the concepts should be applicable to most other CNC controllers.</p>
<p>Check out my <a href="https://www.youtube.com/watch?v=Xu4jt7yHWkU">youtube video</a> that shows my first cut with this rotary axis.</p>
<!--kg-card-end: markdown--><!--kg-card-begin: markdown--><h2 id="settingupthehardware">Setting up the hardware</h2>
<p>When I built my CNC Machine, I set up the Z axis with 10 inches of movement. I eventually wanted to add a rotary axis and figured I needed this extra space so I could place the rotary hardware on the table and raise Z high enough to get the spindle over the work piece.</p>
<!--kg-card-end: markdown--><!--kg-card-begin: image--><figure class="kg-card kg-image-card kg-card-hascaption"><img src="https://buildbotics.com/content/images/2024/02/Doug-s-homebuilt-CNC.jpg" class="kg-image" alt="Cutting on a Rotary Axis"><figcaption>Doug's Homebult CNC Machine</figcaption></figure><!--kg-card-end: image--><p>Then, I bought this rotary axis set off of Amazon. It came with a 100 mm, 4-jaw chuck.</p><!--kg-card-begin: image--><figure class="kg-card kg-image-card kg-card-hascaption"><img src="https://buildbotics.com/content/images/2024/02/CNC-Rotary-Axis.jpg" class="kg-image" alt="Cutting on a Rotary Axis"><figcaption>Rotary Axis Hardware</figcaption></figure><!--kg-card-end: image--><p>I finally got around to setting it up on my machine, and here's the result.</p><!--kg-card-begin: image--><figure class="kg-card kg-image-card kg-card-hascaption"><img src="https://buildbotics.com/content/images/2024/02/Doug-s-homebuilt-CNC-with-rotary-axis.jpg" class="kg-image" alt="Cutting on a Rotary Axis"><figcaption>Doug's CNC Machine with Rotary Axis installed</figcaption></figure><!--kg-card-end: image--><!--kg-card-begin: markdown--><p>The hardware set up was pretty easy. I rewired the Y-axis motors in parallel and connected them to the Motor port 1. This freed up Motor port 3 so I could assign it to the A axis for rotary motion. I had to reduce the top speed on my Y axis a bit to prevent stalling, but rapid moves are still 300 inches per minute.</p>
<!--kg-card-end: markdown--><!--kg-card-begin: markdown--><h2 id="configuringtherotaryaxis">Configuring the rotary axis</h2>
<p>Configuring the rotary axis was a bit more difficult. The axis had to be configured for linear movement in either millimeters or inches, but the axis actually turned. I figured that I needed to calibrate such that a move given in millimeters would actually travel that far in degrees.</p>
<p>The rotary hardware actually turns the chuck one revolution for every six revolutions of the motor. So, I reasoned that if I set the travel-per-revolution to 60 mm, it would work. And it did! Now, I could give it a command like &quot;G0A90&quot; and the chuck would turn by 90 degrees.</p>
<p>Unfortunately, this setup had two major problems:</p>
<ol>
<li><strong>Switching to Imperial units caused the turning distances to be off by a factor of 25.4. For instance, a command like &quot;G0A360&quot; would cause the chuck to turn by 25.4 revolutions. This meant that I would have to reconfigure the axis everytime I switched between Metric and Imperial units</strong>.</li>
<li><strong>The feed rates are based on linear travel distance, but the rotary axis traveled in degrees. As a result, the feed rates were incorrect unless the cutting point was exactly 57.3 mm from the center of rotation</strong></li>
</ol>
<!--kg-card-end: markdown--><!--kg-card-begin: markdown--><p>A better solution is to treat the axis as if it were a linear axis and set a 'sensible' travel distance for one revolution of the motor. This method provides the correct cutting distance as long as the cutting point is at a specific distance from the center of rotation. Here's how I did it:</p>
<ol>
<li>I decided that the travel distance for one rotation of the chuck would be 10 inches.</li>
<li>Since the motor rotates six times for each rotation of the chuck, the travel-per-revoltion would be 10 / 6 = 1.667 inches.</li>
<li>I like to configure my machine in metric units so I converted 1.667 inches to 42.33 mm and entered that value into the travel-per-rev field on the Settings-&gt;Motor page for my rotary axis.</li>
</ol>
<!--kg-card-end: markdown--><!--kg-card-begin: image--><figure class="kg-card kg-image-card kg-card-hascaption"><img src="https://buildbotics.com/content/images/2024/02/travel-per-rev.png" class="kg-image" alt="Cutting on a Rotary Axis"><figcaption>42.33 mm = 10 inches per revolution of the chuck</figcaption></figure><!--kg-card-end: image--><!--kg-card-begin: markdown--><p>This distance is correct as long as the cutting point is 1.59 inches from the center of rotation. If the cutting point moves in or out significantly from 1.59 inches, the cutting speed may be off far enough to negatively impact the quality of the cut.</p>
<p>You may want to change the feed rate in your gcode program to compensate for this problem, but be careful because changing the feed rate changes the cutting speed along both axes while the distances are only changing along the rotary axis.</p>
<p>If your CAD software is sophisticated enough, it may be able to calculate and adjust the feed rate for each line segment so that a constant cutting speed is maintained.</p>
<p>In the worst case, you may need to break your project into separate cuts and adjust the travel-per-revolution of the rotary axis between those cuts.</p>
<!--kg-card-end: markdown--><!--kg-card-begin: markdown--><h2 id="settinguptheorigin">Setting up the origin</h2>
<p>In reality, I could move the rotary axis around on my machine, but it is kind of a pain to set it up and move it around. Once I found a good spot, I made some adjustments in the configuration that allow me to set offsets for my cutting origin and then go there at the beginning of each cut.</p>
<p>This works great as long as the machine is homed before you start your program.</p>
<p>On the Buildbotics Controller, this is done in the &quot;program-start&quot; textbox on the &quot;SETTINGS-&gt;General&quot; page.</p>
<!--kg-card-end: markdown--><!--kg-card-begin: image--><figure class="kg-card kg-image-card kg-card-hascaption"><img src="https://buildbotics.com/content/images/2024/02/program-start-box.png" class="kg-image" alt="Cutting on a Rotary Axis"><figcaption>This code is inserted at the beginning of each program.</figcaption></figure><!--kg-card-end: image--><!--kg-card-begin: markdown--><p>The &quot;G53G0Z100&quot; command tells the machine to ignore existing offsets and move in machine coordinates while raising the Z axis to 100 mm.</p>
<p>The &quot;G53G0X-200A-491&quot; tells the machine to use machine coordinates and move to X=-200mm and A=-491.7 mm. Note that A is actually my linear axis that moves the gantry forward and backward on my machine. The rotary axis is Y. This move puts the tool directly above the center and near the left end of the work piece.</p>
<p>The &quot;G92X0Y0A0&quot; command tells the machine that the current location is the origin for the X, Y, and A axes.</p>
<!--kg-card-end: markdown--><!--kg-card-begin: markdown--><h2 id="settingupzaxisprobing">Setting up Z-Axis probing</h2>
<p>If you want to change tools during a cut, you will need the ability to probe to adjust the Z-axis offset for each tool that you use.</p>
<p>Probing is set up in the &quot;tool-change&quot; textbox on the &quot;SETTINGS-&gt;General&quot; page.</p>
<!--kg-card-end: markdown--><!--kg-card-begin: image--><figure class="kg-card kg-image-card kg-card-hascaption"><img src="https://buildbotics.com/content/images/2024/02/tool-change-1.png" class="kg-image" alt="Cutting on a Rotary Axis"><figcaption>Z-axis probing with the rotary setup</figcaption></figure><!--kg-card-end: image--><!--kg-card-begin: markdown--><p>This picture shows the part of the tool change procedure that is automatically inserted into the gcode program every time a tool change is encountered.</p>
<p>The &quot;G0Z100&quot; command tells the Z-axis to move to 100mm to ensure a safe move to the probing location.</p>
<p>The &quot;G0X-140A0&quot; moves the tool to a place directly above the tail-stock housing.</p>
<p>The &quot;G38.2 Z-54&quot; command tells the controller to move down along the Z axis until the probe is tripped or it reaches the minimum soft limit at -54mm.</p>
<p>After the probe is tripped, the &quot;G92 Z47.05&quot; sets the Z axis to 47.05mm.</p>
<!--kg-card-end: markdown--><!--kg-card-begin: image--><figure class="kg-card kg-image-card kg-card-hascaption"><img src="https://buildbotics.com/content/images/2024/02/probing.png" class="kg-image" alt="Cutting on a Rotary Axis"><figcaption>Probing on the rotary setup</figcaption></figure><!--kg-card-end: image--><!--kg-card-begin: markdown--><p>The Z axis is set to 47.05 mm because the top of the tail-stock housing is 28 mm above the center of rotation and the probe is 19.05 mm (.75 inches) high. 28 + 19.05 = 47.05 mm.</p>
<p>Check out <a href="https://forum.buildbotics.com/viewtopic.php?f=6&amp;t=117">this thread on the Buldbotics Forum</a> for more information on probing.</p>
<!--kg-card-end: markdown--><!--kg-card-begin: markdown--><h3 id="besuretocheckoutmyyoutubevideothatshowsmyfirstcutusingtherotaryaxis">Be sure to check out my youtube video that shows my first cut using the rotary axis.</h3>
<!--kg-card-end: markdown-->]]></content:encoded></item><item><title><![CDATA[Buildbotics Controller Reviews]]></title><description><![CDATA[<p>These are unpaid independent reviews of the Buildbotics controller.</p><ul><li><a href="https://mellowpine.com/cnc/best-cnc-controllers/">July 2021 - Mellow Pine</a></li><li><a href="https://mellowpine.com/cnc/buildbotics-cnc-controller-review/">November 2021 - Mellow Pine</a></li><li><a href="https://www.hackster.io/news/buildbotics-open-source-cnc-controller-d21a2ccb15f6">August 2017 - Hackster.io</a></li></ul>]]></description><link>https://buildbotics.com/reviews/</link><guid isPermaLink="false">619e709d395a95fc71f12874</guid><dc:creator><![CDATA[Joseph Coffland]]></dc:creator><pubDate>Wed, 24 Nov 2021 17:05:30 GMT</pubDate><media:content url="https://buildbotics.com/content/images/2021/11/buildbotics_icon-256x256-1.png" medium="image"/><content:encoded><![CDATA[<img src="https://buildbotics.com/content/images/2021/11/buildbotics_icon-256x256-1.png" alt="Buildbotics Controller Reviews"><p>These are unpaid independent reviews of the Buildbotics controller.</p><ul><li><a href="https://mellowpine.com/cnc/best-cnc-controllers/">July 2021 - Mellow Pine</a></li><li><a href="https://mellowpine.com/cnc/buildbotics-cnc-controller-review/">November 2021 - Mellow Pine</a></li><li><a href="https://www.hackster.io/news/buildbotics-open-source-cnc-controller-d21a2ccb15f6">August 2017 - Hackster.io</a></li></ul>]]></content:encoded></item><item><title><![CDATA[Turning 2D DXF files into GCode]]></title><description><![CDATA[<!--kg-card-begin: image--><figure class="kg-card kg-image-card"><img src="https://buildbotics.com/content/images/2020/01/buildbotics_dxf_to_gcode-1.png" class="kg-image" alt="Convert DXF files to GCode"></figure><!--kg-card-end: image--><p>When you first get started with your CNC you will probably try cutting a few preexisting GCodes but soon you will want to make your own.  The first step in that process is to create a drawing using a CAD or drawing software such as <a href="https://librecad.org">LibreCAD</a> (2D) or <a href="https://inkscape.org/">Inkscape</a> (2D)</p>]]></description><link>https://buildbotics.com/dxf-to-gcode/</link><guid isPermaLink="false">5e2cbc97e9c717462af9085e</guid><category><![CDATA[dxf]]></category><category><![CDATA[gcode]]></category><category><![CDATA[dxf to gcode]]></category><category><![CDATA[cnc]]></category><category><![CDATA[free cnc software]]></category><category><![CDATA[camotics]]></category><category><![CDATA[buldbotics]]></category><category><![CDATA[cnc controller]]></category><dc:creator><![CDATA[Joseph Coffland]]></dc:creator><pubDate>Sat, 25 Jan 2020 22:57:22 GMT</pubDate><media:content url="https://buildbotics.com/content/images/2020/01/buildbotics_dxf_to_gcode-2.png" medium="image"/><content:encoded><![CDATA[<!--kg-card-begin: image--><figure class="kg-card kg-image-card"><img src="https://buildbotics.com/content/images/2020/01/buildbotics_dxf_to_gcode-1.png" class="kg-image" alt="Turning 2D DXF files into GCode"></figure><!--kg-card-end: image--><img src="https://buildbotics.com/content/images/2020/01/buildbotics_dxf_to_gcode-2.png" alt="Turning 2D DXF files into GCode"><p>When you first get started with your CNC you will probably try cutting a few preexisting GCodes but soon you will want to make your own.  The first step in that process is to create a drawing using a CAD or drawing software such as <a href="https://librecad.org">LibreCAD</a> (2D) or <a href="https://inkscape.org/">Inkscape</a> (2D).  There are many guides online explaining how to install and use these programs.</p><p>Once you have a drawing saved in DXF format you will need to convert it to GCode using CAM software.  You can use commercial programs such as Fusion360 or MasterCAM but there are also free and Open-Source solutions such as <a href="https://camotics.org/">CAMotics</a>, Inkscape's gcodetools plugin and <a href="http://pycam.sourceforge.net/">pyCAM</a>.  In this guide, we will focus on using CAMotics and TPL.  A quick Internet search will yield guides on using other software.</p><h2 id="using-camotics-and-tpl">Using CAMotics and TPL</h2><!--kg-card-begin: markdown--><p>CAMotics is a free and Open-Source CNC simulation software. It supports a CNC programming system called <a href="https://tplang.org/">TPL</a> (Tool Path Language) that makes it much easier to create GCode.</p>
<p>If have experience with JavaScript or similar programing languages then TPL will be very easy to learn. If you have no programming experience, then you can use this guide to cut-and-paste the simple TPL program presented here and make small changes to convert your own DXF files.</p>
<p>Once you've <a href="https://camotics.org/download.html">installed CAMotics</a>, try out some of the examples by selecting them from the <em>File</em> menu. The &quot;CAMotics&quot; and &quot;Buildbotics&quot; examples both use DXF files and TPL.  Try changing the tool or workpiece options and rerunning the simulation to see how it changes.</p>
<p>Here we will look at the &quot;Buildbotics&quot; example in detail. Double click on <em>buildbotics_logo.tpl</em> from the left hand side of CAMotics to view the program.  The complete program looks something like this:</p>
<pre><code class="language-javascript">var dxf = require('dxf');
var layers = dxf.open('buildbotics_logo.dxf');

var zSafe = 3;
var cutDepth = -1.5;

units(METRIC); // This must match the units of the DXF file
feed(1600);
speed(10000);
tool(2);

rapid({z: zSafe});

dxf.cut_layer_offset(layers.Inside,  -0.5, zSafe, cutDepth);
dxf.cut_layer_offset(layers.Tools,    0.5, zSafe, cutDepth);
dxf.cut_layer_offset(layers.Head,     0.5, zSafe, cutDepth);
dxf.cut_layer_offset(layers.Ears,    -0.5, zSafe, cutDepth);
dxf.cut_layer_offset(layers.Eyes,    -0.5, zSafe, cutDepth * 0.66);
dxf.cut_layer_offset(layers.Pupils,  -1.2, zSafe, cutDepth * 0.66);
dxf.cut_layer_offset(layers.Outline,    0, zSafe, cutDepth);

rapid({z: zSafe});
speed(0);
rapid(40, 75);
</code></pre>
<p>Let's break it down.</p>
<pre><code class="language-javascript">var dxf = require('dxf');
var layers = dxf.open('buildbotics_logo.dxf');
</code></pre>
<p>The first two lines load in the DXF library and read in the DXF file.  Change the filename to read in a different file.  The DXF file should be in the same directory as the TPL file.  The variable <code>layers</code> now holds the DXF data.</p>
<pre><code class="language-javascript">var zSafe = 3;
var cutDepth = -1.5;
</code></pre>
<p>Next we set a couple more variables that will be used below.  <code>zSafe</code> is the height above the workpiece where the tool can safely make rapid moves. <code>cutDepth</code> is how deep we will be cutting into the material.</p>
<pre><code class="language-javascript">units(METRIC); // This must match the units of the DXF file
feed(1600);
speed(10000);
tool(2);
</code></pre>
<p>Now we set the units mode to metric.  You could also set it to <code>IMPERIAL</code> to use inches instead of millimeters.  The feed rate is set to 1600 mm/min, the spindle speed to 10k RPM and tool 2 is selected.  These are just examples, you must choose appropriate values for your machine, material and tool.</p>
<pre><code class="language-javascript">rapid({z: zSafe});
</code></pre>
<p>Move the tool up to the safe height specified above.</p>
<pre><code class="language-javascript">dxf.cut_layer_offset(layers.Inside,  -0.5, zSafe, cutDepth);
dxf.cut_layer_offset(layers.Tools,    0.5, zSafe, cutDepth);
dxf.cut_layer_offset(layers.Head,     0.5, zSafe, cutDepth);
dxf.cut_layer_offset(layers.Ears,    -0.5, zSafe, cutDepth);
dxf.cut_layer_offset(layers.Eyes,    -0.5, zSafe, cutDepth * 0.66);
dxf.cut_layer_offset(layers.Pupils,  -1.2, zSafe, cutDepth * 0.66);
dxf.cut_layer_offset(layers.Outline,    0, zSafe, cutDepth);
</code></pre>
<p>Here we cut each of the DXF layers using <code>dxf.cut_layer_offset()</code>.  The three paramters passed to <code>dxf.cut_layer_offset()</code> are <em>layer</em>, <em>offset</em>, <em>z-safe</em> and <em>cut depth</em>.</p>
<p>The <em>layer</em> is the DXF layer. DXF layers can be selected by name or by number.  DXF layers are named in the CAD software. Your DXF may only have one layer. In that case, it is easer to cut the single layer like this:</p>
<pre><code class="language-javascript">dxf.cut_layer_offset(layers[0], 0, zSafe, cutDepth);
</code></pre>
<p>The <em>offset</em> offsets the tool position from the DXF path.  A positive offset will cut outside of the path.  For example, you might want to offset by half the tool diameter.  A negative value will cut inside the path and zero will cut exactly on the path.</p>
<pre><code class="language-javascript">rapid({z: zSafe});
speed(0);
rapid(40, 75);
</code></pre>
<p>Finally, we move back up to the safe height, turn off the spindle and move to a position out of the way.</p>
<!--kg-card-end: markdown-->]]></content:encoded></item><item><title><![CDATA[Connecting your CNC to WiFi]]></title><description><![CDATA[<!--kg-card-begin: html--><div class="add-toc"></div><!--kg-card-end: html--><!--kg-card-begin: image--><figure class="kg-card kg-image-card"><img src="https://buildbotics.com/content/images/2020/01/buildbotics-wifi.png" class="kg-image" alt="Buildbotics CNC controller WiFi"></figure><!--kg-card-end: image--><p>One of the first things you will want to do with your Buildbotics CNC controller is connect it to your network.  For many people, this means connecting to WiFi.  To do so you must configure the controller's WiFi settings.</p><p>There are two ways to access the controller's WiFi settings.  Either</p>]]></description><link>https://buildbotics.com/wifi/</link><guid isPermaLink="false">5e2bdab5e9c717462af90665</guid><category><![CDATA[wifi]]></category><category><![CDATA[network]]></category><category><![CDATA[howto]]></category><dc:creator><![CDATA[Joseph Coffland]]></dc:creator><pubDate>Sat, 25 Jan 2020 07:46:40 GMT</pubDate><media:content url="https://buildbotics.com/content/images/2020/01/buildbotics-wifi-1.png" medium="image"/><content:encoded><![CDATA[<!--kg-card-begin: html--><div class="add-toc"></div><!--kg-card-end: html--><!--kg-card-begin: image--><figure class="kg-card kg-image-card"><img src="https://buildbotics.com/content/images/2020/01/buildbotics-wifi.png" class="kg-image" alt="Connecting your CNC to WiFi"></figure><!--kg-card-end: image--><img src="https://buildbotics.com/content/images/2020/01/buildbotics-wifi-1.png" alt="Connecting your CNC to WiFi"><p>One of the first things you will want to do with your Buildbotics CNC controller is connect it to your network.  For many people, this means connecting to WiFi.  To do so you must configure the controller's WiFi settings.</p><p>There are two ways to access the controller's WiFi settings.  Either temporarily connect the controller to a wired network or boot the controller with a monitor, mouse and keyboard connected.  Each of these methods is described in detail below.</p><h2 id="method-1-using-a-wired-network">Method 1: Using a wired network</h2><!--kg-card-begin: image--><figure class="kg-card kg-image-card kg-card-hascaption"><img src="https://buildbotics.com/content/images/2020/01/buildbotics_controller_ethernet.png" class="kg-image" alt="Connecting your CNC to WiFi"><figcaption>Buildbotics CNC controller Ethernet connection</figcaption></figure><!--kg-card-end: image--><p>If you plug the Buildbotics controller directly into a wired network, the network should automatically assign the controller an IP address.  You can then use that IP address to access the controller from another computer on the same network.  Here's how:</p><ol><li>Plug in the controller's power supply.</li><li>Plug an Ethernet cable in to the back of the controller</li><li>Plug the other end of the Ethernet cable in to your router or network wall socket.</li><li>Plug the Gamepad into one of the controller's USB ports.</li><li>Switch the controller on.</li><li>Wait for it to boot.</li><li>Press the right arrow on the Gamepad until you see the network page on the LCD screen.</li></ol><!--kg-card-begin: image--><figure class="kg-card kg-image-card"><img src="https://buildbotics.com/content/images/2020/01/buildbotics_connect_with_f310-gamepad-1.png" class="kg-image" alt="Connecting your CNC to WiFi"></figure><!--kg-card-end: image--><p>8. On another computer navigate to <em>http://</em> followed by the IP address shown on the LCD screen.</p><p>For example, you might enter<em> http://192.168.0.2</em> in your browser.  Once you've reached the Buildbotics controller's Web interface, you can move on to configuring the WiFi.</p><!--kg-card-begin: image--><figure class="kg-card kg-image-card"><img src="https://buildbotics.com/content/images/2020/01/buildbotics_controller_front_network.png" class="kg-image" alt="Connecting your CNC to WiFi"></figure><!--kg-card-end: image--><p></p><h2 id="method-2-connect-a-monitor-mouse-and-keyboard">Method 2: Connect a Monitor, Mouse and Keyboard</h2><!--kg-card-begin: image--><figure class="kg-card kg-image-card"><img src="https://buildbotics.com/content/images/2020/01/buildbotics_controller_backpanel_connections-1.png" class="kg-image" alt="Connecting your CNC to WiFi"></figure><!--kg-card-end: image--><p>The Buildbotics controller has a built-in computer which you can use to control your CNC directly.  You will need the following:</p><ol><li>A monitor with HDMI cable.</li><li>A USB mouse.</li><li>A USB keyboard.</li></ol><p>If your monitor is a touch screen you may be able to forgo the mouse and keyboard.</p><p>Connect the monitor, mouse, keyboard and the controller's power supply.  Turn the controller on and wait for it to boot.  As it starts up you should see the Buildbotics logo.  Once it is fully booted you can move on to configuring the WiFi.</p><!--kg-card-begin: image--><figure class="kg-card kg-image-card"><img src="https://buildbotics.com/content/images/2020/01/buildbotics_splash-512x389.png" class="kg-image" alt="Connecting your CNC to WiFi"></figure><!--kg-card-end: image--><h2 id="configuring-the-wifi">Configuring the WiFi</h2><p>Once you've gained access to the controller's Web interface using one of the methods described above you are ready to configure the WiFi settings.</p><!--kg-card-begin: image--><figure class="kg-card kg-image-card"><img src="https://buildbotics.com/content/images/2020/01/buildbotics_controller_wifi_config-1.png" class="kg-image" alt="Connecting your CNC to WiFi"></figure><!--kg-card-end: image--><p>To setup the WiFi:</p><ol><li>Click on the <em>ADMIN -&gt; General</em> tab from the menu on the left.</li><li>Set the WiFi mode to <em>Client</em>.</li><li>Set your WiFi network's SSID or name.</li><li>Set your WiFi network's password.</li><li>Click the blue <em>Set</em> button.</li><li>Click the green <em>Ok</em> button to reboot the controller.</li><li>Wait for it to fully reboot.</li></ol><!--kg-card-begin: image--><figure class="kg-card kg-image-card"><img src="https://buildbotics.com/content/images/2020/01/buildbotics_controller_wifi_config_reboot.png" class="kg-image" alt="Connecting your CNC to WiFi"></figure><!--kg-card-end: image--><h2 id="accessing-the-buildbotics-controller-over-wifi">Accessing the Buildbotics controller over WiFi</h2><p>Once you've saved the controller's WiFi settings and allowed it to reboot you should be able to access the controller over WiFi.  If you used a wired network to configure the controller, you should unplug the Ethernet cable now.</p><p>As described in method 1 above, use the Gamepad to locate the new IP address on the LCD screen.  It will be different from the wired network IP.  Enter <em>http://</em> followed by the IP in another computer on the network to access the controller remotely.</p><h2 id="troubleshooting">Troubleshooting</h2><p>Here are some common problems and their solutions.  Please feel free to <a href="https://buildbotics.com/contact">contact us</a> if you cannot resolve your problem.</p><h3 id="problem-network-connects-and-disconnects-">Problem: Network connects and disconnects.</h3><p>The Buildbotics controller's built-in WiFi is not particularly strong.  If your WiFi network's signal is weak or there are a lot of other wireless devices in the area it may be difficult to keep the controller connected.  A wired network connection will be more reliable but if you must use WiFi you can add a USB WiFi dongle with an antenna to boost your signal strength.  There are many good inexpensive WiFi adapters available online.</p><h3 id="problem-no-ip-address-on-the-lcd-screen-">Problem: No IP address on the LCD screen.</h3><p>First make sure you are on the LCD screens network page by pressing the right arrow on the Gamepad.  If the screen does not change, make sure the Gamepad is plugged in and you are pressing the right button.</p><p>If there is no IP address on the Buildbotics LCD screen on its network page, then it is either not connected to a network or the network is not assigning the controller an IP address.  Check the network connections or the WiFi settings.  It that fails, check your local network's configuration.</p><h3 id="problem-the-ip-address-will-not-load-in-the-browser">Problem: The IP address will not load in the browser</h3><p>Make sure you type a full address such as <em>http://192.168.0.2  </em>If it still does not work, then the computer you are using may not be on the same network as the Buildbotics controller.  The remote computer must be on the same network.</p><h3 id="problem-the-controller-shows-more-than-one-ip-address">Problem: The controller shows more than one IP address</h3><p>Your controller may get assigned more than one IP address if it is connected both to the WiFi and to a wired network.  This may also occur if you are using a WiFi dongle to boost your signal.  You can disconnect the other networks and restart the controller or try each IP address until one works.</p>]]></content:encoded></item><item><title><![CDATA[How to use a VFD spindle driver]]></title><description><![CDATA[All about connecting and configuring VFDs to drive CNC spindles.]]></description><link>https://buildbotics.com/how-to-use-a-vfd-spindle-driver/</link><guid isPermaLink="false">5d8a4fcc8f0c467f2ac93322</guid><category><![CDATA[vfd]]></category><category><![CDATA[rs485]]></category><category><![CDATA[modbus]]></category><category><![CDATA[howto]]></category><category><![CDATA[spindle]]></category><dc:creator><![CDATA[Joseph Coffland]]></dc:creator><pubDate>Tue, 24 Sep 2019 23:30:08 GMT</pubDate><media:content url="https://buildbotics.com/content/images/2019/09/buildbotics_vfd_control-1.png" medium="image"/><content:encoded><![CDATA[<!--kg-card-begin: html--><div class="add-toc"></div><!--kg-card-end: html--><!--kg-card-begin: image--><figure class="kg-card kg-image-card"><img src="https://buildbotics.com/content/images/2019/09/buildbotics_vfd_control.png" class="kg-image" alt="How to use a VFD spindle driver"></figure><!--kg-card-end: image--><img src="https://buildbotics.com/content/images/2019/09/buildbotics_vfd_control-1.png" alt="How to use a VFD spindle driver"><p>A VFD or Variable Frequency Drive is a type of motor driver often used to control high speed CNC spindles. The VFD converts AC line voltage to higher voltages and frequencies.  The VFD varies the output frequency to control motor speed.  Using a VFD smart controller, like the Buildbotics CNC controller, you can control spindle speed and direction using GCode and get feedback indicating actual speed in real-time.</p><p>You may also be interested in <a href="https://buildbotics.com/connecting-a-pwm-spindle-to-the-buildbotics-controller/">PWM spindle control</a>.</p><h2 id="rs485-vfd-control">RS485 VFD Control</h2><p>Most VFDs support remote control using the two wire RS485 digital interface. This allows a smart CNC controller to command the VFD's speed and direction and read back actual speed and status information while the VFD is running.  Most also use a protocol called Modbus when communicating over RS485.  Unfortunately, compatibility ends here because each VFD vendor uses a different set of Modbus commands.</p><p>Fortunately, the Buildbotics CNC controller has built-in configurations to handle many common VFDs and makes it possible to create custom configurations to support new ones.</p><h2 id="supported-vfds">Supported VFDs</h2><p>Any VFD that supports Modbus can be used with the Buildbotics controller. However, some VFDs have out-of-the-box support and others require custom programming. At the time of this writing the following VFDs are supported out-of-the-box:</p><ul><li><a href="https://buildbotics.com/huanyang-vfd">Huanyang</a></li><li>AC-Tech</li><li>Nowforever</li><li>Delta VFD015M21A (Beta)</li><li>YL600, YL620, YL620-A (Beta)</li><li>FR-D700 (Beta)</li></ul><p>VFDs marked as beta have had limited testing.  If you need help with one of these VFDs or would like to create a custom configuration for a new VFD, don't hesitate to <a href="https://buildbotics.com/contact">contact us</a>.  We will be glad to help decipher the VFD's manual and are eager to add support for more VFDs.</p><h2 id="rs485-wiring">RS485 Wiring</h2><!--kg-card-begin: image--><figure class="kg-card kg-image-card"><img src="https://buildbotics.com/content/images/2019/09/buildbotics_rs485_vfd_control.png" class="kg-image" alt="How to use a VFD spindle driver"></figure><!--kg-card-end: image--><p>Only two wires are needed to make the RS485 connection. To reduce electrical noise it is best to keep the wires short and to use a shielded twisted pair such as one of the pairs found in a <a href="https://en.wikipedia.org/wiki/Category_5_cable">CAT5  network cable</a>.</p><p>First, disconnect all power.  Then, make the following connections on the <a href="https://buildbotics.com/io-breakout">Buildbotics controller I/O breakout box</a>.</p><!--kg-card-begin: markdown--><table>
<thead>
<tr>
<th>Pin</th>
<th>Signal</th>
</tr>
</thead>
<tbody>
<tr>
<td>13</td>
<td>RS485 A</td>
</tr>
<tr>
<td>14</td>
<td>RS485 B</td>
</tr>
</tbody>
</table>
<!--kg-card-end: markdown--><p>You can connect either wire to RS485 A or B; the Buildbotics controller will automatically discover which is which. Consult the VFD's manual for the correct connection points on the VFD.  Be sure not to connect the RS485 wires to any of the high voltage lines with in the VFD.</p><h2 id="buildbotics-controller-configuration">Buildbotics Controller Configuration</h2><p>To configure the Buildbotics controller to talk to the VFD go to the TOOL page on the Web interface and configure the following sections:</p><h3 id="tool-configuration">Tool Configuration</h3><!--kg-card-begin: image--><figure class="kg-card kg-image-card"><img src="https://buildbotics.com/content/images/2019/09/buildbotics_tool_configuration-1.jpg" class="kg-image" alt="How to use a VFD spindle driver"></figure><!--kg-card-end: image--><h4 id="tool-type">tool-type</h4><p>Select one of the built-in VFD configurations or "Custom Modbus VFD" to design your own VFD control commands.</p><h4 id="tool-reversed">tool-reversed</h4><p>Check this box if your spindle turns the wrong direction.  Most tools require clockwise rotation. That is clockwise if you are looking down from above the spindle towards the workpiece.  Spinning the tool in the wrong direction can cause major problems so double check it before you cut anything.</p><h4 id="max-spin-min-spin">max-spin &amp; min-spin</h4><p>Maximum and minimum spindle speed in RPM (Revolutions per Minute).  Check your VFD's manual to determine the correct values for your spindle.  A typical maximum RPM is 10k to 24k.</p><h4 id="tool-enable-mode-tool-direction-mode">tool-enable-mode &amp; tool-direction-mode</h4><p>These options are not normally needed for RS485 VFD control.  Set them <em>disabled</em>.</p><h3 id="modbus-configuration">Modbus Configuration</h3><!--kg-card-begin: image--><figure class="kg-card kg-image-card"><img src="https://buildbotics.com/content/images/2019/09/buildbotics_modbus_configuration.jpg" class="kg-image" alt="How to use a VFD spindle driver"></figure><!--kg-card-end: image--><p>There are a number of configuration options on the Buildbotics controller that are common to all VFDs.  These options must match the settings applied in the VFD's configuration.</p><h4 id="bus-id">bus-id</h4><p>This is the Modbus ID.  It is used to identify multiple Modbus devices on the same RS485 network.  Typically there is only one device so bus ID 1 is a good choice.  It just has to match the setting in the VFD.</p><h4 id="baud">baud</h4><p>This is the speed of the RS485 communication in bits per second.  It is tempting to use higher baud rates but this only increases the likelihood of errors due electrical noise.  The spindle control signals are very brief and even at 9600 baud it is already very fast.  For example, a typical command and response consists of 176 bits of data. At 9600 baud that takes about 1/50th of a second.</p><h4 id="parity">parity</h4><p>The parity bit is an extra bit that is used to help detect communication errors. The Modbus protocol already has it's own error checking so parity is generally set to none. However, it must match the setting in the VFD.</p><h2 id="configuring-the-vfd">Configuring the VFD</h2><!--kg-card-begin: image--><figure class="kg-card kg-image-card"><img src="https://buildbotics.com/content/images/2019/09/vfd_programming-1.png" class="kg-image" alt="How to use a VFD spindle driver"></figure><!--kg-card-end: image--><p>You must configure the VFD for your spindle and enable Modbus communication. If you select one of the preconfigured VFDs, a "Notes" section will appear at the bottom of the page showing the necessary VFD settings.</p><!--kg-card-begin: image--><figure class="kg-card kg-image-card kg-card-hascaption"><img src="https://buildbotics.com/content/images/2019/09/buildbotics_nowforever_vfd_configuration_notes.jpg" class="kg-image" alt="How to use a VFD spindle driver"><figcaption>Example Nowforever VFD configuration notes.</figcaption></figure><!--kg-card-end: image--><p>The configuration process varies for each VFD so consult its manual for details.  It usually consists of using the arrow and enter keys on the VFD's front panel to select an address and then set its value.  This is repeated for each setting until all the necessary settings are configured.</p><p>Here are the most common VFD settings needed for Modbus communication:</p><ul><li>Enable RS485 Modbus communication in RTU mode.</li><li>Select 9600 baud.</li><li>Select no parity, 8 data bits and 2 stop bits.</li><li>Set the Modbus slave ID to 1 or whatever you set <strong>bus-id</strong> to.</li><li>Select Modbus as the start/stop controller and remote frequency source.</li></ul><p>You will also need to set the correct frequency, output voltage and min and max RPM for your spindle in the VFD's configuration.</p><h2 id="testing-the-connection">Testing the Connection</h2><p>With the RS485 wiring complete and the Buildbotics controller and VFD configured, it's time to test the connection.  Test with the spindle disconnected from the VFD until you're sure the VFD is operating correctly.</p><p>To start the VFD in the clockwise direction go to the CONTROL page on the Buildbotics controller, select the "MDI" tab, then run the following GCode command:</p><!--kg-card-begin: html--><pre>M3 S1000</pre><!--kg-card-end: html--><!--kg-card-begin: image--><figure class="kg-card kg-image-card"><img src="https://buildbotics.com/content/images/2019/09/buildbotics_modbus_status.jpg" class="kg-image" alt="How to use a VFD spindle driver"></figure><!--kg-card-end: image--><p>Return the the TOOL page to check the Modbus status.  The VFD's front panel may also indicate if it is operating.</p><p>Increase the speed with:</p><!--kg-card-begin: html--><pre>S5000</pre><!--kg-card-end: html--><p>Reverse the direction with:</p><!--kg-card-begin: html--><pre>M4</pre><!--kg-card-end: html--><p>Stop the VFD by clicking the stop button or with:</p><!--kg-card-begin: html--><pre>M5</pre><!--kg-card-end: html--><p>Once everything appears to be working correctly, disconnect the power, connect the spindle, power it up and try it again for real. Be sure to check that the spindle turns in the correct direction.</p><h2 id="troubleshooting">Troubleshooting</h2><h3 id="vfd-fails-to-operate">VFD fails to operate</h3><p>Check the following:</p><!--kg-card-begin: markdown--><ul>
<li>Both RS485 wires are solidly connected to both the Buildbotics controller and the correct connection points on the VFD.</li>
<li>The following settings match on both the Buildbotics controller and VFD:
<ul>
<li>Modbus ID</li>
<li>RS485 baud rate</li>
<li>RS485 data bits, parity and stop bits</li>
</ul>
</li>
<li>The VFD is in Modbus RTU mode. Not ASCII mode.</li>
<li>RS485 Modbus is the source for start/stop and frequency control on the VFD.</li>
<li>The VFD can be operated manually through its front panel.</li>
</ul>
<!--kg-card-end: markdown--><h3 id="spindle-runs-in-reverse">Spindle runs in reverse</h3><p>If an <strong>M3</strong> causes the spindle to turn counter-clockwise you can either correct the configuration in the VFD or set the <strong>tool-reversed</strong> option on the Buildbotics controller.</p><h3 id="spindle-runs-at-wrong-speed">Spindle runs at wrong speed</h3><p>Check that:</p><ul><li><strong>max-spin</strong> is correct on the Buildbotics controller.</li><li>The maximum frequency is set correctly on the VFD.</li><li>The VFD program uses either <strong>max-freq-read</strong> or <strong>max-freq-fixed</strong> to get the VFD maximum frequency.</li><li>Make sure the VFD output frequency is correct for your spindle motor.</li></ul><h3 id="spindle-does-not-turn-a-low-speeds">Spindle does not turn a low speeds</h3><p>Many VFDs will not turn or have very weak torque below a certain speed.</p><h2 id="creating-a-custom-vfd-program">Creating a Custom VFD Program</h2><p>If there are no preexisting configurations for your VFD but you have the VFD's manual or datasheet, it's time to create a custom VFD control program.  For testing a new VFD program, the VFD must be powered on but you should not connect the spindle until the program appears to be correct.  Incorrect programming could permanently damage your VFD or spindle. Read the VFD manual carefully!</p><!--kg-card-begin: image--><figure class="kg-card kg-image-card kg-card-hascaption"><img src="https://buildbotics.com/content/images/2019/09/buildbotics_edit_custom_vfd_configuration.jpg" class="kg-image" alt="How to use a VFD spindle driver"><figcaption>Editing a custom VFD configuration.</figcaption></figure><!--kg-card-end: image--><p>On the TOOL     configuration page set <strong>tool-type to</strong> "Custom Modbus VFD". Then scroll down and begin adding VFD commands.  To add a new VFD command:</p><ul><li>Select the command type using the drop down menu.</li><li>Set the address specified in the VFD's manual.</li><li>For write operations, set the value according the the manual.</li></ul><h3 id="modbus-addresses">Modbus Addresses</h3><p>The manual may show the addresses or values in hexadecimal so be sure to <a href="https://www.binaryhexconverter.com/hex-to-decimal-converter">convert to decimal</a>.</p><p>Sometimes the Modbus addresses appear in two parts.  For example: <strong>P01.05</strong>. Usually, this corresponds to a high and low byte.  In this case the address in decimal is computed as:</p><!--kg-card-begin: html--><pre>address = high_byte x 256 + low_byte</pre><!--kg-card-end: html--><p>So for <strong>P01.05</strong> we have:</p><!--kg-card-begin: html--><pre>1 x 256 + 5 = 261</pre><!--kg-card-end: html--><h3 id="modbus-control-flow">Modbus Control Flow</h3><!--kg-card-begin: image--><figure class="kg-card kg-image-card"><img src="https://buildbotics.com/content/images/2019/09/buildbotics_modbus_vfd_state_transitions-1.png" class="kg-image" alt="How to use a VFD spindle driver"></figure><!--kg-card-end: image--><p>Modbus commands are executed according to the above state diagram.  Repeated commands are executed in the order they appear. Click the green "Save" button for the commands to take affect.</p><p>Monitor the Modbus <strong>status</strong> and Active Modbus Configuration failures to see how the program progresses.  If you see failures counting up on a command that means it is failing.  The Modbus control flow is restarted after any failure.  If the very first command fails it may indicate that the communication settings don't match the VFD or the RS485 connection is wired incorrectly.</p><h3 id="modbus-commands">Modbus Commands</h3><p>The following table defines all of the Modbus commands used to create VFD configurations with the Buildbotics controller:</p><!--kg-card-begin: markdown--><table>
<thead>
<tr>
<th>Name</th>
<th>Type</th>
</tr>
</thead>
<tbody>
<tr>
<td>connect-write</td>
<td>write</td>
</tr>
<tr>
<td>max-freq-read</td>
<td>read</td>
</tr>
<tr>
<td>max-freq-fixed</td>
<td>constant</td>
</tr>
<tr>
<td>max-freq-read</td>
<td>read</td>
</tr>
<tr>
<td>freq-set</td>
<td>write</td>
</tr>
<tr>
<td>freq-signed-set</td>
<td>write</td>
</tr>
<tr>
<td>stop-write</td>
<td>write</td>
</tr>
<tr>
<td>forward-write</td>
<td>write</td>
</tr>
<tr>
<td>reverse-write</td>
<td>write</td>
</tr>
<tr>
<td>freq-read</td>
<td>read</td>
</tr>
<tr>
<td>freq-signed-read</td>
<td>read</td>
</tr>
<tr>
<td>freq-actech-read</td>
<td>read</td>
</tr>
<tr>
<td>status-read</td>
<td>read</td>
</tr>
<tr>
<td>disconnect-write</td>
<td>write</td>
</tr>
</tbody>
</table>
<!--kg-card-end: markdown--><p><em>Write</em> commands write their value to the specified address.  <em>Read</em> commands read from the specified address and do not require a value.  <em>Constant</em> commands do not require an address but do require a value.</p><h4 id="connect-write">connect-write</h4><p>These commands are executed once whenever the Buildbotics controller connects to the VFD.  <strong>connect-write</strong> commands are used to perform any necessary initialization.  You can enter more than one <strong>connect-write</strong> command or none at all.  They will be executed in order.</p><h4 id="max-freq-read-max-freq-fixed">max-freq-read &amp; max-freq-fixed</h4><p>Get the maximum frequency used by the VFD. Rather than report speed, VFDs usually report the current frequency.  The Buildbotics controller needs the maximum frequency to calculate the speed.</p><p><strong>max-freq-read</strong> reads the maximum frequency from a register in the VFD as an unsigned 16-bit integer.  <strong>max-freq-fixed</strong> does not actually query the VFD but sets a fixed value for the maximum frequency. It must match the value programmed in the VFD.</p><h4 id="freq-set-freq-signed-set">freq-set &amp; freq-signed-set</h4><p>Set the VFD's target frequency and indirectly the spindle speed. Use <strong>freq-set</strong> for VFDs that used an unsigned frequency and a separate direction setting. <strong>freq-signed-set</strong> is for VFDs which equate negative frequencies with reverse spin.</p><h4 id="stop-write-forward-write-reverse-write">stop-write, forward-write &amp; reverse-write</h4><p>Stop the spindle or command it to spin forward or in reverse. These commands are not always required. Some VFDs use a frequency of zero for stop, positive frequency for forward and negative for reverse.</p><h4 id="freq-read-freq-signed-read-freq-actech-read">freq-read, freq-signed-read &amp; freq-actech-read</h4><p>While the VFD is running the Buildbotics controller will repeatedly read the VFD's output frequency to determine the actual spindle speed. Most VFDs use <strong>freq-read</strong> to read an unsigned 16-bit integer value, a few use <strong>freq-signed-read</strong> to read a signed 16-bit integer and ACTech VFDs use <strong>freq-actech-read</strong> to do a special multi-read.</p><p>In order to compute the spindle's actual speed, <strong>max-rpm</strong> must be set correctly and either <strong>max-freq-read</strong> or <strong>max-freq-fixed</strong> must be used to get or set the maximum frequency.  Spindle speed is calculated as:</p><!--kg-card-begin: html--><pre>speed = frequency / max-frequency * max-rpm</pre><!--kg-card-end: html--><h4 id="status-read">status-read</h4><p>Some VFDs require regular communication to keep the connection from timing out and the VFD from automatically turning itself off.  The <strong>status-read</strong> command can be used as a heartbeat signal.  The returned value is recorded and reported on the TOOL page and in the "indicators" tab on the CONTROL page but is otherwise unused.</p><h4 id="disconnect-write">disconnect-write</h4><p>It is not usually necessary but if there are any commands that need to be run before the VFD is disabled they can be entered as <strong>disconnect-write</strong> commands.</p><h3 id="sharing-a-new-custom-vfd-program">Sharing A New Custom VFD Program</h3><p>If you have successfully created a new VFD program or need help with one you're working on, <a href="https://buildbotics.com/contact">email us</a> your controller configuration file using the following procedure:</p><ul><li>Click the "Save" button in the Buildbotics controller's Web interface.</li><li>On the ADMIN page click "Backup" under the "Configuration" heading.</li><li>Download the configuration file to your computer.</li><li>Attach the configuration file to an <a href="https://buildbotics.com/contact">email</a>.</li></ul>]]></content:encoded></item><item><title><![CDATA[How to Wire Stepper Motors]]></title><description><![CDATA[How to wire stepper motors.]]></description><link>https://buildbotics.com/wiring-stepper-motors/</link><guid isPermaLink="false">5d6ed297e7a8d12af0735aa6</guid><category><![CDATA[howto]]></category><category><![CDATA[stepper motors]]></category><category><![CDATA[wiring]]></category><dc:creator><![CDATA[Doug Coffland]]></dc:creator><pubDate>Tue, 03 Sep 2019 21:35:15 GMT</pubDate><media:content url="https://buildbotics.com/content/images/2019/09/stepper-motor-connection-diagram-4-wire-bipolar.png" medium="image"/><content:encoded><![CDATA[<img src="https://buildbotics.com/content/images/2019/09/stepper-motor-connection-diagram-4-wire-bipolar.png" alt="How to Wire Stepper Motors"><p>The Buildbotics CNC Controller provides four bipolar stepper motor drivers. It cannot drive unipolar stepper motors. Fortunately, most stepper motors can be wired up as bipolar motors.</p><p>Connecting a stepper motor to a Buildbotics CNC Controller requires properly connecting the four wires from the driver to the right wires on the motor. Unfortunately, stepper motors come in a variety of configurations and it is not always immediately obvious how to hook them up. There are several characteristics that make stepper motors different from one another. One big difference is the number of wires emanating from the motor. It is not uncommon to encounter motors with 4, 5, 6, or 8 wires coming out of the motor. This article discusses each of those configurations.</p><p>The Buildbotics CNC Controller provides four motor driver outputs through the back panel on ports labeled X, Y, Z, and A. All four of these ports are wired the same and they look like this:</p><!--kg-card-begin: image--><figure class="kg-card kg-image-card"><img src="https://buildbotics.com/content/images/2019/10/motor_pin_out-1.png" class="kg-image" alt="How to Wire Stepper Motors"></figure><!--kg-card-end: image--><p>Each output has four pins. The upper left pin is B+, the lower left is B-, the upper right is A-, and the lower right is A+. B- and B+ must drive one of the motor coils and A- and A+ must drive the other motor coil.</p><p>Buildbotics provides pre-made cables that connect to the driver outputs on one end. These cables are color coded such that the A+ wire is red, the A- wire is black, the B+ wire is yellow, and the B- wire is purple.</p><h2 id="connecting-4-wire-motors">Connecting 4-wire motors</h2><p>Connecting 4-wire stepper motors requires connecting A+ and A- to one of the motor coils and B+ and B- to the other motor coil.</p><!--kg-card-begin: image--><figure class="kg-card kg-image-card"><img src="https://buildbotics.com/content/images/2019/09/4wireMotor.png" class="kg-image" alt="How to Wire Stepper Motors"></figure><!--kg-card-end: image--><p>The trick is figuring out which wires make up the coil pairs. Here’s three ways to figure this out:</p><ol><li>Find the documentation for the motor. Assuming you don’t already have it, read the model number off of the motor and then search for it on the Internet. With a little effort, it is usually possible to get a datasheet for the motor. The datasheet will usually specify the wires by A+, A-, B+, and B-, or at least show which wires by color attach to which coils.</li><li>If you can’t find the datasheet, but have an ohmmeter, measure the resistance between any two of the motor wires. If you measure a near short, then that pair makes up one coil, and the other two wires make up the other coil. If it is an open, then measure between the first wire and another wire and then to the fourth wire until you find a near short. Notice that I say near short because the coil is a long thin wire and has some resistance. Once the pairs are identified, then arbitrarily assign one pair as “A” and  the other as “B” and arbitrarily assign one wire as “+” and the other as  “-” within each pair. Then connect the wires as shown. There is a 50% chance that the motor will turn backwards when connecting this way. If it does turn the wrong way simply reverse one (not both) of the pairs and the motor will turn the other direction.</li><li>If you don’t have an ohmmeter, most people can identify the pairs by feel. Stepper motor shafts turn fairly easily when the motor coils are open, but are more difficult to turn when a coil is shorted. First, leave all four motor coils open and turn the motor shaft to get a feel for how hard it is to turn. Then twist any two wires together. If the motor is significantly harder to turn, then you have shorted one of the coils and identified a pair. If not, disconnect the two wires from each other and connect a third wire to the first wire. If the motor doesn’t get harder to turn, disconnect the third wire from the first wire and connect the fourth wire. One of the combinations should be harder to turn and that is one coil and the two wires make up the other coil. Once the pairs are identified, then arbitrarily assign one pair as “A” and the other as “B” and arbitrarily assign one wire as “+” and the other as “-” within each pair. Then connect the wires as shown. There is a 50% chance that the motor will turn backwards when connecting this way. If it does turn the wrong way simply reverse one (not both) of the pairs and the motor will turn the other direction.</li></ol><h2 id="connecting-5-wire-motors">Connecting 5-wire motors</h2><p>5-Wire  motors are strictly unipolar motors and cannot be wired as bipolar motors. As such, they are not compatible with the Buildbotics CNC Controller.</p><h2 id="connecting-6-wire-motors">Connecting 6-wire motors</h2><p>6-wire motors can be configured as either unipolar or bipolar series motors. The Buildbotics CNC Controller does not support unipolar motors. The bipolar series connections are shown here.</p><!--kg-card-begin: image--><figure class="kg-card kg-image-card"><img src="https://buildbotics.com/content/images/2019/09/6wire.png" class="kg-image" alt="How to Wire Stepper Motors"></figure><!--kg-card-end: image--><p>6-wire motors have two center-tapped coils and expose the ends of the coils and the center tapped conductor of the coil. That’s three wires for each of the two coils. The center taps are not connected and the coil ends are connected as shown. The trick is figuring out which wires belong to each coil and which of those wires are the center conductor. Here are two methods:</p><ol><li>Find the documentation for the motor. Assuming you don’t already have it, read the model number off of the motor and then search for it on the Internet. You may have to call the vendor. With a little effort, it is usually possible to get a datasheet for the motor. The datasheet will usually specify the wires by A+, A-, B+, and B-, or at least show which wires by color attach to which coils.</li><li>Use an ohmmeter to identify the individual coils. Any wires that appear to be connected through a few ohms will be part of one coil. Wires that appear to be open are part of the different coils. Arbitrarily choose one of the coils as “A”  and the other as “B”. Once the coils have been identified, measure the resistance between each of the three wires on that coil. The resistance between the two coil ends will appear to be about twice the resistance between the either coil end and the coil center tap. When the coil ends have been identified, arbitrarily choose one of the ends to be “+” and the other to be “-” for each coil. Then connect the wires as shown. There is a 50% chance that the motor will turn backwards when connecting this way. If it does turn the wrong way simply reverse one (not both) of the pairs and the motor will turn the other direction.</li></ol><h2 id="connecting-8-wire-motors">Connecting 8-wire motors</h2><p>Eight  wire motors can be configured as unipolar, bipolar series, or bipolar parallel motors. The Buildbotics CNC Controller does not support unipolar connections. Before configuring an 8 wire motor, you must first decide whether to configure the motor as a bipolar series or a bipolar parallel motor. Bipolar parallel connected motors will generally provide higher top speed, but will require twice as much current as a series connected motor. A series configuration should be used if the parallel configuration current exceeds the output capability of the driver. This is especially true for larger motors. In the case of the Buildbotics CNC Controller the maximum current is 6 amps for any individual motor port.</p><p>The following diagram shows the connections to be made for an 8-wire series connected bipolar stepper motor.</p><!--kg-card-begin: image--><figure class="kg-card kg-image-card"><img src="https://buildbotics.com/content/images/2019/09/8wireSeries.png" class="kg-image" alt="How to Wire Stepper Motors"></figure><!--kg-card-end: image--><p>The next diagram shows the connections for an 8-wire parallel connected bipolar stepper motor.</p><!--kg-card-begin: image--><figure class="kg-card kg-image-card"><img src="https://buildbotics.com/content/images/2019/09/8wireParallel.png" class="kg-image" alt="How to Wire Stepper Motors"></figure><!--kg-card-end: image--><p>It is not realistic to sort out all of the possible combinations of connections with an ohmmeter or by feel. You need the datasheet for the motor to hook it up. Assuming you don’t already have it, read the model number off of the motor and then search for it on the Internet. You may have to contact the vendor to get the motor datasheet. The datasheet will usually specify the wires by A1+, A1-, A2+, A2-, B1+, B1-,  B2+, and B2-, or something like that. Given that information, simply wire the motors as shown in the diagrams above.</p>]]></content:encoded></item><item><title><![CDATA[Connecting a PWM Spindle]]></title><description><![CDATA[How to connect a PWM spindle to the Buildbotics CNC controller. ]]></description><link>https://buildbotics.com/connecting-a-pwm-spindle-to-the-buildbotics-controller/</link><guid isPermaLink="false">5d6ed11be7a8d12af0735a99</guid><category><![CDATA[spindle]]></category><category><![CDATA[cnc]]></category><category><![CDATA[howto]]></category><category><![CDATA[pwm]]></category><dc:creator><![CDATA[Doug Coffland]]></dc:creator><pubDate>Tue, 03 Sep 2019 20:46:47 GMT</pubDate><media:content url="https://buildbotics.com/content/images/2019/09/pwm-spindle.png" medium="image"/><content:encoded><![CDATA[<!--kg-card-begin: image--><figure class="kg-card kg-image-card"><img src="https://buildbotics.com/content/images/2019/09/pwmwiring.png" class="kg-image" alt="Connecting a PWM Spindle"></figure><!--kg-card-end: image--><ol><li>Connect Pin 17 (spin pwm) the DB25 Breakout Board to the PWM+ input on the Spindle Controller.</li><li>Connect GND on the DB25 Breakout Board to PWM- on the Spindle Controller.</li><li>Move the jumper on the Spindle Controller to the "J21" position.</li><li>Connect the red wire from the Spindle to M+Load terminal on the Spindle Controller.</li><li>Connect the black wire on the Spindle to the M-Load terminal on the Spindle Controller.</li><li>Connect a V- terminal on the 48VDC power supply to the Power-In side of the AC/DC connector on the Spindle Controller.</li><li>Connect a V+ terminal on the 48VDC power supply to the positive side of the AC/DC connector on the Spindle Controller.</li><li>Connect the DB25 Breakout Board to the back of the Buildbotics Controller.</li><li>Connect power to the 48VDC power supply.</li><li>Connect the 24-48VDC power supply to the Buildbotics Controller and turn it on.</li></ol><!--kg-card-begin: image--><figure class="kg-card kg-image-card"><img src="https://buildbotics.com/content/images/2019/09/pwmspindle.png" class="kg-image" alt="Connecting a PWM Spindle"></figure><!--kg-card-end: image--><img src="https://buildbotics.com/content/images/2019/09/pwm-spindle.png" alt="Connecting a PWM Spindle"><p>After the Buildbotics Controller boots, navigate to the "Tool Configuration" page and set the following parameters.</p><ol><li>Set 'tool-type' to 'PWM Spindle'.</li><li>Leave 'tool-reversed' unchecked. (If the spindle turns backwards, either check this field or reverse the wires between the Spindle and the Spindle Controller.</li><li>Set 'max-spin' to 12000 RPM. This value varies with the type of spindle and controller, but the common spindle and controller shown should be set to 12000.</li><li>Set 'min-spin' to 0.</li><li>Set 'tool-enable-mode' to 'lo-hi'.</li><li>Set 'tool-direction-mode' to 'disabled'. The Spindle Controller shown does not provide reverse operation. If your Spindle and Spindle Controller do support reverse operation, connect the wire to pin 16 and set this field to the value needed for the spindle controller.</li><li>Leave 'pwm-inverted' unchecked.</li><li>Set 'pwm-min-duty' to 1</li><li>Set 'pwm-max-duty' to 100</li><li>Set 'pwm-freq' to 1000</li><li>Leave 'rapid-auto-off' and 'dynamic-power' unchecked. These fields are mostly used for laser engravers.</li></ol>]]></content:encoded></item></channel></rss>