17. Machine

Aims

We start to design a 5 axis machine base on SPML machine.

repo link

3D CAD Design

I started the design by making a parametric configuration of mechanical parts to get a better overall sense of the machine and have some visual understanding of axis range of movement. After that I start to place the actual geometry of the parts and design a raping for the system.

Fig-1: The mechanical parts
Fig-2: The Body overall
Fig-3: The body with the component placement
Fig04: The body side view

Extra Axes

After finishing the frame of the machine I have realized that my extra axes design include a axes same as the spindle. So that axes would not be that much help to the system. Therefor, I had to redesign that part.

Fig-1: The overall two axes add on base in perspective
Fig-2: the extra axes from side
Fig-3: two axes system from the top
Fig04: Extra axes base plate
Fig05: Connection between first axes to second
Fig06: Material base connection to the base

3D models

Fabrication and assembly

The fabrication of this machine involves laser cutting and 3printing. the laser cutting file prepared to be cut on the acrylic. In the design considered to assemble the pieces with three screw in each edge to make it stable and rigid. the only problem that I faced was the limit sensor position on each axes. the problem was that the screw size that we had in the inventory was not fitting in the spacing that I had considered. To fixing that I had to use small drill and make hole for screws.

Fig-1: The final assembled frame
Fig-2: install axes to the frame
Fig-3: closing the back of the frame
Fig-1: The final assembled machine
Fig-2: The final assembled machine
Fig-3: The final assembled machine

Extra axes fabrication

I used 3d printing technique to fabricate the extra axes. I have used FDM with PLA material. The thickness layer of the prints was 0.15 and the temperature was around 210C. It happened 2 times that the prints failed at the end. I do not have a image but seems that bed loosing temperature and the layers at the end are not getting attach to the piece. The post process for each pieces consist of hole making for screws with 2.5 and 3 mm drill bit and sanding. there is a problem that I am facing now for connector piece as shaft coupler. It is not keeping the shaft tight and the pieces start breaking. I will need to 3dprint this part with SLA printer.

Fig-1: The place for stepper on extra axes base
Fig-2: The connection of the base to the rail in Y axes
Fig-3: Overall view to the back of the base
Fig-4: The hole for connection the base to the Y axes
Fig-5: Overall view to the front of the base
Fig-6: perspective of the piece
Fig-7: The base assembled on Y axe
Fig-8: Motor mounted on the base
Fig-9: Motor connection to the base
Fig-10: overall view to the base mounted
Fig-11: The base connection to the Y-axe

Fig-12: The second axes
Fig-13: mounted motor on second axes
Fig-14: Motor connection to the first extra axe
Fig-15: the second axes holder and the shaft coupler connector
Fig-16: the shaft coupler connection to the second axe motor holder
Fig-17: Motor holder on the 3d printer
Fig-18: shaft coupler screw for tightening
Fig-19: shaft coupler installed
Fig-20: coupler connection to the stepper

Extra axes update

I had problem with shaft coupler so I used the SLA technique to print this particular part. Also I update the design with one screw from side. also made the holes a bit tighter.

SLA printing

I have used Chitubox for slicing the geometry for the anyCubic Photon S. The process was very simple and fast for making the file ready. First I import the geometry. then I changed the orientation of its plane so I could add the supports. In the next step I used auto-generative support to add supports. But you can also edit them manually. Later on I set the setting of the slicer for the Photon s machine and base on the resin, select the specification for the light exposure. After slicing you can save the file in photon format and printed on the machine.

Fig-21: Open the Chitubox and import the geometry
Fig-22: Rotating the geometry to align it for adding supports
Fig-23: supports panel with options to add the support manually or generate them with different density. If your piece is heavy you need to add more support to hold it on the platform.
Fig-24: generated support for the geometry with medium density
Fig-25: selecting the anyCubic photon S as the machine
Fig-26: Add the light exposure time and speed for the green resin that I was using
Fig-27: Slicing the geometry and export the file for printing

SLA Post process

SLA Process is very easy at the beginning but it will get mess at the end! :)) Make sure during all these processes ware gloves and cover the surfaces that you make touch. So After 5hr the print finished. I removed the platform from its stand. after removing my piece form the platform I put it in a ultrasonic cleaner for about 20 min. After that I pas it through the alcohol baths. At the end I placed the piece in the UVB chamber to pas las process of curing of the resin.

Fig-28: SLA post process you can see the ultrasonic cleaner in the left and the alcohol bath in the right side of the image

Final printed piece

Fig-29: Final piece
Fig-30: Final piece
Fig-31: Final piece

SPML5X Shield

I based my design on the main board that has developed for SPML. After going through the design of that board Which was a bit overwhelming. I start modifying the initial design to fit the extra drivers on the shield. After checking the available IO pins in ESP32 and compare it to the design that I already had, I realized that I need to remove couple of unnecessary pins in order to address the 2 extra drivers that I am adding. In total By adding this to extra axis I needed 2 pins for the driving the motors for each of them and 2 pins for checking the limitation sensors which sum up to 6 pins.

