DIY

Graphic tablet for CNC

Graphic tablet for CNC  Graphic tablet for CNC Graphic tablet for CNC Graphic tablet for CNC This article explains how to make a CNC graphics tablet from a 4-wire resistive touchpad and an Arduino UNO R3 microcontroller. The tablet is intended for use with CNC plotters (not CNC milling machines).
A gcode file is generated for each drawing. The tablet is very easy to make.
The tablet supports freehand and point-to-point drawing.
The touchpad of the device has a resolution of 600 x 800 pixels, which corresponds to a drawing of 600 x 800 mm if the installation resolution is 1 mm/pixel.
At a cost of such a tablet comes out about $ 25.
Tools and Materials: -8 inches, 183 * 141mm (4: 3) 4-wire resistive touchpad AT080TN52 V1 – Arduino UNO R3 with USB cable; – Jumpers; – Backing or back of picture frame 23 X 23 cm – 2 pcs; -8 bolts M3 x 5 mm; -Four nylon spacers with thread 9 mm x M3; -Wood toothpick; -Mask tape; -Double-sided tape;
 Graphic tablet for CNC Step One: Theory
An 8-inch 4-wire resistive touchscreen consists of two resistive films separated by an 800 x 600 array of microscopic insulators. < br>Each resistive layer has two pins:
The Y-axis has one pin connected to the top edge and one pin connected to the bottom edge.
The X-axis has one pin connected to the left edge and one pin connected to right edge.
When the top surface is pressed, the two films touch.
Y-axis measurements
For simplicity of explanation, assume the bottom layer is the Y-axis and the Y-axis leads are connected to a 5 Volt DC source.
The resistive film acts as a voltage divider.
The voltage at the bottom will be 0 volts
the voltage in the center will be 2.5 volts
and the voltage at the top will be 5 volts
To measure this voltage, we connect a wire from the top tape to an analog input, for example A0, then click on the top layer with the stylus to make the connection [1].
When the connection is established, the analog-to-digital (A/D) converter of the Arduino will give a number from 0 to 1023.
0 volts means a shutdown of 0
5 volts corresponds to reading 1023
2.5V corresponds to reading 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 touching the bottom of the screen [2]
958 = actual value when touching the top of the screen [2 ]
0 = bottom coordinate of the screen.
800 = coordinate of the top screen.
X-axis measurements
Likewise, the X coordinates can be found by applying 5 volts to the X axis wires (top layer) and measuring the A/D values ​​with one of the Y axis wires.
In this case, the X coordinates can be found using the following Arduino code: < br> Xpos = map (x, 95, 912, 0, 600); ………………………………………….. ………….. (2)
Where
95 = actual value when touching the left side of the screen [2]
912 = actual value when touching the right side of the screen [2 ]
0 = left screen coordinate.
600 = right screen coordinate.
This process is repeated many times per second and the coordinates are sent to the computer, where a Processing 3 thumbnail displays them on the screen and converts them to gcode.
Display Modes
Processing thumbnails measure the time interval between coordinates.
If the time interval is less than 1500 ms, it is attached to the coordinates (ie the points are connected).
If the time interval is more than 1500 ms, the points are displayed separately.
This time interval can be customized discretion.
Saving gcode
Tap the upper-right corner of the touchpad to exit and save gcode.
gcode is automatically saved to a text file named drawing.gcode.
This file is located in the same folder as the sketch you are editing. < br> Rename this file to avoid overwriting work in the next project.
Notes:
[1]
The analog inputs of the Arduino are high impedance, which means there is no voltage drop across the top film.
[2]
These values ​​depend on the specific touch panel and may need to be adjusted.
Step two: the circuit
The circuit is simple. You need to place the touchpad face up and connect the Arduino pins A0, A1, A2 and A3 as shown in the diagram.
 Graphic tablet for CNC Step three: preparing the parts
