Contents in this wiki are for entertainment purposes only
This is not fiction ∞ this is psience of mind

CNC Torus Carver: Difference between revisions

From Catcliffe Development
Jump to navigation Jump to search
mNo edit summary
mNo edit summary
 
Line 6: Line 6:
|user=<big>'''XenoEngineer'''</big>
|user=<big>'''XenoEngineer'''</big>
|prompt=
|prompt=
<div style="margin-left:200px;">Helloo!  Let's automate a pair of rings, or hoops.  These are passing through each other, at a right angle.  The rings are mechanically mounted on rollers to implement a slew bearing.  Mechanical scaffolding then erects each slew at a right angle to the other.  This is to implment a CNC carver machine.  The right angle rotations pass a material rotating on a plane, while the orthogonal slew plane revolves a CNC spindle motor and V-bit that carves a helix into the material, while both slew bearings revolve as a fixed ratio to each the other slew.
<div style="width:62%; margin:0 auto;">
 
Helloo!  Let's automate a pair of rings, or hoops.  These are passing through each other, at a right angle.  The rings are mechanically mounted on rollers to implement a slew bearing.  Mechanical scaffolding then erects each slew at a right angle to the other.  This is to implment a CNC carver machine.  The right angle rotations pass a material rotating on a plane, while the orthogonal slew plane revolves a CNC spindle motor and V-bit that carves a helix into the material, while both slew bearings revolve as a fixed ratio to each the other slew.
In this scenario, let's design a simple controller to program the helical tangent slope.  BTW: the toroidal spindle path will carve only 1/6th of the torus.  Six parts as 'bagle sliced torus, with each slice in thirds'.  This allows for CNC carving through the hole region which greatly simplifies the mechanical freedoms needed, with the CNC spindle slew only traveling 180 degrees, while the other slew, corresponding to the torus plane, revolves 120 degrees beneath the spindle cutter.
&nbsp;
 
In this scenario, let's design a simple controller to program the helical tangent slope.  BTW: the toroidal spindle path will carve only 1/6th of the torus.  Six parts as 'bagle sliced torus, with each slice in thirds'.  This allows for CNC carving through the hole region which greatly simplifies the mechanical freedoms needed, with the CNC spindle slew only traveling 180 degrees, while the other slew, corresponding to the torus plane, revolves 120 degrees beneath the spindle cutter.
Besides the pitch-ratio, we also will have parallel torus knots carved into our 1/6th torus form.  This will need an indexed starting position, to offset one knot winding groove cut into the form from another.   
&nbsp;
 
Besides the pitch-ratio, we also will have parallel torus knots carved into our 1/6th torus form.  This will need an indexed starting position, to offset one knot winding groove cut into the form from another.   
Have I covered the needed details?
&nbsp;
 
Have I covered the needed details?
On hand is  an ESP8266 w/WiFi.  
&nbsp;
On hand is  an ESP8266 w/WiFi.  
</div><br style="clear:both;"/>
</div><br style="clear:both;"/>


Line 35: Line 36:
===  Hardware Requirements ===  
===  Hardware Requirements ===  


1. ESP8266 microcontroller<br/>
# ESP8266 microcontroller<br/>
2. Two stepper motors (NEMA 17 recommended)<br/>
# Two stepper motors (NEMA 17 recommended)<br/>
3. Two stepper motor drivers (A4988 or DRV8825)<br/>
# Two stepper motor drivers (A4988 or DRV8825)<br/>
4. Power supply (12V-24V depending on motors)<br/>
# Power supply (12V-24V depending on motors)<br/>
5. Limit switches for homing<br/>
# Limit switches for homing<br/>
6. Optional: OLED display for status
# Optional: OLED display for status


=== Controller Design ===  
=== Controller Design ===  

Latest revision as of 16:56, 11 December 2025


XenoEngineer

Helloo!  Let's automate a pair of rings, or hoops.  These are passing through each other, at a right angle.  The rings are mechanically mounted on rollers to implement a slew bearing.  Mechanical scaffolding then erects each slew at a right angle to the other.  This is to implment a CNC carver machine.  The right angle rotations pass a material rotating on a plane, while the orthogonal slew plane revolves a CNC spindle motor and V-bit that carves a helix into the material, while both slew bearings revolve as a fixed ratio to each the other slew.
 
In this scenario, let's design a simple controller to program the helical tangent slope.  BTW: the toroidal spindle path will carve only 1/6th of the torus.  Six parts as 'bagle sliced torus, with each slice in thirds'.  This allows for CNC carving through the hole region which greatly simplifies the mechanical freedoms needed, with the CNC spindle slew only traveling 180 degrees, while the other slew, corresponding to the torus plane, revolves 120 degrees beneath the spindle cutter.
 