removed pins:
  • Probe
  • Flood
  • Hold
  • Door
  • Mist
  • Spindle_Ena
Added pins:
  • A_Dir
  • A_Step
  • C_Step
  • C_Dir
  • A_limit _ C_limit
Fig-1: schematic of CNC shield
Fig-2: PCB traces and footprint
Fig-3: the 3d model of the PCB

After consulting with the instructors they told me that they ordered the PCBs. So I needed to design and extension for the shield.

Fig-1: schematic of extra board for 4&5 axis
Fig-2: PCB traces and footprint of extra axis board
Fig-3: PCB board for extra axes after milling
Fig-4: PCB board for extra axes cleaned up
Fig-5: PCB board for extra axes with component soldered on
Fig-6: PCB board for extra axes close up (showing of the soldering)
Fig-7: PCB board for extra axes perspective showing the power connector
Fig-8: PCB board for extra axes with stepper dreiver installed

Barduino and SMPL shield

Also I needed to solder a Barduino2.0 and CNC shield that they have ordered. Was very long soldering session. After gathering all the components, I start the soldering from Barduino. As always ESP32 and Ft230xs was the hardest component to add. Mini USB also was quite challenging. After first check I found a small short between mini-usb legs. another challenging of soldering this board was making sure that the terminal legs are straight. On the shield, I start the soldering from the back since it has smaller components and it will not disturb the soldering on the other face. the other side was mostly terminals. you can check the final image of components

Fig-1: Barduino2.0
Fig-2: CNC shield
Fig-3: Bake of the CNC shield
Fig-4: Barduino2.0 and its CNC shield before installation
Fig-5: CNC shield after inserting Barduino2.0

modification on CNC shield

During assemble I have realized that there is no out terminal for the step enable. well now there is! So I solder a wire directly to the board.

Fig-6: take a wire out of GPIO-9 which is the step enable pin

grbl Firmware

I start reading the codes grbl to get a better understanding for machines. It sound ridicules but it helped me a lot to realize the architecture of system. Now I know where should I modify and where I should not touch.

I am using grbl32 firmware which has been modified for the ESP32 processor. In general grbl lib which developed for Arduino boards there is cpu_map.h where you can modify the IO ports adjust it to your machine. However in the grbl32 there is a folder called machines where you can open a specific file for your machine and define the pins and soft-limits. the other difference is the wifi configuration files which has been added in case of ESP32.

Also most of the file are pairs one file is the code and the other is a set of direction for compiling the code.

Fig-1: grbl files
Fig-2: wi-fi configuration file

After these analysis I made a spml5x.h file in the machines directory and add the name of the machine to the machine.h file.

spml5x.h
#define MACHINE_NAME            "SixPackMachineLab5X"

#define X_STEP_PIN              GPIO_NUM_12
#define X_DIRECTION_PIN         GPIO_NUM_14
#define Y_STEP_PIN              GPIO_NUM_27
#define Y_DIRECTION_PIN         GPIO_NUM_26
#define Z_STEP_PIN              GPIO_NUM_33
#define Z_DIRECTION_PIN         GPIO_NUM_32
#define A_STEP_PIN              GPIO_NUM_8
#define A_DIRECTION_PIN         GPIO_NUM_15
#define C_STEP_PIN              GPIO_NUM_36
#define C_DIRECTION_PIN         GPIO_NUM_39

#define LIMIT_MASK              B111
#define X_LIMIT_PIN             GPIO_NUM_17
#define Y_LIMIT_PIN             GPIO_NUM_16
#define Z_LIMIT_PIN             GPIO_NUM_23
#define A_LIMIT_PIN             GPIO_NUM_22
#define C_LIMIT_PIN             GPIO_NUM_21

// OK to comment out to use pin for other features
#define STEPPERS_DISABLE_PIN    GPIO_NUM_25

#define SPINDLE_PWM_PIN         GPIO_NUM_2   // labeled SpinPWM
//#define SPINDLE_ENABLE_PIN      GPIO_NUM_22  // labeled SpinEnbl
//#define MIST_PIN                GPIO_NUM_21  // labeled Mist
//#define FLOOD_PIN               GPIO_NUM_8  // labeled Flood
//#define PROBE_PIN               GPIO_NUM_15  // labeled Probe

#define CONTROL_SAFETY_DOOR_PIN GPIO_NUM_39  // labeled Door,  needs external pullup
#define CONTROL_RESET_PIN       GPIO_NUM_35  // labeled Reset, needs external pullup
#define CONTROL_FEED_HOLD_PIN   GPIO_NUM_36  // labeled Hold,  needs external pullup
#define CONTROL_CYCLE_START_PIN GPIO_NUM_34  // labeled Start, needs external pullup