The base is cut from the material used to frame the paintings. It should be about 1.5mm thick. The base of the card is used to position the touchpad and protect it from downward pressure. This is achieved by cutting a hole (pocket) in the material.
Do it as follows.
Position the touchpad 20 mm from the lower right corner.
Now trace the outline of the screen. Cut a hole for the touchpad.
Position the Arduino 20mm from the touchpad so that the touchpad pins are under the Arduino pins A0, A1, A2 and A3 (photo 3).
Trace the Arduino, including the holes
Drill 3mm holes for the Arduino screws .
Cut the base so that there is a 20mm gap to the left of the Arduino and 20mm on the top, right and bottom of the touchpad.
Cut a hole for the touchpad cable. The cable actually goes through the top card, and a slot in the base is needed to make a stencil for marking the top card.
Graphic tablet for CNC  Graphic tablet for CNC Graphic tablet for CNC  Graphic tablet for CNC The top card is identical to the bottom card with one important exception, the touchpad opening is smaller to hide the edges.
Place the base on top. Circle all the edges. Mark the Arduino mounting holes and the cable cutout.
Measure 9mm around the touchpad. Cut out the touchpad viewing hole.
Drill the 3mm mounting holes for the Arduino.
Cut a rectangular hole for the cable.
Cut the outer edges to match the bottom.
Graphic tablet for CNC Graphic tablet for CNC Graphic tablet for CNC Graphic tablet for CNC Step Four: Assembly
Increase the M3 Arduino mounting holes in the base to 5mm. This is necessary for the clearance of the M3 bolt heads.
Attach the touchpad to the base with masking tape.
Place double-sided tape on each edge of the base including the touchpad. Remove the protective backing.
Attach the M3 threaded nylon spacers to the top board.
Pass the touchpad cable through the slot.
Connect the male-to-male jumpers to the touchpad cable.
Screw the Arduino to the nylon spacers using bolts M3 x 5 mm. The holes can be covered with fabric tape. Connect the jumpers to pins A0, A1, A2, and A3 of the Arduino.
The CNC pen tablet is now ready for testing.
Graphic tablet for CNC  Graphic tablet for CNC Graphic tablet for CNC  Graphic tablet for CNC Graphic tablet for CNC Graphic tablet for CNC Graphic tablet for CNC Step five: installation Software
Download and install the following software on your computer:
Arduino IDE (Integrated Development Environment), available at https://www.arduino.cc/en/software.
Processing 3, available at https://processing.org/download/
Download each of the attached files
touchpad_sender.ino
touchpad_receiver.pde
Download the attached file touchpad_sender.ino
Copy the contents of the file into a new Arduino sketch.
Save the sketch as “touchpad_sender” (no quotes).
Compile and upload the sketch to your Arduino touchpad
You can check this sketch as follows
Open the “Serial Monitor” on the Arduino.
Set the “baud” rate to 115200
The user should see a stream of “S” letters flowing down the monitor screen. This Arduino is trying to “sync” with a machining sketch that hasn't been loaded yet.
Send an uppercase “S” from the serial monitor, stream “S” will stop, now arduino thinks that Processing 3 has noticed it.
Then send another letter “S” by touching the touchpad with a toothpick (or something similar ), The Arduino should respond with the XY touch coordinates.
The Arduino and Processing software uses two-way handshake (acknowledgment) when sending data, to see a different coordinate, you will need to send another letter “S”.
The Processing sketch is very similar to the Arduino sketch, the only visual difference is that the Arduino () loop has been replaced with a draw () loop.
Download the attached file touchpad_receiver.pde
Copy the contents of the file into a new processing sketch.
Save sketch as “touchpad_receiver” (without quotes).
Processing installation is now complete
No testing required.
Files can be downloaded below.
touchpad_sender.inotouchpad_receiver.pde Step six: how to create a drawing
Close Arduino IDE, no need to program anymore.
Connect your graphic tablet to your computer with a USB cable.
Open Processing3.
Open the file “touchpad_receiver”. [1]
Now everything is ready to go.
Left-click on the Start button Processing3. It's the top-left button in the editing window.
A 600 x 800 pixel screen appears.
Swipe the toothpick across the touchpad. [1]
A line should appear on the 600 x 800 pixel display.
gcode should also appear on the left side of the PC screen.
Now “Exit” from the program by touching the upper right corner of the pen tablet.
The line gcode (G00 X0 Y0) will appear on the left side of the computer screen, followed by the message “Drawing completed. ”A gcode text file named“ drawing.gcode ”is also sent to the“ touchpad_receiver ”folder. [2]
You need a text editor such as Notepad ++ to view the “drawing.gcode” file.
The gcode file is called “drawing.gcode” and is located in the “touchpad_receiver” folder.
The code must be identical to the one that was on the screen.
The file needs to be renamed.
Notes:
[1]
If the interval between touches exceeds 1500 ms, the processor interprets the touch as a point (or a new object), not as continuous line.
[2]
The “drawing.gcode” file is always overwritten, so you need to rename it if you want to keep its contents.
You're done, and you can see the touchpad in the video.
[media = https: //youtu.be/DKXx003Rp1w

Source:

usamodelkina.ru

Show More

Related Articles

Leave a Reply

Your email address will not be published. Required fields are marked *

Back to top button