142 78 47MB
English Pages 170 Year 2022
books books
books
Plot, Cut, Drill, Mill, and Laser with the Z99 This book covers the construction, hardware, software, and operation of the Z99 - CNC machine. This is a multifunctional 4-axis machine for home construction. The capabilities of the Z99 machine include: • large-format schematic plotting • PCB plotting with etch-resist pens • schematic plotting with conductive-ink pens • letter cutting out of vinyl • paper cutting • PCB/substrate drilling • PCB/substrate milling • text milling • laser engraving • laser cutting of solder paste masks
José Ganseman, MD. (1951) was occupied as a General Practitioner for 35 years. He is a passionate, lifelong electronics hobbyist and software programmer in several languages. He is also an Elektor reader from the seventies on. After his retirement in 2010 he decided to build a multifunctional machine for personal use. The machine can be used for several tasks like plotting, cutting, milling, and laser etching/cutting.
By making the support software available as freeware, readers of the book are challenged and encouraged to develop new applications for the Z99. The machine would not be of much use if the user has no option to create suitable files for the designs in mind. A large part of this book is dedicated to creating source files in a variety of freeware software packages, including Inkscape, DesignSpark PCB, KiCad, and FlatCAM. The book is also useful for readers keen to comprehend and then master the basic structure of HPGL, Gerber, Drill, and G-code files, as well as to have a go at deciphering them using software.
Elektor International Media BV www.elektor.com
Build Your Own 4-Axis Multifunctional CNC Machine • José Ganseman
Build Your Own 4-Axis Multifunctional CNC Machine
Build Your Own 4-Axis Multifunctional CNC Machine Plot, Cut, Drill, Mill, and Laser with the Z99
José Ganseman
Cover Build Your Own 4-Axis Multifunctional CNC Machine_v01.indd Alle pagina's
27-10-2022 17:14
Build Your Own Multifunctional 4-Axis CNC Machine Plot, Cut, Drill, Mill and Laser with the Z99
● José Ganseman
Boek - Build Your Own Multifunctional 4 Axis Machine_converted.indd 3
28/10/2022 11:40
● This is an Elektor Publication. Elektor is the media brand of Elektor International Media B.V.
PO Box 11, NL-6114-ZG Susteren, The Netherlands Phone: +31 46 4389444
● All rights reserved. No part of this book may be reproduced in any material form, including photocopying, or
storing in any medium by electronic means and whether or not transiently or incidentally to some other use of this publication, without the written permission of the copyright holder except in accordance with the provisions of the Copyright Designs and Patents Act 1988 or under the terms of a licence issued by the Copyright Licencing Agency Ltd., 90 Tottenham Court Road, London, England W1P 9HE. Applications for the copyright holder's permission to reproduce any part of the publication should be addressed to the publishers.
● Declaration
The Author and Publisher have used their best efforts in ensuring the correctness of the information contained in this book. They do not assume, and hereby disclaim, any liability to any party for any loss or damage caused by errors or omissions in this book, whether such errors or omissions result from negligence, accident, or any other cause. All the programs given in the book are Copyright of the Author and Elektor International Media. These programs may only be used for educational purposes. Written permission from the Author or Elektor must be obtained before any of these programs can be used for commercial purposes.
● British Library Cataloguing in Publication Data
A catalogue record for this book is available from the British Library
● ISBN 978-3-89576-527-8 ISBN 978-3-89576-528-5
Print eBook
● © Copyright 2022: Elektor International Media B.V. Editor: David Reid
Prepress Production: D-Vision, Julian van den Berg
Elektor is part of EIM, the world's leading source of essential technical information and electronics products for pro engineers, electronics designers, and the companies seeking to engage them. Each day, our international team develops and delivers high-quality content - via a variety of media channels (including magazines, video, digital media, and social media) in several languages - relating to electronics design and DIY electronics. www.elektormagazine.com
●4
Boek - Build Your Own Multifunctional 4 Axis Machine_converted.indd 4
28/10/2022 11:40
Contents
Contents Preface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8 Unlimited safety pages . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10 Chapter 1 • Installation (Windows 10 or 11) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12 Chapter 2 • The X2Y4Z Printed Circuit Board . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17 2.1 Schematic design X2Y4Z.sch in KiCad . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18 2.2 X2Y4Z PCB Top and silkcreen . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19 2.3 Component list X2Y4Z PCB for Z99 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19 2.4 X2Y4Z bipolar steppers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26 2.5 Stepper bipolar driver modules . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28 2.6 Unipolar stepper for solder paste dispensing . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30 2.7 The PIC microcontroller code . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33 2.8 Programming the PIC. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37 2.8.1 Programming the PIC with MikroE programmer . . . . . . . . . . . . . . . . . . . . . . . . 37 2.8.2 Programming the PIC with Pickit3 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38 Chapter 3 • Design and 3D printing settings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41 3.1 Designing the 3D parts. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41 3.2 Setup of Slic3r . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42 3.2.1 Print settings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42 3.2.2 Filament settings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44 3.2.3 ‘Printer Settings’ – ‘Extruder 1’ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45 3.3 Make G-code files with Slic3r . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46 Chapter 4 • Hardware parts Z99 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48 4.1 Tools you need for construction and operation. . . . . . . . . . . . . . . . . . . . . . . . . . . 48 4.2 Skeleton . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48 4.3 Core parts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50 4.4 Summary hardware parts Z99. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53 Chapter 5 • Construction Z99. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55 5.1 Skeleton construction. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55 5.1.1 Table top version . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55 5.1.2 Finish the MDF bottom side . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 57 5.1.3 Mounting the fan and the PCB . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 57
●5
Boek - Build Your Own Multifunctional 4 Axis Machine_converted.indd 5
28/10/2022 11:40
Build Your Own Multifunctional 4-Axis CNC Machine 5.2.1 Stand-alone version . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 59 5.3 Longer X shafts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 60 5.4 Overview of 3D parts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 60 5.5 Assembly of the corner pieces. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61 5.6 Assembly of X axis terminals . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63 5.7 Assembly of right and left Y axis . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 64 5.8 Assembly of Z carriage. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 66 5.9 Putting the skeleton together . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 67 5.10 Possible elevation of the four corner pieces . . . . . . . . . . . . . . . . . . . . . . . . . . . . 68 Chapter 6 • The Z carriages . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 70 6.1 Assembly of a laser module without Z motor. . . . . . . . . . . . . . . . . . . . . . . . . . . . 70 6.2 Assembly of a laser module with Z motor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 74 6.3 Assembly of plotter and cutter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 77 6.4 Assembly of drill and mill . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 80 6.5 Assembly of solder paste dispenser . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 82 Chapter 7 • Z99 dedicated to drilling and milling . . . . . . . . . . . . . . . . . . . . . . . . . . 85 7.1 Fixing for drilling or milling . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 85 7.2 Add suction to mill and drill . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 87 Chapter 8 • C Sharp source code . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 90 8.1 Overview of the code . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 90 8.2 Dedicated class for serial communication . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 90 Chapter 9 • Working with XYZ.exe. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 96 9.1 Main menu
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 96
9.2 Setup . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 97 9.3 Command mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 98 9.4 Draw . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 101 9.5 Plotter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 103 9.5.1 Plot a large format schematic design. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 105 9.5.2 Plot a PCB with etch resist pen . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 107 9.5.3 Plot a PCB with conductive ink pen . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 108 9.5.4 Engraving with the laser . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 110 9.6 Using the Cutter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 112 9.6.1 Cutting vinyl . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 114
●6
Boek - Build Your Own Multifunctional 4 Axis Machine_converted.indd 6
28/10/2022 11:40
Contents 9.6.2 Cutting with laser . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 114 9.7 Drilling holes with the drill . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 115 9.8 Solder paste dispensing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 117 9.9 Milling . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 121 9.9.1 Milling a PCB . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 121 9.9.2 Laser ‘milling’ a solder paste mask . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 122 9.9.3 Milling, cutting text with laser . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 125 Chapter 10 • Creating source files for the Z99 . . . . . . . . . . . . . . . . . . . . . . . . . . . 127 10.1 Inkscape – design your letters to plot or cut . . . . . . . . . . . . . . . . . . . . . . . . . . 127 10.2 DesignSpark PCB (DS) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 132 10.2.1 Plot a PCB with etch free ink or conductive ink . . . . . . . . . . . . . . . . . . . . . . . 132 10.2.2 Create a solder paste mask file (*.gbr) in DS . . . . . . . . . . . . . . . . . . . . . . . . 134 10.2.3 Create a copper Gerber file in DesignSpark PCB . . . . . . . . . . . . . . . . . . . . . . 135 10.2.4 Create a drill file (*.drl) in DesignSpark PCB. . . . . . . . . . . . . . . . . . . . . . . . . 137 10.2.5 Create a Gerber text file in DesignSpark PCB . . . . . . . . . . . . . . . . . . . . . . . . 139 10.3 KiCad . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 140 10.3.1 Plot a large format schematic . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 140 10.3.2 Create a Gerber solder paste mask file in KiCad . . . . . . . . . . . . . . . . . . . . . . 142 10.3.3 Create a Gerber copper file in KiCad . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 143 10.3.4 Create a drill file in KiCad. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 143 10.3.5 Create a Gerber text file in KiCad . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 144 10.4 FlatCAM - Convert Gerber to G-code files . . . . . . . . . . . . . . . . . . . . . . . . . . . . 146 10.4.1 How to create a G-code file for milling a PCB . . . . . . . . . . . . . . . . . . . . . . . . 146 10.4.2 FlatCAM. Create a solder paste mask. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 149 10.4.3 FlatCAM. Create G-code text files for plotting, cutting, or milling text . . . . . . . 152 Chapter 11 • File formats accepted by XYZ.EXE . . . . . . . . . . . . . . . . . . . . . . . . . . 154 11.1 HPGL language . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 154 11.2 Drill files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 155 11.3 Gerber files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 156 11.4 G-code files. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 159 Appendix . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 161 Index . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 170
●7
Boek - Build Your Own Multifunctional 4 Axis Machine_converted.indd 7
28/10/2022 11:40
Build Your Own Multifunctional 4-Axis CNC Machine
Preface Our goal was to build a multifunctional 4-axis machine. From idea to successful operation took quite some time. We will not bore you with the description of all the failed prototypes we have built. Several times we had an apparatus that worked well, but was rather difficult to build and even more difficult to explain how to build it. Repeatedly, we re-started from scratch. Finally, we dare to say now that everybody who can drill a hole in an MDF baseplate can construct the Z99. Some examples for using are: • • • • • • • • • •
Drawing on screen and large format plot output, up to A3+. Plot a PCB with etch resist ink. Plot a circuit with conductive ink. Plot a large format poster. Cut vinyl letters. Cut paper. Drill holes. Mill a PCB. Engrave, cut and make a solder pad masks with a laser. …
Most of the components stay the same for all functions. Two main factors contributed to the success of creating a precision apparatus: • 3D printer Ordinary people, like the author, are now able to build complex 3D parts at home. A few years ago, we could only dream of this possibility. Just as important is the advent of advanced free 3D creation software like OpenSCAD (www.openscad.org). • Spare parts for 3D printer Not only are 3D printers widespread now, but also all the parts to build them. All the construction parts are available on various websites like eBay or AliExpress and many others. There are no hard to get or very expensive parts used in this project. Most of the parts are also used in 3D printers. About the name Z99 All the options use the same XY mechanism. The only component with some differences is the Z carriage. Previous names we thought of were Z3, Z4, Z5... However, the number of possibilities is not yet exhausted, hence the name Z99.
●8
Boek - Build Your Own Multifunctional 4 Axis Machine_converted.indd 8
28/10/2022 11:40
Preface
Perhaps the number 99 is also close to the number of prototypes we have built. How long does it take to build the machine from scratch? The mechanical build of the machine takes most people less than half a day. However, printing of all 3D PLA parts can take several days depending on the type and size of your 3D printer. How much will it cost? According to the capabilities and options you require, it is much cheaper than an equivalent commercial machine. A lot will depend on the basic parts you already have at home and the place where you buy them. Reading this manual Several components collaborate closely for successful operation, the Windows PC software, the electronics and microcontroller code, 3D parts, motors, and constrction. We follow this order: • • • • • • •
Installation of the software and source files. Electronics, PCB, stepper motors and drivers and microcontroller code. Printing the 3D parts. Mechanical construction. The PC software code, using the Z99 as a plotter, cutter, solder paste dispenser, Drilling and milling machine. Creating source files for working with the Z99.
Before starting to build, it is wise to quickly read through the entire manual. Afterwards start thoroughly with the beginning and go step by step through the manual. If you don’t understand something in one section, it will probably become clearer in a later chapter. We wish that you will have as much joy building and using the Z99 as we had in developing it!
●9
Boek - Build Your Own Multifunctional 4 Axis Machine_converted.indd 9
28/10/2022 11:40
Build Your Own Multifunctional 4-Axis CNC Machine
Unlimited safety pages
DC power supply 3 Ampere – 30 Volt - Use only a fused power supply with a quality label. Ear protection - Use protective headphone on all noisy construction and operation. Eye protection - Wear safety glasses when drilling, cutting and all dusting activities. Heat injury - Never touch the nozzle of a 3D printer. - The same remark applies for soldering and hot air gun. Dust and fume extraction - Milling and drilling can produce a lot of dust. - Use appropriate dust suction. - Wear a quality safety mask. - Vinyl cutting with laser can produce toxic fumes: use fume extraction and filtering. Even better is to do it outside or not. Mechanical - The 6 X and Y stepper motors are strong and quick. Stay out of reach during operation, - Do not wear lossy clothes. Keep visitors out of reach. Turn power off during maintenance. Laser
● 10
Boek - Build Your Own Multifunctional 4 Axis Machine_converted.indd 10
28/10/2022 11:40
Unlimited safety pages
-
Read the safety instructions that come with your device. Work only with a weak 500 mW blue laser. Do not turn on laser if it is not properly mounted with ray directed downwards. Never use on reflective surfaces, glossy paper, glossy vinyl, copper or other reflective metal surfaces. Reflected laser rays are dangerous. A weak laser doesn’t work on glossy or white surfaces. The laser itself could be destroyed by the reflections. Wear always protection glasses of decent quality. Do not allow anybody else to enter the room during laser operation. Keep fire extinguisher at hand.
Remark The Z99 apparatus as described here has no CE or EMC qualifications. Personal use is allowed. Commercial use is not allowed.
● 11
Boek - Build Your Own Multifunctional 4 Axis Machine_converted.indd 11
28/10/2022 11:40
Build Your Own Multifunctional 4-Axis CNC Machine
Chapter 1 • Installation (Windows 10 or 11) All code is provided as a zip file, InstallZ99.zip. The download file is available on the Elektor website https://www.elektor.com. An alternative download is available at GitHub https://github.com/opaJG/Z99. Click on the green button 'Code' and download the file InstallZ99.zip.
Save the zip (InstallZ99.zip) to any directory on your hard disk. Right-click on it and select extract all.
Select as extraction directory C:\Z99.
There is only one file extracted with name C\Z99\InstallZ99.exe. Right-click on it. Select properties and verify the digital certificate.
● 12
Boek - Build Your Own Multifunctional 4 Axis Machine_converted.indd 12
28/10/2022 11:40
Chapter 1 • Installation (Windows 10 or 11)
The installation is straight forward. Double click on C\Z99\InstallZ99.exe. Select ‘Next’
Install in directory C:\Z99.
Installation to any other directory is possible.
Select “create a shortcut” in Start Menu and Desktop.
● 13
Boek - Build Your Own Multifunctional 4 Axis Machine_converted.indd 13
28/10/2022 11:40
Build Your Own Multifunctional 4-Axis CNC Machine
By creating a Desktop shortcut, the Z99 icon is placed on your desktop. When the installation is finished, you may launch XYZ.exe but it is probably better to wait until your Z99 is built and you have learned to work with the software.
Open ‘Windows Explorer’ and have a look in the C:\Z99 directory.
There are seven subdirectories • 3Dparts: Contains all the 3D parts: See chapter 3. • CSharpCode: The C# source code for Visual Studio. See chapter 7. • DemoFiles: HPGL, Gerber, Drill, Gerber, and G-code files. See chapter 8. • MikrocontrollerCode: PIC microcontroller code and Z99.hex file. See chapter 2. • PCB_LayoutAndSchematicDesign: Contains the drawing and PCB layout. See chapter 2. • WindowsSoftware: XYZ.exe: Contains the PC software. See chapter 8. Some of the subdirectories contain subdirectories.
● 14
Boek - Build Your Own Multifunctional 4 Axis Machine_converted.indd 14
28/10/2022 11:40
Chapter 1 • Installation (Windows 10 or 11)
Subdirectories of C:\Z99\3DParts
A. B.
C.
ScadSourceCode: The *.scad source code for all 3D components. STL: The stereo lithographic files, made with A. When you have no 3D printer and need to send the files to a 3D printing firm, these are the files they need so they can print the parts for you. G-code: This directory is empty. G-code files are printer dependent. We will explain later how to generate them from the *.stl files.
Subdirectories of C:\Z99\DemoFiles
• Dispenser: *.disp files for solder paste dispensing. • Drill: *.drl files to drill. • G-code: *.gcode files to mill text or PCB. G-code files are made from Gerber files by means of FlatCAM. This is explained in chapter 9. • Gerber: *.gbr files made with a PCB design program. • HPGL: *.hpgl or *.plt files for plotter or cutter. Subdirectory C:\Z99\CSharpCode After registration, Visual Studio is free and available from the Microsoft website: https://visualstudio.microsoft.com/downloads/ The software was created with Visual Studio 2015, later tested also with Visual Studio 2019 and Visual Studio 2022. If you are not familiar with C# or Visual Studio there is an informative book that will set you on track in no time: C# Programming for Windows and Android from John Allwork
● 15
Boek - Build Your Own Multifunctional 4 Axis Machine_converted.indd 15
28/10/2022 11:40
Build Your Own Multifunctional 4-Axis CNC Machine
The E-Book is available in the Elektor shop. Open C:\Z99\CSharpCode\XYZ.sln with Visual Studio to see all the files. Structure of the software The structure of the software is quite simple. No files are installed in a Windows directory. Installation without the installation program is possible. Moving the software to another PC just requires you to copy the C:\Z99 directory and all its contents to the other PC. If you move Z99 in this manner, without using the installation program, you will get no shortcut on Windows desktop. In Windows explorer, right-click on C:\Z99\WindowsSoftware\XYZ.exe and select ‘Send to desktop’ to create a Desktop icon.
● 16
Boek - Build Your Own Multifunctional 4 Axis Machine_converted.indd 16
28/10/2022 11:40
Chapter 2 • The X2Y4Z Printed Circuit Board
Chapter 2 • The X2Y4Z Printed Circuit Board About the name X2Y4Z X axis is controlled by two bipolar steppers. Y axis is controlled by four bipolar steppers. Z axis is controlled by one bipolar stepper. Why so many XY motors? For XY movement 2 or 3 steppers motors are enough for a common 3D printer with XY dimension of up to 200 mm and linear shafts of 8 mm diameter. Linear shafts of 8 mm are not strong enough for our size of the working area and the heavy workloads like-, drilling and milling. Even 10 mm shafts were not strong enough. Only 12 mm was strong enough. Driving two 12 mm shafts at a reasonable speed with one Nema17 stepper was not very reliable. However, the main reason for the six steppers is that we obtain a higher resolution in the XY plane! Nema17 steppers and drivers are no longer expensive. One Nema23 stepper and suitable driver is still much more expensive then 2 Nema17 steppers! Why is the X2Y4Z PCB not using SMD component? Stepper driver modules and the connectors occupy the most space. All components are easily available as Dual Inline Package (DIP). An SMD PCB wouldn’t be any smaller because the connectors and modules are still the same size. Schematic design and PCB layout were done in DesignSpark PCB 8.0 from RS Components. A download of this powerful PCB design software is available as freeware on the RS Components site: http://www.rs-online.com/designspark/electronics/eng/page/designspark-pcb-home-page After buying and reading the Elektor book ‘KiCad Like a Pro’ from Dr Peter Dalmaris, I also redrew the schematic in KiCad. This software is also available for free from: https://kicad-pcb.org/ We will later show you how it is possible to plot the design on A3+ format. This gives better overview than printing on A4 format.
● 17
Boek - Build Your Own Multifunctional 4 Axis Machine_converted.indd 17
28/10/2022 11:40
Build Your Own Multifunctional 4-Axis CNC Machine
2.1 Schematic design X2Y4Z.sch in KiCad
● 18
Boek - Build Your Own Multifunctional 4 Axis Machine_converted.indd 18
28/10/2022 11:40
Chapter 2 • The X2Y4Z Printed Circuit Board
2.2 X2Y4Z PCB Top and silkcreen ‘Top’ should be readable after manufacturing.
X2Y4Z bottom copper. ‘Bottom’ should be readable after manufacturing.
2.3 Component list X2Y4Z PCB for Z99 Capacitors - C1, C2 - C3 to C29 - C30 to C33 - C34 to C40
22 pF,16 V. Pitch 0.1 inch. 100 nF, 35 volt decoupling capacitors. Pitch 0.1 inch. 100 uF Elco, 16 V. Pitch 0.1 inch or 2.5 mm. 100 uF Elco, 50 V. Pitch 3.5 mm.
● 19
Boek - Build Your Own Multifunctional 4 Axis Machine_converted.indd 19
28/10/2022 11:40
Build Your Own Multifunctional 4-Axis CNC Machine
Resistors - R1 - R2, R3 - R4 to R9 - R10 to R14 Diodes - D1
47 ohm. 390 ohm. 1K ohm. 10 K ohm.
- D2 - D3 at D15
Diode 3 ampere UF5400, UF5401 or similar in D0-201 package. Protection against reverse DC power supply connection. Diode 1 A, 1N4004 or similar in D0-41 package. Diodes 1N4148.
IC’s - IC1 - IC2 - IC3
7805, +5 V regulator with cooling fin T0-220 or a switching regulator. 7812, +12 V regulator. PIC18F45KXX microcontroller 40 pins DIP version.
Originally this was a PIC18F45K22. Actually (2022), due to the global chip shortage, most suppliers have it not in stock. Alternatives are PIC18F45K40 and PIC18F45K42. Both IC’s are available. In the download - IC4 - IC5, IC6 - IC7
are hex files for all of the three IC’s. HEF4093 Schmitt trigger inverter DIP version. Optocouplers 6N136. ULN2803, 5 V DIP version.
Miscellaneous - X1 - M1 at M7. - Male headers - Female headers
Crystal 14.7456 MHz. Seven DRV8825 stepper modules. 60 pins. 8 pins, 14 pieces for mounting of the DRV8825 modules.
Make sure to mount the headers parallel, otherwise insertion of the modules is cumbersome. You need 1 socket 40pins, 1 socket 18 pins, 1 socket 14 pins and 2 sockets 8 pins. Connectors (Cn) Cn1. Connect to DC power supply (12-30) V, 2 A or more. Search for “removable screw terminal block with pitch 0.2 inch” (5.08 mm). Two poles Straight and rectangular types are both OK. Below is a rectangular type.
● 20
Boek - Build Your Own Multifunctional 4 Axis Machine_converted.indd 20
28/10/2022 11:40
Chapter 2 • The X2Y4Z Printed Circuit Board
A: socket, solder on PCB. B: plug, screw the wires into it. C: plug is in socket. Connector ID
Pin Number
Description
Cn1
1
DC Power Supply Voltage(12-30 VDC)
2
DC Power Supply Ground
Cn2. Connect to 5-V TTL FTDI compatible USB-SERIAL cable. Search for removable screw terminal block with pitch 0.15 inch (3.81 mm). Four poles Straight and rectangular types are both OK.
Connector ID
Pin Number
Description
Colour code in case of FTDI cable
Cn2
1
PC RX
yellow
2
PC TX
orange
3
PC Ground
black
4
PC +5 V
red
● 21
Boek - Build Your Own Multifunctional 4 Axis Machine_converted.indd 21
28/10/2022 11:40
Build Your Own Multifunctional 4-Axis CNC Machine
Cn3. Programming header. Five pins male header, pitch 0.1 inch. Connector ID
Pin Number
Description
Cn3
1
+ 5 V PCB
2
PGC pin 39 of PIC
3
PGD pin 40 of PIC
4
MCLR pin 40 of PIC
5
Ground PCB
Cn4.
Two pole male header, 0.1 pitch. Makes reset of the PIC possible without powering on and off. It is not required to mount,
Cn5.
Five pole male header, 0.1 pitch. Connections to the solder paste dispensing motor, 28BYJ-48. Is only necessary if you want to build the solder paste dispenser. Pin 1, +5V for the red wire of ST28.
Cn6.
Connection to laser module. Search for “removable screw terminal block with pitch 0.15 inch” (3.81 mm).
Cn7.
Connector ID
Pin Number
Description
Cn6
1
Laser ON-OFF
2
DC Power Supply Ground
Connection to fan 12 V. Connector ID
Pin Number
Description
Cn7
1
+12 Volt
2
DC Power Supply Ground
Cn8 at Cn13. Six corner switches. Male header 2 pins, pitch 0.1 mm. Pin order has no importance. Switches are normally off and become closed when end position has been reached. Connector ID
Description
Cn8
Z axis top switch
Cn9
Y axis back left switch
Cn10
Y axis back right switch
Cn11
Y axis both front switches parallel
Cn12
X axis left switch
Cn13
X axis right switch
● 22
Boek - Build Your Own Multifunctional 4 Axis Machine_converted.indd 22
28/10/2022 11:40
Chapter 2 • The X2Y4Z Printed Circuit Board
Cn14 at Cn20. Connectors for the bipolar stepper motors. Male headers 4 pins, pitch 0.1 mm. Connector ID
Pin Number
Description
Most used colour code
Cn14 at 20
1
Coil A+
red
2
Coil A-
blue
3
Coil B+
green
4
Coil B-
black
Cn14. Z axis stepper motor. Cn15 and Cn16. Two X steppers. As both X steppers turn the same way, switching connections Cn15-Cn16 is allowed. Cn17 and Cn18. Two left Y steppers. As both left Y steppers turn the same way, switching connections Cn17-Cn18 is allowed. Cn19 and Cn20. Two right Y steppers. As both right Y steppers turn the same way, switching connections Cn19-Cn20 is allowed.
Some details of the components IC3 +5 V regulator. Power supply is 24 to 30 V. When using a linear regulator type 7805, about 25 V x 0.1 A = 2.5 Watt cooling is necessary. There is room on the PCB for a large T0-220 cooling fin. However, it is better to use a switching regulator of at least 0.5 A. Use only a type that supports more than 30 V input, E.g TSR 1-2450 converter DC/DC 5V, 1 A SIP (Farnell order code 2007987). Optocouplers Bidirectional data traffic between PCB and PC is optical isolated by means of two optocouplers 6N136, IC5 and IC6. Observe the polarity of the optocouplers on the PCB. The optocouplers avoid ground loops between PC and PCB and protect your PC. Detail of protection circuit corner switch In an early version the pull up resistors were 10K. An unexpected stop of the Z99 occurred sometimes. It took quite some time to find out why. Changing the value of the pull up resistors with 1K was the solution. The wiring to the right XY switches is rather long. Twisting the wiring to the switches reduces common pickup noise. It is a good idea to twist the wires of the switches. Most 3D printers also have corner switches with twisted wiring.
● 23
Boek - Build Your Own Multifunctional 4 Axis Machine_converted.indd 23
28/10/2022 11:40
Build Your Own Multifunctional 4-Axis CNC Machine
Timing constant of R8 x C29 is 100 microseconds. Even at the highest speed no micro step can be done after a switch is closed. IC4 Output buffer TX signals from PCB to PC The signal is buffered by four gates from an HEF4093 Schmitt trigger, IC4. The resistor R1 47 ohm is necessary for good output drive capability! At 57600 baud a cable length of four meters is possible without errors. If you need a longer cable, use an active USB2.0 extension cable to obtain 5 or 10 meters more distance. Finished X2Y4Z PCB for Z99
● 24
Boek - Build Your Own Multifunctional 4 Axis Machine_converted.indd 24
28/10/2022 11:40
Chapter 2 • The X2Y4Z Printed Circuit Board
Remarks 1. Ground pin. Use it to connect to – lead of multimeter or oscilloscope for measuring. 2. Metal potentiometer for regulation of current limiting. Explanation follows. 3. Programming header with layout for MikroE programmer. 4. Jumper Jp1. When this jumper is in place, the XYZ motors do not move after turning power on. - For testing PCB, steppers and corner switches, place the jumper. - For operation of laser module without using the Z motor, use the jumper. - For all other modules, normal operation when everything is mounted, remove the jumper, before turning the power on. Initialisation and the seven switches When jumper1, jp1 is not placed, after turning on the power, the PIC code initializes the Z99 in three steps: Step 1 The Z motor moves up until Z switch is closed (if jumper1 is not in place) and moves then 3 mm down. This is the Z zero point. Step 2 When the Z99 is not powered, it is possible that both X terminals are somewhat skewed to each other, are no longer at same distance from the Y switches:
In the picture you see an example of misalignment during power up. Distance ‘R’ differs from distance ‘L’ All four Y motors move to the back. As soon as one of the back Y switches close, the two Y motors on that side stop. The other two Y motors continue until both back Y switches are closed. When both back Y switches are closed, the carriage moves 3 mm to the front. This is the home position for the carriage in the Y plane. Example of a Power up initialization error In the example above distance 'L' is larger than 'R'. During initialisation, the back right Y switch closes before the left back Y switch.
● 25
Boek - Build Your Own Multifunctional 4 Axis Machine_converted.indd 25
28/10/2022 11:40
Build Your Own Multifunctional 4-Axis CNC Machine
The two right Y motors stop as soon as right back Y switch is closed. The two left Y motors continue until left back Y switch also closes. The four Y motors then move Z carriage 3 mm to the front. Step 3 Both X motors move the carriage to the left until the left X switch closes, then 3 mm right. This is the home position for the X-axis. The 2 front Y switches are connected in parallel. When one of them closes, all four Y motors stop, and then the carriage moves 3 mm to the back. The right X switch. When the right switch closes, both X motors stop, and the Z carriage moves 3 mm to the left. This sets the right limit.
2.4 X2Y4Z bipolar steppers All XYZ bipolar stepper motors are Nema17 types, with 200 steps per revolution. The six XY steppers Any type of stepper motor that can deliver between 1.2 and 2.5 amps is OK. Shaft diameter 5 mm and shaft length minimal 16 mm. D- shape shaft is not required but makes fixing of pulleys easier and more accurate. Wires A brand with removable wires makes the wiring easier. Types with a removable wired connection and 1 or 2 meters of wire are available.
Z motor We used lightweight, +/-140 gr steppers, e.g., 17HS08-1004S with 800 mA power consumption or the 17HS4023 with 1A. The type below left has fixed wiring. At right the same type with removable wiring. This is handier.
● 26
Boek - Build Your Own Multifunctional 4 Axis Machine_converted.indd 26
28/10/2022 11:40
Chapter 2 • The X2Y4Z Printed Circuit Board
About the step resolution of 200 steps per revolution A single revolution of a 16 tooth pulley with GT2 belt gives a displacement of 16 x 2 mm = 32 mm. Steppers with 200 full steps per resolution equals (200 x 32) = 6400 micro steps for 32 mm travel. The resolution in each direction is 32/6400 = 0.005 mm. Nema 17 connection cables Search for “Nema17 Dupont type extension cable”. Even better is to buy motors together with accompanying removable cables. Another type extension cable is ‘XH2.54’. Do not use it. Buy three cables with length of 1 meter for the two left Y motors and left X motor. Buy four cables with length of 2 meters for the two right Y motors, right X motor and Z motor. Below are the endings of a ‘Dupont’ type extension cable.
A: fitted in the Nema17 stepper. B: fitted to four pin male headers of the PCB. A wrong connection will not damage the stepper, but it will not turn or turn reverse. Measure with an ohmmeter which pair of wires are connected. When a motor turns the wrong direction, swap the wires of one pair. Wiring of steppers to connectors for a Z carriage assembly Back view of wiring assembled front and mid part of a Z carriage.
● 27
Boek - Build Your Own Multifunctional 4 Axis Machine_converted.indd 27
28/10/2022 11:40
Build Your Own Multifunctional 4-Axis CNC Machine
1. Connector for Nema17 connection. 2. The two wires on the Z top switch have a separate connector. Mounting a different Z carriage assembly means just swapping connectors 1 and 2 and fastening six winged M4 nuts when the assembly is in place.
2.5 Stepper bipolar driver modules For XYZ movements we use DRV8825 drivers, see: https://www.pololu.com/product/2133 for an example, but they are widely available. The maximum current of the modules is 2 Ampere. A cooling fin is mandatory for more than 1 ampere or if power supply is more than 12 V. In our design it is essential that the drive modules are fitted with an appropriate heatsink. For proper function of the 1/32 micro step mode, it is also necessary to limit the current through the stepper by means of the small potentiometer on the driver board. Without current limiting, steppers and modules become very hot and can be possibly damaged. On https://www.pololu.com/product/1182/resources you can find a video on how to adjust the potentiometers of the modules. For the DRV8825 modules, the current limit is determined by the formulae - Vref x 2. Before insertion of DRV8825 in the female headers, check not only the polarity of the module but also the polarity of the 100 mF capacitor below it.
● 28
Boek - Build Your Own Multifunctional 4 Axis Machine_converted.indd 28
28/10/2022 11:40
Chapter 2 • The X2Y4Z Printed Circuit Board
1. Heatsink fin. Most of the modules come without the heatsink fin installed. Remove the paper from the fin and press it firmly on the chip. Make sure it is in the middle of chip and doesn’t touch the mounting pins. 2. Potentiometer. The single turn potentiometer adjusts the Vref. Turning in direction of arrow, diminishes Vref. Important tips for adjusting the driver modules DRV8825 Adjust the potentiometer before connecting the steppers and before mounting the PCB in the Z99. Be careful not to touch anything else other than the body of the potentiometer, otherwise module will be destroyed. It is wise to turn DC power off before adjusting the potentiometer and to turn it on before measuring. When Vref on the pot meter is 0.600 mV, the stepper current is limited to 0.6 x 2 = 1.2 A The lightweight Z motor support only 800 mA. Set Vref to about 0.4 V. The potentiometer is not a multi turn type. A small displacement can result in a big difference. With some patience, adjust up to within 50 mV of the target voltage. Never set Vref higher than required! Somewhat less is fine. During adjustments, fan cooling is not possible: set power supply temporary to 12 V! When the DC motors are powered with 12 V active cooling of the modules is not necessary. A lot of 3D printers operate with a 12 V DC power supply. Active cooling with a fan is then not necessary. However, with 12 V power supply, the steppers cannot reach full power and speed. Our advice is to set DC power supply at 12 V for calibration without fan. For later operation use 24 or even 30 V DC and an external fan.
● 29
Boek - Build Your Own Multifunctional 4 Axis Machine_converted.indd 29
28/10/2022 11:40
Build Your Own Multifunctional 4-Axis CNC Machine
Never insert a module or connect a stepper when PCB is powered! Inserting a module the wrong way will destroy it. Before inserting a module, double check that it is in the correct orientation.
2.6 Unipolar stepper for solder paste dispensing Skip this section if you are not installing the solder paste option. The Cn5 connector pin 1 to 5 supports a unipolar stepper. A unipolar stepper is used for solder paste dispensing. Search for “28BYJ-48-5V stepper” and buy a 5 V type with wired connector. Often, the 28BYJ-48-5V steppers are sold with a small ULN2003 PCB. This board is not required and can be put in your junk box for re-use later. These steppers have a step size of 1:64 and a resolution of 4096 half steps for one revolution.
Connection on the Cn5 connector 5 red (+5 V), 4 orange, 3 yellow, 2 pink, 1 blue.
● 30
Boek - Build Your Own Multifunctional 4 Axis Machine_converted.indd 30
28/10/2022 11:40
Chapter 2 • The X2Y4Z Printed Circuit Board
Resistance between red (+5 V) and the other wires is about 25 ohm and between all other connections is about 50 ohm. In half-step mode the powering order is: Half-step
1
2
Blue
+
+
Pink
+
3
4
5
6
7
8 +
+
Yellow
+ +
+
+
Orange
+
+
+
Half steps in “MikroC code” Half steps are advised in datasheet of 28BYJ-48 stepper. #define F1 LATA.B1
// F = phase 1
PORT A1
(pin2)
#define F2 LATA.B2
// phase 2
PORT A2
(pin 4 )
#define F3 LATA.B3
// phase 3
PORT A3
(pin 5 )
#define F4 LATA.B4
// phase 4
PORT A4
(pin 6 )
…. // subroutine for half steps: void MoveST28(int Direction, int Steps) { int x;
//
4096 half steps / revolution
int Zsteps =0; for (x=0;x7)
Zsteps - 1; Zsteps=0;
if (Zsteps 256*256*2 micro steps.
95
XY movement leftwards and backwards.
X or Y > 256*256*2 micro steps.
96
XY movement rightwards and frontwards.
97
XY movement rightwards and downwards.
98
XY movement leftwards and frontwards.
X or Y > 256*256*3 micro steps.
99
XY movement leftwards and backwards.
X or Y > 256*256*3 micro steps.
100
XY movement rightwards and frontwards.
X or Y > 256*256*3 micro steps.
101
XY movement rightwards and downwards.
X or Y > 256*256*3 micro steps.
110
When top Z corner switch becomes closed, Z axis moves 2.5 mm downwards
111
When corner X switch becomes closed carriage moves 3 mm opposite.
113
When both back Y switches become closed carriage moves 3 mm opposite.
X or Y > 256*256*2 micro steps. X or Y > 256*256*2 micro steps.
Example of XY code command: b[0] =
87;
// XY direction left and frontwards
b[1] = (byte)(MSB van X);
// most significant byte X
b[2] = (byte)(LSB van X);
// less significant byte X
● 34
Boek - Build Your Own Multifunctional 4 Axis Machine_converted.indd 34
28/10/2022 11:40
Chapter 2 • The X2Y4Z Printed Circuit Board
b[3] = (byte)(MSB van Y);
// less significant byte Y
b[4] = (byte)(LSB van Y);
// less significant byte Y
b[5] = (byte)(bb[0]+b[1]+b[2]+b[3]+b[4]);
// checksum byte && 0XFF
The maximum of micro steps for X and Y are 256 x 256 = 65536. This is enough for 65536 x 0.005 mm = 327.68 mm movement. Simultaneous XY movements with an 8-bit microcontroller Since you have the complete source code, we will not duplicate it here. We mention only a small piece of code that costed us quite some effort to develop. For simultaneous movements of two steppers is mostly a 32-bit microcontroller used. The reason is obvious when you look at the following problem: Suppose you want to move from coordinate X0, Y0 to coordinate X700, Y500.
Possible solution is to do 500 X and Y steps synchronous and then 200 X steps more. The red line above is acceptable for drilling or solder dispensing but not for a plotter or a cutter. For simultaneous movements you need to do one Y step for each 700/500 X steps! Note that 700 cannot be divided by 500 and that 700 x 500 = 350000 is larger than an 8-bit integer (65536). You need to work with long integers. Example in code: int stepsX = 700; int stepsY = 500; long L = (long)stepsX * (long)stepsY; long x; for (x=0;xySteps) { stepperDelayX=XYMotorDelay*4*15;
//
*15 from 14.7456MHZ clock
count/sec // the line below is the most important, X and Y movement are synchronous: stepperDelayY=(unsigned int)(((long)stepperDelayX*(long) xSteps)/(long)ySteps); // so, we need only one calculation with long integers. TimerX = stepperDelayX;
// load TimerX and start it
TimerY = stepperDelayY;
// load TimerY and start it.
while (1) { // TimerX action on the 2 X motors: if (TimerXready && (counterStepX=ySteps)) break; } }
// xSteps >
// end of while(1) ySteps
● 36
Boek - Build Your Own Multifunctional 4 Axis Machine_converted.indd 36
28/10/2022 11:40
Chapter 2 • The X2Y4Z Printed Circuit Board
This code worked fine. The final code is a bit more complicated. Stepper motors create some inertia and cannot start and stop from full speed without skipping or adding some extra micro steps. With the aid of the code above, the final MikroC code is easier to understand.
2.8 Programming the PIC Building of the mikroC code creates a hex file. Various ways to upload the hex file into the PIC are possible. Since it is a DIP device file it can be programmed with an external programmer and then inserted into the board. Or, it can be programmed while in the board, via the programming header. We give two examples.
2.8.1 Programming the PIC with MikroE programmer The programming header Cn5 is compatible with the mikroE programmer. Programming in the MikroC environment with MikroE programmer is easy. It is not necessary to power the board when DRV8825 modules are not inserted, power consumption is then less than 100 mA. See connection in picture.
In the IDE of MikroC, select Build + Program:
● 37
Boek - Build Your Own Multifunctional 4 Axis Machine_converted.indd 37
28/10/2022 11:40
Build Your Own Multifunctional 4-Axis CNC Machine
2.8.2 Programming the PIC with Pickit3 It is possible to use a different external programmer e.g., the Pickit3. The layout of the header is different, so you need to make a connecting cable, see below.
Pickit3 to MikroE header 1 => 2 => 3 => 4 => 5 =>
on the PCB: 4 1 5 3 4
Verify that Pickit3 is properly connected and that the X2Y4Z PCB is powered with +5 V. Since there is no cooling fan during programming, set temporary power supply of X2Y4Z PCB to 12 V. The PICKIT3 works with the free MPLAB integrated development programming environment from Microchip. Various versions of MPLAB exists.
● 38
Boek - Build Your Own Multifunctional 4 Axis Machine_converted.indd 38
28/10/2022 11:40
Chapter 2 • The X2Y4Z Printed Circuit Board
Below is a snapshot of MPLAB4.1, an older version without all the bells and whistles.
1. 2. 3. 4.
Select PIC18FXX in use as the Device. Hex files for PIC18F45K22, PIC18F45K40 and PIC18F45K42 are in the download. Click ‘Connect’ and wait about 3 seconds. Browse to the hex file and select it. Click the Program button. Takes only a couple of seconds to upload the code.
● 39
Boek - Build Your Own Multifunctional 4 Axis Machine_converted.indd 39
28/10/2022 11:40
Build Your Own Multifunctional 4-Axis CNC Machine
Overview of X2Y4Z with all seven steppers, corner switches and fan connected
Testing all motors and corner switches is possible in the Command mode of the software “XYZ.exe”. This is explained in Chapter 9.3. Remark above that jumper “Jp1” is placed on the PCB for testing. Is it is possible to test in the Command mode when the jumper is not placed? Yes, if you follow this four steps. - turn power on. - press Z switch. - press both front Y switches. - press left X switch.
● 40
Boek - Build Your Own Multifunctional 4 Axis Machine_converted.indd 40
28/10/2022 11:40
Chapter 3 • Design and 3D printing settings
Chapter 3 • Design and 3D printing settings 3.1 Designing the 3D parts All the 3D parts of the Z99 are made with the freeware software application OpenSCAD. See https://www.openscad.org to download the software. It is a very user friendly program. OpenSCAD is a parametric design tool, so no real artistic skills are required to use it. It works of the basis of defining what you require using basic shapes such as cubes, cylinders and spheres. And either joining these together or subtracting them from each other. OpenSCAD is a very user friendly program. Anyone with some programming knowledge can build complex parts in no time. OpenSCAD contains a “Help” function and a lot of examples. Small differences in printed dimensions between different printers can affect the end result. Numerous settings have influence on the quality of the final piece, such as extrusion (flow), temperature of the nozzle, the speed you print at, and the quality of filament you choose. We will see later how to manage these settings. Printing large parts takes a lot of time. It is best to start with some of the smaller parts. Start by opening OpenSCAD and then open the file: Z99:\3DParts\ScadSourceCode\ConstructionAid\Z99CornerAid.scad You will need four of these parts temporarily for the construction.
In the Figure above, OpenSCAD displaying the “Z99CornerAid.scad”
● 41
Boek - Build Your Own Multifunctional 4 Axis Machine_converted.indd 41
28/10/2022 11:40
Build Your Own Multifunctional 4-Axis CNC Machine
Look to the beginning of the file. Most of the dimensions and all the diameters are defined at the top of the files. Even without any programming knowledge modifications are possible. Suppose that you want a different Diameter for M2 e.g., 2.6 instead of 2.5. Change line 6 to DiaM2 = 2.6; If you made modifications, save with a new name, e.g. Z99CornerAid_mod.stl. 1. Build the preview. 2. Render. Note that on large parts this takes a lot of time. Do not interrupt it. Go and have a coffee while it is doing the processing. 3. Save as Z99CornerAid as Z99CornerAid_mod.stl. Save your work and close OpenSCAD. You have now the *.stl (stereolithographic) file. Before you can print it, the stl file needs conversion to a *.gcode file. A slicer program does this job. We use Slic3r. Remark Before printing, look at the *.scad source code. Some points of attention are in the comments at the top of the files.
3.2 Setup of Slic3r We use for slicing of all parts Slic3r. Slic3r is free available at: http://slic3r.org/download To obtain good results it is worth to spend some time studying how to setup the slicer. See 3.2.1 for a list of the settings we used for our printer.
3.2.1 Print settings Select Tab ‘Print Settings’ and left column ‘Layers and perimeters’.
● 42
Boek - Build Your Own Multifunctional 4 Axis Machine_converted.indd 42
28/10/2022 11:40
Chapter 3 • Design and 3D printing settings
First layer height We make this a bit thicker: 0.3 mm. If the Z axis of the printer is well calibrated then you can use 0.20 mm for most of the parts. Perimeters and solid ‘Bottom’ and ‘Top’ layers are set to 3. Printing with 2 perimeter layers is quicker and for some parts acceptable. Left column ‘Infill’.
● 43
Boek - Build Your Own Multifunctional 4 Axis Machine_converted.indd 43
28/10/2022 11:40
Build Your Own Multifunctional 4-Axis CNC Machine
All 3D prints are made with a 25% Honeycomb infill. This saves time, weight and material without sacrificing strength. For Top and Bottom layers we use “Rectangular” Skirt and brim A brim is an edge of 4 or 5 mm and is useful for smaller parts, e.g., a spacer. A 5 mm brim is useful when printing large parts to avoid warping at the corners. Support material None of the prints require supports! Important: some parts should be rotated, so that no supports are necessary. See the notes by each piece. Speed We use for all prints the same setting of 40 mm/second and for the first layer as low as 20 mm/second. The author prefers to print slowly. Printing faster creates a lot of noise and mechanical stress for the printer and more chance for a failure of the print.
3.2.2 Filament settings
PLA filament PLA is very strong. ABS plastic is not stronger, more difficult to work with and gives a terrible smell. For the temperature of the extruder nozzle we used 205°C. Sometimes a bit hotter (5%C) is needed for the first layer. We use a heated print bed of 50°C. Printing without heated bed is possible, but increases the chances of warping at the corners of the larger pieces. PLA with 1.75 mm diameter is the most common size. However, a printer that uses 3 mm filament will perform equally well.
● 44
Boek - Build Your Own Multifunctional 4 Axis Machine_converted.indd 44
28/10/2022 11:40
Chapter 3 • Design and 3D printing settings
Cooling
Disabling the fan during first 3 layers helps to create a good fixing of part to the bed and this prevents warping, especially in larger parts.
3.2.3 ‘Printer Settings’ – ‘Extruder 1’
Lift Z: 0.25 and Only lift Z Above Z: 2 mm These are important settings and the only reason to select ‘Expert mode’ from File – Preferences. The intention is that the nozzle rises 0.25 mm (or more) when moving and the extrusion is inhibited. Only lift Z is set to 2 mm here but it could have been much higher, e.g., 50 mm. Some prints fail because the nozzle touches the already printed material. The already printed material is then displaced and/or destroyed. The taller the print is, the more chance this will happen. It is a contributing factor to the fact that large prints can fail after many hours of printing! Printing with some ‘Z Lift’ takes a bit longer but it prevents this type of failure.
● 45
Boek - Build Your Own Multifunctional 4 Axis Machine_converted.indd 45
28/10/2022 11:40
Build Your Own Multifunctional 4-Axis CNC Machine
Nozzle 0.4 mm This doesn’t mean that the resolution is limited to 0.4 mm, but the printed diameters become about 0.4 mm smaller. Printing with a nozzle of e.g., 0.2 mm takes at least 4 times longer, first layer adhesion is problematic, and blocking of the nozzle often occurs. Printing with a larger nozzle e.g. 0.8 could speed-up printing of the elevation of the corner pieces. General’ and ‘Custom G-code’ use the default settings. ‘General’ permits wireless operation. Wireless communication is not always reliable. PC may block or fall in sleep. Best is to use a 3D printer with a SD card or USB stick reader.
3.3 Make G-code files with Slic3r After all these settings are set. the use of Slic3r itself is as easy as 1, 2, 3.
1. 2. 3.
Add the *.stl file. Verify the settings “Print settings”, “Filament” and “Printer”. “Export G-code” to the SD card or the USB stick. The LCD screen of some printers is not able to render more than 10 signs. Give the exported file a name that is shorter than 10 characters.
. Important Before exporting the G-code verify that the object in use is flat on the table. If not, rightclick on it and move it until it is flat on the surface. Some parts contain text or the letter ‘L’ or ‘R’. Before printing verify that text or letters appear readable, not mirrored. 4. In the red circle is a small gap in the bottom layers. Most large parts have this. Removal of a large piece from the heat bed is sometimes difficult. The gap makes removal much easier with the aid of a plastic screwdriver. Adjustment of flow, amount of extruded PLA on a printer with LCD is possible. Default is 100%. If the print doesn’t stick well at the bottom, it is often because distance between nozzle and bed is too great. If you don’t want to adjust the Z axis, use a higher flow for the first layer, (E.g.110%). But it is always better to adjust the Z axis correctly before printing.
● 46
Boek - Build Your Own Multifunctional 4 Axis Machine_converted.indd 46
28/10/2022 11:40
Chapter 3 • Design and 3D printing settings
Initially we printed on a glass plate covered with tinny painter’s tape and some glue stick. Later we switched to a glass plate and some 3DLAC Spray plus. This gives always good results, no more warping. Is a budget printer, e.g., a Prusa clone also capable? We were interested to find out and bought a cheap Chinese 3D printer-kit with an acrylic frame. The manual and pictures were good, and the build quality was good. The first prints were not acceptable. The acrylic frame was too weak. I reinforced it with some aluminium lathes. Also, it was equipped with something called a remote extrusion feed. Although some people claim good results with remote extrusion feeds, for us it reacted to slowly. After reinforcement of the frame and replacement of the remote extrusion feed by a direct drive feed, the results were much more acceptable. For the large pieces, this type of printer is acceptable however, for the smaller pieces, the quality was not as good as the original
● 47
Boek - Build Your Own Multifunctional 4 Axis Machine_converted.indd 47
28/10/2022 11:40
Build Your Own Multifunctional 4-Axis CNC Machine
Chapter 4 • Hardware parts Z99 4.1 Tools you need for construction and operation Windows 10 or 11 PC - A moderate PC, acquired after 2015 with at least one free USB port is OK. - The minimal screen resolution should be 1600 x 1024 pixels. 3D PLA printer - Minimal print dimensions are 20 cm(X) x 20 cm(Y) x 10 cm(Z). It is possible also with a bed size of 25 cm x 10 cm x 10 cm. - One roll of 1 kg PLA in your preferred colour. PLA is OK for all parts. 3D printing of PLA is a slow process. Maybe you should already start with the 3D printing. See chapter 3. DC power supply 12 at 30 V at a minimum of 3 A. USB serial converter 5-V TTL in-out, e.g., from ftdichip.com. Only pins +5 V, ground, TX and RX are used. Check the specification of the cable you purchase, as not all cables use the same colour wires. Various - Electric drill and drill bit for holes up to 9 mm diameter in wood. - Jigsaw and wood cutting blades. - Meter and micrometer (callipers). - Solder gun and solder. - Spiral wrap for wiring. Google for “spiral wrap”. - Coloured multi-core wire for corner switches. - X2Y4Z PCB with stepper drivers and connectors. User Basic knowledge of Windows and a 3D printer. Limited woodworking skills. Note: Delivery of the parts takes some time. Don’t wait to order them. We start with the construction of the Z99 for use as plotter, cutter, drill and mill machine.
4.2 Skeleton The skeleton parts are available in a DIY or hardware store. MDF base plate, 18 mm thick MDF, Medium Density Fiber Board is available everywhere were wood is sold. It is cheap, strong and stays flat at ambient room temperatures and humidity levels. Default dimension of an MDF plate is 244 x 122 cm.
● 48
Boek - Build Your Own Multifunctional 4 Axis Machine_converted.indd 48
28/10/2022 11:40
Chapter 4 • Hardware parts Z99
The ideal size is a piece that is 1220 mm long and 610 mm wide if you have enough space for it on your work area. If not, then you can make it is small as 800 mm long by 610 mm wide. The length depends on the desired length of the X axis. Keep long enough, the ground plate has then room enough to also place the PCB board and DC power supply left on the board. MDF plate, 3 mm thick If you want to work with a laser or a drill, use at least one thin MDF plate 610 x 48 x 3 mm. They will serve as a replaceable under layer so that main MDF plate is not damaged. Iron lathe Search for “shelf support rail”.
This is an iron lathe of 1 meter long. It is normally used to make shelving on a wall for a bookshelf, for example. In this project, it will be used to reinforce the MDF baseplate and for securing the wiring under the bed. Table legs
All above types are available in DIY stores. First, we describe the construction of a Z99 with: 4 legs with height 10 cm, type 1 1 leg with height 40 cm, type 3 It is intended to be placed on an existing workbench. Construction as stand-alone machine is also possible. You then need 4 table legs type 5. The height of type 5 is adjustable, see downwards arrow at right. This allows easy levelling of the machine in case your floor is not level.
● 49
Boek - Build Your Own Multifunctional 4 Axis Machine_converted.indd 49
28/10/2022 11:40
Build Your Own Multifunctional 4-Axis CNC Machine
Remarks Type 1 to 4 have a bottom hole with 10 mm diameter. We will need later this hole of our single table leg type 3. See the horizontal arrow. Maybe buy already also a M10 x 30 x 40 mm bolt + large locking washer. Also buy a box of self-tapping wood screws 3.5 x 30 mm and 2 x 20 mm. MDF, iron rail and table legs are available in most hardware shops.
4.3 Core parts Delivery time via some websites can be quite long. eBay and Amazon are often quicker than e.g., AliExpress, except on parts where the country of origin is China. Some parts are also available on websites where PLA filament is sold. Linear shafts 12 mm. Search for “Linear shaft 12 mm”. Two shafts of 500 mm for X axis (or longer, up to 700 mm for laser, plotter, and cutter). Four shafts of 500 mm for the Y axis. After arrival, verify they are straight by rolling them on a flat surface. Linear shaft 6 mm Search for “Linear shafts 6mm” length 200 mm. Buy two for each Z assembly. Ball bearings 12 mm and 6 mm
Search for “LM12UU” 12 pieces and “LM6UU” 4 pieces (for each Z assembly). Dimensions of LM6UU are 6 (inner diameter) x 12 (outer diameter) x 19 mm (length). Dimensions of LM12UU are 12 (inner diameter) x 21 (outer diameter) x 30 mm (length). Use some oil to walk in. Plastic ball bearings are also possible. They are strong and quiet. Search for “Igus LM12UU”. Buy them from a reliable source like Igus GmbH otherwise they are often not very good. Collars M6 Buy two for each Z assembly.
● 50
Boek - Build Your Own Multifunctional 4 Axis Machine_converted.indd 50
28/10/2022 11:40
Chapter 4 • Hardware parts Z99
Steppers Six Nema17 steppers for XY movements. Specifications, see chapter 2. One lightweight Nema17 stepper for each Z assembly, see chapter 2. Corner switches Micro limit switch with a long lever arm SPDT. Six + one for each Z assembly are needed. Distance between the M2 mounting holes has to be 10 mm.
Right terminal is away from switch and is not in use. Do not connect it. Connector 2P One pair for each Z assembly. Makes switching Z carriages easy. Belt GT2 A “2 mm pitch belt” or “Timing belt GT2” with a width of 9 mm. Most 3D printers work with a belt of 6 mm width. This works also but for heavy work, milling and drilling, 9 mm is better. Buy a roll of 5 meter length.
Pulleys with 16 teeth A “GT2 pulley 16 teeth bore 5 mm” with internal diameter of 5 mm. The height of the pulley teeth is 10 mm. Buy 6 pieces. This is not the most common type. Most are made for a GT2 belt of 6 mm. For heavy work, milling and drilling a GT2 belt width 9 mm and pulleys with 10 mm width are required.
● 51
Boek - Build Your Own Multifunctional 4 Axis Machine_converted.indd 51
28/10/2022 11:40
Build Your Own Multifunctional 4-Axis CNC Machine
Trapezoidal screw, acme screw (“Trapezoidal screw T8 lead 8 mm”) Pitch 2 mm, diameter 8 mm, length 100 mm, lead 8 mm. One for each Z assembly.
Attention: lead 8 mm, this means that one turn moves T8 nut 8 mm. The Z stepper has a resolution of 200 x 32 = 6400 micro steps for each turn. We have Z resolution, lead of 8 mm / 6400 = 0.00125 mm. Other types exist that advance only 1,2 or even 4 mm for a turn. Flexible couplings (“Flexible coupling M5 M8”)
Used for coupling the trapezoidal screw to the Z axis stepper. For the solder paste dispenser, an M5M5 coupler is also required. Fan 12 V, square 12 cm (”Fan 12 V, 120 mm”) A wide variety exist, all have 4 corner holes for M4 bolts.
● 52
Boek - Build Your Own Multifunctional 4 Axis Machine_converted.indd 52
28/10/2022 11:40
Chapter 4 • Hardware parts Z99
4.4 Summary hardware parts Z99 Description
Count
MDF baseplate 1220 x 610 (600)
1 see note below
x 18 mm MDF plate 610 x 48 x 3 mm
1 if using the laser or drill Z-carriages
Table legs height 10 cm
4
Table leg height 40 cm
1 for origin of Z axis wiring
Iron bookshelf lathe 1 meter, see
1
above Nema17 1.8° steppers
6
Lightweight stepper Nema17 140
1 for each Z carriage, except for laser.
gr 1.8° Linear shafts 12 mm x 500 mm
6
Linear shafts 6 mm 200 mm
2 for each Z axis
Locking collars 6 mm
2 for each Z axis
GT2 belt 5-meter, width 9 mm
roll of 5-meter
Trapezoidal screw T8 M8 x100
1 for each Z axis.
mm and nut Pulleys 16 teeth, 10 mm high
6
Corner switches
6 + 1 for each Z carriage
Connector 2 pin, any type
1 pair for each Z carriage
Flexible coupling M5 M8
1 for each Z carriage
1 stepper 28BYJ-48-5 V
only for solder paste dispenser
Fan 12 V, 12 cm square
1
About the X dimension of the MDF plate When using X shafts of 500 mm, a shorter length than 1220 mm is possible. However, if your workplace has room enough, the longer dimension permits use of a longer X shafts. Another possibility of a longer MDF plate is the construction of a stand-alone Z99 with longer table legs. This is explained further. Specific Z carriage requirements Some Z carriages require specific accessories like a pen, a cutter, a drill, a mill, a dispenser or a laser. We will list them further as needed.
● 53
Boek - Build Your Own Multifunctional 4 Axis Machine_converted.indd 53
28/10/2022 11:40
Build Your Own Multifunctional 4-Axis CNC Machine
Fixing components Description and purpose 1. Wood screws M4 length 30mm. 10. Zip ties, width 2.5 mm of decent quality
1 Set
Remarks The M4 wing nuts (6) are not necessary but are recommended to allow for quick changing of the Z carriage to a different tool. The M8 wing nuts (8) permit quick mounting of different elevation for the 4 corner pieces of the Z99.
● 54
Boek - Build Your Own Multifunctional 4 Axis Machine_converted.indd 54
28/10/2022 11:40
Chapter 5 • Construction Z99
Chapter 5 • Construction Z99 5.1 Skeleton construction The construction of Z99 with X and Y shafts of 500 mm length is described here. If you want to use the Z99 for heavy precision work like drilling and milling, a shorter length of 350-400 mm is probably enough and will be stronger. If you want a larger workspace, X shafts of up to 650 mm are possible. We describe here the construction of a Z99 with short 10 cm high table legs in Chapter 5.1.1. Alternatively, a stand-alone apparatus with ±74 cm high table legs, can be built. Details are in Chapter 5.1.2. We describe first the construction of Z99 with default MDF baseplate 1220 x 610 x 18 mm and legs of 10 cm high. It is intended to be placed on a table.
5.1.1 Table top version Print four pieces of CornerAid (2) and four pieces of XterminalAid (1) Files are in directory \ConstructionAids Put them on MDF base plate together with the six 50 cm M12 bars like this:
Verify that both X bars are completely inserted into the XTerminalAid. (1) bracket. About 1 cm space for a plate of 61 cm width. (3) A plate of 60 cm is also OK, the margin is then about 0.5 cm. Leave about 1 cm extra margin on the right. (4) Fix each ‘CornerAid’ piece temporarily with 4 self tapping screws 2.5 mm. (5) Drill 8 pilot holes with a 2 mm drill bit. The holes are encircled red. (6)
● 55
Boek - Build Your Own Multifunctional 4 Axis Machine_converted.indd 55
28/10/2022 11:40
Build Your Own Multifunctional 4-Axis CNC Machine
Detail of right front corner
1. Leave about a 1 cm margin. 2. Temporarily fix all 4 corners with 4 little nails or small wood screws 2.5 mm. 3. Drill two orientation holes 2 mm in all four corner pieces (Red arrows). Remove now everything and drill eight larger holes (using a 9 mm drill bit through the pilot holes). Top view of MDF plate after drilling of the M9 mm holes
At the left, the hole for the cooling fan (3), two 30 mm holes (4) for wiring and PCB fixing points (5) are made. The exact location of 3,4 and 5 is explained on the following pages. Note that the fan and PCB are installed from the bottom. The top side has room for the power supply. Distance (1) is about 15cm and (2) about 34 cm. Remark Four extra holes are marked between brackets (M9). They allow you to extend the X shafts to 650 mm without the need for complete disassembly. If required, these need to be measured and correctly drilled, but they are not required for the 500 mm version.
● 56
Boek - Build Your Own Multifunctional 4 Axis Machine_converted.indd 56
28/10/2022 11:40
Chapter 5 • Construction Z99
5.1.2 Finish the MDF bottom side Table top version
1. Bottom iron lathe 1 meter. Insert some ties in the lathe before fixing the lathe to the board. The ties will later fix the bottom wiring (see photo). Fix the lathe with six 4 mm wood screws length 16 mm. 2. Right table legs is positioned at 6 cm from MDF corner. 3. Left back table legs are at 3 cm from front and back of the MDF board edge. 4. Left table legs at 22 cm from left MDF border. Fix the table legs with four 4 mm wood screws length 16 mm. 5. M4 x 60 mm fixing bolts, spacers, and nuts for the PCB. For exact location of M4 see the following section. Do not fix the PCB to the MDF until the wiring is finished. 6. The eight 9 mm holes for fixing of corner pieces. The four 9 mm holes marked by a (6) are optional for working with longer X shafts of 650 mm. 7. Two large holes 30 mm. The left hole is for the power supply wires. Right hole is for the wiring for the Z carriage. 8. Clock saw 30 mm. If you don’t have a clock saw drill holes 8 mm and use a jigsaw to cut two rectangular holes (7).
5.1.3 Mounting the fan and the PCB
● 57
Boek - Build Your Own Multifunctional 4 Axis Machine_converted.indd 57
28/10/2022 11:40
Build Your Own Multifunctional 4-Axis CNC Machine
1. 2 3. 4.
Drill a hole 8 mm to allow you to put the blade of the jigsaw through the baseplate. Leave a border of about 3 cm at left side of MDF plate. Draw square 123 mm, a couple of mm larger than fan. Use the fan as template. Print the four \CommonParts\LargeFanCornerFix parts and fix with M4 x 35 mm.
Cut the fan holder with a jigsaw:
1. About 3 cm. 2. Square about 123 mm. Test that insertion and removal of fan is easy. Fan should go easily in and out. Drilling and sawing make some dust. My wife prefers that I do it outside... Mounting the PCB
From the top of the baseboard, place the PCB over the fan opening. Mark the 4 corner mounting holes and drill the four holes 4 mm for the PCB.
● 58
Boek - Build Your Own Multifunctional 4 Axis Machine_converted.indd 58
28/10/2022 11:40
Chapter 5 • Construction Z99
1. Fan is placed to the side to be able to view the PCB. 2. PCB is fixed on the bottom side with four M4 x 60 mm and spacers. The spacers are in file \CommonParts\FixX2Y4ZPCB. The PCB doesn’t need a housing and the connections remain accessible by lifting out the fan.
5.2.1 Stand-alone version Construction of a stand alone Z99 with longer table legs is possible. Use four solid table legs. Below is an MDF plate of 1100 x 610 x 18 mm. All six linear shafts in use are 12 x 500 mm.
1 2 3 4
Distance of 15 cm. Distance of 13 cm. It is not mandatory to place the left table legs at the left margin. Mark the sixteen holes. The holes are encircled red. Mark the eight pilot holes. The holes are encircled black.
Measure twice, drill once. Remove everything. Drill 3 with 5 mm drill. Drill 4 with 9 mm drill.
● 59
Boek - Build Your Own Multifunctional 4 Axis Machine_converted.indd 59
28/10/2022 11:40
Build Your Own Multifunctional 4-Axis CNC Machine
The rest of the construction, fixing the lathe, fan an PCB is similar as described in 5.1.2 and 5.1.3 On the image below you see the right side of a Z99 with 4 table legs about 72 cm height.
1. A margin of 15 cm at right. 2. The distance of the fixing bolts is about 3 cm from the edge of the board. The distance between the fixing bolts depends on the legs chosen. 3. Use bolts and nuts to secure the legs. Do not secure with self-tapping screws. Use M5 bolts and nuts. 4. Use large flat washers with an external diameter of at least 25 mm to enhance the stability of the table. 5. Extra outlet hole 30 mm for wiring of right X axis. The other two legs on the left end are mounted in a similar manner.
5.3 Longer X shafts The X dimension of the MDF plate, 1220 mm is too long for 500 mm X shafts. When using 500 mm X shafts, it is possible to shorten the X dimension to about 1 meter if you prefer. However, the longer length of the X dimension can have some advantages. It is possible to use longer X shafts of up to 650 mm. The workspace becomes then A3. All you need to do is drill 4 extra M9 holes for the left corner pieces. Marked on the drawing in step 5.1.1 with (M9).
5.4 Overview of 3D parts The parts are placed approximately in their corresponding orientation. Note the orientation indicators, ‘BACK’, ‘FRONT’, ‘LEFT’ and ‘RIGHT’. All these parts are in directory 3Dparts\STL\CommonParts and STL\ZCarriage. The OpenScad source code is in directory 3Dparts\ScadSourceCode.
● 60
Boek - Build Your Own Multifunctional 4 Axis Machine_converted.indd 60
28/10/2022 11:40
Chapter 5 • Construction Z99
Part
*.scad filename
Description
Count
1 and 3
CornerFrontRightBackLeft
Corner
2
2 and 4
CornerFrontLeftBackRight
Corner
2
5
LeftTerminalXUp
Left end of upper X shaft
1
6
LeftTerminalXDown
Left end of lower X shaft.
1
7
RightTerminalXUp
Right end of upper X
1
number
shaft. 8
RightTerminalXDown
Right end of lower X
1
shaft. 9
ZCommonBackPart
Back part for all Z
1
carriages. 10
ZCommonMidPart
Mid part for all Z car-
1
riages, except laser without Z motor. 11
ZCommonFrontPart
Front part for all Z
1
carriages, except laser without Z motor. 12
LargeFanCornerFix
Fix the fan
4
13
FixX2Y4ZPCB
Spacers to fix PCB
4
5.5 Assembly of the corner pieces What you need: • Four corner pieces. 1, 2, 3 and 4. • The difference between 1 (3) and 2 (4) is the position of the corner switches. • Four Nema17 stepper motor.
● 61
Boek - Build Your Own Multifunctional 4 Axis Machine_converted.indd 61
28/10/2022 11:40
Build Your Own Multifunctional 4-Axis CNC Machine
• Sixteen M3 x 12 + locking washers. • Four pulleys T16 width 10 mm for GT2 belt with width of 9 mm. • Four corner switches with soldered wires. Use 2 different colours. Do not melt the PLA. Solder the wires before fixing the switch. Right corner switches require about 120 cm and left about 70 cm long wires. • Eight M2 x 18 bolts, nuts and locking washer to fix Y corner switches.
Slide the Nema17 into the corner piece through the bottom, see the arrow in the photo. The connector (1) must be visible through the corner piece window. Fix a Nema17 stepper motor and Y switch in a corner piece 1-2. Text FL and BR. Front Left = FL corner piece = Back Right= BR corner piece. Text FR and BL. Front Right =FR corner piece = Back Left =BL corner piece. 3. The steppers are fixed with four M3 x 12 mm and locking washers. Do not tighten yet. Adjustment of the Y belt tension will be necessary later. 4. The connector for the stepper motor wiring faces outwards.
● 62
Boek - Build Your Own Multifunctional 4 Axis Machine_converted.indd 62
28/10/2022 11:40
Chapter 5 • Construction Z99
5. 6.
Pulley 16 teeth width 10 mm. If the M5 shaft has a D-shape, fix one of the screws on flat side of shaft. Corner switch with wiring already attached is fixed with M2 x 18 mm and locking washer. Do not tighten yet, so that adjustment of the corner switch position is possible.
About wiring of the corner switches For all seven switches, use the same colour for one of the two wires. This wire will be the common terminal.
5.6 Assembly of X axis terminals Below is the right X terminal. The Left X terminal is similar. What • • • • • • • • •
you need: ‘RightTerminalXUp’ (7) and ‘RightTerminalXDown’ (8) 3D printed pieces. Nema17 stepper. Four M3 x 12 or M3 x16 and locking washers. M3 x 16 requires a couple of 4 extra locking washers of 1 mm thick. Pulley T16 width 10 mm. Four LM12UU linear shaft ball bearings. Corner switch with soldered wires. Use 2 different colours. Right X terminal requires about 120 cm and left X terminal about 40 cm length. Two M2 x 18 bolts, nuts and locking washer to fix X corner switch. Eight ties. The two pieces of the X terminals are tied together with the four LM12UU ball bearings.
View from frontside
1 Note the letter R on both parts of right X terminal and the letter L on the Left X terminal parts. 2. M2 nuts on the X switch assemblies are directed to the front, so they do not interfere with the X belt.
● 63
Boek - Build Your Own Multifunctional 4 Axis Machine_converted.indd 63
28/10/2022 11:40
Build Your Own Multifunctional 4-Axis CNC Machine
Bottom view of ‘RightTerminalX’ 1. Start with LM12holder below. The arrow below shows how to slide the holder in his position.
2. The ties are not yet tightened and not trimmed off yet. It is better do this after Y axis is completely mounted and works fluently. View from backside of assembled and mounted right X terminal
1. 2. 3. 4. 5. 6.
Inserted Y shafts. Inserted X shafts. Right Y switch of the right corner part. Four M3 x 12 mm + locking washers. Tighten only after the X belt tension is adjusted. Head of two M2 x 18 mm fixing bolts for the right X corner switch. End of spiral wrap for stepper and the right X switch.
5.7 Assembly of right and left Y axis Top view of the right Y axis. Left Y axis is similar but mirrored.
● 64
Boek - Build Your Own Multifunctional 4 Axis Machine_converted.indd 64
28/10/2022 11:40
Chapter 5 • Construction Z99
1. The X axis stepper is fixed with four M3 x 12 mm bolts and locking washer. 2. All 3 pulleys are T16 width 10 mm for the GT2 belt 9 mm. 3. The little red arrows show how to adjust Y belt tension quickly. Note that the weight of X axis motor is supported by the outermost Y bars. The innermost Y bars bear the weight of Z carriage. Bottom view of X terminal right with the right Y belt in place:
1. Cutting the belt a little bit too long is recommended as it makes insertion easier. 2. Make sure belt is pushed down to the to bottom. Use a small screwdriver or an old credit card to help push it into place. Put a drop of lithium or paraffin oil on both Y linear shafts. Slide the X terminal along the Y bars. The LM12UU holders often need some run in. If the Y movements are fluent, tighten the ties on X terminal one by one and check the movements are still running well. When the right and left X terminal sides are assembled: Proceed to connect all Nema17 steppers and 6 corner switches to the X2Y4Z PCB and test them in the ‘Command’ mode of XYZ.exe, before going further with the assembly.
● 65
Boek - Build Your Own Multifunctional 4 Axis Machine_converted.indd 65
28/10/2022 11:40
Build Your Own Multifunctional 4-Axis CNC Machine
Since the Z switch of Z carriage is not mounted yet, place a jumper on JP1 on the PCB before turning power on. There is only one jumper position on the PCB. Take a look at Chapter 9.3 about using the command mode. Connect and test the 7 corner switches Move the Z trolley to somewhere in the middle of the X axis and the Y axis. Select a very low XY speed. Give a command of about 10 cm in any direction and press manually one of the switches. The XY motors should stop directly. Repeat this for all the switches. All switches, when pressed, should stop the motors. Remark The intention of the many corner switches is not only to have an origin point after powering on, but also to protect the Z99 against the force of an erroneous XYZ command..
5.8 Assembly of Z carriage For now, we describe only assembly of bracket part of Z carriage. What you need: - Back Z carriage (part number 9) 3D printed piece. - Four LM12UU linear shaft ball bearings. - Eight ties. View from backside:
1. 2. 3. 4.
LM12UU ball bearings and ties. Do not fasten ties too much at this time. Two X bars M12 x 500 mm. Six holes four mm. Front and mid Z carriage will be inserted here. Insertion and terminal of the 9mm X belt (type GT2).
● 66
Boek - Build Your Own Multifunctional 4 Axis Machine_converted.indd 66
28/10/2022 11:40
Chapter 5 • Construction Z99
We will attach the specific Z carriage for laser, plot, cut, drill, mill, and dispenser later.
5.9 Putting the skeleton together We now bring the 3 assembled parts together. Start with the left Y axis, then the X shafts and Z carriage and then the right Y axis.
1. Fix the two left corner pieces of the left Y axis assembly with four M8 bolts. 2. Slide both X bars into the left terminal X as far as possible. 3. Place a couple of good books below lowest X bar temporarily to keep the X bars parallel. Detail of corner fix
1. M8 bolt and flat washer. 2. Spacer M8. Length 40 mm. Remove the spacers, if required, for the drill and solder dispenser options. 3. Winged M8 nuts are not mandatory, but very handy when swapping to other tools.
● 67
Boek - Build Your Own Multifunctional 4 Axis Machine_converted.indd 67
28/10/2022 11:40
Build Your Own Multifunctional 4-Axis CNC Machine
Right Y axis and origin of Z axis wiring (Top view)
1. Slide right Y axis to the right side of the X bars in the direction of the red arrow. 2. Fix the two right corner pieces with M8 bolts. 3. Fix the table leg, height 40 cm with four self tapping screws 4 mm. The screws may somewhat penetrate the wood. Bolts and nuts are as good. 4. An M10 bolt goes in bottom of table leg for height adjust. It will be used later. 5. Tie the wiring for the left X terminal about halfway of up the leg. Back view of X belt
1. Insert the X belt as deep as possible into the slot in the X terminal. Use an old credit card to help push it into the slot. 2. Fix both X steppers with M3 x 12 bolts and locking washers. Tension the X belt quickly so it doesn’t get free. 3. Vibrations in the upper belt are muted by the upper part of the belt clamp.
5.10 Possible elevation of the four corner pieces The plotter, cutter, and laser do not need corner elevations. However, the drill, solder dispenser, and mill require some elevation, depending on drill, syringe, or mill in use.
● 68
Boek - Build Your Own Multifunctional 4 Axis Machine_converted.indd 68
28/10/2022 11:40
Chapter 5 • Construction Z99
Some elevations are in directory \Various\Elevations. Examples above are: 1. Elevation of 32 mm. Slide in the direction of the blue arrow. Insertion is possible without removal of M8 bolts. But the spacers will need to be removed. 2. MDF rectangle 105 x 75 x 18 mm. Use \XYconstruction\ZCornerAid to drill the two 9mm holes. Several MDF elevations can be stacked, e.g., 3 x 10 mm = 30 mm. 3. 3D printed elevation of 18 mm. Remarks 3D printing of large elevations takes quite some time and PLA. The elevations could be printed with a large nozzle 0.8 and corresponding quick Slic3r settings. MDF elevations are just as good and take less time and material to make.
● 69
Boek - Build Your Own Multifunctional 4 Axis Machine_converted.indd 69
28/10/2022 11:40
Build Your Own Multifunctional 4-Axis CNC Machine
Chapter 6 • The Z carriages We now need to add the specific Z carriages that you require, so that you can do useful activities with it. We will do this in the order of difficulty. We describe the simplest Z carriage first. 1. Laser module without Z motor This is the easiest to build. Most laser activities do not require any adjustment to the Z axis during operation. 2. Laser module with Z motor When laser is used for cutting or milling, it is possible to use several passes and to adjust Z depth after each pass. Once you understand how to assemble the laser module with Z motor, construction of the other Z carriages is very similar. 3. Plotter The plotter can use a pencil, a marker, a pen with etch free ink for plotting on copper or a pen with conductive ink for making quick prototype PCBs. 4. Cutter With this Z carriage the Z99 becomes a flatbed cutter for cutting paper or vinyl. It is possible to use the cutter Z carriage as a plotter, but it is not possible to use the plotter as a cutter. 5. Drill The Drill Z carriage provides a controllable drill, by mounting a Dremel tool, spindle or other drilling DC motors onto the Drill Z- carriage. 6. Mill The Mill Z carriage is the same as drill carriage. The only differences are in the software which controls the Z-axis and the type of bit you use in the mill. 7. Solder Dispenser The Solder paste dispenser Z carriage can accurately place solder paste on a PCB. 2, 3, 4, 5, 6 and 7 use all the same mid part for Z carriage: part 10 in section 5.4. 2, 3, 4, 5 and 6 use all the same front part for Z carriage: part 11 in section 5.4.
6.1 Assembly of a laser module without Z motor Attention Before you ever turn a laser on, read and understand the safety information! Never turn a laser on when the ray is not directed down at a non-reflective surface.
● 70
Boek - Build Your Own Multifunctional 4 Axis Machine_converted.indd 70
28/10/2022 11:40
Chapter 6 • The Z carriages
Example of laser module Search for ‘blue laser module 500 mW’. See an example below.
1. 2. 3. 4. 5.
DC 12 V, 2 Ampere supply. Ask for a suitable plug adapter for your country. Control PCB that comes with laser. Laser device. Safety goggles. Two cables, one is for PWM modulation of laser that we do not use.
Limitations of the 500 mW blue laser White paper is difficult to cut with a blue laser. We obtained good results with brown wrapping paper. The thickness of it is 0.12 mm. This is perfect for creating a solder paste mask for an SMD device. Engraving wood is also possible, if necessary, use multiple passes. A lot of videos about it exist on the web. Search for ‘laser wood engraving 500 mW’ and for ‘laser paper cutting 500 mW’ for more information. 3D part:
\ZCarriage\Laser\ ZlaserHolderWithoutZMotor
The image below shows a blue 500 mW laser module. The laser is mounted in the Z carriage holder.
● 71
Boek - Build Your Own Multifunctional 4 Axis Machine_converted.indd 71
28/10/2022 11:40
Build Your Own Multifunctional 4-Axis CNC Machine
1. 2. 3. 4. 5. 6. 7. 8. 9. 10. 11. 12. 13. 14.
Small MDF plate 330 x 60 x 18 mm. One M10 bolt 20-30 mm long. Flat washer to fit the M10 bolt. Ten mm hole drilled in the MDF baseplate. Attach the laser PCB with 2 small self tapping wood screws. Note: the screw below connector 6 is not very visible. Terminal commands can be used to turn the laser ON or OFF. Power supply for the laser is 12 V, 2 A. Cable for it is supplied but we do not use it. It is for PWM control of laser. Since we work with a weak laser, we control the intensity with the XY speed instead. Adapter 12 V, 2 A. Laser fixed with two M3 x 12 mm bolts with locking washers. Four LM6UU’s, two on each side, fixed with ties. Nut of trapezoidal screw fixed with M3 x 16 mm with locking washers. Trapezoidal screw, length 10 cm. One of the two M6 linear shafts.
Front part of Z carriage for laser without Z motor 3D part
\Zcarriage\ZCarriageLaserWithoutZMotor
1. Put 6 hexagonal bolts M4 x 50 mm in the front part. Fix the laser holder to Z carriage
● 72
Boek - Build Your Own Multifunctional 4 Axis Machine_converted.indd 72
28/10/2022 11:40
Chapter 6 • The Z carriages
1. Insert M6 linear shaft via top, through the M6 collar; follow the direction of the red arrows. 2. M6 collar. Fix it on top after the M6 shaft is completely inserted to hold the shaft in place. 3. Trapezoidal screws, makes manual adjustment of the distance of the laser to the object possible. 4. Focusing knob for the lens. Do this later, after laser is mounted vertically and use your safety glasses. Adjust the laser ray to as fine a point as possible. Fix front Z carriage to back Z carriage (top view)
Insert from front to back in direction of arrows. 1. Six spacers M4 x 4. 2. Six spacers M4 x 20. 3. Six winged nuts. Winged nuts permit easy switching of different Z modules. 4. The wiring for the laser module is tied to left M6 shaft. Spacers 1 and 2 are in directory: \Various\Spacers Front view
● 73
Boek - Build Your Own Multifunctional 4 Axis Machine_converted.indd 73
28/10/2022 11:40
Build Your Own Multifunctional 4-Axis CNC Machine
1. Manual adjustment of the height of the laser module. Finished mechanical part of laser module
Fix the MDF platform with an M10 bolt and large flat washers. The Z carriage can reach the whole workspace. The wiring of the laser module is tied to the MDF platform and the table leg. Our goal was functionality and not to win a beauty prize for the design. Important When Z carriage has no Z motor or Z switch, add the jumper below on the X2Y4Z PCB!
When jumper is placed and board is powered, the PIC will not lift the Z motor until the Z switch becomes closed. REMOVE THE JUMPER FOR ALL OTHER Z CARRIAGES WITH A Z MOTOR!
6.2 Assembly of a laser module with Z motor 3D parts: \ZCarriage\ZCommonMidPart \ZCarriage\ZCommonFrontPart. This is the same part as for plotter and cutter.
● 74
Boek - Build Your Own Multifunctional 4 Axis Machine_converted.indd 74
28/10/2022 11:40
Chapter 6 • The Z carriages
Front and mid part of Z carriage
1. Insert 6 hex bolts M4, length 60 mm in front part. 2. Insert 4 self-tapping screws. Will later be fixed to the M6 shafts. Fix front and mid part together
1. Six M4 nuts. 2. The fences in the front and mid part allow easy removal of the heated bed using a flat screwdriver. All large parts have this. Z switch and Nema17 stepper (view from frontside)
● 75
Boek - Build Your Own Multifunctional 4 Axis Machine_converted.indd 75
28/10/2022 11:40
Build Your Own Multifunctional 4-Axis CNC Machine
1. Fix lightweight Nema17 stepper by means of four M3 x 12 and locking washers. The wiring of the stepper is fed to the backside. 2. Flexible coupler M5 - M8. 3. Z corner switch. Fix with two M2 x 18 mm. Be careful not to melt the PLA. It is safer to solder the wiring to the switch before mounting the switch. As stated earlier, use one common colour of wire for one of the wires on all the switches. Use different colours for the second wire so that you can easily recognize which switch has which colour wire when you connect them to the controller board. Assembly of laser module 3D parts are in directory: \ZCarriage\Laser\ZLaserHolderWithZMotor Assembly is exactly the same as described in 6.4. Fix laser holder in Z carriage
1. Z switch activator. Bolt M4 x 60 mm, locking washer and nut. 2. Slide an M8 trapezoidal screw coupler into the assembly, and fix the two screws into the coupler to secure it. 3. Slide the M6 linear shafts into the holes and fix the M6 collars to hold the shafts in place. 4. Tie the wiring to the left shaft. Connect the Z motor wiring and the Z switch cable to X2Y4Z PCB. On the image above, the right M6 shaft (200 mm was shortened to 130 mm). Sawing a chrome hardened rod with a hacksaw is a very hard job. With a small angle-grinder it is easier. Observe all safety procedures when working with a grinder! You can leave the right rod also 200 mm. The extra weight doesn’t matter much.
● 76
Boek - Build Your Own Multifunctional 4 Axis Machine_converted.indd 76
28/10/2022 11:40
Chapter 6 • The Z carriages
6.3 Assembly of plotter and cutter 3D parts: \ZCarriage\ZCommonMidPart \ZCarriage\ZCommonFrontPart. The assembly is exactly the same as the laser module with Z motor. Print also the other two parts from the directory: \Zcarriage\Cutter (Plotter) PushCutterOrPen CutterOrPenHolder You also need 2 springs with M6+ internal diameter. It’s easy to make them yourself with aid of 3D coil former part: \Various\MakeSpring\MakeSpring6MM.
Turn 12 turns of 0.6 mm steel wire onto the former. Unscrew the former and cut the free end. PushCutterOrPen - Pusher
1. Fix trapezoidal nut with 4 M3 x 16 with locking washers to (1). 2. Fix the Z switch activator, an M4 x 20 bolt. Lock washer and nut.
● 77
Boek - Build Your Own Multifunctional 4 Axis Machine_converted.indd 77
28/10/2022 11:40
Build Your Own Multifunctional 4-Axis CNC Machine
Fix pusher in Z carriage
1. Fix the 4 locking screws of the flexible coupler M5-M8. 2. Insert four M2 (M2 at M2.3) self-tapping screws. Do not tighten yet. Final assembly pen or cutter holder
1. 2. 3. 4. 5. 6.
Tie 4 LM6UU linear bearings onto the holders. Slide the 2 M6 shafts from top in carriage. Slide M6 shafts through the pusher. Slide the springs onto the M6 shafts. Tighten the self-tapping screws to fasten the M6 shafts. Rotate the trapezoidal screw until the holder is at bottom and the distance between the pusher and the holder is +/- 20 mm. The springs are not too much compressed. 7. Tie two strings between the holder and the pusher. This allows the holder to move up. 8. Tie the cutter (or the pen) to the holder. Why not a fixed coupling between the trapezoidal screw and pen or cutter? We worked some time with fixed couplings, without springs. With a fixed coupling, the alignment of the Z height of the device becomes very critical. Paper is only 0.1 mm thick and vinyl only about 0.065 mm. A difference in the Z height of 0.05 mm or any irregularity on the surface gives a bad result.
● 78
Boek - Build Your Own Multifunctional 4 Axis Machine_converted.indd 78
28/10/2022 11:40
Chapter 6 • The Z carriages
With the spring, the Z height adjustment is far less critical. The springs provide a uniform pressure and a more stable Z height. Lower opening for M6 shafts
1. The plotter and the cutter assemblies do not allow the M6 shafts to pass through the lower holders. 2. The mill and the drill allow the shafts to pass through the lower holder. We will later see that this enables an option to add a dust suction component to the design. Mill and Drill holder could also serve as plotter and cutter holder. Alternative to fix pen and cutter
The pen or cutter is fixed with elastic ties. The cutter holder can also serve as a pen holder. The pen holder cannot serve as cutter holder. The pen holder has a diameter of 12 mm. Using thinner pens is possible in the same holder if you tape them with some paper tape. For thicker pens, you need to print a holder with larger diameter. Cutter holder and blades Below are two types of holders for vinyl or paper cutting activity. Both have possibilities for precise adjustment of cutter depth. Adjustment is possible after fixing the holder on the Z carriage.
● 79
Boek - Build Your Own Multifunctional 4 Axis Machine_converted.indd 79
28/10/2022 11:40
Build Your Own Multifunctional 4-Axis CNC Machine
Cutter knives of various cutting angles exist: - 30° is not used often, only for very thin material. - 60° for thicker material or paper. - 45° is probably best for vinyl.
6.4 Assembly of drill and mill 3D parts in directory \Zcarriage\DrillMill are: DCMotorHolder37 is a holder for motors of 37 mm diameter. DCMotorHolder44 is a holder for motors of 44 mm diameter. DremelHolder is holder for a classic Dremel 4000. SpindleHolder is a holder for 300 Watt spindle motor with external diameter of 52 mm. The Z99 is not a CNC machine. However, if the XY linear shafts are no longer than 40 cm, operating with an ordinary drilling machine (e.g. a Dremel) or a spindle motor is possible. One advantage of a drilling machine is that speed is adjustable and there is no need for a separate DC power supply. A Major disadvantages is the weight (> 400 gram). DC motor A wide variety of DC motors exists. Search for ‘DC motor 12V’ or ‘DC motor 24V’.
Image above shows 2 common types. Left is DC motor with external diameter of 37 mm It is fixed in holder with two M3 x 8 with locking washers. Distance between the two M3 bolts is 25 mm. The shaft is 3.17 mm. Sometimes a chuck is provided with it. If not, search for ‘mini drill chuck 3.17 mm’ and make sure the chuck has an M3 holder.
● 80
Boek - Build Your Own Multifunctional 4 Axis Machine_converted.indd 80
28/10/2022 11:40
Chapter 6 • The Z carriages
Right is DC motor with external diameter of 44 mm It is fixed in holder with two M4 x 10, plus lock washers. The distance between the two M4 bolts is 29 mm. The shaft is 5 mm. Search for ‘mini drill chuck 5 mm’. Both types exist with either a 12- or 24-VDC supply. Some allow variable power supply 12 to 24 V or more, and a higher rotational speed (revolutions per minute (rpm)) depending on the input voltage. It is best to provide a separate DC power supply for the Drill motor. It is not recommended to use the same power supply as the X2Y4Z PCB, because DC motors give spikes. DC motors can rotate in both directions by reversing the + and - contacts. Observe polarity so that drill bit or mill bit is not destroyed. DC motors after fixing in motor holder
Left is the motor with 37 mm diameter. Right is the motor with 44 mm diameter. 1. 2. 3. 4.
Two M3 x 8 with locking washers Two M4 x 10 with locking washers ‘mini drill chuck 3.17 mm’ ‘mini drill chuck 5 mm’
Add M4 x 70, Z switch activation, see image above on the motor on the left. Insert the motor into the Z carriage. Fix the M8 threaded rod and insert the two M6 x 200 mm linear shafts. Additional information about Milling and Drilling of PCBs For one time trial Fix PCB with small wood screws on the MDF plate. Oil the surface of the copper. This will absorb dust. Clean away oil and dust afterwards with a rag and brush. Wear a quality dust mask.
● 81
Boek - Build Your Own Multifunctional 4 Axis Machine_converted.indd 81
28/10/2022 11:40
Build Your Own Multifunctional 4-Axis CNC Machine
If you plan to do drilling and mill frequently it is recommended to add PCB fixation and dust suction and described further. Milling bits The milling bits are important for good results.
Above are three common types. A. V or pyramid shape. Are very cheap. Setting of milling depth is very critical. We could not obtain good results for PCB milling, even with the sharpest ones and with more than one pass. B. Longer shaft. Have a diameter of 0.2 mm or more. Setting milling depth is not as critical. Some have a collar that makes insertion of a new milling bit on the same Z height easier. Most types have a shaft of 3.17 mm. This is OK for most chucks. We obtained no good results with 0.2 mm shafts. They break easy. C. Short shafts. Have a working diameter from 0.2 mm on. Are the most expensive but the best for SMD. Some support very high temperature. Oil cooling is then less necessary. Attention: the shaft is often 4 mm. This is not OK for some chucks. Maybe the best results are obtained by using a spindle motor and power supply with adjustable speed. Spindles are somewhat expensive.
6.5 Assembly of solder paste dispenser The solder paste dispenser needs not only a Z motor for lifting but also a motor for paste extrusion. We describe here our device with a syringe of 3 mm. Dispensing with a larger syringe did not work well, too much paste was extruded. How to put paste into the 3 ml syringe?
● 82
Boek - Build Your Own Multifunctional 4 Axis Machine_converted.indd 82
28/10/2022 11:40
Chapter 6 • The Z carriages
Connect both syringes with a short 5.5 mm external diameter plastic tube. Push and pull both plungers in direction of red arrows. Do not put more paste in the syringe than is needed and try to avoid air bubbles. Assembly The Z99 front carriage differs from plotter, cutter, and drill: \ZCarriage\ZCarriageDispenser
Push the M5 hex nut into the holder (\ZCarriageDispenser\Dispenser\DispHexNutM5Hold)
Fix the cover over the hex nut. (\ZcarriageDispenser\Dispenser\DispMiddlePart)
1. Assemble the two parts using M3 x 16 with locking washers. 2. Insert the M5 x 80 bolt through the M5 captured nut.
● 83
Boek - Build Your Own Multifunctional 4 Axis Machine_converted.indd 83
28/10/2022 11:40
Build Your Own Multifunctional 4-Axis CNC Machine
Complete assembly solder paste dispenser
1.
Place the first coupler between the M5 head and the plunger (\Dispenser\PlungerToM5). 2. Screw a M5 x 80 mm bolt into the hex nut holder (3). 3. Hex nut holder. 4. Fix the M5 to M5 flexible coupler to the M5 x 80 mm bolt (from step 2). 5. ST28 stepper, fixed with two M3 x 30 mm into the holder (\Dispenser\ST28Holder). 6. Flexible coupler M5 - M8 with trapezoidal screw. 7. Two long M6 x 200 mm linear shafts, inserted from the top side. 8. Cover for the paste syringe. 9. Syringe holder with two LM6UU holders tied to it. 10. Luer lock syringe 3 mm with blunt needle screwed into it. The ‘Luer lock’ is very important for keeping the dispensing needle firmly in place.
The pusher is fixed to the syringe holder with twisted wires (1) or ties. The syringe cover (2) is put into place and fixed with ties.
● 84
Boek - Build Your Own Multifunctional 4 Axis Machine_converted.indd 84
28/10/2022 11:40
Chapter 7 • Z99 dedicated to drilling and milling
Chapter 7 • Z99 dedicated to drilling and milling XY shafts of 500 mm and the weight of a Dremel or spindle motor are on the border of the possibilities for precision work. Below is a Z99 with X shafts of 400 mm and Y shafts of 350 mm. The useful workspace is then 280 x 240 mm. This is still a very large PCB. The motherboard of a desktop PC is smaller.
Remarks 1. The lightweight Z motor was on the limit of its power capability. We replaced it with the same type motor as used for the XY motors. 2. When using oil on the PCB for absorbing dust, put a layer of household plastic foil as an under layer. When oil is spilled on MDF, it is impossible to clean it away! Believe me, I did... 3. Borders of foil. 4. Fixed PCB with some oil on it. Sewing oil is OK. The oil absorbs dust and extends live of mill by cooling it. 5. Alternative room to place the PCB and Z origin elevator.
7.1 Fixing for drilling or milling For drilling and milling the PCB needs to be securely fastened to the MDF. A one-time solution could be to fix it in place with some tiny wood screws. A better solution is to make some 4 mm wide fences in the MDF ground plate. Make an under layer for drilling on Z99 with X shafts 40 mm, Y shafts 35 mm
● 85
Boek - Build Your Own Multifunctional 4 Axis Machine_converted.indd 85
28/10/2022 11:40
Build Your Own Multifunctional 4-Axis CNC Machine
Cut an MDF plate 61 (60) X 36.5 cm, thickness 3 mm. 1. 2. 3. 4.
Margin +/- 5 cm Four clamps or small wood screws to temporarily fix the board to the base plate. Distance centre-to-centre of the five fences is 6 cm. Width of each fence is approximately 4.25 mm. An M4 bolt should slide easily in the slot. 5. Length of each fence is 25 cm. We used here a weak laser in Command mode to mark the MDF. Drill two 6 mm holes at the ends of each fence strip and cut the fence slots with a jigsaw. The fences do not need to be perfect. Result with the 5 fixing fences spaced 6cm from each other
Use the thin MDF plate as template on the Z99 for making the same fences in the base plate with a jigsaw or mill in ‘Command mode’. Print two pieces of \Zcarriage\DrillMill\FixPCB
● 86
Boek - Build Your Own Multifunctional 4 Axis Machine_converted.indd 86
28/10/2022 11:40
Chapter 7 • Z99 dedicated to drilling and milling
Remarks 1. Distance between the centres of the fences is 6 cm. 2. Fences are approximately 4.25 mm wide. They should fit an M4 bolt smoothly. 3. Fix the printed FixPCB parts with M4 bolts and winged nuts on the bottom side. 4. The openings in the FixPCB parts are slotted so the fences don’t need to be perfect. What to do if your MDF has fences and you want to plot something? No problem. Remove the two FixPCB parts and put a thin MDF plate (600 x 480x 3 mm) on the surface. Adjust Z height 3 mm.
7.2 Add suction to mill and drill Extra parts 3D part: \Zcarriage\DrillMill\SuctionHolder allows you to add suction to the Z carriage. Flexible suction tubing with an external diameter 8 mm (DIY store or aquarium/fish shop). Aluminium tubing with an external diameter 8 mm internal 6 mm length +-100 mm (DIY store or model shop).
● 87
Boek - Build Your Own Multifunctional 4 Axis Machine_converted.indd 87
28/10/2022 11:40
Build Your Own Multifunctional 4-Axis CNC Machine
1. 2. 3. 4. 5.
Slide the Aluminium tube over the left LM6 shaft. It serves as an extension. Tie the wiring of the Z motor, DC motor and Z switch onto the aluminium shaft. Suction tube 8 mm external diameter. Self tapping M2 screws to fix the suction holder onto the M6 shafts. Self tapping M2 screws to fix the suction tube to the suction holder.
Detail of suction
Adjust (1) the end of the suction tube so that it is as close as possible to drill or mill in working position with self-tapping screws (2). Suction Most battery powered vacuum cleaners are not powerful enough. Select a mains powered device. 3D part \Zcarriage\DrillMill\AdapterVacuumCleaner contains an example adapter for my vacuum cleaner.
Adapter (1) between vacuum cleaner and 8 mm suction tube. The suction tube is fixed with self-tapping screws.
● 88
Boek - Build Your Own Multifunctional 4 Axis Machine_converted.indd 88
28/10/2022 11:40
Chapter 7 • Z99 dedicated to drilling and milling
If your vacuum cleaner has a different construction, adapt the *.scad file or make an airtight seal with tape or glue. Warning Most vacuum cleaners are very noisy. Drilling and milling are also noisy. Wear appropriate ear protection during operation!
● 89
Boek - Build Your Own Multifunctional 4 Axis Machine_converted.indd 89
28/10/2022 11:40
Build Your Own Multifunctional 4-Axis CNC Machine
Chapter 8 • C Sharp source code Open the C:\Z99\CSharpCode\XYZ.sln with Microsoft Visual Studio. The complete C# code for plotter, cutter, drill, and dispenser is free. You may adapt it to your wishes. Even for an experienced programmer, the code of another programmer is often difficult to read. This is the reason that we putted a lot of comments in it. We will not list the complete code which is some 12000 lines of code. When some code is not clear at the first glance, the best way to see what is does is to modify it a bit and see the result of the changes. Before modifying the code, make a backup.
8.1 Overview of the code XYZMainform entry, start screen with main menu. XYZSetupForm setup, COM port choice and various settings. XYZCommandForm manual command of the Z99 and Z height adjustment and switch tests. DrawForm small drawing program, intended for plotter output. HelpForm view this manual. PlotterForm plot with a pen, or mark with the laser. CutterForm cut with the cutter or the laser. DrillForm used for drilling. DispenseForm solder paste dispensing. MillForm mill a PCB, text, or make a solder paste mask with the laser. XYZ1.cs part 1 of a partial class XYZR. XYZ2.cs part 2 of the partial class XYZR. All output to serial port is centralized in the class XYZR. This class avoids duplicate code in modules. Language.cs translations. Are not yet complete. Functions static class with some common functions and management of the configuration *.XM files. The configuration is saved in an XML file called XYZConfig.xml. The XYZConfig.xml file must be in the same directory as XYZ.exe.
8.2 Dedicated class for serial communication A class XYZR.cs is used for the serial communication. The class relies on component ‘SerialPort’ from Visual Studio. It could serve as a base for all projects with C# code where communication with a COM port is necessary without a hardware handshake. We use a software handshake.
● 90
Boek - Build Your Own Multifunctional 4 Axis Machine_converted.indd 90
28/10/2022 11:40
Chapter 8 • C Sharp source code
Condensed code from class XYZR.cs using System; using System.Windows.Forms; // makes MessageBox possible in class namespace XYZ { public class XYZR { public System.IO.Ports.SerialPort serialPort1 =
new
System.IO.Ports.SerialPort(); public static byte[] bytesToPIC = new byte[6];
// all commands are 6 bytes
public Boolean NextCommand;
// as soon as true, PC may send new command
public bool leftFlagX = false;
// true when left X corner switch is closed
// all 7 corner switches have similar declaration in the full code public void InitSerialPort() { // XYZMainForm.CMPRT and Baudrate are stored in .xml configuration file serialPort1.PortName = XYZMainForm.CMPRT; // Com3..Com128 serialPort1.BaudRate = XYZMainForm.baudrate; // default 57600; NextCommand = true;
//
ready to receive commands
// Event handler when serial port of PC receives incoming command: this.serialPort1.DataReceived += new System.IO.Ports.SerialDataReceivedEventHandler(this.serialPort1_DataReceived); } // variable below is used in Z99PP for measuring vacuum pressure: private int pressure; public int thePressure {
get
{
return this.pressure;
}
public int OpenSerialPort()
} // open comport
{ try {
if (serialPort1.IsOpen == false) serialPort1.Open(); return 1;
}
catch (Exception Exc) {
MessageBox.Show(Exc.ToString()); return 0;
}
} public void CloseSerialPort()
// close comport
● 91
Boek - Build Your Own Multifunctional 4 Axis Machine_converted.indd 91
28/10/2022 11:40
Build Your Own Multifunctional 4-Axis CNC Machine
{ if (serialPort1.IsOpen) { serialPort1.ReadExisting(); serialPort1.Close(); } } // Turn laser on or off.
action 0 = OFF, action 1 = ON.
public void SetLaser(int action) { if (OpenSerialPort() == 0) return; bytesToPIC[0] = 75;
// ASCII 75 = LASER
bytesToPIC[1] = (byte)(action);
//
0 or 1
bytesToPIC[2] = 0; bytesToPIC[3] = 0; bytesToPIC[4] = 0; sendBytesToPIC(5); } // Set speed of XY motors public void SetXYMotorsDelay(int delay) { if (OpenSerialPort() == 0) return; bytesToPIC[0] = 68;
//
D = delay,XY steppers speed
bytesToPIC[1] = (byte)((delay & 0xFF00) >> 8); //
MSB first
//
LSB
bytesToPIC[2] = (byte)(delay & 0X00FF); bytesToPIC[3] = 0; bytesToPIC[4] = 0; sendBytesToPIC(5); } // Command for XY steppers for case
xSteps and ySteps are both > 8);
//
MSB of X
bytesToPIC[2] = (byte)(xSteps & 0X00FF);
//
LSB of X
bytesToPIC[3] = (byte)((ySteps & 0xFF00) >> 8);
//
MSB of Y
steps steps steps bytesToPIC[4] = (byte)(ySteps & 0X00FF); //
LSB of Y steps sendBytesToPIC(5); }
public void sendBytesToPIC(int CountBytes) { // checksumbyte calculation: bytesToPIC[5] = (byte)(bytesToPIC[0] + bytesToPIC[1] + bytesToPIC[2] + bytesToPIC[3] + bytesToPIC[4]); // wait until previous command is ready : while (NextCommand == false) Application.DoEvents(); //
NextCommand will become true when byte is received in next method NextCommand = false; serialPort1.Write(bytesToPIC, 0, CountBytes + 1);
// Ready, send to
PIC } //
NextCommand will become true when byte is received
private void serialPort1_DataReceived(object sender, System.IO.Ports.SerialDataReceivedEventArgs e) { int br;
//
br = byte received, is indeed an
int while (serialPort1.BytesToRead > 0) { br = serialPort1.ReadByte(); if (br == 43)
//
43 = ASII for +, give us more data
{ InputIndex = 0; XYZMainForm.SerialPortReturnS = br.ToString(); NextCommand = true; } else if (br == 45)
//
X left switch is closed
{
● 93
Boek - Build Your Own Multifunctional 4 Axis Machine_converted.indd 93
28/10/2022 11:40
Build Your Own Multifunctional 4-Axis CNC Machine
XYZMainForm.SerialPortReturnS = br.ToString(); NextCommand = true; leftFlagX = true; EscapeXY_Move(1, 600, 0);
//
600 = 3 mm
br = 0; } //
here escape code for all 7 switches is omitted, see complete source code } }
} }
//
end of class XYZR
//
end of namespace XYZ
To use the class XYZR in other C# code we add the class XYZR.cs to our solution and create an instance of it: using System; using System.Windows.Forms; using System.IO; using System.Runtime.InteropServices; using System.Diagnostics; namespace XYZ { public partial class CutForm : Form
// Form in use
{ XYZR MyXYZR = new XYZR();
// instance creation
MyXYZR.InitSerialPort();
// Set comport number and baudrate
} // examples of use of the instance of the class XYZR private void buttonSetLaserON_Click(object sender, EventArgs e) { MyXYZR.SetLaser(0);
// 0 turns laser on
} private void buttonSetLaserOFF_Click(object sender, EventArgs e) { MyXYZR.SetLaser(1);
// 1 turns laser off
} // example of XY steps private void buttonDoStepsXY(object sender, EventArgs e) { MyXYZR.SetXYMotorsDelay(250);
// XY motor speed. // higher argument = slower speed
● 94
Boek - Build Your Own Multifunctional 4 Axis Machine_converted.indd 94
28/10/2022 11:40
Chapter 8 • C Sharp source code
MyXYZR.XY_Move(1, 100, 200);
// 1 = direction to front and right // 100 = x microsteps to do // 200 = y microsteps to do
} // on quit of module private void buttonQuit(object sender, EventArgs e) { MyXYZR.CloseSerialPort(); } }
To understand the serial communication code, also have a look at the MikroC code for the PIC in directory C:\Z99\MikrocontrollerCode.
● 95
Boek - Build Your Own Multifunctional 4 Axis Machine_converted.indd 95
28/10/2022 11:40
Build Your Own Multifunctional 4-Axis CNC Machine
Chapter 9 • Working with XYZ.exe Launch C:\Z99\WindowsSoftware\XYZ.exe or click on the desktop icon.
9.1 Main menu
1. 2.
Setup. Do this once before applying power to the Z99. Command mode lets you test all commands, set the XYZ speed and the Z position used by steps 6 to 10. 3. Draw. A simple drawing program to make HPGL files. 4. Help. 5. Quit. Quits the program. 6. Plotter. For plotting with an ordinary pen, a pen with conductive ink or a pen with etch free ink. It can be used to engrave with the laser. Works with HPGL files. 7. Cutter. For paper cutting, vinyl cutting and laser cutting. Works with HPGL files. 8. Drill. Drill excellon *.drl files. 9. Dispense. Solder paste dispensing with a dispenser *.disp file. 10. Mill. Mill a PCB, wood or paper and you can mill a solder paste mask with the laser. Works with *.gcode files made from Gerber files by means of FlatCAM. The structure of HPGL, *.drl, and *.gcode files is explained in Chapter 11.
● 96
Boek - Build Your Own Multifunctional 4 Axis Machine_converted.indd 96
28/10/2022 11:40
Chapter 9 • Working with XYZ.exe
9.2 Setup
Left in the setup screen are settings for the screen 1. 2. 3. 4.
Select language. Not all text has been translated from English. Colour of buttons in the program. Colour of the form, the room around the buttons. Background colour of graphics screens.
Right in setup screen are settings for the hardware 5 Comport. This is a number 3 to 128 that Windows assigned to your 5 V - TTL USB serial converter cable. Windows takes the lowest free comport number. Making a wrong choice will not harm but machine will not work. How to find the correct comport number? Remove the cable from the USB port. Click the down symbol in the combo box. The down symbol is marked in a red box in the image below. Do this before the Z99 is connected to USB. Write down the COM port numbers. Connect the cable and switch on the Z99. Click the down symbol again with the cable connected. The extra port that appears in the dropdown list is the correct choice. Below this is COM5. Click on ‘COM5’ in the dropdown list to select it in the combo box.
● 97
Boek - Build Your Own Multifunctional 4 Axis Machine_converted.indd 97
28/10/2022 11:40
Build Your Own Multifunctional 4-Axis CNC Machine
If no extra comport number is displayed in the drop-down list when USB cable is connected, there are two possibilities: - USB serial converter cable is not functioning correctly. - One or both drivers for the usb serial converters are not installed. Remove the cable from USB. Execute once \Z99\WindowsSoftware\CDMUSB.exe. This appears to do nothing. Verify that your internet connection is operational. Wait five minutes. Connect the cable again and click again on the red rectangle above. On subsequent starting up operations, If the machine doesn’t work, verify the comport choice as windows can sometimes re-allocate them! 6. The default baud rate is 57600. If you want another baud rate, do not forget to change the baud rate in the MikroC source code and the *.hex file! 7 and 8. Length of X and Y shafts respectively in mm. 9 and 10. X and Y margins respectively. Leave these set to 0 for the moment. At the bottom of the setup screen are the following buttons: 11. Cancel. Quits the setup program without saving your choices! 12. Save and quit. Saves the settings and quits the setup program.
9.3 Command mode In the ‘Command mode’, you can test all the XYZ movements by clicking on the arrows. Before starting with laser, plotting, cutting, drilling, milling, or solder paste dispensing, spend some time in the command mode to adjust XYZ speed and Z position. The textboxes next to the arrows contain dimensions in mm. Editing is possible. Float values are allowed. Use a decimal point!
● 98
Boek - Build Your Own Multifunctional 4 Axis Machine_converted.indd 98
28/10/2022 11:40
Chapter 9 • Working with XYZ.exe
1. Menu
‘Detect hardware limits’ (1) Verify that the power of Z99 is ON. Execute. The useful workspace depends not only on length of the XY shafts but also on position of the XY corner switches. The software will check and use the detected values. Reset (2) Tries to reset the PIC. Success is displayed in RX box, right below. Quit (3) Quits command mode. 2. Select action. The settings below 4, 5 and 6 apply only to the action selected in 2! 3. Laser. When the checkbox ‘Laser’ is checked, all XY commands are done with the laser switched ON. 4. XY travel speed. The XY speed when Z device, pen, cutter, drill, mill is up. XY work speed. The XY speed when Z device is down. If below 2 ‘Drill is selected, work speed is not displayed. XY movements are not allowed when drill is down! ‘Mill’ requires a low work speed, e.g. 10 mm/sec. 5. Z up speed. Speed of Z movement upwards. Z down speed. Speed of Z movement downwards. ‘Drill’ and ‘Mill’ require low speed downwards, e.g. 5 mm/sec. 6. Z up position. Distance from top Z switch in mm for a selected tool up action. Z down position. Distance from top Z switch in mm for a selected tool down action. The small button ‘Set’ sets speed or position of 4, 5 and 6. An example for plotter pen and the Z up and Z down position ‘Z up position’: pen may have no contact with paper, best set to a few mm above the paper. ‘Z down position’: pressure of pen against paper, depends on the pen, position of the pen in the holder, the paper thickness and the XY speed. A few test lines are necessary to determinate the best ‘Z down’ position. We will see later how fine adjustment changes of the Z position are possible in all modules. All parameters may be critical to obtain good results. A laser with too much XY speed gives almost no result. A vinyl cutter with too much Z depth gives a poor raggedy cut.
● 99
Boek - Build Your Own Multifunctional 4 Axis Machine_converted.indd 99
28/10/2022 11:40
Build Your Own Multifunctional 4-Axis CNC Machine .
Vinyl is only about 0.07 mm thick. The Z depth for milling is also very critical so you don’t damage your milling bits. For all these settings start with a very low XY speed e.g. 10 mm/sec. Checking of the corner switches Set XY speed very slow, e.g., 5 mm/sec. Move Z tool to the middle. With arrow give a command of e.g., 150 mm to a free direction. Press manually a corner switch. The Z99 should stop directly. Test all 6 XY corner switches. Test also the Z switch after giving an upwards Z command. Textbox TX at right of command mode screen The six bytes of commands send to the PIC are listed. This serves as a debugging option. Button ‘Clear’ clears content of textbox TX. Textbox RX at right of command mode screen Byte received from the PIC after execution of a command. This serves as a debugging option. Button ‘Clear’ clears the content of textbox TX. Laser focusing Wear protection goggles at all times when using a laser, These devices can permanently damage your sight. Set the laser to object distance to about 20 mm by turning trapezoidal screw. (1) Press the ‘weak light button’ on laser control board and turn the focusing knob (2) to set the beam to be as narrow (small and focussed) as possible.
Test then for optimal XY speed for desired effect.
● 100
Boek - Build Your Own Multifunctional 4 Axis Machine_converted.indd 100
28/10/2022 11:40
Chapter 9 • Working with XYZ.exe
Troubleshooting What to do if the Z99 has no reaction to the Command mode commands. Verify that DC power 12 to 24 V is ON. Verify all connections. Plug the USB serial converter cable in and out. This resets the serial converter. Verify that the right comport number and baud rate are still selected in the setup. Try to reset the pic microcontroller with command Menu – Reset PIC. If this works, the RX textbox will show ‘43 Reset OK’. If this does not work, switch OFF the DC power of Z99, then switch it ON again after one minute. Quit and restart XYZ.exe. If still no success, reboot your PC from cold. Important During all activities that take some time, make sure that PC doesn’t fall asleep! Right-click on Windows 10 desktop – ‘Display settings’ and select ‘Power & sleep’
9.4 Draw Draw is a simple program to make a HPGL file. You have then a file to test the plotter and cutter.
● 101
Boek - Build Your Own Multifunctional 4 Axis Machine_converted.indd 101
28/10/2022 11:40
Build Your Own Multifunctional 4-Axis CNC Machine
1. Menu
Before start drawing it is possible to ‘Load a model image’, jpg, png or bmp as a template. 2. Mirror With Menu – Open HPGL file it is possible to load a *.hpgl, *.plt or *.pen file. If this is a PCB layout, it is sometimes rendered in a mirrored state. It depends on the software that created the file. In that case execute “Menu-Clear all”, check ‘Y mirror’ and reload the file. 3. Drawing Tick the ‘Drawing’ box for freehand drawing. Select colour and thickness pen at left. Press the left mouse button to do freehand drawing.
● 102
Boek - Build Your Own Multifunctional 4 Axis Machine_converted.indd 102
28/10/2022 11:40
Chapter 9 • Working with XYZ.exe
4. Undo Undoes the last drawn steps. Number of undo steps is set with 5. 5. Number of undo steps List box on the left shows all commands as HPGL instructions for didactic purpose. Don't forget to save your work with 'Save HPGL file’.
9.5 Plotter
Figure XXX: PCB plot 1. Menu Load an existing *.hpgl or *.plt file. The extension .plt is often be used by PCB design programs. Above file ‘X2Y4ZBottomCopper.plt’ has been loaded. This is a file that is ready to draw the PCB with an etch free pen on a PCB. We will later explain how you can create this file in a PCB design program. 2. Progress bar Loading or plotting a large file can take some time. Below the progress bar are 3 small radio buttons R (red) G (green) and (B) blue. The list box at left contains the HPGL commands. A click with left mouse button on a command will draw a small cross in the picture with the selected RGB colour. Lines that are plotted are drawn in the selected RGB colour. 3. Checkbox ‘Y mirror’, it is often necessary to check this box before loading a file. Below checkbox ‘Y mirror’ is the checkbox ‘Border’. When ‘Border’ is not checked, borders will not be plotted.
● 103
Boek - Build Your Own Multifunctional 4 Axis Machine_converted.indd 103
28/10/2022 11:40
Build Your Own Multifunctional 4-Axis CNC Machine
4-5. Plot dimensions Custom dimension: for a PCB plot, select ‘Custom dimensions’ and enter the XY dimensions of the PCB in mm with at least 3 decimal places of precision.
Preset values
Take care not to exceed the maximal possible X and Y dimensions of the Z99. Dimensions of a plot are always output oriented. Drawing is scaled to the selected output dimensions. The input dimensions, inch or mm have no importance! Below button ‘Output’ are three buttons ‘1’ ‘2’ and ‘4’. Default is ‘1’. On Figure 9.5 #4 is selected to show more detail on the screen. 6.
Checkbox ‘Laser’ For plotting with a normal pen, do not select this box. For laser engraving check the box and enter the number of passes. For laser engraving 1 pass is often enough.
● 104
Boek - Build Your Own Multifunctional 4 Axis Machine_converted.indd 104
28/10/2022 11:40
Chapter 9 • Working with XYZ.exe
7.
Start plot Verify that pen is properly attached and the Z99 is ON. After the plotting starts, items 9, 10 and 11 become invisible. It is still possible to adjust XYZ speed and Z position if the Z99 is paused.
8.
Pause This is an important option. It allows secondary adjustments of XY speed and Z position. When ‘Pause’ is selected, items 9,10 and 11 become visible.
In 9, 10 and 11 the values that were set in ‘Command mode’ for the plotter are displayed. 9.
Top it is possible to set another XY travel speed. This is the speed when the pen is up. Bottom it is possible to set another XY work speed. This is the speed when the pen is down.
10. Top it is possible to set another speed for upward Z movement. Bottom it is possible to set another speed for downwards Z movement. 11. Top permits adjustment of the pen up position. Bottom This is the most important possible adjustment during pause. If the Z position is too low, the pen will hesitate on the paper and sharp corners will be rounded off. If the Z position is too high, the drawing will not be clear. The small blue up and down arrows at right move the pen 0.1 mm up or down. You might also enter a new float value in the textbox yourself. Use ‘.’ as decimal separator e.g., 10.25 mm. For 9, 10 and 11 the button ‘Set’ sets the new parameters that are in textboxes. After adjustment, deselect the ‘Pause’ button, and the plotter will continue with the new settings. 12. Actual XYZ coordinates in mm are displayed on top right of screen.
9.5.1 Plot a large format schematic design. When you have a large schematic, plotting on a large format gives a more readable view than one printed on A4. Open the plot module of XYZ.exe Check ‘Y mirror’ and ‘Border’ With button Menu-Open *.plt open X2Y4Z.plt made with KiCad. X2Y4Z.plt contains the schematic design of X2Y4Z PCB. We will explain later how to make a HPGL compatible *.plt file in KiCad.
● 105
Boek - Build Your Own Multifunctional 4 Axis Machine_converted.indd 105
28/10/2022 11:40
Build Your Own Multifunctional 4-Axis CNC Machine
After opening the plot file, be patient. Rendering takes a few seconds.
Select output format as large as allowed by the Z99 and paper in use and start the plotting. Below is the plotted schematic design of the X2Y4Z PCB.
1. 2.
The output above is made with an ordinary pen. The pens are wrapped in tape so they fit in the holder and are fixed with three ties. The paper and under layer pad below are fixed with a little bit of paper tape in the margins.
● 106
Boek - Build Your Own Multifunctional 4 Axis Machine_converted.indd 106
28/10/2022 11:40
Chapter 9 • Working with XYZ.exe
Plotting on paper takes some time. The example above took 2 hours. There are more than 60000 vectors to plot. The main reason is the large amount of text in the design. Each digit or letter is plotted as a sequence of vectors.
9.5.2 Plot a PCB with etch resist pen Search for “etch resist PCB pen” or “etch free PCB pen”. You will see the one below on several sites.
The pens are very cheap. Buy a set. The colour is not important. The pens dry out rather fast. Leave them in original package until you need to use them. Most pens have two tips: about 0.9 mm thick(1). about 0.45 mm thick(2). It is not possible to make traces or pads smaller than the diameter of the pen tip. We used a 0.45 mm tip and a slow working speed of 15 mm/sec. Do not apply too much downwards force on the small tip. Test the Z down position in the command mode on a piece of scrap copper PCB. When there is too much pressure on the small tip, it will deform or break. Clean the copper surface of PCB with acetone or alcohol and dry it. The PCB is fixed with paper tape to the MDF ground plate.
● 107
Boek - Build Your Own Multifunctional 4 Axis Machine_converted.indd 107
28/10/2022 11:40
Build Your Own Multifunctional 4-Axis CNC Machine
After plotting:
All traces and pads should be well covered. If a PCB is not plotted correctly from the first try, don’t panic just clean the copper surface with acetone or alcohol, dry and retry it. Etch the PCB with Ferric Chloride (FeCl3) until all the bare copper is removed. If you are not familiar with FeCl3 search for “etch pcb with fecl3”. Flush with water, dry and remove the etch resist with acetone or alcohol. Result:
9.5.3 Plot a PCB with conductive ink pen Search for “Circuitscribe pen”. These pens are not expensive or toxic. The ink dries in about 3 minutes. The Figure on the left below is a simple PCB design. The IC is a ‘555’ timer IC and functions as multi vibrator. Resistors and capacitors are 0805 types. The Figure on the right shows the output on cardboard of 0.12 mm.
● 108
Boek - Build Your Own Multifunctional 4 Axis Machine_converted.indd 108
28/10/2022 11:40
Chapter 9 • Working with XYZ.exe
Some hints for successful plotting with conductive ink Make pads and tracks large enough. Thinnest traces are 0.65 mm width. Tip of pen is about 0.4 mm. We selected in DesignSpark PCB 0.3 mm as pen width so that each track has at least 3 passes of the pen. We will explain later how to do this. Thinner traces 0.4 mm are possible when design is plotted more than once. Shake the pen very well and test it on paper before mounting the pen in the pen holder. Working XY speed was 15 mm/sec. No need to apply very much force on the pen, the conductive liquid ink flows easily from the tip. Figure below shows the paper “PCB” with components soldered on it. We made the legs of the DIP IC horizontal.
● 109
Boek - Build Your Own Multifunctional 4 Axis Machine_converted.indd 109
28/10/2022 11:40
Build Your Own Multifunctional 4-Axis CNC Machine
The circuit worked from the first try, both LED’s flash alternately! Soldering Soldering on conductive ink requires some experience and practice. Do not make the soldering iron too hot, about 250° is good, and allow a couple of seconds cooling after applying the iron and solder. Plotting a circuit with conductive ink offers quite a lot of fascinating possibilities! Two things that did not work were: - Printing on the back side of a single sided PCB. The ink refuses to stick to it. - Printing on heat resistant baking paper. The idea was to use solder paste and hot air gun for soldering. Unfortunately, the ink did not stick to the baking paper. There is still a lot of room for further experimentation with other conductive pens and other materials to print on!
9.5.4 Engraving with the laser Warning: observe safety precaution as described in Chapter 1. Figure below shows a freehand drawing made in the module ‘Draw’ from the file ‘Elephant. jpg’. Note that the author is not very skilled in freehand drawing.
● 110
Boek - Build Your Own Multifunctional 4 Axis Machine_converted.indd 110
28/10/2022 11:40
Chapter 9 • Working with XYZ.exe
1. 2. 3. 4. 5.
Check ‘Border’. Since there is no border in the drawing, check it! Output – Enter desired X and Y dimensions for output. Set checkbox ‘Laser’ ON. Verify that Z99 and laser are powered and start the laser engraving Checkbox “Pause” allows to modify the working speed.
Engraving with the laser module is possible without using the Z motor. Figure below shows output on piece of MDF:
Many materials are suitable for engraving, including leather, wood, dark paper etc. Don’t use reflective surfaces like glass, polished metal. The reflection could damage your eyes.
● 111
Boek - Build Your Own Multifunctional 4 Axis Machine_converted.indd 111
28/10/2022 11:40
Build Your Own Multifunctional 4-Axis CNC Machine
9.6 Using the Cutter With ‘Menu’ – Open an HPGL file, e.g., ABC.hpgl.
This menu is about the same as the plotter menu. 1. A click in the list box with HPGL commands marks the corresponding point on the drawing with a cross and with selected colour Red, Green or Blue. 2. When ‘Border’ is unchecked, the border is not cut. Here ‘Border’ is best checked, otherwise part of letters on the outside are not cut. 3. Setting of cutter down position is very important. The small blue arrows up and down allow adjustments of 0.1 mm. Confirm with the ‘Set’ button. With the cutter too high, the vinyl or paper is not cut cleanly. With the cutter too low, the bottom layer of vinyl is also cut. When cutting paper, ensure the ‘Border’ checkbox is not selected, as this would cut the paper away from the securing tape and the centre piece can move around, ruining your paper cutting experience. The cutter needs also: A bottom protection layer Search for a ‘Self-healing mat’ to use for the bottom layer. It protects the MDF board, if you cut too deep, and it makes cleaner cuts.
● 112
Boek - Build Your Own Multifunctional 4 Axis Machine_converted.indd 112
28/10/2022 11:40
Chapter 9 • Working with XYZ.exe
A selection of Vinyl sheets Search for ‘Cutter vinyl sheets’
At left of the image above is an assortment. At right are ‘black matte vinyl sheets’. Attention Vinyl rolls are not really acceptable. It is too difficult to lay them flat. The cutter is designed to cut flat materials. What to buy? Flat vinyl sheets and a self-healing mat. Transfer tape is handy for small items. Self-healing mats are also available in sewing shops or hobby shops, for cutting tissues. There is a lot to learn about vinyl cutting. On the web are many interesting videos and tips. Search for ‘Vinyl cutting’ or ‘Vinyl cutting using transfer tape’.
● 113
Boek - Build Your Own Multifunctional 4 Axis Machine_converted.indd 113
28/10/2022 11:40
Build Your Own Multifunctional 4-Axis CNC Machine
9.6.1 Cutting vinyl With Menu – Open file ‘Inkscape.hpgl’. We will later learn how to makes a suitable file in Inkscape.
1. 2. 3.
1. 2. 3. 4. 5.
Check ‘Mirror’ and ‘Border’. Set output format, dimensions. XY speed may be rather high, eg 40 mm/sec.
Self-healing mat. Vinyl and mat are fixed to the MDF base with some paper tape. Glossy vinyl sheet. Backside of a wasted vinyl sheet. It shows the letters after transfer. Blade and tweezers used for transfer to other surface.
9.6.2 Cutting with laser
Cutting matte vinyl or dark coloured paper is easy, even with a weak 500 mW blue laser. 1. ‘Border’ is not checked here. Cutting paper: if drawing has a border rectangle, do not check! If you do, paper will float around after cutting border. Vinyl: check ‘Border’.
● 114
Boek - Build Your Own Multifunctional 4 Axis Machine_converted.indd 114
28/10/2022 11:40
Chapter 9 • Working with XYZ.exe
2. Select output format dimensions. 3. Check ‘Laser.’ Note that setting the Z up and Z down speed is not possible. 4. Select number of passes. For vinyl of 0.65 mm 1 pass is enough. For thick wrapping paper of 0.12 mm 2 passes is better. 5. When the laser is equipped with a Z motor, then the Z depth is adjusted after each pass. This is only handy when you try to cut thick objects. If no Z motor is mounted, this is ignored. 6. Working speed. Here 6 mm/sec is selected. This could differ. Try out first in the ‘Command mode’. 7. It is possible to use a Z motor for setting the distance to the object. If a Z motor is not present, this is ignored. WARNING: Laser cutting of vinyl gives a very unpleasant smell and toxic fumes. Do not do it indoors unless you have a fume extractor and filtering device!
9.7 Drilling holes with the drill Drill files (*.drl) are text files. They can be opened with a text editor e.g., Windows Notepad or Notepad++. Example of a drill file with 2 holes: METRIC (OR
INCH)
T001
// coordinates are in mm OR in inches. // drill in use, diameter is in a separate drill
identification // file or in the header. X02092210Y02068130
// coordinates for drilling at X 20.9221 Y 20.6813 mm
X02092210Y02318920
// coordinates for drilling at X 20.9221 Y 23.1892 mm
The drill menu is almost the same as the plotter or cutter menu.
1. A click in the list box will display the corresponding drill hole. 2. No possibility to set XY speed when drill is down. XY movement with drill down would destroy it.
● 115
Boek - Build Your Own Multifunctional 4 Axis Machine_converted.indd 115
28/10/2022 11:40
Build Your Own Multifunctional 4-Axis CNC Machine
3. Select the decimal place precision of the drill file. This is done on the right, in the combo box ‘Decimals’. It is very important to select the same number of decimal places as in your PCB software. For drill files made with KiCad, ‘Decimals’ is always 3. We will later show how to make a drill file in a PCB design program. Pause to adjust settings is also possible 1. Check ‘Pause’. A panel with four arrows and a textbox appears (See figure below).
2. The default in the textbox is 0.1 = 0.1 mm. You can enter any integer value like 2 (for 2 mm) or a floating number like 1.25 for 1.25 mm. 3. Click on one of the four arrows to move the offset. ‘Pause’ is handy in several cases Before starting to drill. ‘Pause’ allows you to place the drill at the exact at origin of a PCB. You can also do this in the command mode. After starting drilling. ‘Pause’ permits secondary small adjustments. Suppose you have a PCB that has previously been etched or milled. Check ‘Pause’ after the first hole and observe that it is perfect in the middle of the pad. If not, use the arrows to adjust. Changes to XY speed, Z speed and Z position are also possible. Uncheck ‘Pause’ to continue. When drilling a PCB that is already etched or milled, it is wise to start with drilling the non-critical holes from separate file.
● 116
Boek - Build Your Own Multifunctional 4 Axis Machine_converted.indd 116
28/10/2022 11:40
Chapter 9 • Working with XYZ.exe
Example Figure below shows a PCB, we milled first. Apply tape to the PCB first, otherwise the drill can jump around. We use a thin paper tape (painters tape), the same as used with 3D printers. The tape is somewhat transparent.
Result after drilling all holes with a 0.8 mm drill bit.
Drill the corner mounting holes first! If the drilling location is not perfect, the PCB is not ruined yet. Adjust with button ‘Pause’, before drilling the critical holes.
9.8 Solder paste dispensing Mount the dispenser. Before you start verify that the dispenser is ready, and the tip is filled with paste without air bubbles.
● 117
Boek - Build Your Own Multifunctional 4 Axis Machine_converted.indd 117
28/10/2022 11:40
Build Your Own Multifunctional 4-Axis CNC Machine
1. Extr - Click the Extr button to extrude an amount of paste, here ‘250’. Note that 4096 extrusion clicks advances plunger of syringe 1 mm. 2. Retr - Check retraction. When moving from one pad to another, retraction is necessary to avoid dripping or dragging solder paste across the board. Retraction sucks the solder paste back into the syringe so it doesn’t drip. A 3D printer also uses this method. 3. Perc - Percent of extrusion. 100 by default. 50 sets extrusion to half, 200 to double. 4. Retr steps - Steps of retraction after each pad. It is possible to change 3 and 4 during ‘Pause’. 5. Y-Mirror - Check Y mirror before loading the Gerber paste file, if ‘mirror’ was not done in PCB program. 6. Menu - Open a Gerber PASTE file. We will later explain more about Gerber files and Gerber file generation.
All pads are displayed equally, with same dimension. Large pads will need more solder paste then small ones. 7. Click on a pad shape to display corresponding pads in red. Rectangular or oval pads can receive more than one dot of solder paste. Possibilities for each pad shape are: A/ Six possibilities for the dots • one dot • two horizontal dots • two vertical dots • three horizontal dots • three vertical dots • four dots B/ Dot distance, if more than one dot. C/ Amount of extruded paste for each dot. Set with “Extr”(1)
● 118
Boek - Build Your Own Multifunctional 4 Axis Machine_converted.indd 118
28/10/2022 11:40
Chapter 9 • Working with XYZ.exe
Screen after loading a Gerber solder pad mask file 1. 2. 3. 4. 5.
Select a pad in left column. The selected pads are displayed as red on the screen. Set number and direction of dots. For most pads, a single dot is enough. Set distance of dots on the pad in mm. Select the amount of solder paste for one dot, with “Extr”. Set will display the changes on the right of the screen.
Don’t forget to save your work When all pads are done, save your work with Menu – Save as dispense file.
Later you can open this *.disp file for editing or execution. When loading a dispense file, don’t check ‘Y mirror’.
● 119
Boek - Build Your Own Multifunctional 4 Axis Machine_converted.indd 119
28/10/2022 11:40
Build Your Own Multifunctional 4-Axis CNC Machine
Start dispensing
1. Syringe is fixed with two ties. 2. Between the PCB and the MDF base plate there are 4 ~ 2 mm thick foam pads. The PCB is fixed in place with paper tape. The foam pads make the adjustment of Z depth easier. The tip of dispenser should touch the PCB when the dispenser is down. In ‘Command mode’ or after checking ‘Pause’ navigate the tip of the needle to the left top corner of the PCB, load the dispense file and start dispensing. Detail of PCB after dispensing:
The rest of the dispenser menu has the same properties as plotter, cutter, drill, and mill.
● 120
Boek - Build Your Own Multifunctional 4 Axis Machine_converted.indd 120
28/10/2022 11:40
Chapter 9 • Working with XYZ.exe
We did a lot of work on the solder paste module and it works very well. However, this was before we discovered the possibility of burning a solder paste mask with a low power laser.
9.9 Milling The Z99 is built strong. Milling a PCB or even wood is possible. Milling uses G-code files made with the FlatCAM software. ‘Flatcam’ is freeware program that makes a conversion of a Gerber file into G-code possible. In Chapter 10 we will learn how to convert a Gerber to G-code file by means of FlatCAM.
9.9.1 Milling a PCB 1. Open the G-code file with ‘Menu’ – ‘Open gcode’. Verify that image is not mirrored. When there is ‘Copper’ text on it, it should be readable.
2. 3. 4. 5. 6. 7.
This is the layout of a copper bottom file. No need to check ‘Y mirror’. Output format. Select ‘Custom dimensions’. Enter the dimensions of the PCB in mm with at least 3 decimals precision. Verify that ‘Laser’ is unchecked. Start milling. Check ‘Pause’ to make changes to mill speed, mill depth or mill position.
Is it possible to mill a double-sided PCB? Yes, but it requires precise position adjustment. The holes are not Through Plated so you must solder on both sides. Should the holes be drilled before or after milling? Opinions differ about this question. When holes are drilled before milling, taping the PCB is not necessary.
● 121
Boek - Build Your Own Multifunctional 4 Axis Machine_converted.indd 121
28/10/2022 11:40
Build Your Own Multifunctional 4-Axis CNC Machine
Example of milled PCB
This PCB was milled with a Dremel and 0.5 mm mill. 0.5 mm means mill width means that you must add 0.5 mm to traces and pads. Advantage of a wide mill is that deburring is easy.
9.9.2 Laser ‘milling’ a solder paste mask A solder paste mask makes dispensing of solder paste on an SMD PCB easy. We show here a method to make a paper solder paste mask. 1. Open a G-code paste file with ‘Menu’ – ‘Open gcode’. The example below is the top paste file for “Feeder32PCB”. Note that the pads are made and displayed somewhat smaller than they really are. Since the laser beam has a small diameter, this is necessary.
2. This is a top view file. Check ‘Y mirror’, if not done in PCB program. Leave ‘Border’ unchecked. Paper would float around if border were first “cut”.
● 122
Boek - Build Your Own Multifunctional 4 Axis Machine_converted.indd 122
28/10/2022 11:40
Chapter 9 • Working with XYZ.exe
3. Output format. Select ‘Custom dimensions’ 4. Enter the dimensions of the PCB in mm with at least 3 decimal places of precision. 5. Check ‘Laser’. Below checkbox ‘Laser’ are 2 boxes. You can see what they mean by hovering the mouse cursor over them. A hint text will be displayed. The left combobox displays the number of passes. For a wrapping paper of 0.120 mm thick, 2 laser passes are better than 1. The Right textbox is for the Z adjustment after each pass if there is a Z motor. 6. Start the laser. 7. Check ‘Pause’ to make changes to XY speed or distance of laser to object. When ‘Pause’ is checked the laser is turned off. 8. XY laser speed of 8 mm/sec works for 500 mW laser and brown wrapping paper of 0.120 mm thick. 9. When the Z carriage is equipped with a motor, adjustment of the height is possible during ‘Pause’. Examples of solder paste mask Below is an enlarged image of a small chip (FT232RL), 0805 components and some contact pads. Pads of the chip have pitch of 0.625 mm.
Burning in two passes at 6 mm/sec takes only about 2 minutes. In figure below is a large solder paste mask. The PCB dimensions are 149.931 x 112.397 mm.
● 123
Boek - Build Your Own Multifunctional 4 Axis Machine_converted.indd 123
28/10/2022 11:40
Build Your Own Multifunctional 4-Axis CNC Machine
Burning in two passes at 6 mm/sec takes about half an hour. Figure below shows an enlarged view of the large solder paste mask. The pitch of the chips is 1.27 mm.
Is it possible to burn a solder paste mask for a very fine pitch ICs EG 0.4 mm? A laser beam has a small diameter. In the case of a cheap low power laser, this is about 0.1 to 0.150 mm when properly focussed. Suppose that we have pads of only 0.2 mm width, we need to subtract then at least 2 x 0.1 mm, so nothing would be left. We will see later how to subtract the beam diameter during the Gerber file generation.
● 124
Boek - Build Your Own Multifunctional 4 Axis Machine_converted.indd 124
28/10/2022 11:40
Chapter 9 • Working with XYZ.exe
In your PCB design circuit, you could first try to enlarge all the pads. It is then possible to create the solder mask. How to fix the solder paste mask on top of PCB and apply the solder paste? Search for “apply solder paste with stencil”. Is this solder paste mask reusable? You can use it several times in a row, on the same day.
9.9.3 Milling, cutting text with laser Milling out letters is also possible with laser (vinyl = outdoors!). Example of laser cut made with DesignSpark PCB The TextDS.gbr file was made in the silkscreen of DesignSpark and then converted to TextDS.gcode file with FlatCAM. Figure below shows a vinyl A4 output after removal of signs.
Figure below shows the removed signs after transfer to a blank sheet. Both could be used.
● 125
Boek - Build Your Own Multifunctional 4 Axis Machine_converted.indd 125
28/10/2022 11:40
Build Your Own Multifunctional 4-Axis CNC Machine
Example of laser cut made with KiCad The Gerber file is TextKiCad.gbr and the G-code file is TextKiCad.gcode. After ‘milling’ out the letters, the vinyl was attached to a red cardboard sheet. Below is an example of vinyl output on format A4.
Both DesignSpark PCB and KiCad allow to add geometric figures other than text to the Gerber silkscreen file.
● 126
Boek - Build Your Own Multifunctional 4 Axis Machine_converted.indd 126
28/10/2022 11:40
Chapter 10 • Creating source files for the Z99
Chapter 10 • Creating source files for the Z99 You have built the Z99 machine and learned to work with XYZ.exe. However, to do useful work you need suitable input files. We will give some more explanation about generating suitable input files with the aid of four advanced freeware programs. Inkscape For generating HPGL files, letters to plot or cut. Download at https://inkscape.org At least version 0.92 necessary. Don’t be afraid of the many menus and options. We will explain only how to make a poster and sticky letters with the Z99. DesignSpark PCB Version10.0 For plotting PCBs with etch free or conductive ink, making a Gerber text file. Making a Gerber solder paste mask file as well as creating a copper Gerber file for milling a PCB or other material and finally, creating a drill file for drilling a PCB or other material. This powerful program is, after registration, available as freeware: https://uk.rs-online.com/web/generalDisplay.html?id=designspark/designspark-pcb KiCad Version 6.0 For plotting a large format schematic or text, making a Gerber text file, making a Gerber solder paste mask file, making a copper Gerber file for milling a PCB or other material, making a drill file for drilling of a PCB or other material. KiCad is available at https://kicad-pcb.org/download FlatCAM Version 8.5 For converting Gerber (*.gbr) files to G-code files ‘FlatCAM’ has a website http://www.flatcam.org This is not a secure website. Downloads are available at the secure site https://bitbucket.org/jpcgt/flatcam/downloads/ Select ‘FlatCAM-Win32-8-5-Install.exe’.
10.1 Inkscape – design your letters to plot or cut
Start Inkscape. Click in the left column on the large ‘A’, (below left down red arrow). Above with Menu – Text – Font select a font with large size e.g., 64. Then click in the middle of screen and type your text. If nothing becomes visible, select menu View – Display mode – Outline. When your text is ready, click on the arrow icon on the left at the top corner (left upmost red arrow) and select all your text with left mouse button.
● 127
Boek - Build Your Own Multifunctional 4 Axis Machine_converted.indd 127
28/10/2022 11:40
Build Your Own Multifunctional 4-Axis CNC Machine
If necessary, adapt the selection to the paper size with the small black arrows, (Marked with little red arrows). To hold the same size ratio press Ctrl while adjusting. Only the outline of the letters must be cut Select Object – Fill and Stroke
Verify that Tabs, ‘Fill’, ‘Stroke Paint’ and ‘Stroke style’ are empty for cutting.
● 128
Boek - Build Your Own Multifunctional 4 Axis Machine_converted.indd 128
28/10/2022 11:40
Chapter 10 • Creating source files for the Z99
For plotting of text and graphics Fill and Stroke must not be empty. If your text is not visible, select again View – Display Mode – Outline.
Path – Combine Select menu item Path then option combine. Only the borders of the letters are displayed:
File – Save As and save as *.hpgl file with a suitable filename:
● 129
Boek - Build Your Own Multifunctional 4 Axis Machine_converted.indd 129
28/10/2022 11:40
Build Your Own Multifunctional 4-Axis CNC Machine
A panel with two tabs appears. Tab ‘Plotter Settings’.
Resolution for X and Y was originally 1016, number of steps, lines per inch. Set to 254, this is 10 lines for a single mm. Nobody can see better than 0.1 mm, so this setting is good enough. With 1016 the HPGL files are 4 x 4=16 times larger without better quality. ‘Mirror Y axis’ may be checked here, but it is better to use he controls in XYZ.exe. Tab ‘Plot features’ is important. See figure below. For the correct settings we need to understand: Overcut The cutter needs to cut the border of the letter completely, so it has to cut a little bit further. Knife offset correction The tip of the blade is somewhat ex centric so that the blade follows the cutting directions. There is need to start cutting a little bit before the real onset.
● 130
Boek - Build Your Own Multifunctional 4 Axis Machine_converted.indd 130
28/10/2022 11:40
Chapter 10 • Creating source files for the Z99
The ‘L’ below was made with exaggerated over cut (3 mm) and knife offset correction (0.25 mm) to illustrate the effects. The red dots show the overcut.
We obtained good results with ‘Overcut’ 2 mm and ‘Knife offset correction’ 0.5 mm. Click ‘OK’ to create the HPGL file Your text is ready for cutting! Inkscape is capable of reading many file formats, even pdf or bmp. With the options below the ‘Path’ menu item, converting almost anything to a path and saving it as *.hpgl is possible. Inkscape has a great number of text and graphic options that open up a lot of possibilities. A lot of books and internet material exists. For more explanation about inkscape and plotters, search for ‘Inkscape and plotters’ or for ‘hpgl cutter’ or ‘hpgl plotter’.
● 131
Boek - Build Your Own Multifunctional 4 Axis Machine_converted.indd 131
28/10/2022 11:40
Build Your Own Multifunctional 4-Axis CNC Machine
10.2 DesignSpark PCB (DS) 10.2.1 Plot a PCB with etch free ink or conductive ink Most PCBs are manufactured by means of Gerber files. Until about 20 years ago it was more common to send HPGL files or the plots itself to a PCB manufacturer. Most programs for schematics and PCB design still have the possibility to output HPGL files. Such files have often another extension than .HPGL like .plt or .pen We can plot them with the Z99. All PCB programs have a different interface. We cannot go in detail for all programs. We give an example with DesignSpark PCB from RS components. Load C:\Z99\PCB_LayoutAndSchematicDesign\DesignsparkPCB\X2Y4Z.pcb and select Output – Manufacturing plots.
Select in the left column the tab ‘Layers’, then select ‘Penplot’ and then ‘Device Setup’. Device setup
The default extension is .plt
● 132
Boek - Build Your Own Multifunctional 4 Axis Machine_converted.indd 132
28/10/2022 11:40
Chapter 10 • Creating source files for the Z99
‘Widths.” is very important. Click on it.
1 Select ‘mm’. 2 Select ‘All’. 3 Enter pen width in mm. Select a Pen width somewhat thinner than the pen in use. E.g. 0.3 mm for a 0.4 mm pen. This ensures there are no gaps between the lines in the plot. A track width of 0.65 mm will be plotted with 3 passes of the pen. It is not possible to print tracks thinner than your pen width. Click ‘OK’ to close the Device Setup window. Tab ‘Layers’ The pen is always Pen 1. We do not change pens during plotting. [Board Outline] select Yes by clicking on ‘Y’.
In XYZ.exe you still have the possibility to omit the border. Click ‘Run’ to create the .plt file in default directory. Before leaving DS, make a note of the X and Y dimension of PCB in mm. You will need the exact dimensions in XYZ.exe for setting the output dimensions.
● 133
Boek - Build Your Own Multifunctional 4 Axis Machine_converted.indd 133
28/10/2022 11:40
Build Your Own Multifunctional 4-Axis CNC Machine
XYZ.exe can use the *.plt files to: - plot a PCB on paper. - plot a circuit with etch free ink on a copper PCB for etching. - plot a PCB with conductive ink on paper or cardboard.
10.2.2 Create a solder paste mask file (*.gbr) in DS Open .pcb file and select Output – Manufacturing plots.
Select in the Plots window on the left, only ‘Top Copper (Paste)’ and, in the Output’ Tab, select ‘Gerber’.
In the ‘Layers’ Tab select ‘Top Copper’ and ‘Board Outline’. Click on ‘Y’ or ‘N’ to change. Set all other options to ‘N’.
● 134
Boek - Build Your Own Multifunctional 4 Axis Machine_converted.indd 134
28/10/2022 11:40
Chapter 10 • Creating source files for the Z99
Even a well-focused laser beam has a small dimension, so we need to make our solder paste mask a little bit smaller.
Select: 1 Tab ‘Settings’. 2 Select ‘mm’. 3 Select ‘Smaller’ and then ‘Absolute Radius Adjust’ and enter the dimension in mm that the pads needs to be smaller. We obtained good results with 0.150 mm but this is dependent on the laser and how it is focussed. You need to experiment a bit with your own setup. 4 Click ‘Run’ to create the Gerber solder paste mask (*.gbr) file. Before you leave DS, note the XY dimensions of your PCB in mm with at least 3 decimal place of precision. If you have a manufactured PCB, you can measure it with a micrometer. Before we can start milling, (or rather cutting with laser), we need to convert the Gerber file to a G-code file. We do this using the ‘FlatCAM’ convertor software.
10.2.3 Create a copper Gerber file in DesignSpark PCB Load a .pcb file and select Output – Manufacturing Plots. 1. Select ‘Top Copper’ for the top copper layer. OR 2. Select ‘Bottom Copper’ if you are plotting a bottom copper layer. In this example, we are plotting a top layer.
● 135
Boek - Build Your Own Multifunctional 4 Axis Machine_converted.indd 135
28/10/2022 11:40
Build Your Own Multifunctional 4-Axis CNC Machine
In the ‘Output’ Tab select ‘Gerber’.
In the ‘Layers’ Tab. Select ‘Board Outline’ and ‘Top Copper’. Click on ‘Y’ or ‘N’ to change. (assuming you are plotting a Top layer) – if you are plotting a bottom layer, then change Top Copper to ’N’ and Bottom Copper to ‘Y’ so it matches the selection in the plots window on the left. In the ‘Settings’ Tab, Verify that ‘mm’ is selected. There is no need to enlarge or shrink something.
● 136
Boek - Build Your Own Multifunctional 4 Axis Machine_converted.indd 136
28/10/2022 11:40
Chapter 10 • Creating source files for the Z99
In the ‘Position’ Tab, Verify that ‘mm’ and ‘Whole Design’ are selected. Click ‘Run’ to create the top copper Gerber file. For milling we will later convert the Gerber file to a G-code file with FlatCAM.
10.2.4 Create a drill file (*.drl) in DesignSpark PCB Load a .pcb file and select ‘Output’ ‘Manufacturing plots’.
● 137
Boek - Build Your Own Multifunctional 4 Axis Machine_converted.indd 137
28/10/2022 11:40
Build Your Own Multifunctional 4-Axis CNC Machine
1. Select ‘Excellon’. 2. Click on ‘Device Setup’ and Select mm everywhere.
1. For drilling with XYZ.exe check this option! This allows you to drill only the unplated holed and check that the alignment is OK before drilling the plated holes. 2. Note the units in ‘Decimal’. 5 means that XY coordinates have 5 decimal places of precision. XYZ.exe requires the decimal places of precision for accurate drilling. Do not 'Omit Zeroes' and leave .drl as file extension.
● 138
Boek - Build Your Own Multifunctional 4 Axis Machine_converted.indd 138
28/10/2022 11:40
Chapter 10 • Creating source files for the Z99
In the ‘Layers’ Tab, For ‘Through Hole’ select ‘Y’.
In the ’Setting’Tab, Make two separate .drl files, one for ‘Plated Holes’ and one for ‘Unplated Holes’.
In the ‘Position’ Tab, Set ‘mm’ and ‘Whole Design’.
Click ‘Run’ to create the drill file. Create 2 separate files, one with plated holes and one with unplated holes. This allows you to verify the alignment is correct after drilling the non-plated holes and make any corrections before drilling the plated holes.
10.2.5 Create a Gerber text file in DesignSpark PCB All programs for PCB design allow you to enter text in the silkscreen. They have also a wide variety of fonts and you can select any size and thickness.
● 139
Boek - Build Your Own Multifunctional 4 Axis Machine_converted.indd 139
28/10/2022 11:40
Build Your Own Multifunctional 4-Axis CNC Machine
After entering your text in the silkscreen, select Output – Manufacturing plots. Verify that ‘Top silkscreen’ is checked. Click ‘Run’ to create the Gerber file. We will see further how to convert the Gerber file to a G-code file by means of ‘FlatCAM’. Most PCB design programs allow you to draw graphics on the silkscreen as well as just text.
10.3 KiCad You need to gain some knowledge about working with KiCad. It is a very comprehensive program. We recommend the excellent book available from Elektor: ‘KiCad Like a Pro’ from Dr Peter Dalmaris.
10.3.1 Plot a large format schematic When printed on A4 paper with an ordinary printer, the output of the X2Y4Z.sch is not very readable. We should to plot the schematic on larger format so we can actually read it. Start KiCad. Load X2Y4Z.kicad_sch from folder C:\Z99\PCB_LayoutAndSchematicDesign\KiCadSchematic
● 140
Boek - Build Your Own Multifunctional 4 Axis Machine_converted.indd 140
28/10/2022 11:40
Chapter 10 • Creating source files for the Z99
1. 2. 3. 4.
Click ‘Plot’ or menu File - Plot. Set the output directory. Select HPGL. ‘Plot Current Page’ to create the HPGL compatible *.plt file.
Plot size is set in menu of XYZ.exe.
● 141
Boek - Build Your Own Multifunctional 4 Axis Machine_converted.indd 141
28/10/2022 11:40
Build Your Own Multifunctional 4-Axis CNC Machine
10.3.2 Create a Gerber solder paste mask file in KiCad
1. 2. 3. 4.
Select ‘Gerber’. Set the output directory. Front paste ‘F.Paste’ is selected for a top paste file. ‘Plot’ generates the solder mask paste Gerber file.
In KiCad we have no possibility to shrink the solder paste pads mask. As mentioned before, a 500 mW blue laser beam has a spot radius of about 0.100 at 0.150 mm. The only way to create a suitable solder paste mask in KiCad with a weak laser, is to make a copy of your design and shrink all pads in the PCB design.
● 142
Boek - Build Your Own Multifunctional 4 Axis Machine_converted.indd 142
28/10/2022 11:40
Chapter 10 • Creating source files for the Z99
10.3.3 Create a Gerber copper file in KiCad View PCB and select File - Plot.
1. Select ‘Gerber’. 2 Set ‘Output Directory’. 3 Select top and bottom copper layer. 4 Click ‘Plot’ to create the Gerber files for the top and bottom copper layers.
10.3.4 Create a drill file in KiCad Select Menu File – Plot.
Select ‘Output directory’ and then ‘Generate Drill Files’.
● 143
Boek - Build Your Own Multifunctional 4 Axis Machine_converted.indd 143
28/10/2022 11:40
Build Your Own Multifunctional 4-Axis CNC Machine
1. Put Plated Through Holes and Non-Plated Through Holes in separate files. By doing so, we can verify drilling position after drilling the not so critical unplated holes. 2. Check ‘Millimetres’. 3. ‘Keep zeros’. 4. KiCad has no possibility to set decimal precision. It is fixed at 3. Anyway 0.001 mm is still 100 times better than a human being could distinguish. 5. Click ‘Generate Drill File’ to make the .drl file.
10.3.5 Create a Gerber text file in KiCad With File – Page settings Select a size and orientation. Below A4 – Landscape was selected.
Select the silkscreen ‘F.SilkS’ as the layer. Select a large font with enough thickness. Enter text in the silkscreen so that it fills most of the ‘Page settings’ (red arrows above). Secondary adjustments of width, height and thickness of the text are possible with ‘E’.
● 144
Boek - Build Your Own Multifunctional 4 Axis Machine_converted.indd 144
28/10/2022 11:40
Chapter 10 • Creating source files for the Z99
You can also add lines and geometric figures to the silkscreen. File – Plot
1. 2. 3. 4.
Plot format ‘Gerber’. Select the Output directory: if you want another directory as for the source file. Select F.SilkS. Click ‘Plot’ to create the Gerber file.
● 145
Boek - Build Your Own Multifunctional 4 Axis Machine_converted.indd 145
28/10/2022 11:40
Build Your Own Multifunctional 4-Axis CNC Machine
10.4 FlatCAM - Convert Gerber to G-code files After studying G-code files made with FlatCAM it became clear that we need only to decode a few commands. They are listed in a following chapter about G-code. FlatCAM has an excellent manual, but many more possibilities than we need for our purposes. We need only a tiny fraction of the possibilities.
10.4.1 How to create a G-code file for milling a PCB 1. Start FlatCAM – File – Open Gerber. Below X2Y4ZR_BottomCopper.gbr is loaded in folder C:\Z99\DemoFiles\Gerber.
2. In the ‘Project’ Tab (with the file X2Y4ZRBottomCopper.gbr loaded). You need to select the filename. Click on it.
3. In the ‘Selected’ Tab, click the ‘Generate Geometry’ button and wait a few seconds while the file is generated.
● 146
Boek - Build Your Own Multifunctional 4 Axis Machine_converted.indd 146
28/10/2022 11:40
Chapter 10 • Creating source files for the Z99
The button ‘Generate Geometry’ generates a file with extension .gbr_iso 4. In the ‘Project’ Tab, select the .gbr_iso file. Click on it.
5. In the ‘Selected’ Tab, click the ‘Generate Geometry’’ button. This creates a CNC version of the file with extension .gbr_iso_cnc
● 147
Boek - Build Your Own Multifunctional 4 Axis Machine_converted.indd 147
28/10/2022 11:40
Build Your Own Multifunctional 4-Axis CNC Machine
6. In the ‘Project’ Tab, select the .gbr_iso_cnc file. Click on it.
● 148
Boek - Build Your Own Multifunctional 4 Axis Machine_converted.indd 148
28/10/2022 11:40
Chapter 10 • Creating source files for the Z99
7. In the ‘Selected’ Tab, click the ‘Export G-Code’ button. Save the G-code file in a directory of your choice.
Important: you have to type in the extension .gcode! Exit ‘FlatCAM’, load the G-code file into the mill module of XYZ.exe and start milling.
10.4.2 FlatCAM. Create a solder paste mask It is also possible to create the G-code for a solder paste mask. Start FlatCAM – File - Open Gerber and open a Gerber paste mask file. Below file C:\Z99\DemoFiles\Gerber\Feeder32_TopCopperPaste.gbr is loaded.
● 149
Boek - Build Your Own Multifunctional 4 Axis Machine_converted.indd 149
28/10/2022 11:40
Build Your Own Multifunctional 4-Axis CNC Machine
1. Select tab ‘Project’ and click on the .gbr file.
2. Select tab ‘Selected’ and click on the button 'Generate Geometry' below 'Board cutout:'. This generates a file with extension .gbr_cutout.
3. Select tab ‘Project’ and click on the .gbr_cutout file.
4. Select tab ‘Selected’ and click on the button ‘Generate’ below ‘Create CNC Job’. A file with extension .gbr_cutout_cnc is generated.
● 150
Boek - Build Your Own Multifunctional 4 Axis Machine_converted.indd 150
28/10/2022 11:40
Chapter 10 • Creating source files for the Z99
5. Select tab ‘Project’ and click on the .gbr_cutout_cnc file.
6. Select tab ‘Selected’ and click on the button ‘Export G-Code’.
● 151
Boek - Build Your Own Multifunctional 4 Axis Machine_converted.indd 151
28/10/2022 11:40
Build Your Own Multifunctional 4-Axis CNC Machine
7. Save as .gcode file, you have to type in the extension .gcode!
10.4.3 FlatCAM. Create G-code text files for plotting, cutting, or milling text The silkscreen layer of all PCB programs allows you to enter text. Different fonts and sizes and even shapes are available.
● 152
Boek - Build Your Own Multifunctional 4 Axis Machine_converted.indd 152
28/10/2022 11:40
Chapter 10 • Creating source files for the Z99
Follow the same steps as used for the copper layer G-code generation. The main thing to remember is to toggle several times between the tabs ‘Project’ and ‘Selected’ until you get to the generate G-code screen.
● 153
Boek - Build Your Own Multifunctional 4 Axis Machine_converted.indd 153
28/10/2022 11:40
Build Your Own Multifunctional 4-Axis CNC Machine
Chapter 11 • File formats accepted by XYZ.EXE This chapter will provide you with a basic understanding of the file formats used to create things on your Z99. It is basic background information which helps with your understanding, especially if you are going to dive into the C# code. In either case, understanding more about the file formats can be a useful learning experience.
11.1 HPGL language For more than 40 years the Hewlett Packard Graphic Language (HPGL) has been the main language of plotters and cutters. Most programs for schematic and PCB design still support hpgl output. Common extensions are *.hpgl, *.plt, *.pen. HPGL file are plain text files. You can even open them in MicroSoftWindowsTM Notepad. HPGL is a simple list of instructions that get sent to the plotter or cutter. For complete explanation about the Hewlett Packard Graphic Language, search for “hpgl commands”. The real source about HPGL from the inventor is in the first part of: http://www.hp.com/ctg/Manual/bpl13211.pdf. This is a very technical description. A more understandable version can be found at: https://www.isoplotec.co.jp/HPGL/eHPGL.htm Later versions of HPGL have also many extensions. For the moment we do not claim to support all of them. Free HPGL viewers are also available on the web. Search for ‘HPGL viewer’. Most HPGL instructions are easy to understand. All instructions start with two letters and end with a semicolon (;) Standard HPGL does not support comments. Code examples: Version A HPGL code
Explanation
IN;
INitialization, begin
SP1;
Select Pen number 1
PW3;
Pen Width
PU100,100;
with Pen Up move to coordinate X 100 and Y 200.
PD200,100;
with Pen Down, draw a line from X 100 Y 100 to X 200 and Y100.
PD200,200;
with Pen Down draw a line from X 200 Y 100 to X 200 and Y200.
PD100,200;
with Pen Down draw a line from X 200 Y 200 to X 100 and Y200.
PD100,100;
with Pen Down draw a line back to X 100 and Y100.
● 154
Boek - Build Your Own Multifunctional 4 Axis Machine_converted.indd 154
28/10/2022 11:40
Chapter 11 • File formats accepted by XYZ.EXE
A square has been drawn. However, there are alternative ways for the same instruction as above, e.g.: Version B HPGL code
Explanation
IN;
INitialization, begin
SP1;
Select Pen number 1
PW3;
Pen Width
PU;
Pen Up
PA100,100;
Plot Absolute: move to X 100 and Y 100
PD;
Pen Down
PA200,100,200,200,100,200,100,100;
Draw same square as in Version A
or even, Version C HPGL code
Explanation
IN;
INitialization, begin
SP1;
Select Pen number 1
PW3;
Pen Width
PU;
Pen Up
PA100,100;
Plot Absolute: move to X 100 and Y 100
PD;
Pen Down
PR100,0,0,100,-100,0,0,-100;
Plot Relative draws the same square as in Version A.
The PR, plot relative commands seem not to be very commonly used. Version A is easiest to read. Versions B and C are more compact. When version B or C is detected, our software converts the code to version A.
11.2 Drill files Excellon drill files (*.drl) are plain text files. You can view the content of a *.drl file in Microsoft Windows Notepad or other text editors. Comments are possible on a single line starting with ‘;’. Example of a drill file:
● 155
Boek - Build Your Own Multifunctional 4 Axis Machine_converted.indd 155
28/10/2022 11:40
Build Your Own Multifunctional 4-Axis CNC Machine
G81 ; start M48 ; coordinates are in mm METRIC ; definition of drill 1 with 0.889 mm diameter T1C0000.88900 ; definition of drill 2 with 1.5 mm diameter T2C0001.50000 ; M95 or % finishes definition of drills in use % ; start with drill 1 T001 ; drill hole at X 16.1415 mm and Y 16.2245 mm ; we are using 5 decimal places of precision X1614150Y1122450 ; drill hole at X 11.6145 mm and Y 12.13045 mm X11614150Y12130450 X11626850Y11101750 ; drill holes with drill 2: T002 X2025650Y16931050 X10598150Y7190150 ; end of file M30
Other commands that start with ‘G’ or ‘M’ can be present but the Z99 doesn’t use them. The Z99 only needs to extract the X and Y coordinates of the holes, the start code (M48) and the end code (M30). The decimal place precision is important. KiCad always uses 3 decimals precision (0.001 mm), DesignSpark let you select the precision 3,4 5 decimal places. You must enter the correct decimal point precision in XYZ.exe. The Z99 does not have an automatic drill change possibility and drills all the holes with same diameter. For through hole components drill of 0.8 mm is an excellent choice. Afterwards, manually drill holes that should be larger, or create a new *.drl file and use a larger bit in the drill.
11.3 Gerber files Gerber files originated about the same time as HPGL files. Since about 1998 with the specification of ‘Extended Gerber – RS-274X, Gerber became the dominant file format used by PCB manufacturers.
● 156
Boek - Build Your Own Multifunctional 4 Axis Machine_converted.indd 156
28/10/2022 11:40
Chapter 11 • File formats accepted by XYZ.EXE
For understanding our software code, it is necessary to have some insight into the Gerber file commands. The Gerber file specifications are available as a free download on the website of Ucamco (https://www.ucamco.com/en/). Don’t get overwhelmed by the specifications. Not all of them are important for using the Z99. You need only understand a few commands. A Gerber file is a text file. Microsoft Windows Notepad can open them. Here is an extract of a Gerber solder paste mask file. Line
Gerber code
1
G04 Gerber Version 21.0.3 Build 4286 *
2
%FSLAX45Y45*%
3
%MOMM*%
4
%ADD89R,0.64000X2.03000*%
5
%ADD74C,0.12700*%
6
X0Y0D02*
7
D02*
8
D74*
9
X9620Y6350D02*
10
X15080660D01*
11
Y11200420*
12
X9620*
13
Y6350*
14
D02*
15
D89*
16
X3904560Y2072470D03*
17
Y3659970D03*
18
Y5307160D03*
19
X0Y0D02*
20
M02*
Explanation line number: 1.
All lines that start with G04 are comments, ignored.
2.
%FSLAX45Y45*% - most often in the beginning of a file. X45 means that the X coordinates have a resolution of 4-whole digits and 5 decimal places. Y45 means that the Y coordinates have a resolution of 4-whole digits and 5 decimal places.
● 157
Boek - Build Your Own Multifunctional 4 Axis Machine_converted.indd 157
28/10/2022 11:40
Build Your Own Multifunctional 4-Axis CNC Machine
The resolution of X and Y coordinates is mostly the same. Note that the resolution is very high to avoid cumulative rounding errors. 3.
%MOMM*% Means that all coordinates are in mm. %MOIN*% - means that all coordinates are in inch.
4.
%ADD89R,0.64000X2.03000*% %ADD89 - is the name of a pad shape. R - the pad is rectangular. X - dimension is 0.64 mm and Y dimension is 2.03 mm.
5.
%ADD74C,0.12700*% %ADD74 - is the name of a pad shape. C - the pad is circular with a radius of 0.127 mm.
6.
X0Y0D02* Move to coordinates X 0 and Y 0. Command with D02 = move to.
7.
D02* Move to stays in action.
8.
D74* Use the circular pad defined in line 5.
9.
X9620Y6350D02* Move to coordinate X 0.0962 mm and Y0.0635 mm.
10. X15080660D01* Draw line from previous coordinate to X 150.8066 mm. Y coordinate is not mentioned, stays the same. Command with D01 = draw line to. 11. Y11200420* D01 is not included, so it stays in action. X coordinate is not mentioned, stays the same. Draw line from previous coordinate to X 150.8066 mm Y 112.0042 mm. 12. X9620* Draw line to X 0.0962 mm and same Y coordinate.
● 158
Boek - Build Your Own Multifunctional 4 Axis Machine_converted.indd 158
28/10/2022 11:40
Chapter 11 • File formats accepted by XYZ.EXE
13. Y6350* Draw line to same X coordinate and Y 0.0635 mm. Lines 9 at 13 draw a rectangle near border of PCB. Pad D74 was defined but not used. 14 D02* Move to is in action. 15 D89* Use the rectangular pad defined in line 4. 16 X3904560Y2072470D03* Command with D03 = flash pad. Gerber files were designed for use with photo plotters. Make pad type D89 at X 39.0456 mm and Y 20.7247 mm. 17 Y3659970D03* Make pad type D89 at X 36.5997 mm and Y 20.7247 mm. 18 Y5307160D03* Make pad type D89 at X 36.59997 mm and Y 53.0716 mm. 19 X0Y0D02* Move to origin. 20 M02* End. We made Gerber files with various programs. EasyPC for Windows, DesignSpark PCB, KiCad, Eagle. It was sometimes necessary to adapt our software. Many Gerber variations exists, leading 0, trailing 0 etc., We cannot give warranty that all kind of Gerber files are OK.
11.4 G-code files G-code is the language of CNC machines, 3D printers and other computer aided manufacturing machines. Search for ‘G-code’ commands’ and you will see that there are hundreds of commands. Most commands start with ‘G’ (geometric) or ‘M’ (machine control). We thought at first that it would be an impossible task to decode all these commands. This is indeed so when it comes to the G-code commands for a 3D printer. (And even if it was possible, the X2Y4Z PCB has no provisions on board for an extruder motor, heated bed, or nozzle control). However, after studying G-code files made with FlatCAM it became clear that we need only a subset of the possible G-code commands. For example:
● 159
Boek - Build Your Own Multifunctional 4 Axis Machine_converted.indd 159
28/10/2022 11:40
Build Your Own Multifunctional 4-Axis CNC Machine
G00 Z0.2000; G00 X100.1234Y50.5678; G00 Z-0.200; G01 X50.1234Y10.1234;
lift Z-axis 0.2 units upwards. This is the up position set in XYZ.exe move at full speed to X 100.1234 and Y 50.5678 Z-axis down 0.2 units. Sets the Z-axis to the milling position in XYZ.exe Move the head and cut a line at slow speed, to X50.123 and Y10.1234.
All statements end with a semicolon. Comment after the semicolon are allowed. G00 G01
is equivalent to ‘move to’ at full speed with mill up. is equivalent to ‘line to’ at working (milling) speed with mill down.
For milling we decode only four commands that start with: G00 Zx.x; G00Z-x.x; G00 Xx.xYy.y; G01 Xx.xYy.y;
move Z axis upwards (or turn laser off). move Z axis downwards (or turn laser on). move at full speed to x.x and y.y coordinate. mill at milling speed to x.x y.y coordinate.
We ignore all other commands and set them in XYZ.exe: XY travel speed, XY working speed, Z speed up, Z speed down, Z position up and Z position down. In the end, it was much easier to decode the G-code than the Gerber files. Of course, this is only a tiny part of G-code that we require for a fully working Z99. Epilogue All code for the Z99 is currently free. You have: - The designs of all the 3D parts. - The PIC microcontroller code. - The XYZ.exe software. - The Complete C# source code software.
● 160
Boek - Build Your Own Multifunctional 4 Axis Machine_converted.indd 160
28/10/2022 11:40
Appendix
Appendix Wireless connection to Z99 This is an extension that makes wireless Bluetooth communication between PC and the X2Y4Z PCB of Z99 possible. It could serve in other electronic projects where serial communication is used. 1. Component list - HC-06 slave module. Search for “HC-06 Bluetooth”.
- Programming cable. You may use the 5V TTL cable that is connected to Connector2 (Cn2) of the X2Y4Z PCB of Z99. - Tera Term software. Downloadable as freeware. Search for “Download Tera Term”. - If your PC has no Bluetooth you also need a Bluetooth dongle. Search for “Bluetooth dongle” Version 4.0 and version 5.0 are both ok.
● 161
Boek - Build Your Own Multifunctional 4 Axis Machine_converted.indd 161
28/10/2022 11:40
Build Your Own Multifunctional 4-Axis CNC Machine
2. Connect the HC-06 module to USB serial cable The HC-06 modules comes with default settings 9600N81, baud rate 9600, no parity, 8 data bits and 1 stop bit. As X2Y4Z PCB works with 57600 baud, we need to reprogram it. We use the same 5V TTL USB serial converter cable as for the wired connection, the cable that goes in connector 2 (Cn2) of the PCB. Some sources say a 3V3 cable is needed for programming, but a 5V cable works without any problem. Connect the male end of four Dupont cables male-female, length 10 cm in removable part of Cn2. We used the same colours as colours of the TTL cable.
Connect the female end of the four Dupont cables to HC-06.
Connect the USB serial cable to PC. 3. Programming of the HC-06 module Start Tera Term. This screen appears:
● 162
Boek - Build Your Own Multifunctional 4 Axis Machine_converted.indd 162
28/10/2022 11:40
Appendix
1. Select “Serial”. 2. Select the same comport number as for the wired Z99 connection. 3. Click “OK”. Select Setup – Serial port:
Verify that Speed – baud rate is 9600. If changes are necessary, click “New setting”.
● 163
Boek - Build Your Own Multifunctional 4 Axis Machine_converted.indd 163
28/10/2022 11:40
Build Your Own Multifunctional 4-Axis CNC Machine
Programming Nobody can type fast enough to enter the commands directly in Tera Term. Start Windows Notepad with HC06Commands.txt file and adjust it to Tera Term as below side by side. You will find HC06Commands.txt in the directory C:\Z99\WindowsSoftware.
Copy text “AT+VERSION” in the text file. Make sure you copy it without spaces! Right-click in Tera Term. Right-clicking in Tera Term enters the command. “OKlinvorV1.8” appears in Tera Term. Give the module a useful name, for example Z99. Copy AT+NAMEZ99 and right-click in Tera Term. “OKsetname” appears in Tera Term. Copy AT+PIN1234 and right-click in Tera Term. Of course, you can use another four-digit number, but make sure that you remember it. “OKsetPIN” appears in Tera Term. Copy AT+BAUD7 and right-click in Tera Term. “OK57600” appears in Tera Term. From now on it is no longer possible to communicate at 9600 baud! In Tera Term open again Setup-Serial port. Set “Speed” at 57600 and click “New setting”.
● 164
Boek - Build Your Own Multifunctional 4 Axis Machine_converted.indd 164
28/10/2022 11:40
Appendix
As before copy AT+VERSION in Notepad and right-click in Tera Term to verify that communication at 57600 baud works.
You have now programmed the HC-06 with a new name and a baudrate of 57600. 4. Connect HC-06 to X2Y4Z PCB Remove the two opto-couplers IC5 and IC6 from sockets of the X2Y4Z PCB. Connect the programmed Bluetooth module to the sockets with removable wires. The cables below are half of four breadboard connections cables. IC5-Pin2 IC6-Pin5 IC6-Pin7 IC6-Pin8
is is is is
connected connected connected connected
to to to to
RX pin of Bluetooth module (yellow wire). GND pin of Bluetooth module (black wire). TX pin of Bluetooth module (orange wire). VCC pin of Bluetooth module (red wire).
● 165
Boek - Build Your Own Multifunctional 4 Axis Machine_converted.indd 165
28/10/2022 11:40
Build Your Own Multifunctional 4-Axis CNC Machine
No level shifters 5 V - 3.3 V are used. Some sources state that level shifters are necessary. This is only true when you use a HC-06 module without carrier board. Remark that the antenna of the Bluetooth module faces outwards of PCB. 5. Connect Windows 10 or 11 with the Bluetooth module Verify that Z99 with the programmed HC-06 is powered on and nearby PC. Search in Windows for “Bluetooth”.
1. Verify that Bluetooth is “ON”. 2. Click “Add device”.
Click “Bluetooth”.
● 166
Boek - Build Your Own Multifunctional 4 Axis Machine_converted.indd 166
28/10/2022 11:40
Appendix
As soon as the name of your Bluetooth module is listed. Tap on it. Sometimes the name is listed twice. This doesn’t matter.
If pin code is asked, enter it and click “Connect”. Windows doesn’t always ask the pin code.
● 167
Boek - Build Your Own Multifunctional 4 Axis Machine_converted.indd 167
28/10/2022 11:40
Build Your Own Multifunctional 4-Axis CNC Machine
Click “Done”. Windows has automatically assigned two comport numbers to the Bluetooth module. Search on your screen for “More Bluetooth settings”. Depending on your screen configuration, this is listed downwards or rightwards.
Select Tab “COM Ports” and note the one with “Outgoing” Direction. In case below this is “COM4”.
Outgoing means that the PC software takes the initiative for communication.
● 168
Boek - Build Your Own Multifunctional 4 Axis Machine_converted.indd 168
28/10/2022 11:40
Appendix
Select in the setup of XYZ.exe the outgoing comport number:
You are ready for wireless Bluetooth communication. The wireless distance on a baud rate of 57600 is up to 6 meters, often more. A desktop with an external Bluetooth dongle offers larger range then a portable PC with build-in Bluetooth. Make sure there are no metal surfaces or a PC screen between X2Y4Z PCB and Bluetooth dongle.
● 169
Boek - Build Your Own Multifunctional 4 Axis Machine_converted.indd 169
28/10/2022 11:40
Build Your Own Multifunctional 4-Axis CNC Machine
Index C C sharp Conductive ink Construction Z99 Corner switches Cut
90 108, 132 55 23, 25, 100 77, 112, 114
D Designspark PCB Drill
17, 109, 125, 132 80, 115, 137, 134, 155
E Engrave Etch resist pen
71, 104, 110 107, 132
F Fan FlatCAM G Gerber files G-code
57 121, 146
135, 139, 143, 146, 156 46, 121, 146, 159
H Hardware part Z99 HPGL
48 154
I Inkscape Installation
127 12
K KiCad
17, 105, 126, 140
L Laser
10, 11, 70, 74, 100, 110, 114
M MDF MikroC Mill
48, 55, 86 33 80, 121, 137, 143
N Nema 17 Nema 17 driver modules
26 28
O Open SCAD Overview 3D parts
41 60
P PCB Z99 Pic code Pic programming PLA Plot S Serial communication Schematic design Slic3r Solder paste mask Solder paste dispensing
19 33 37 44 77, 103, 132, 140
90 48 42 122, 134, 142 82, 117
T Tools for construction
48
U Unipolar stepper
30
V Vinyl W Wireless Bluetooth connection
113, 125
161
X X2Y4Z PCB XYZ.exe
17 96
Z Z carriages
70
● 170
Boek - Build Your Own Multifunctional 4 Axis Machine_converted.indd 170
28/10/2022 11:40
books books
books
Plot, Cut, Drill, Mill, and Laser with the Z99 This book covers the construction, hardware, software, and operation of the Z99 - CNC machine. This is a multifunctional 4-axis machine for home construction. The capabilities of the Z99 machine include: • large-format schematic plotting • PCB plotting with etch-resist pens • schematic plotting with conductive-ink pens • letter cutting out of vinyl • paper cutting • PCB/substrate drilling • PCB/substrate milling • text milling • laser engraving • laser cutting of solder paste masks
José Ganseman, MD. (1951) was occupied as a General Practitioner for 35 years. He is a passionate, lifelong electronics hobbyist and software programmer in several languages. He is also an Elektor reader from the seventies on. After his retirement in 2010 he decided to build a multifunctional machine for personal use. The machine can be used for several tasks like plotting, cutting, milling, and laser etching/cutting.
By making the support software available as freeware, readers of the book are challenged and encouraged to develop new applications for the Z99. The machine would not be of much use if the user has no option to create suitable files for the designs in mind. A large part of this book is dedicated to creating source files in a variety of freeware software packages, including Inkscape, DesignSpark PCB, KiCad, and FlatCAM. The book is also useful for readers keen to comprehend and then master the basic structure of HPGL, Gerber, Drill, and G-code files, as well as to have a go at deciphering them using software.
Elektor International Media BV www.elektor.com
Build Your Own 4-Axis Multifunctional CNC Machine • José Ganseman
Build Your Own 4-Axis Multifunctional CNC Machine
Build Your Own 4-Axis Multifunctional CNC Machine Plot, Cut, Drill, Mill, and Laser with the Z99
José Ganseman
Cover Build Your Own 4-Axis Multifunctional CNC Machine_v01.indd Alle pagina's
27-10-2022 17:14