Skip to content

Field notes

One saturday evening, I sat with the solenoid coiler, and tried to make good solenoids with it. These are the unedited notes I made during that session.

The end result for all of this was mostly that I managed to calibrate my code so that the machine would always start and stop at the correct position for the wire to be directed to the proper position.

Problems still persisted with the slipping wire from the wire tightener, and the distance between the y-axis moving arm and the spinning coiler. Smaller distance between them could solve the aiming problem.

At later points, I also noticed that the tightener was mostly optimized around the heavy spool of copper wire, and once I had used enough of it, it got lighter, and started spinning more freely. This meant that the tightener could not keep up, and the wire would always be extremely loose. I tried to fight that by tightening the wire by hand, and by increasing the speed of the coiler.

The notes

Solenoid 1 - white
Coiled one layer at a time. Manually fixed every problem.
Solenoid 2 - black
Coiled 800 loop, ran the whole program at once.
Fixed problematic areas manually, while the machine was running.
Interrupted the run, when there was not enough room in the solenoid core. 
Ended the run after around 600 loops.
Solenoid 3 - white - disassemled afterwards

Ran program fully
Loops reduced to 600
In the code, wire thickess changed  0.48f -> 0.49 (including the float error)
No manual intervention.
Was stopped once, when the wire got tangled in the original spool

the gcode:
G1 Y-25.31 F90
G1 X265.31 Y-0.31 F90
G1 Y0.00 F90
G1 X530.61 Y-24.69 F90
G1 Y-25.31 F90
G1 X795.92 Y-0.31 F90
G1 Y0.00 F90
G1 X1061.22 Y-24.69 F90
G1 Y-25.31 F90
G1 X1326.53 Y-0.31 F90
G1 Y0.00 F90
G1 X1591.84 Y-24.69 F90
G1 Y-25.31 F90
G1 X1857.14 Y-0.31 F90
G1 Y0.00 F90
G1 X2122.45 Y-24.69 F90
Solenoid 4 - white - never finished

Whole program
600 loops
Code changed so that only the first layer takes yPullDistance into account.

Slipped once from the tightener.
Tightener got stuck twice.
After getting stuck another time, coiling was ended.

gcode:
G1 Y-25.31 F90
G1 X265.31 Y-0.31 F90
G1 X530.61 Y-25.00 F90
G1 X795.92 Y-0.31 F90
G1 X1061.22 Y-25.00 F90
G1 X1326.53 Y-0.31 F90
G1 X1591.84 Y-25.00 F90
G1 X1857.14 Y-0.31 F90
G1 X2122.45 Y-25.00 F90
Measurement

Y-axel movement

G1 Y-10 F90 moves 25.17mm
G1 Y-10 F90 moves 25.25mm (repeat)
G1 Y-10 F90 moves 25.30mm (repeat)

Y-10 moves 25.17mm

G1 Y-5 F90 moves 13.07mm

G1 Y-20 F90 moves 50.50mm

Based on the measurements, the tightener moves 2.525mm per unit. More than the previously used 1.6mm.
Code changes

Measure tightener position when at the base of the solenoid.
Measure tightener position when at the top of the solenoid.

Use those measurements in the code.

alt text

Solenoid 5 - white

Ran the code with the changes.
Seemed to work well
The tightener got stuck a couple of times, that caused the wire to loosen itself.

Otherwise good enough.

The tightener needs a redesign.

Final code

// The code expects that the coiler is at the position {0, 0} at the beginning.

using System.Globalization;

class yAxis {
  public const double mmPerUnit = 2.53;
  public const double minRangeInMillis = 0;
  public const double maxRangeInMillis = 200;
  public const double solenoidBasePositionInMillis = 16.9;
}

class xAxis {
  public const double unitsPerRevolution = 3.25;
}

class Core {
  public double length;
  public double diameter;

  public Core(double length, double diameter) {
    this.length = length;
    this.diameter = diameter;
  }
}


public class Coiler {
  public static void Main (string[] args) {

    double wireThickness = 0.49; //0.48;
    double targetLoopCount = 600;
    double coreLength = 40;
    double coreDiameter = 10;

    Core solenoid = new Core(coreLength, coreDiameter);

    //Legend:
    // total - full length of movement
    // leg - one layer of coil spin from one end of the core to another

    double loopsPerLeg = solenoid.length / wireThickness;

    int legCount = (int)Math.Ceiling(targetLoopCount / loopsPerLeg);

    double yLegDistance = solenoid.length * (1.0 / yAxis.mmPerUnit);
    double yPullDistance = wireThickness * (1.0 / yAxis.mmPerUnit);

    double yPosAtBase = -yAxis.solenoidBasePositionInMillis * (1.0 / yAxis.mmPerUnit);
    double yPosAtHat = yPosAtBase - yLegDistance;

    double xDistanceTraveled = 0.0;

    CultureInfo.CurrentCulture = CultureInfo.InvariantCulture;    

    Console.WriteLine("G1 Y{0:0.00} F90", yPosAtBase);
    Console.WriteLine("G1 Y{0:0.00} F90", yPosAtHat);

    Console.WriteLine("G1 Y{0:0.00} F90", yPosAtHat - yPullDistance);

    for (int legIndex = 0; legIndex<legCount; ++legIndex) {

      double xLegDistance = xAxis.unitsPerRevolution * loopsPerLeg;

      Console.WriteLine("G1 X{0:0.00} Y{1:0.00} F90", 
       xDistanceTraveled + xLegDistance,
       legIndex % 2 == 0? yPosAtBase : yPosAtHat);

      xDistanceTraveled += xLegDistance;

    }
  }


  public static double Circumference(double coreDiameter, double wireThickness, double layerIndex) {
    return Math.PI * (coreDiameter + 2*wireThickness*layerIndex);
  }
}