Besides the pitch-ratio, we also will have parallel torus knots carved into our 1/6th torus form.  This will need an indexed starting position, to offset one knot winding groove cut into the form from another.  
 
Have I covered the needed details?
 
On hand is  an ESP8266 w/WiFi. 


Z.ai

ESP8266 Controller for Toroidal CNC Carver

I understand you want to build a unique CNC system using two perpendicular slew bearings to carve helical patterns on torus segments. Let me design a controller solution for you.

System Overview

Your system consists of:

  • Two perpendicular rings (slew bearings)
  • Material ring: rotates 120°
  • Spindle ring: rotates 180°
  • Fixed rotation ratio: 2:3 (material:spindle)
  • Carves 1/6th of a torus at a time
  • Creates parallel torus knots with indexed positions

Hardware Requirements

  1. ESP8266 microcontroller
  2. Two stepper motors (NEMA 17 recommended)
  3. Two stepper motor drivers (A4988 or DRV8825)
  4. Power supply (12V-24V depending on motors)
  5. Limit switches for homing
  6. Optional: OLED display for status

Controller Design

ESP8266 Code

#include <ESP8266WiFi.h>
#include <ESP8266WebServer.h>
#include <AccelStepper.h>
#include <ArduinoJson.h>

// WiFi credentials
const char* ssid = "YourSSID";
const char* password = "YourPassword";

// Web server on port 80
ESP8266WebServer server(80);

// Define stepper motors
// Material ring (120° total movement)
AccelStepper materialStepper(AccelStepper::DRIVER, D1, D2);
// Spindle ring (180° total movement)
AccelStepper spindleStepper(AccelStepper::DRIVER, D3, D4);

// System parameters
#define MATERIAL_STEPS_PER_DEGREE 10  // Adjust based on your motor/gearing
#define SPINDLE_STEPS_PER_DEGREE 10   // Adjust based on your motor/gearing
#define MATERIAL_MAX_DEGREES 120
#define SPINDLE_MAX_DEGREES 180

// Helical parameters
float helicalPitch = 1.0;  // Default pitch ratio
int knotCount = 3;         // Number of parallel knots
int currentKnot = 0;       // Current knot being carved
bool isCarving = false;    // Carving status

// Homing switches
#define MATERIAL_HOME_SWITCH D5
#define SPINDLE_HOME_SWITCH D6

void setup() {
  Serial.begin(115200);
  
  // Initialize limit switches
  pinMode(MATERIAL_HOME_SWITCH, INPUT_PULLUP);
  pinMode(SPINDLE_HOME_SWITCH, INPUT_PULLUP);
  
  // Configure steppers
  materialStepper.setMaxSpeed(1000);
  materialStepper.setAcceleration(500);
  spindleStepper.setMaxSpeed(1000);
  spindleStepper.setAcceleration(500);
  
  // Connect to WiFi
  WiFi.begin(ssid, password);
  while (WiFi.status() != WL_CONNECTED) {
    delay(500);
    Serial.print(".");
  }
  Serial.println("");
  Serial.println("WiFi connected");
  
  // Print IP address
  Serial.println(WiFi.localIP());
  
  // Setup web server routes
  server.on("/", handleRoot);
  server.on("/carve", handleCarve);
  server.on("/home", handleHome);
  server.on("/stop", handleStop);
  server.on("/status", handleStatus);
  
  server.begin();
  Serial.println("HTTP server started");
  
  // Home the system on startup
  homeSystem();
}

void loop() {
  server.handleClient();
  
  // Run steppers if carving
  if (isCarving) {
    materialStepper.run();
    spindleStepper.run();
    
    // Check if carving is complete
    if (materialStepper.distanceToGo() == 0 && spindleStepper.distanceToGo() == 0) {
      if (currentKnot < knotCount - 1) {
        // Move to next knot
        currentKnot++;
        startCarving();
      } else {
        // All knots carved
        isCarving = false;
      }
    }
  }
}

void homeSystem() {
  Serial.println("Homing system...");
  
  // Home material axis
  materialStepper.setMaxSpeed(500);
  while (digitalRead(MATERIAL_HOME_SWITCH) == HIGH) {
    materialStepper.moveTo(materialStepper.currentPosition() - 10);
    materialStepper.run();
  }
  materialStepper.setCurrentPosition(0);
  
  // Home spindle axis
  spindleStepper.setMaxSpeed(500);
  while (digitalRead(SPINDLE_HOME_SWITCH) == HIGH) {
    spindleStepper.moveTo(spindleStepper.currentPosition() - 10);
    spindleStepper.run();
  }
  spindleStepper.setCurrentPosition(0);
  
  // Restore normal speed
  materialStepper.setMaxSpeed(1000);
  spindleStepper.setMaxSpeed(1000);
  
  Serial.println("System homed");
}

