CNC Graphics Tablet

5.9K358

Intro: CNC Graphics Tablet

a.articles { font-size: 110.0%; font-weight: bold; font-style: italic; text-decoration: none; background-color: red; } a.articles:hover { background-color: black; }

This instructable explains how to make a CNC graphics tablet from a 4-wire resistive touchpad and an Arduino UNO R3 microcontroller.

A gcode file is created for each of your drawings. [1]

Construction is simple ... all you need is a steel ruler and a sharp knife.

The tablet supports both freehand and point-to-point drawing.

The touchpad has a resolution of 600 x800 pixels which translates to a 600mm x 800mm drawing if your target resolution is 1mm/pixel.

The estimated cost of construction is less than $25

Images

  • The cover photo (photo1)shows the completed tablet.
  • Photo 2 shows a magazine cover under the tablet
  • Photo 3 is a close up of the tablet
  • Photo 4 shows the freehand tracing
  • The video shows the tablet in operation

Notes

[1]

The tablet is intended for use with CNC plotters ... not CNC mills.

STEP 1: Parts List

Photo one shows all of the parts needed to build this tablet.

The following parts were obtained from https://www.aliexpress.com/

  • 1 only 8 inch, 183*141mm (4:3), AT080TN52 V1 4 Wire Resistive Touch Screen Panel
  • Resistive Touch Screen Panel
  • 1 only Arduino UNO R3 microcontroller with USB cable
  • 4 only 100mm male-to-male Arduino jumper wires

The following parts were obtained locally

  • 2 only 23cm x 26cm pieces of mat-board from a picture-framer
  • 8 only M3 x 5mm bolts
  • 4 only 9mm x M3-threaded nylon spacers
  • 1 only roll of cloth tape
  • 1 only roll of doubled-side tape
  • 1 only wooden toothpick

The estimated cost of construction is less than $25

STEP 2: Circuit

Place the touchpad face-up and connect the Arduino pins A0, A1, A2, and A3 as shown.

Do not cross the male-to-male jumper wires

STEP 3: Theory

The 8 inch 4-wire resistive touch-screen comprises two resistive films that are separated by an 800 x 600 array of microscope insulators.

Each resistive layer has two leads

  • The Y-axis has one lead connected to the top-edge and one lead connected to the bottom edge.
  • The X-axis has one lead connected to the left- edge and one lead connected to the right-edge.

Pressing on the top surface causes the two films to make contact.

Y-Axis Measurements

For ease of explanation let’s assume that the bottom layer is the Y-axis and that the Y-axis leads are connected to a 5 volt DC supply.

  • The resistive film acts like a voltage-divider.
  • The voltage at the bottom will measure 0 volts,
  • the voltage at the center will measure 2.5 volts,
  • and the voltage at the top will measure 5 volts

To measure this voltage we connect a lead from the top film to an analog input such as A0 , then press the top layer with a stylus to make a connection. [1]

When a connection is made the Arduino analog-to-digital (A/D) converter will output a number between 0 and 1023

  • 0 volts equates to a reading off 0
  • 5 volts equates to a reading off 1023
  • 2.5 volts equates to a reading of 2.5/5*1023 = 512 (rounded)

These numbers can be converted to Y-coordinates using the following Arduino code:

Ypos = map(y, 61, 958, 0, 800); ................................................................ (1)

where

  • 61 = actual value when the bottom of the screen is touched [2]
  • 958 = actual value when the top of the screen is touched [2]
  • 0 = the lower screen coordinate.
  • 800 = the top screen coordinate.

X-Axis Measurements

Similarly the X-coordinates may be found by applying 5 volts across the X-axis leads (top-layer) and measuring the A/D values with one of the Y-axis leads.

In this case the X-coordinates may be found using the following Arduino code:

Xpos = map(x, 95, 912, 0, 600); ................................................................ (2)

where

  • 95 = actual value when the left-side of the screen is touched [2]
  • 912 = actual value when the right-side of the screen is touched [2]
  • 0 = the left screen coordinate.
  • 600 = the right screen coordinate.

This process is repeated many times a second and the coordinates sent to your PC where a Processing 3 sketch displays them on screen and converts them to gcode.

Display modes

The processing sketch measures the time interval between coordinates.

