× Forum Header

plotter pen up/down control

More
10 Apr 2010 14:35 #2565 by smiki
imagine a simple pen plotter. X and Y axes and a solenoid to drive the pen up/down.

probably i'm missing something really obvious but I can't figure out how to control the pen. Can I use the Z axis signals to somehow fake the pen[up/down] signal ??
What configuration should I choose for this situation (pen plotter)
I've searched the forum and google without a result. But then again this is the most simple "cnc" setup to use, so it has to be something obvious i'm missing.

Can anyone help me out?
thank you

Please Log in or Create an account to join the conversation.

More
11 Apr 2010 11:20 #2574 by Rick G
Hello,

You might try startting with a xyz. Then edit the z axis. The direction pin should go high or low based on the z direction, up or down. Use the z axis direction pin connected to your break out board to activate a relay to control the solenoid. You could also usa hal to control another pin that activates the relay when z is a negative number. Depending on how you are writing the g code if there can be a spindle on/of command when the pen is raised or lowered you could use the spindle signal and realy to turn the solenoid on and off.

Rick G

Please Log in or Create an account to join the conversation.

More
19 Apr 2010 23:18 - 19 Apr 2010 23:53 #2631 by Metallho
Hi,

I am trying also to use EMC2 on my plotter/cutter project.

Is possible to configure tangential moves in any axis (the 4th or A axis) to control a stepper with a Knife on the end?

if it is so, how can I do that?

Any advice will be appreciate


Thanks
Last edit: 19 Apr 2010 23:53 by BigJohnT. Reason: remove bad character

Please Log in or Create an account to join the conversation.

More
21 Apr 2010 10:24 #2644 by Rick G
There is some current discussion on the mail list about this. From Dave....

".......Going back to your original question when you quoted Jon Elson... Jon was referring to a filter program. The term "filter program" in EMC2 jargon is a program that creates or processes G code. The wiki references a couple of examples:

wiki.linuxcnc.org/cgi-bin/emcinfo.pl

Look for:

* Simple EMC G-Code Generators
<wiki.linuxcnc.org/cgi-bin/emcinfo.pl?Sim...MC_G-Code_Generators>
- Facing, Pockets, Drill Patterns Etc.
* GWiz - A Gcode Wizard Framework
<wiki.linuxcnc.org/cgi-bin/emcinfo.pl?GWi...ode_Wizard_Framework>


On that page.

The simple G code generators output code based on a menu driven input, sometimes directly into the EMC2 Axis interface.

GWiz is a fairly complex concept that was done by Ken Lerman to allow non programmers to create a G code creation "filter" program without programming. Pretty clever IMO.

If you know Python (or are willing to learn it) these examples should give you a start on how to program a filter program to process X,Y,Z Gcode into XYZAB Gcode that you can use with a tilting head.

This setup uses a filter program also that you might be able to use for example code ...
objects.reprap.org/wiki/EMCRepStrap#GCode_Decoding


Dave"

Please Log in or Create an account to join the conversation.

More
22 Apr 2010 10:39 #2651 by Rick G
Of course if you intend to cut thin plastic film such as in sign making you can purchase a drag knife bit that will automatically swivel to the direction of travel.

Rick G

Please Log in or Create an account to join the conversation.

More
16 Aug 2010 22:35 #3779 by lanthan
I built a plotter for learning purposes some time ago. The plotter head was certainly the most interesting part.
Here's some Arduino code to drive the plotter pen up an down. It reacts to the direction and enable signals sent by EMC, and also featiured an pen up / pen down switch directly on the head.
This worked very well.
/* a sketch to use a an arduino or derivative and a L293D as a stepper motor controller
with an additional homing button (pen up/pen down for example)
Uses optionally John Zandbergen's enhancement to the stepper library to do half-stepping
http://code.google.com/p/arduino/issues/detail?id=139
the arduino responds to standard STEP, DIR and ENABLE signals
we have only an upper limit stop sensor, the lower limit is done in software
*/

#define IN_DIR_PIN 12
#define IN_STEP_PIN 13
#define IN_ENABLE_PIN 8
#define STEPPER_ENABLE_PIN 7
#define STEPPER_PIN_A1 11 
#define STEPPER_PIN_A2 10
#define STEPPER_PIN_B1 6
#define STEPPER_PIN_B2 5
#define IN_Z_LIM_PROX_PIN 3
#define OUT_Z_LIM_PROX_PIN 14
#define OUT_Z_LIM_DIST_PIN 1
#define IN_HOME_SWITCH_PIN 4
#define UP 1
#define DOWN -1
#define ZLENGTH 54
#define USE_HALF_STEP 0
#define ENABLED 1
#define DISABLED 0

// change this to your motor's number of steps per turn
#define STEPS 48
 
#include <HalfStepper.h>

int zButtonState = 0 ;  // current z button state
int zLastButtonState = 0 ; // previous state of the z button
int zButtonPushCounter = 1 ; // push counter for the z button
int zProxLimState = LOW ; // z prox limit sensor state  
int zpos = 0 ; // keeps the current z position. 0 is all the way up.
int ztarget = 0 ; // target position
int direction = 0 ;
int enableState = DISABLED ;
int doStep = 0 ;

