The Freetronics CNCPlot is Arduino Leonardo compatible, with onboard stepper motor drivers. It can be powered by the USB connection or powered separately by your project via the DC jack, which also provides power to any connected steppers.

The CNCPlot includes a 20x4 LCD, but the picture below shows it with the LCD removed so that you can see the major parts of the board.

Software Installation

1. Download the latest Arduino IDE for your operating system from and install it to suit. You'll also find more step-by-step guides for installation here:

2. Once the Arduino IDE is installed, we're ready to do the initial board and port setup. You won't need to do this again unless the serial port number changes such as when using a different USB port on your computer.

3. In the Arduino IDE, select Tools > Board > Arduino Leonardo.

4. Before connecting your CNCPlot to the USB port, have a look at the list of ports in Tools > Serial Port. That's where your CNCPlot serial port is going to appear when you plug it in.

5. Connect your CNCPlot to the computer USB port. We supply an appropriate USB cable with the CNCPlot. After a short while if you look at Tools > Serial Port again you'll see a new port appear: that's the CNCPlot ready to be used. Select that port now with Tools > Serial Port so there is a tick mark next to it

6. You're ready to go. The Arduino IDE now knows about your board and has a connection to it.

Compiling and uploading a sketch to the CNCPlot

"Sketch" is the Arduino term for a program. To test uploading a simple sketch to your CNCPlot:

1. Choose File > Examples > 01.Basics > AnalogReadSerial. You'll see the code open in the IDE.

2. Select Sketch > Verify/Compile, you've now built (compiled) the program ready to be loaded.

3. Lastly, to load the program into the CNCPlot, select File > Upload to I/O Board. You'll see the green and yellow RX and TX LEDs near the bottom left of the PCB flashing while the upload is in being done.

4. A few seconds later the RX and TX LEDs will go off, the board will reset, and the TX LED will appear to be on constantly.

5. In the IDE, select Tools > Serial Monitor. A new window will open. Check that the speed drop-down in the bottom right of the window is set to "9600 baud". You will then see a stream of numbers down the window showing readings from the analog inputs on the CNCPlot.

Congratulations! You've now compiled and uploaded your first sketch to the CNCPlot.

Using the microSD card slot

The microSD card slot is supported by a variety of libraries that implement different versions of the FAT filesystem commonly used on microSD cards. The Arduino IDE comes bundled with the "SD" library pre-installed including some example sketches, so look in File > Examples > SD to see how to communicate with a microSD card.

Note: the "select" line for the microSD slot on the StepDuino is D6, which is different to the examples bundled with the IDE that use pin 4. Ensure you change the select line setting in the sketch to pin 6.

Using the stepper motor outputs

Stepper motors do not simply spin like most motors you may be familiar with. They move in a series of steps (hence the name) with a defined angle of rotation per step. Stepper motors can be specified as having a certain number of steps per rotation, or as a number of degrees of rotation per step. Both numbers are just different ways of stating the same thing. For example, a typical hobby stepper motor may be said to have "200 steps/rev" (steps per revolution), or "1.8º/step" (degrees per step) which are really the same thing.

So if you drive a 200 steps/rev (or 1.8º/step) motor through 200 steps, it will rotate a complete 360º back to where it started.

Microstepping Settings

Stepper motors are specified in terms of how many steps they take per revolution, but a technique called "microstepping" allows controllers to drive motors in smaller increments. The CNCPlot supports four levels or increments of microstepping: full-step, 1/2-step, 1/4-step, and 1/8-step. The default configuration is 1/8-step, which is set by leaving the pairs of solder bridges on the front of the PCB unconnected. That means you need to send 8 times as many step pulses as you may expect based on the specs of your motor, but it also gives you much finer control of the rotation of the motor.

You can adjust the microstep settings for both outputs independently by applying solder bridges across the positions labelled "MS0" and "MS1" for the relevant output.

MS0 MS1 Setting
Open Open 1/8 step (default)
Closed Open 1/4 step
Open Closed 1/2 step
Closed Closed  Full step

Note: these solder jumpers are located on the front of the PCB underneath the LCD. You will need to remove the LCD to access the jumpers.

Motor Connections

The CNCPlot has two independent 4-wire bipolar stepper motor outputs. Each output (labelled "X-MOTOR" and "Y-MOTOR" on the PCB) uses two control lines: one line to determine the direction of rotation of the stepper motor, and one to trigger a step of the motor.

  • Stepper 1 direction: Arduino digital pin 2.
  • Stepper 1 step: Arduino digital pin 5.
  • Stepper 2 direction: Arduino digital pin 3.
  • Stepper 2 step: Arduino digital pin 6.

To connect your 4-wire bipolar stepper motor, you first need to determine the coil connections using the datasheet of your particular motor. The very common NEMA-17 stepper motors used in many hobby projects such as 3D printers can generally be connected using the colour codes as shown below, using (left to right) red, green, yellow, blue:

Otherwise, the general coil wiring for your stepper should match this (there should be a similar diagram in the datasheet for your stepper):




Stepper motors cannot be powered from the USB port because they generally require a higher voltage and more current than USB can provide. Connect an external power source suitable for your stepper motors (often 12Vdc) to the DC IN jack in the top left of your CNCPlot as shown above.

Example Sketch

