Designing an Arduino Board-based Electronic Device Driven by GRBL Gru to Operate the Mini PCB Printing Machine

—A compact integrated circuit is an intellectual property core at the heart of the decades of embedded devices on embedded systems. Using a microcontroller-based electronic module manufactured as desired or direct service of the board of Arduino as a control system for many purposes has become a certainty. Defining the problem formulations is related to the manufacture, assembly of the mechanical apparatus, and integrated wiring of several electronic modules. The acquisition of research contributions is expected to get the miniature embodiment of the physical machine equipped with a user program and perform the machine driver. The research methods consist of several steps to carry out each research objective. The miniature embodiment is carried out through (i) manufacturing and assembling to obtain the physical machine, (ii) integrating the electronic modules and all components and support systems by wiring to form an embedded system as a mini-PCB printing machine, and (iii) making a program structure based on Arduino IDE. Performing the machine driving mechanism is operating tests of calibration and moving on the axes of X, Y, and Z. Concluding based on the implementation process, testing, and analysis are carried out that the stages for performing the Mini PCB Printing Machine assisted by Arduino board with driven by GRBL Gru can be realized according to the initial design of hardware and software design.


Introduction
The microcontroller, often shorthanded as µC (or uC), is shown as a microcontroller unit (MCU) [1]- [3]. The µC is the electronic device in the form of a compact or monolithic chip or integrated circuit (IC) [4]- [6] containing a processor core, memory, and programmable input/output (I/O) peripherals. The MCU is a set of electronic circuits on one small flat piece of semiconductor material [7]. This chip in a single silicon wafer was invented by Jack S. Kilby and Robert N. Noyce in the early 1960s [8], [9]. The IC is a microchip or microelectronic circuit designed to process signals digitally efficiently, known as a digital signal processor (DSP) [10]- [12]. A compact integrated circuit is an intellectual property core (IP core or IP block) that has been at the heart of the decades of embedded devices on Designing an Arduino Board-based Electronic Device Driven by GRBL Gru to Operate the Mini PCB Printing Machine embedded systems [13]. This paragraph of description for backgrounding is necessary to reason for choosing the title of this paper. According to the background description, it is necessary to explain several state-of-the-art related studies presented, namely (i) the research on the embedded system controlled by a branded software (a set of instructions) [14], [15] or operated by a built application (the user program) [16] and (ii) the research on the operation of a PCB printing machine [17]- [19]. An embedded device is the hardware in on-progress when the software runs [20]. The software is a set of instructions or the user program stored in the program memories [21]. It ranges from common consumer electronic devices to home, office, factory or industry applications and automotive and avionic implementations [22]. Using a microcontroller-based electronic module that is manufactured as desired [23], [24] or direct service the board of Arduino [25], [26] as a control system for many purposes has been used become a certainty.
An embedded device driven by the branded software can be implemented into a device operating system [27]. There are many different branded software available today for allowing the easy deployment of code, scripts, and other entities to perform various functions within a system [28]. In this research, branded software explains the application for driving the computer numerical control (CNC) machines, i.e., the GRBL Gru application is opensource software [29]. The CNC machine, in this case, is a PCB printing machine [30]. It can also synergize the user program in syntax structure based on an algorithm with branded software is a syntax structure based on Arduino IDE. In collaboration with a set of instructions and the user program, some inevitability can find the embedded system with microcontroller-driven in almost every aspect of today's consumer life. Its partnership ranges from home appliances to machine automation systems in small and medium-sized industries or several devices for public use in a general area [31]. In general, the embedded devices are included branded software or built application that play a crucial role in the functioning of the systems.
Defining the problem formulations based on the "stateof-the-art" are related to the manufacture of mechanical frames made of stainless steel, assembly of parts on the mechanical equipment, and integrated wiring of several electronic modules [32]. This system makes paths and holes on the PCB using a DC motor equipped with an engraving drill bit (end mill cutter) [33]. When the PCB design file is ready in the SVG/DXF/NC/BMP format, the design file is entered in the "GBRL Gru". The software will translate the design into G-Code or step coordinates, select the executive function in the software (engraving/ drilling/etc.) and the type of knife as well as the depth of the knife feeding after the software and machine are ready, namely, the engraving knife is at zero point, the system will start, and the software will send the G-code file to the microcontroller. The microcontroller will process the G-code so that the stepper motor runs according to the design coordinates. A block diagram of a problem formulation of this research is shown in Figure 1.
Based on Fig. 1, it is shown that a microcontroller-based which direct service of the Arduino board as a control system [34] for operating the mini PCB printing machine can be performed automatically by the user via a PC [35], [36]. However, this design is a simple idea to use the system with the design file is ready.
In the block diagram in Figure 1, the PC or laptop as communication and control contains the GRBL Gru which functions as a controller, monitors, and sends G-code files to the microcontroller. Then the Arduino UNO R3 module functions as the brain of the system which will control the running of the system and will turn off the system if the emergency switch or limit switch sensor receives a signal. The Arduino module will control the stepper motor via the motor driver [37]. Motor drivers, stepper motors, and DC motors work with a power supply from a 24 Vdc and 5A switched-mode power supply (SMPS). This tool works using three axes, i.e., the X, Y, and Z axes [38]. The three axes are driven by a stepper motor that is connected to the Arduino module via a CNC Shield.
Guided by the formulation of the problems, they set the research objectives, i.e., a) to manufacture the embodiment of the physical machine with a miniature size that is equipped with a user program and b) to perform the machine driver mechanism [39], [40]. The embodiment of the physical machine included (i) manufacturing the main mechanical frame structure and assembling the parts of the physical miniature machine, (ii) integrating the electronic modules and all of the components and the support system and wiring an embedded system, and (iii) making a program structure based on Arduino software or Arduino Integrated Development Environment (IDE) [34] for the Arduino module. The performance of the mini machine driver mechanism is the operating test of calibration and movement testing against the axes of X, Y, and Z. After the research objectives are obtained, it is expected that the acquisition of research contributions are (1) for manufacturing and assembling the main mechanical structure and electronic modules through the integrating of all of the components and making the structured program and (2) for observation results of the operation performed on the PCB printing machine driver after obtaining the physical embodiment of a simple idea.