// create an instance of the stepper class, specifying
// the number of steps of the motor and the pins it's
// attached to
Stepper stepper(STEPS, STEPPER_PIN_A1, STEPPER_PIN_A2, STEPPER_PIN_B1, STEPPER_PIN_B2, USE_HALF_STEP);

void setup()
{
 pinMode(IN_DIR_PIN, INPUT) ;  
 pinMode(IN_STEP_PIN, INPUT) ;
 pinMode(IN_ENABLE_PIN, INPUT) ;
 pinMode(IN_HOME_SWITCH_PIN, INPUT);
 pinMode(IN_Z_LIM_PROX_PIN, INPUT);
 pinMode(OUT_Z_LIM_PROX_PIN, OUTPUT);
 pinMode(STEPPER_ENABLE_PIN, OUTPUT) ;   
 pinMode(STEPPER_PIN_A1, OUTPUT) ;
 pinMode(STEPPER_PIN_A2, OUTPUT) ;
 pinMode(STEPPER_PIN_B1, OUTPUT) ; 
 pinMode(STEPPER_PIN_B2, OUTPUT) ;  
    
  // set the speed of the motor to  RPMs. Use something adapted to your particular stepper
  stepper.setSpeed(200);
}

void readButton() {
  zButtonState = digitalRead(IN_HOME_SWITCH_PIN);  
}

void homePen() {
   if (zButtonState != zLastButtonState) {
   if (zButtonState == LOW) {
    zButtonPushCounter++ ;
  if (zButtonPushCounter % 2 == 0) {
      homeUp();
  } else {
      homeDown();
      } 
     }
    } 
 zLastButtonState = zButtonState;
}

void homeUp() {
    digitalWrite(STEPPER_ENABLE_PIN, HIGH);         // enable the L293D output
  while (true) {
  zProxLimState = digitalRead(IN_Z_LIM_PROX_PIN) ;  // check if we have activated the upper limit sensor
  
  if (zProxLimState == HIGH) {
    zpos = 0 ;                                      // we are at the top. Let this position be 0
    digitalWrite(OUT_Z_LIM_PROX_PIN, HIGH);         // Notify the hierarchy we reached the limit
    break ;     // get outta here
   }
    stepper.step(UP) ;                  
  }
  digitalWrite(STEPPER_ENABLE_PIN, LOW); // disable the L293D output
}

void homeDown() {
  digitalWrite(STEPPER_ENABLE_PIN, HIGH); // enable the L293D output
  ztarget = ZLENGTH - zpos ;
  for(int i = 0; i <= ztarget; i++) {
     stepper.step(DOWN) ;
     zpos = zpos + 1 ; // update position counter
     if (zpos > 0) {
             digitalWrite(OUT_Z_LIM_PROX_PIN, LOW);  // 
     }
     if (zpos == ZLENGTH) {
            digitalWrite(OUT_Z_LIM_DIST_PIN, HIGH) ;         // Advertise we have reached the lower limit
     } else if (zpos < 100) {
            digitalWrite(OUT_Z_LIM_DIST_PIN, LOW) ;          // all OK
     }
  }
 digitalWrite(STEPPER_ENABLE_PIN, LOW); // disable the l293D output
}

void listenCommands(){
direction = digitalRead(IN_DIR_PIN);
enableState = digitalRead(IN_ENABLE_PIN);
doStep = digitalRead(IN_STEP_PIN);
}

void doStuff(){
  if (enableState == ENABLED) {
         if (direction == 1) {
              homeUp();
         }
         if (direction == 0) {
               homeDown();
         }
  }
   
  if (enableState == DISABLED) {
       digitalWrite(STEPPER_ENABLE_PIN, LOW); // disable the L293D output
  }
}

void loop()
{
  readButton() ;      // check manual button
  homePen() ;         // do manual pen up / pen down
  listenCommands();   // check for signals
  doStuff();          // take the actual actions
}

Some more details on the construction at my place:
korovievskitchen.blogspot.com/2010/08/co...ino-plotterhead.html

Please Log in or Create an account to join the conversation.

More
17 Aug 2010 08:29 #3785 by andypugh
Metallho wrote:

Is possible to configure tangential moves in any axis (the 4th or A axis) to control a stepper with a Knife on the end?


You could do this in a kinematics file, although a drag-knife would be easier.

I have helped someone do something vaguely similar for a waterjet cutter. The kinematics file determines the direction of the tangent from the x and y changes since the last call to the kinematics module. His version has some "interesting" problems with the fact that head rotations need to be compensated with axis rotations.

Custom kinematics is not for the faint-hearted, there is no option to writing a module in C-code and compiling it, though you can install the module with "comp" without needing to recompile the whole of EMC2 from source.

Please Log in or Create an account to join the conversation.

Time to create page: 0.097 seconds
Powered by Kunena Forum