#define DEFAULT_SOFT_LIMIT_ENABLE 0 // false
#define DEFAULT_HARD_LIMIT_ENABLE 0  // false

// Softlimit

#define DEFAULT_X_MAX_TRAVEL 200.0 // mm NOTE: Must be a positive value.
#define DEFAULT_Y_MAX_TRAVEL 200.0 // mm NOTE: Must be a positive value.
#define DEFAULT_Z_MAX_TRAVEL 100.0 // mm NOTE: Must be a positive value.
#define DEFAULT_A_MAX_TRAVEL 100.0 // mm NOTE: Must be a positive value.
#define DEFAULT_C_MAX_TRAVEL 100.0 // mm NOTE: Must be a positive

here because of pin limitation I removed the accessories such as mist, flood, door, and spindle enable pin to assign them to the extra axis that has been added to spml.

ESP32-grbl Firmware Update

I recently check the ESP-GRBL repo and realized that hey published a new version with more support for up to 6 axes machines. Also there was a huge update on the file organization system. So I decided to update my firmware to the new version. As previous version the I needed to add my machine specific pin out to the machine file. The only update was that I need to define the number of the axes in here.

#define MACHINE_NAME            "spml5x"

#ifdef N_AXIS
#    undef N_AXIS
#endif
#define N_AXIS 4

#define X_STEP_PIN              GPIO_NUM_12
#define X_DIRECTION_PIN         GPIO_NUM_14
#define Y_STEP_PIN              GPIO_NUM_27
#define Y_DIRECTION_PIN         GPIO_NUM_26
#define Z_STEP_PIN              GPIO_NUM_33
#define Z_DIRECTION_PIN         GPIO_NUM_32
//#define A_STEP_PIN              GPIO_NUM_8
//#define A_DIRECTION_PIN         GPIO_NUM_21
#define C_STEP_PIN              GPIO_NUM_36
#define C_DIRECTION_PIN         GPIO_NUM_39

#define LIMIT_MASK              B111
#define X_LIMIT_PIN             GPIO_NUM_17
#define Y_LIMIT_PIN             GPIO_NUM_16
#define Z_LIMIT_PIN             GPIO_NUM_4
//#define A_LIMIT_PIN             GPIO_NUM_22
//#define C_LIMIT_PIN             GPIO_NUM_21

// OK to comment out to use pin for other features
#define STEPPERS_DISABLE_PIN    GPIO_NUM_25

#define SPINDLE_PWM_PIN         GPIO_NUM_2   // labeled SpinPWM
//#define SPINDLE_ENABLE_PIN      GPIO_NUM_22  // labeled SpinEnbl
//#define MIST_PIN                GPIO_NUM_21  // labeled Mist
//#define FLOOD_PIN               GPIO_NUM_8  // labeled Flood
//#define PROBE_PIN               GPIO_NUM_15  // labeled Probe

//#define CONTROL_SAFETY_DOOR_PIN GPIO_NUM_39  // labeled Door,  needs external pullup
#define CONTROL_RESET_PIN       GPIO_NUM_35  // labeled Reset, needs external pullup
//#define CONTROL_FEED_HOLD_PIN   GPIO_NUM_36  // labeled Hold,  needs external pullup
#define CONTROL_CYCLE_START_PIN GPIO_NUM_34  // labeled Start, needs external pullup


#define DEFAULT_SOFT_LIMIT_ENABLE 0 // false
#define DEFAULT_HARD_LIMIT_ENABLE 0  // false

// Softlimit

#define DEFAULT_X_MAX_TRAVEL 200.0 // mm NOTE: Must be a positive value.
#define DEFAULT_Y_MAX_TRAVEL 200.0 // mm NOTE: Must be a positive value.
#define DEFAULT_Z_MAX_TRAVEL 100.0 // mm NOTE: Must be a positive value.
#define DEFAULT_A_MAX_TRAVEL 100.0 // mm NOTE: Must be a positive value.
#define DEFAULT_C_MAX_TRAVEL 100.0 // mm NOTE: Must be a positive value.

As you can see in the code I had to comment out one of my axes. Apparently ESP32 has a problem to use GPIO_8 and GPIO_15. because when I had these two active the board was constantly resetting.

Video

you can find the video of working prototype here.

vid-1: Moving axes in the frist prototype
vid-4: Testing the extra axes before mounting
vid-2: Moving axes after upgrading GRBL
vid-3: Interface of the CNC Web-UI
vid-5: Running the file from the SD memory
vid-6: Running the file from the SD memory

Conclusion and future works

It was an amazing experince to build the machien for sure there are so many aspect need to take in consideration. from mechanical point of view to electronic and programming all of this skills getting involve. For the future I think I would change the stepper for extra axes with servo motor since it is easier to operate. It does not need an extra board. Also it would be much more stronger then stepper motor in this scale.

files

All the design and fabrication file are available here.