II. Research Methods
The methods of research are an algorithm of a researcher for conducting the research that is carried out in the form of stages to achievement and which is guided by the research objectives [41], [25]. In other words, some stages must be carried out sequentially the objectives [41], [42], [25], [26], [43] so this research method is made in the form of a flow chart, and under steps for achieving each research objective [42], [26], [43]. The flowchart of the research methods is shown in Figure 2.
Based on Fig. 2, some things related to the stages can be explained that the research methods consist of several steps to carry out each research objective. The first objective is to manufacture the embodiment of the physical machine with a miniature size that is equipped with a user program through the three steps, i.e.: (i) Manufacturing the main mechanical frame structure and assembling the parts of the physical miniature machine, (ii) Integrating the electronic modules and all components and the support system and wiring an embedded system, and (iii) Making a program structure based on Arduino software for the Arduino module. The second objective is to perform the machine driver mechanism through the two operating tests against  (i) manufacturing the main mechanical frame structure and assembling the parts of the physical miniature machine, (ii) integrating the electronic modules and all of the components and the support system and wiring an embedded system, and (iii) making a program structure based on Arduino software for the Arduino module.
(i) manufacturing the main mechanical frame structure and assembling the parts of the physical miniature machine, (ii) integrating the electronic modules and all of the components and the support system and wiring an embedded system, and (iii) making a program structure based on Arduino software for the Arduino module.
integrating the electronic modules and all of the components and the support system and wiring an embedded system integrating the electronic modules and all of the components and the support system and wiring an embedded system are the manufacturing and assembling amount of mechanical and physical, has been done? are the manufacturing and assembling amount of mechanical and physical, has been done? no yes manufacturing the main mechanical frame structure and assembling the parts of the physical miniature machine manufacturing the main mechanical frame structure and assembling the parts of the physical miniature machine stop to perform of the machine driver mechanism to perform of the machine driver mechanism performing of the mini machine driver mechanism are the operating-test of (i) calibration and (ii) movement against the axes of X, Y, and Z performing of the mini machine driver mechanism are the operating-test of (i) calibration and (ii) movement against the axes of X, Y, and Z

