Computer Numerically Controlled Drawing Robot Based on Computer-Aided Design

Due to the rapid development of technology, the use of numerically controlled machines in the industry is increasing. The main idea behind this paper is computer-aided design (CAD) based low-cost computer numerical control 2D drawing robot that can accurately draw complex circuits, diagrams, logos, etc. The system is created using open-source hardware and software, which makes it available at a low cost. The open-source LibreCAD application has been used for computer-aided design. Geometric data of a CAD model is converted to coordinate points using the python-based F-Engrave application. This system uses the Arduino UNO board as a signal generator of the universal g-code sender without compromising the performance. The proposed drawing robot is designed as a low-cost robot for educational purposes and aims to increase the student's interest in robotics and computer-aided design (CAD) skills to the next level. The drawing robot structure has been developed, and it meets the requirements of low cost with satisfactory experimental results.


Introduction 1
In recent years, we have witnessed the tremendous impact of robotics in many areas of science and technology. CNC machining is a process in which computers are used to control machine tools such as plotters, lathes, mills, machine tools, etc., for the production process. Due to the significant developments in personal computers, it has become easy to add new functions to modern CNC machines, as well as it is easy to change and develop control algorithms (Da Rocha, de Silva e Souza, & de Lima Tostes, 2010). Robotic technologies are widely used for educational purposes, and this paper analyzed a robot that has the ability of drawing. This robot is able to draw sketches similar to the given instruction with acceptable accuracy, and this drawing robot is designed to work with open-source software and a G-code sender. The main goal of this research is to develop a CNC drawing robot that can draw complex sketches on paper. This robot will not only encourage people to participate in artistic activities but also encourage people's interest in actively participating in robotics and programming.

Literature Review
Modern technologies offer people to conduct comfortable lives by reducing human effort. For this purpose, several devices have been developed that reduce the burden on human labor, such as autonomous self-reconfigurable floor cleaning robot (Asafa, Afonja, Olaniyan, & Alade, 2018), automatic plant irrigation system using Arduino (Devika, Bose, & Vijayalekshmy, 2017), etc.
Various projects have been implemented for CNC machines, such as Madekar et al. was proposed an automatic mini CNC machine for PCB drawing and drilling (Kajal, Kranti, Pooja, & Vikas, 2016). The idea behind their project is to design and drill a PCB based on an inexpensive CNC system. Lower cost is achieved by including the computer functions of the atmega328 controller in the Arduino and three easy drivers to control the motors. They used Inkscape software to generate the g-code that controls the system. Pandian et al. presented the results of a low-cost three-axis vertical computer numerical control mill for a graduate mechanical engineering laboratory (Pandian, & Pandian, 2014). The open-source XLoader is used to upload a hex file directly to the Arduino and the universal g-code sender platform is used as a g-code sender. The total cost of the developed system is approximately 1/20 of the cost of commercial CNC machines currently used in the laboratory. In addition, this machine can be easily customized for modification and it provides students with a better understanding of the operation and use of CNC milling machines. Jayachandraiah et al. designed a low-cost 3-axis CNC router for the fabrication system (Jayachandraiah, Krishna, Khan, & Reddy, 2014). Lower cost is achieved by incorporating computer interface features with an Arduino-based system. To control this system, the router used an atmega328p microcontroller based on Arduino. They used GRBL, an open-source g-code interpreter controller for the Arduino development board, and MATLAB, used for data analysis. All parts of the machine have been designed with computer-aided software (CAD). Vijayaraghavan et al. developed an algorithm and graphical interface that were used to develop a complete CAD programming-based application (Vijayaraghavan, & Dornfeld, 2007). Logic operations were used to simulate the manufacturing steps of a drill and create a fully designed drill. The above application deals with automatic drilling simulation.

Methodology
The detailed functional block diagram of the drawing robot is shown in Figure 1. The computer used as the control unit is connected to the Arduino UNO to control the full operation. This CNC drawing robot based on LibreCAD platform, F-Engrave platform, universal g-code sender, Arduino UNO, moto driver IC, stepper motor, and servo motor.

Software Description
LibreCAD is a 2D CAD (Computer-Aided Design) drawing tool and the graphical user interface (GUI) is based on the Qt5 libraries (Tsvetkova, & Kerenchev, 2020). LibreCAD application provides a user interface and many retouching tools allowed to create, modify, and analyze for 2D drawing. The detailed interface of the LibreCAD application is shown in Figure 2-the most widely used file format. DXF files are used for this drawing robot because DXF files are used to generate g-code. LibreCAD is a free, open-source application and windows, apple, and Linux supported.  F-Engrave is a g-code generator application that is written in the optimized python programming language (Yau Lam, & Ngan, 1989). F-Engrave is free and open-source software. The. DXF file of the CAD model is given as an input to the F-Engrave DXF reader, and the output of the reader is a coordinate point or g-code. The user interface of F-Engrave v1.73 applications and gcode generate configuration with a sample design layout is shown in Figure 3.
The computer numerical control drawing robot takes input commands from the computer using the universal g-code sender (UGS) platform. UGS is a Java application that runs in the Java runtime environment (Patil, & Anasane, 2020). The universal gcode sender takes a g-code program file as an input and sends it line-by-line through the USB connection between the computer and the atmega328P microcontroller. GRBL is an open-source firmware that we need to load into the atmega328P microcontroller to control the movement of the motors of the drawing robot. The function of the GRBL firmware in our system is to translate the g-code into motor movement.

