INTRODUCTION TO HOW TO CUSTOMIZE CNC CONTROL SOFTWARE NAMED MACH3 TO CONTROL 3D PRINTER WHICH HAS LINEAR EXTRUDING MOTION
written by Junghoon LEE
written in March 2019
Generally 3D printer on the shelf is controlled by embedded software supplied by the manufacturer. But when a maker is trying to set up a 3D printer by herself, it is definitely not an easy task to develop or write a software and firmware to control the printer, though assembling parts of the printer could be rather easy.
I first was planning to make a 3D printer by myself from top to bottom, which requires designing and assembling motor drivers, logic board, firmware, software and hardware. But under the time constraint, I had to find a other way around. I adopted different approach to overcome my limitations on the project, by utilizing pre-built systems such as a machine with 2 axis of linear motion implementing a belt driven system, microcontroller(arduino MEGA2560) with an add-on interface(ramps 1.4), all-in-one controller(stm32f103 based CNC controller), stepper motor driver(based on a TB6600 IC), ect. Hereunder, I summarized a short essay about how I could utilize pre-existing tools for completing controller of a multi-axis machine.
II. Setting Up a 3D Printer
After assembling mechanical parts of the multi-axis machine, such as moving axis, stepper motors, setting the right amount of tension to the belts, aligning the aluminium profiles, now I was ready to wire the motor and drivers with the corresponding connections. At first, I tried an arduino mega 2560 with TB6600 motor drivers, in order to control the printer. However, the ramps board did not show the direction, step, enable pins populated on the board. By having a look at the schematic of the ramps PCB and some searching of the code that is for the marlin firmware, I matched all the needed connections and soldered wire to the corresponding pins.
There are several advantages in using the external stepper motor driver(with a big heat sink) instead of small integrated drivers that plugs on to the controller board. The external motor driver is powerful enough to run all motors of a 3D printer, unlike a small integrated stepper that over heats which causing shortening the overall lifespan of the driver. Furthermore, current setting and micro stepping of a motor can be easily performed via hardware switch that is also helpful for troubleshooting.
The software that I used was Marlin firmware for the arduino and Pronterface software for PC to control the printer. For the mechanical part, I used a XY axis platform, which requires one motor for the x-axis and two motor for the y-axis. For the z-axis, that is an extruder, I used a lead screw driven by sliding axis that is c-shaped aluminum profile.
I programmed the arduino with the Marlin firmware and downloaded the Pronterface software on my PC. I connected my arduino board with the Pronterface software via USB. After selecting the proper baud rate to make the arduino and Pronterface software for the PC to communicate to each other, I was able to connect the arduino to my PC.
Next, I tried to test the printer by moving all the axis by entering commanding order in my PC, in order to make sure all the axis were moving to direction ordered. In order for the test being performed properly, it was required that the printer must have the same measurement as Pronterface software of PC does. Accordingly I made some modifications of the measurement to the Marrlin firmware of the arduino and stepper drivers, after calculating such measurement.
To make sure that the printer run as coordinated by a command, I did some G-code work. After making a test image and converting into G-code, I loaded the code to the PC to check that it work properly. However, it did not work as what I intended. After frantic search for a solution to the problem, I could find out the cause...Read more »