III. Results and Discussion
According to the research objectives and supported by the methods of research are obtained the two results of research, namely a) the embodiment of the physical machine with a miniature size that is equipped with a user program and b) the performance of the machine driver mechanism.

A. The Embodiment of the Physical Machine that Equipped with a User Program
The explanations in this subsection are several results related to the first research objective which included the processes for (i) manufacturing the main mechanical frame structure and assembling the parts of the important and main to obtain the physical miniature machine, (ii) integrating the electronic modules and all of the components and support system by wiring to form an embedded system as a mini PCB printing machine, and (iii) making a program structure based on Arduino IDE for the Arduino modules as an embedded system to drive the mini machine mechanism.
1. The mechanical frame structure as a physical miniature machine The mechanical part of this machine frame structure uses the main material is a V slot aluminum profile with dimensions of 20x20 mm. This material is very suitable for use on CNC machines, because the material is light and strong, so it is very supportive for the accuracy of machine work. A view of the three-dimensional main mechanical frame structure is shown in Figure 3.
Based on Fig. 3, it can be explained that the mechanical system consists of 4 parts, namely (i) the first is the base which serves as the basis and also the place for the microcontroller and power supply, (ii) the second is in the form of the Y-axis which functions to move the PCB board forward and backward, (iii) the third is in the form of the X-axis which functions as a mover of the PCB board forward and backward to the right and left, and (iv) the last part is the Z-axis which functions to move the spindle up and down. The spindle is a dc motor as a driving knife for cutting.
2. The electronic modules and all of the components of the electrical support system Integrating the electronic modules and all of the components and support systems consists of three stepper motors, a dc motor as a driving knife for cutting, a switched-mode power supply or voltage regulator as a voltage source, and a CNC shield as a driver for other components. The additional components in the form of a dc fan as a cooling driver, limit switches to limit the movement of all axes or safety, an emergency switch to stop the system if there is a machine mechanism error, also three Elco capacitors of 47 uF/50 V to temporarily store voltage or stabilize the voltage on the limit switch pin so that there is no problem when the voltage is down when the machine is running. A view of the integration of the electronic modules and all of the components and support systems is shown in Figure 4.
Based on Fig. 4, it can be explained that a schematic of electronic and electrical circuits on a mini-PCB printing machine consists of several main and additional components.
The mini-PCB printing machine also comes with the actuator control system which uses a stepper motor with a type A4988 driver for directing the X, Y, and Z axes. The circuit configuration of the microcontroller board, a type of A4988 driver, and a stepper motor are shown in Figure 5.
Based on Fig. 5, it can be explained that the stepper motor driver provides a pulse of 5 Vdc on the pin of 4 with a certain sequence pattern. One particular sequence will move one step (equal to 1.8 degrees, 1.80°). Rotating one full rotation of the stepper motor (equal to 360 degrees, 360°) is done by repeating the one step two hundred times from the following calculation (360°/1.80° = 200 steps) to drive one step, so the pin of 4 must be pulsed in four steps. The step sequence pattern is shown in Table 1. 3. The program structure for the Arduino module based on Arduino IDE Programming the Arduino UNO R3 used the Arduino IDE, which is the default software for the Arduino board using the C programming language. Before defining the algorithm and syntax in writing, it is preceded by providing the raw file which is downloaded directly from the Arduino website for the Arduino module. Three stages related to this programming, namely determinating the algorithm, writing the syntax structure, and compiling and uploading processes from PC to Arduino module. Forming the flow chart is used to the make a model of the algorithms. The flow diagram of the Arduino system programming to operate of the embedded system is shown in Figure 6.
Based on Fig. 6, it can be explained, that the algorithm of system programming consists of several steps to perform the operation of the embedded system. The flowchart of the PCB printing machine operating system is carried out through several stages. GBRL Gru sends the G-Code to the Arduino Uno, if the sensor reads an error then the machine will not run. And if the sensor is in normal condition, or does not read an error, the microcontroller will read the instructions from the G-Code file that has been sent and start controlling the stepper motor on the X, Y, and Z axes to move according to the instructions given to drill and engrave the PCB.
There are six stages of the program structure that covers related to (i) configuration of pins, (ii) variables and constants declaration, (iii) initialization, (iv) main program, (v) retrieve and sending data, and (vi) the output. The flowchart of the steps to anticipate and perform the system programming is shown in Figure 7.
Based on Fig. 7, it can be a determining algorithm  The compilation of the syntax structure is an effort to obtain several source codes as the principal of operating an integrated system based on the microcontroller, then process the uploading is carried out to the Arduino modules using the USB cabling. The schematic diagram of the uploading process is shown in Figure 8.