Electrical Components
The Arduino UNO is an atmega328P based microcontroller. It is open-source software and hardware that is created by a single microcontroller. It has 14 digital input & output and 6 analogue inputs. Arduino UNO platform is used in this system which drives the motor with the help of motor driver IC (Figure 4). The command is processed by the universal g-code sender platform. The computer used as the control unit is connected to the Arduino UNO to control the whole operation. The L293D is a 16-pin motor driver IC that allows the stepper motor to run in any direction. The L293D IC has two H-bridges which we mentioned in Figure 4, and each H-bridge drives one stepper motors electromagnetic coils. We used two L293D motor driver IC, which drives two stepper motors as the X-axis and Y-axis. The project uses a bipolar stepper motor with 2 phases, 4 wires, a step angle of 18 degrees, and a torque of 500gf.cm with 200 steps per revolution (Virgala, Kelemen, Lipták, & Prada, 2015). To drive the bipolar stepper motor (Figure 4), we used the L293D motor driver IC with an internal H bridge circuit. Stepper motors are used to convert rotary motion into linear motion and stored along the X-axis and Y-axis. The X stepper motor move left and right, the Y stepper motor to move them forward and backwards according to the given signal. The power supply is given from the adapter.
The MG90S servo motor can be rotated 180 degrees with 1.8 kg/cm torque and 0.1s/60-degree operating speed (Kamble, Khoje, & Lele, 2018). It is fixed in the vertical direction at the moment of the Z-axis. The servo motor moved the pen up and down and took a signal from Arduino UNO. The electrical power is required for the servo motor, which is provided by the adapter.

Circuit Diagram
We have designed a circuit diagram of the computer numerical control drawing robot that is shown in Figure 5. Pins 8, 9, 10, 11 of the Arduino Uno are connected to the L293D motor driver IC, which is configured to drive the stepper motor in the X-axis. Pins 2, 3, 4, 5 of the Arduino UNO are connected to another L293D motor driver IC to drive another stepper motor for Y-axis. Motor drivers 3, 6, 11, 14 no pins are connected by stepper motors. Pin 6 of Arduino Uno is connected to the Z-axis of the servo motor. An experimental system layout with one stepper motor for the X-axis, one stepper motor for the Y-axis, and a servo motor for the Z-axis is shown in Figure 6.   Table 1 presents the technical characteristics of the developed numerical control drawing robot. This section contains detailed results of the various response time stages for the drawing robot. Consider a CAD model of the text "Happy Father's Day" as input to the system which is shown in Figure 7 (A). Firstly, the CAD model is converted to .DXF format and then passed as input to the F-Engrave application for converting to g-code. The result of the CAD model is shown in Figure 7 (B) based on the g-code data; the movement of the axis is controlled by the motion control unit. The proposed drawing robot takes the total time to draw the CAD model shown in Figure 7 (B) is about 48.60 second. Consider another CAD model of a geometric frame as input to a drawing robot, as shown in Figure 7 (C). The output of the gcode and the drawing robot is shown in Figure 7 (D). The total time taken to draw this CAD model shown in Figure 7 (D) is about 14.94 s by the proposed system. The images were drawn 4 times and the response time has been recorded. These steps were repeated for two different images shown in Figure 7 (B) and Figure 7 (D). Response times varied slightly for each trial. The response times are shown in Table 2. Table 2 Response time measurements  Trials Response time (Second) For Figure 7

Conclusion
This article discussed the design, implementation, and analysis of a three-axis drawing robot for educational purposes. This system can be used as a learning tool for university students, helping them understand the numerical control computer and CAD. The output generated by the drawing robot is very similar to the given input and the response time is the same for every trial. The accuracy can be improved by installing an appropriate mechanical system. This drawing robot needs to be stable during the drawing process because any simple vibration can cause errors. This system can be directly implemented on raspberry pi platforms. As a result, it can eliminate the Arduino board and PC from the system design and this can significantly reduce the cost of the system. In addition, the pen can be replaced with a laser to work as a laser engraving machine, and then it can be used to paint on wood. However, there are future plans to scale the drawing robot in terms of size, use more powerful motors, strengthen the frame, and sketch the design from a distance using a Bluetooth module with this system.