If the time interval is less than 1500ms it joins the coordinates.

If the time interval is greater than 1500ms the dots are displayed separately.

This time interval may be adjusted to suit.

Saving your gcode

Touch the top-right corner off the touch-pad to exit and save your gcode.

Your gcode is automatically saved to a text file called drawing.gcode.

This file is located in the same folder as your processing sketch.

Rename this file to avoid overwriting your work with your next project.

Notes

[1]

The Arduino analog inputs are high impedance which means there is no voltage drop across the top film.

[2]

These values are dependent on your touchpad and may need to be adjusted

STEP 4: Construction ... the Base

The base is cut from picture framing “mat-board” which can be obtained from your local picture framer ... often for free.

The card base is used to position the touchpad and protect it from downward pressure. This is achieved by cutting an opening (pocket) in the card such that the touchpad is a loose fit.

Method

Step 1

  • Choose your base card ... it should be approximately 1.5mm thick
  • Position the touchpad 20mm from the lower-right corner edges
  • Now the trace around the screen as shown in photo 1

Step 2

  • Cut a pocket-hole for touch pad (photo 2)

Step 3

  • Position the Arduino 20mm from the touch pad such that the touch pad leads lie beneath Arduino pins A0, A1, A2, and A3 (photo 3).
  • Trace around the arduino including the holes
  • Drill 3mm holes for Arduino screws
  • Trim the base such that there is 20mm clearance to the left of the Arduino and 20mm clearance at the top, right, and bottom sides of the touchpad (photo 3).
  • Cut a hole for the touch pad cable. The cable actually goes through the top card but we are cutting a slot in the base to make a stencil for when we mark the top card (photo 4).

STEP 5: Construction ... the Top

The top card is identical to the base with one important exception ... the touchpad opening is smaller to hide the touchpad edges.

Method

Step 1

  • Lay the base over the top as shown in photo1.
  • Trace all edges.
  • Trace the touchpad opening.
  • Trace the arduino mounting holes.
  • Trace the cable slot.

Step 2

  • Measure 9mm around the touchpad dimension (photo 2).
  • Now cut the touchpad viewing hole (photos 3).
  • Drill the 3mm Arduino mounting holes.
  • Cut out rectangular hole for cable.

Step 3

  • Cut the outside edges to match the base (photo 4).

STEP 6: Construction ... Assembly

Method

Step 1

  • Enlarge the M3 Arduino mounting holes in the base to 5mm. This is to provide clearance for the M3 bolt heads when we attach the nylon spacers to the top plate.

Step 2

  • Attach the touchpad to the base using cloth tape (photo1).

Step3

  • Run doubled-sided tape around each edge of the base including the touchpad (photo 2).
  • Remove the protective backing.

Step 4

  • Attach the M3 threaded nylon spacers to the top card (photo 3).

Step 5

  • Feed the touchpad cable through the slot (photo 4).

Step 6

  • Attach male-to-male jumper-wires to the touchpad cable (photo 5).

Step 7

  • Attach the Arduino to the nylon spacers using M3 x 5mm bolts (photo 6).
  • Connect the jumper wires to Arduino pins A0, A1, A2, and A3.
  • Do not cross the cables.
  • Your CNC Graphics Tablet is now ready to test.

Photo 7 shows the underside of the graphics tablet. Any holes may be covered with cloth tape.

STEP 7: Software Installation

Downloads

Download and install the following software on your computer

Download each of the attached files

  • touchpad_sender.ino
  • touchpad_receiver.pde

Arduino file installation

  • Download the attached file touchpad_sender.ino
  • Copy the file contents to a new Arduino sketch.
  • Save the sketch as “touchpad_sender” (without the quotes)
  • Compile and upload the sketch to your touchpad Arduino
  • You can test this sketch as follows
  • Open your Arduino “Serial Monitor”
  • Set the “baud” speed to 115200

Testing the Arduino software

You should see a stream of “S”s flowing down your monitor screen. This is the Arduino trying to “Sync” to the Processing sketch which has yet to be loaded.

Send an upper-case letter “S” from the Serial Monitor ... the stream of “S”s will stop ... the arduino now thinks it has the attention of Processing 3

Now send another “S” while touching the touchpad with a toothpick (or similar) ... the Arduino should respond with the XY touch coordinates.