B. The Axes of X, Y, and Z Calibration and Moving Testing
The results and discussion in this sub-chapter are related to the second research objective on the axes of the X, Y, and Z in an operating test of calibration and operating test of moving.

The axes of X, Y, and Z in operating test of calibration
The axis calibration is done by running the CNC machine at a 10 mm distance, on the computer and seeing the reaction of the CNC machine using a carbon pencil as a marker, a ruler as the first reference, and a digital caliper as a measuring tool. This test was carried out in 6 directions on a CNC machine. The six directions are X(+)-axis, X(-)-axis, Y(+)-axis, Y(-)-axis, Z(+)-axis, and Z(-)-axis. Before performing calibration, it is necessary to know the initial parameter values of each axis of the GRBL. How to perform the calibration is as follows: #1) Open the GRBL Gru APP, #2) Ensure the connection of the laptop with the machine control, #3) Type "$$" in the console, #4) Record the initial parameters of the X, Y, and Z axis of the app: $100 = x, steps/mm $101 = y, steps/mm $102 = x, steps/mm #5) Axis movement by entering a value of 100 mm in the GRBL Gru Console, #6) Measure the length of the movement of the axis from the initial position of the pencil carbon to the end position of the pencil carbon of each axis, and #7) Change the parameters of each axis until the length of the movement of the pencil carbon is equal to the input value in the console.
The following are the results of the calibration that has been carried out with the indicated axis movement acceleration value of 2 meters per minute are: (a) Axis X: movement parameter code on GRBL = $100 and initial parameter $100 = 353.333 steps/mm; (b) Axis Y: movement parameter code on GRBL = $101 and initial parameter $101 = 353.330 steps/mm; and (c) Axis Z: movement parameter code on GRBL = $102 and initial parameter $102 = 250.000 steps/mm.
The axes of X, Y, and Z in the operating test of calibration are shown in Table 2.

The axes of X, Y, and Z in operating test of movement
The operating test of this axis movement is done by running the CNC machine with a distance of five and ten mm, on the computer and seeing the reaction of the CNC machine by using a carbon pencil as a marker, a ruler as

no yes
Step verification for Y-axis, has it been done and is it appropriate?

no yes
Stepper motor of X-axis is moved Step verification for X-axis, has it been done and is it appropriate?

no yes
Stepper motor of Z-axis is moved Step verification for Z-axis, has it been done and is it appropriate?  This test is carried out in six directions on a CNC machine, so after the CNC machine runs according to the distance specified in the software, the movement of the stepper motor will stop. The process is carried out on the six axes. The moving directions are: #a) from the starting point to the right is the X(+)-axis and from the starting point to the left is the X(-)-axis; #b) from the starting point in an upward direction is the Y(+)-axis and from the starting point in a downward direction is the Y(-)-axis; and #c) from the bottom to the up is the Z(+)-axis and from the up to the bottom is the Z(-)-axis.
The distance traveled by the stepper motor was carried out ten times. The results of the operating test of movement for the X-axis, Y-axis, and Z-axis is shown in Table 3.
Based on Table 3, it can be explained, that all experiments/data on each axis with ten experiments each, can be averaged so as to produce the accuracy value of the error value. The following is the calculation of the average error value of all experiments. So to calculate the error from all the data as follow: So, from the measurements above, the data obtained shows that this automatic PCB printing CNC machine has a distance accuracy of 98.9% with an error value of 1.1% (target error value smaller than 5%).