The example sketch below sets up the output pins for both Stepper 1 (X-axis) and Stepper 2 (Y-axis, and then drives the X channel through a total of 1600 steps (ie: one complete rotation for a 200 steps/rev motor using 1/8th microstepping: 200 x 8 = 1600) then pauses for one second, then does the same thing in reverse, then repeats. You'll see in the sketch there are also unused example functions for running Stepper 2 forward and for "braking" both motors so the controller holds them in place and resists rotation.


 * CNCPlot example
// For the X-axis stepper
const int Stepper1Step      = 10;
const int Stepper1Direction = 11;
const int StepsPerRev1      = 1600;

// For the Y-axis stepper const int Stepper2Step = 8; const int Stepper2Direction = 9; const int StepsPerRev2 = 1600; /**  * Set pin assignments  */ void setup() {   pinMode(Stepper1Step, OUTPUT);   pinMode(Stepper1Direction, OUTPUT);      pinMode(Stepper2Step, OUTPUT);   pinMode(Stepper2Direction, OUTPUT); } /**  * Main loop  */ void loop() {   for(int i = 0; i < StepsPerRev1; i++)   {     stepper1Forward();   }   delay( 1000 );      for(int i = 0; i < StepsPerRev1; i++)   {     stepper1Reverse();   }   delay( 1000 ); } /**  * Rotate stepper 1 forward by 1 step  */ void stepper1Forward() {   digitalWrite(Stepper1Direction, HIGH);   digitalWrite(Stepper1Step, HIGH);   delayMicroseconds(2); // 1uS minimum pulse duration for DRV8811   digitalWrite(Stepper1Step, LOW);   delayMicroseconds(100); } /**  * Rotate stepper 1 backwards by 1 step  */ void stepper1Reverse() {   digitalWrite(Stepper1Direction, LOW);   digitalWrite(Stepper1Step, HIGH);   delayMicroseconds(2);   digitalWrite(Stepper1Step, LOW);   delayMicroseconds(100); } /**  * Rotate stepper 1 forward by 1 step  */ void stepper2Forward() {   digitalWrite(Stepper2Direction, HIGH);   digitalWrite(Stepper2Step, HIGH);   delayMicroseconds(2); // 1uS minimum pulse duration for DRV8811   digitalWrite(Stepper2Step, LOW);   delayMicroseconds(100); } /**  * Lock both steppers in place  */ void applyBrakes() {   digitalWrite(Stepper1Direction, LOW);   digitalWrite(Stepper1Step, LOW);   digitalWrite(Stepper2Direction, LOW);   digitalWrite(Stepper2Step, LOW);   delayMicroseconds(50); } 

Using the servo output

A servo is a device that contains a small electric motor that can be commanded to rotate to a specific angular position. For example you might use a servo to move the part of a robotic arm, or lift a stylus from a two-axis plotter. Your CNCPlot allows for easy connection of a servo.

To connect your servo, observe the colour of the wires. The darkest wire will match the GND pin on the SERVO port of your CNCPlot.

However if you are unsure, check with the supplier of the servo to ascertain which wire is GND, 5V and signal. Controlling your servos is equally simple, and the Servo library included by default with the Arduino IDE will suffice. Consider the following sketch:

#include <Servo.h> 
Servo myServo; // assign object to the Servo library

int pos = 0;    // variable to store the servo position 
void setup() 
  myServo.attach(12);  // servo connected to D12 
void loop() 
  for(pos = 0; pos < 180; pos += 1)  
 // goes from 0 degrees to 180 degrees in steps of 1 degree 
   // tell servo to go to position in variable 'pos' 
   // wait 15ms for the servo to reach the position
  for(pos = 180; pos>=1; pos-=1)    
  // and reverse
This will sweep the servo across a 180 degree range and back again. Once the servo has been activated and assigned to the CNCPlot's output pin 12, you can simply use the required ".write" function to control the servo.

Using the LCD

The 20x4 LCD is controlled using a shift register, which saves some I/O pins on the microcontroller and allows them to be used for other purposes. This means the regular LiquidCrystal library included with the Arduino IDE can't drive it directly, so you need to use Marc Merlin's version of the "NewLiquidCrystal" library.

To do so, visit and click the "Download ZIP" button on the right-hand side of the page. Once the .zip file has completed downloading, open the .zip file and copy the folder labelled "NewLiquidCrystal-master" into your Arduino IDE libraries folder. Finally, rename the folder to "NewLiquidCrystal". For detailed instructions on library installation please see our tutorial "How To Install Arduino Libraries".

Once you have the library installed and your IDE has been restarted, create a new sketch and paste the following code into it: 

 * Demo of writing to the CNCPlot LCD
#include <LiquidCrystal_SR_LCD3.h>

const int PIN_LCD_STROBE         =  2;  // Out: LCD IC4094 shift-register strobe
const int PIN_LCD_DATA           =  3;  // Out: LCD IC4094 shift-register data
const int PIN_LCD_CLOCK          =  4;  // Out: LCD IC4094 shift-register clock


 * Setup routine. Run once
void setup(){
    lcd.begin( 20, 4 );               // Initialize the LCD 
    lcd.home ();                      // Go to the home location
    lcd.setCursor (0, 0);
    lcd.print(F("*** CNCPLOT v1.0 ***"));  
    lcd.setCursor (0, 1);
    lcd.print(F("Stepper/servo ctrl"));
    lcd.setCursor (0, 2);
    lcd.setCursor (0, 3);
    lcd.print(F("                    "));
    delay( 2000 );
    lcd.setCursor( 0, 3 );
    lcd.print(F("                    "));

 * Main loop. Run indefinitely
void loop()
  // Set the cursor to column 0, line 1
  // (Note: line 1 is the second row, since counting begins with 0):
  lcd.setCursor(0, 3);
  // Display the number of seconds since reset: