Mini Pen Plotter

<Hello,
The project is: Making a mini plotter from old CD-ROM stepper motors for the x-axis and y-axis, and a servo motor for the pen lifter.
Control is via an Arduino UNO 3 board with a CNC shield and an A4988 stepper drive.
How can I test this within Processing Foundation?
Regards, SPW48

  1. Use Arduino shield to control devices (example shown below).

  2. Use Processing to control the device using either a desktop computer or a mobile device (phone or tablet).

  3. Processing communicates with Arduino either with USB port or bluetooth if using a mobile device; in case of the latter you would also need a bluetooth shield or an HC-05 (or similar) module.

  4. The shields are stackable if you don’t already know.

    Below is a motor shield sold by Adafruit.

What you are using in your Arduino ??? GRBL or what and what is the version???

Example to test pen up/down

// Keyboard input function to control the servo pen mechanism
void keyPressed() {
  if (key == 'u' || key == 'U') {
    // M5 turns off the spindle pin, telling the GRBL-Servo firmware to lift the pen UP
    grblPort.write("M5\n"); 
    println("Sent: Pen UP (M5)");
  } 
  else if (key == 'd' || key == 'D') {
    // M3 S1000 turns on the spindle at max speed, telling the GRBL-Servo firmware to lower the pen DOWN
    grblPort.write("M3 S1000\n"); 
    println("Sent: Pen DOWN (M3 S1000)");
  }
}




⚠️ VERY IMPORTANT PROGRAMMING NOTE FOR ARDUINO:

The standard version of GRBL designed for standard CNC 
machines does not natively support servo motors;
 it only supports stepper motors. 
For your servo motor to respond correctly to the M3 and M5 commands used in the Processing code above,
 you must upload a specialized "GRBL Servo Firmware 
(Pen Plotter version)" to your Arduino instead of the generic CNC version.