void startCarving() {
  // Calculate positions based on current knot
  float knotOffset = (float)currentKnot / knotCount;
  
  // Calculate target positions
  long materialTarget = MATERIAL_MAX_DEGREES * MATERIAL_STEPS_PER_DEGREE;
  long spindleTarget = SPINDLE_MAX_DEGREES * SPINDLE_STEPS_PER_DEGREE;
  
  // Apply helical pitch ratio
  spindleTarget = (long)(spindleTarget * helicalPitch);
  
  // Apply knot offset
  materialTarget = (long)(materialTarget * (1.0 + knotOffset * 0.1));  // Small offset for each knot
  
  // Set targets
  materialStepper.moveTo(materialTarget);
  spindleStepper.moveTo(spindleTarget);
  
  isCarving = true;
  Serial.print("Starting knot ");
  Serial.print(currentKnot + 1);
  Serial.print(" of ");
  Serial.println(knotCount);
}

// Web server handlers
void handleRoot() {
  String html = "<html><body>";
  html += "<h1>Toroidal CNC Carver</h1>";
  html += "<form action='/carve' method='post'>";
  html += "Helical Pitch: <input type='number' name='pitch' value='" + String(helicalPitch) + "' step='0.1'><br>";
  html += "Number of Knots: <input type='number' name='knots' value='" + String(knotCount) + "' min='1' max='10'><br>";
  html += "<input type='submit' value='Start Carving'>";
  html += "</form>";
  html += "<form action='/home' method='post'>";
  html += "<input type='submit' value='Home System'>";
  html += "</form>";
  html += "<form action='/stop' method='post'>";
  html += "<input type='submit' value='Stop'>";
  html += "</form>";
  html += "<div id='status'></div>";
  html += "<script>";
  html += "setInterval(function() {";
  html += "  fetch('/status').then(response => response.json()).then(data => {";
  html += "    document.getElementById('status').innerHTML = 'Status: ' + data.status + '<br>Knot: ' + data.knot + '/' + data.totalKnots;";
  html += "  });";
  html += "}, 1000);";
  html += "</script>";
  html += "</body></html>";
  server.send(200, "text/html", html);
}

void handleCarve() {
  if (server.hasArg("pitch")) {
    helicalPitch = server.arg("pitch").toFloat();
  }
  if (server.hasArg("knots")) {
    knotCount = server.arg("knots").toInt();
  }
  
  currentKnot = 0;
  startCarving();
  
  server.sendHeader("Location", "/");
  server.send(302, "text/plain", "");
}

void handleHome() {
  homeSystem();
  server.sendHeader("Location", "/");
  server.send(302, "text/plain", "");
}

void handleStop() {
  isCarving = false;
  materialStepper.stop();
  spindleStepper.stop();
  server.sendHeader("Location", "/");
  server.send(302, "text/plain", "");
}

void handleStatus() {
  String json = "{\"status\":\"";
  json += isCarving ? "Carving" : "Idle";
  json += "\",\"knot\":";
  json += currentKnot + 1;
  json += ",\"totalKnots\":";
  json += knotCount;
  json += "}";
  server.send(200, "application/json", json);
}


Key Features

  1. WiFi Control Interface: Access the controller through a web browser on any device connected to the same network.
  2. Helical Pitch Control: Adjust the pitch ratio to control the slope of the helix carved into the material.
  3. Multiple Knots: Carve parallel torus knots with indexed starting positions.
  4. Homing System: Automatically finds the zero position for both axes using limit switches.
  5. Real-time Status: Monitor the carving progress through the web interface.

Usage Instructions

  1. Connect to the ESP8266's WiFi network (or configure it to connect to your existing network).
  2. Open a web browser and navigate to the ESP8266's IP address.
  3. Set the desired helical pitch and number of knots.
  4. Click "Start Carving" to begin the process.
  5. Use "Home System" to reset the position if needed.
  6. Click "Stop" to halt the carving process.

Customization Options

  1. Motor Configuration: Adjust the `MATERIAL_STEPS_PER_DEGREE` and `SPINDLE_STEPS_PER_DEGREE` constants based on your specific motor and gearing setup.
  2. Speed and Acceleration: Modify the stepper motor speed and acceleration values to optimize for your specific mechanical setup.
  3. Knot Offset Algorithm: The current implementation uses a simple offset for each knot. You may want to develop a more sophisticated algorithm based on your specific requirements.
  4. Additional Features: Consider adding:
  • Emergency stop functionality
  • Spindle speed control
  • Material detection
  • Progress logging
This controller provides a solid foundation for your unique toroidal CNC carving system. You can further customize it based on your specific mechanical requirements and desired functionality.