The Arduino and Processing software use two-way handshaking when data is being sent ... to see another coordinate you will have to send another “S”

Processing file installation

A Processing sketch is very similar to an Arduino sketch ... the only visual difference is that the Arduino loop() is replaced with a draw() loop.

  • Download the attached file touchpad_receiver.pde
  • Copy the file contents to a new Processing sketch.
  • Save the sketch as “touchpad_receiver” (without the quotes)
  • Your Processing installation is now complete
  • No testing is required.

Software upgrade

12 December 2021

Improved software for this digitiser may be found at https://www.instructables.com/CNC-Graphics-Tablet-V2/

STEP 8: How to Create a Drawing

Step 1

  • Close your Arduino IDE ... we no longer need it.
  • Connect the Graphics Tablet to your PC with a USB cable.
  • Launch Processing3.
  • Open the file “touchpad_receiver”. [1]
  • We are now ready to go.

Step 2

  • Left-click the Processing3 “Start” button .
  • This is the top-left button in the processing window.
  • A 600 pixel x 800 pixel screen will appear.
  • Run a toothpick over the touchpad. [1]
  • A line should appear in the 600 x 800 pixel display.
  • gcode should also appear down the left-side the PC screen.

Step 3

  • Now "Exit" the program by touching the top right-hand corner of your graphics tablet.
  • A line of gcode (G00 X0 Y0) will appear down the left-side of your PC screen followed by the message “Drawing complete”.
  • A gcode text file called “drawing.gcode” is also sent to your “touchpad_receiver" folder. [2]

Step 4

  • To examine the file “drawing.gcode” you will need a text editor such as Notepad++.
  • The gcode file is called "drawing.gcode" and is located in your "touchpad_receiver" folder.
  • The code should be identical to that which you saw on the screen.
  • Feel free to rename this file to anything you want [2]

Notes

[1]

If the interval between your touches exceed 1500ms the processing software will interpret the touch as a point (or new object) rather than as a continuous line.

[2]

The file “drawing.gcode” is always overwritten so you need to rename it if you want to keep its contents

STEP 9: Summary

This Instructable describes how to make a CNC graphics Tablet from an Arduino and an 8 inch 4-wire resistive touchpad.

The gcode output from the tablet is intended for use with plotters ... not CNC mills.

The touchpad has a resolution of 600 x800 pixels which translates to a 600mm x 800mm drawing if your target resolution is 1mm/pixel.

The project comprises an Arduino sender and a Processing receiver.

The Arduino is responsible for sending each touchpad coordinate to a PC which is running Processing3.

Processing3 displays what you have traced and generates a valid gcode file that is compatible with most CNC plotters.

The gcode file is called “drawing.gcode” which can be renamed.

The estimated cost of construction is less than $25.

  Click here   to view my other instructables.

7 Comments

A lovely idea.
May I suggest bottom left corner to finish and save, as this is X0 Y0. Home position.
Also instead of relying on a time interval. Have top right corner = pen up, and bottom right corner = pen down.
Have a red and a green LED on the Arduino to remind you what state the pen is.
I think this would make copying more complex sketches easier.

Brilliant.
Thank you for your suggestions :)

I am already working on this and will publish a software update shortly.

The new version has four "button-areas" across the top of the touch-pad:
- point-mode ... for dots,
- line-mode ...... for continuous lines,
- arc-mode ....... for drawing curves using the 3-point circle method,
- exit ................. for adding a G00 X0 Y0 instruction before closing the file.

Once I have completed the software update I will look at placing a LED above each of the menu buttons ... for now the menu-mode is automatically displayed on-screen when-ever the pen has been lifted for more than two seconds.

Operation is much like a word-processor where the 1st- button touch activates the mode and the 2nd disables the mode.

You can also switch modes, without exiting, by touching another button. This allows you to draw continuous shapes at your own pace.

Example:
To draw a rectangle with rounded corners select the line mode whenever you are doing the straight sections and touch the arc-mode when you are turning the corners. Circles require a minimum of two arcs ... preferably three.
Great instructable lingib....
Thank you :)
Amazing work sir.....I like it very very much, want to use this feature in some other project. Best wishes...
Glad you like it ... thank you for commenting :)