CNC plotter, pen displacement and voltage drop

Hey everyone. I’ve been trying to make a CNC plotter for a while. Encountered tons of problems along the way. Some of them were just small mistakes and some made me scratch my head for quite a long time . Now I’m stuck with one of them.

The plotter is made out of 2 steppers which I’ve got from scraping old CD drivers. One of the axis(From now on it will be called “Y” axis) has a metal sheet attached and the other one - just a simple pen(“X” axis). Each stepper is controlled by an L298N motor driver. Instead of using a battery as an energy supplier I’m using an Ac adapter which outputs 12Volts and 0.4 Amperes. The current is a little too high for a direct connection to the L298N. It’s reduced to 6.1V via “DC to DC step down”, after that it flows to the motor drivers. The core of the pen is usually on the ground (the spring is pushing it from the top), to lift it a servo motor turns a certain amount of degrees, pulls a string which squezzes the spring and the pen core goes up.

Now here is the problem:

  1. At some points on the metal sheet (paper on top of it) the pressure from pen core is so high that the Y axis cannot move. At the other points the pressure is too low and the pen does not write at all. I did tried equalizing the heights of all 4 long-threadeds (long, metal, bolt-like pieces) to make the “table” as flat as possible - did not worked out, since a small height difference of about 0.1 milimeter can be a cause for the problem to appear. In addition, adjusting the value of degrees the servo must turn to lift or lower the pen, is not a soliution I’m looking for, since that doesn’t give proper results and if it did - It would need a recalibration everytime before using the thing.

A guy on reddit proposed a soliution for this - increase the input voltage. Sounds good, however then I stumbled upon another obstacle.

  1. After first command is sent(stepper moved) the voltage drops to 4.5V, no matter what was the starting point. In this case it’s dropping from 6.1 to 4.5, but if the starting voltage value of the output from “Step Down” would have been, let’s say 10V, it would still drop to 4.5V

CNC photos and a rough connection diagram:







Code:

#include <Servo.h>
#include <Stepper.h>

byte number;
int steps=0;
bool gotTheNumber=false;
bool xStep=false;
bool yStep=false;

  Stepper xStepper(stepsPerRevolution, 8, 9, 10, 11);
  Stepper yStepper(stepsPerRevolution, 4, 5, 6, 7);
  Servo myServo;


void setup(){
  xStepper.setSpeed(30);
  yStepper.setSpeed(30);
  Serial.begin(9600);
  Serial.println("Started");
  myServo.attach(12);
  myServo.write(70);
}

void loop(){
  if(Serial.available()){
    Serial.read();
    
  }
  while(Serial.available()==0){/*do nothing*/}
    while(Serial.available()>0){
     number=Serial.read();
     if(number=='X'){
      xStep=true;
      continue;
     }
     if(number=='Y'){
      yStep=true;
      continue;
     }
     if(number>='0'&&number<='9'){
      steps = steps*10 + (number-'0');
      delay(5);
      continue;
     }
     if(number=='N'){
      steps=steps*-1;
      gotTheNumber=true;
      continue;
      
     }
     if(number=='P'){
      gotTheNumber=true;
      continue;

     }
     if(number=='U'){
      Serial.println("Pen Up!");
      myServo.write(70);
      continue;

     }
     if(number=='D'){
      Serial.println("Pen Down!");
      myServo.write(34);
      continue;

     }
     else{
      Serial.println("\nInvalid Entry! ");
     }  
  }
if(gotTheNumber){  
 if(xStep){
  Serial.print("\nxStep: ");
  Serial.println(steps);

xStepper.step(steps);
xStep=false;
gotTheNumber=false;
steps=0;
}
 if(yStep){
  Serial.print("\nyStep: ");
  Serial.println(steps);
yStepper.step(steps);
yStep=false;
gotTheNumber=false;
steps=0;
 }
}
}

Some examples of how I send commands: “X57N”,“D”,“Y13P”

Please ask if more information is needed. Any help would be appreciated.

Pradedantysis:
I'm using an Ac adapter which outputs 12Volts and 0.4 Amperes. The current is a little too high for a direct connection to the L298N. It's reduced to 6.1V via "DC to DC step down", after that it flows to the motor drivers.

This is a bit mixed up. There is no such thing as a power supply with a too-high current. The devices using the electricity will just take what they need. Perhaps you meant to say that the voltage was too high and that is why the step-down is used.

Without technical details of your stepper motors and your step-down module it is impossible to know whether the module can supply enough current for the motors. You should also be aware that the L298N is old technology and causes a significant voltage loss between its input and its output. You could try increasing the voltage above 6v but I am reluctant to recommend that in case your motors get damaged. The L298 can work with voltages up to 46v so it won't be damaged.

The L298 is generally a poor choice for driving stepper motors, A specialised stepper motor driver such as an A4988 has the ability to limit the current to protect the motor.

However I suspect your pen-pressure problem could solved in a different way. If the pen is able to slide up and down in the holder (just a few mm of movement) and if it pressed down on the paper with a suitable spring, or even by a small weight it should be able to deal with the imperfect alignment of the axes and the table surface.

...R

Stepper Motor Basics
Simple Stepper Code

I'd second that - the weight of the pen may be enough, you just need a lifting mechanism with
enough travel to handle the variation in pen height.

Something like a polythene or teflon tube with low friction might work. A hinged mechanism would be
less likely to jam, but larger and more complex. I think old pen-plotters used to pivot the pens on a rail
with an individual solenoid per pen - you might find inspiration looking at how some of these machines
worked.

The problem with the spring method is that there is no Z axis so there would be constant pressure between pen moves.

The servo is the better option and a lot of these mini plotters use one for pen up / pen down.

Most also employ a more robust control and driver scheme (as robin mentioned)

Myself i would recommend ditching the current drivers and going for a CNC shield approach with a UNO as the base or even one of the super cheap NANO adaptor boards.

That would do a few things to help you.

  1. Give you a starting point for a better CNC approach.
  2. Introduce you to GRBL.
  3. Allow you to customise your approach.
  4. simplify the wiring.

ballscrewbob:
The problem with the spring method is that there is no Z axis so there would be constant pressure between pen moves.

Sorry for not being clear. My intention is that the sliding pen be used in conjunction with the servo. The ability of the pen to slide up and down a few mm allows the pen to follow the page. The servo can then lift it clear when needed by lifting it more than the amount of free travel available to the pen.

...R

Robin2:
Sorry for not being clear. My intention is that the sliding pen be used in conjunction with the servo. The ability of the pen to slide up and down a few mm allows the pen to follow the page. The servo can then lift it clear when needed by lifting it more than the amount of free travel available to the pen.

...R

Yes that is a common approach too Robin and quite successful.