Thursday, 8 December 2016

The making of the pulse stretcher

This is a follow up post about the pulse stretcher I made for my CNC, which you can read the details about here:

https://adapting-camera.blogspot.se/2016/12/making-pcb-with-my-upgraded-diy-cnc.html

I made a video about it as well. The reason is that I am really happy with the results, the LEDs are flashing like crazy at the right pace, easy to see from any angle, unlike before, and if I wanted to see the status I had to be in front of them to see anything. The intensity is simply too low at high speed, so stretching is necessary.

The circuit is really simple, just a few resistors and capacitors and two 74HC14 inverters.

Anybody interested can just make the same circuit. If you are not happy with the pulse lengths you can play with the four resistors (R1, R2, R3, R4) and/or the four capacitors (C1, C2, C3, C4) to change the behavior of the circuit. I used Eagle to draw the circuit and to create the layout.

The PCB turned out really nice, no additional work needed with cleaning the tracks or anything at all. Traces are beautifully milled and follow what's been routed with the auto router of Eagle. Manually routing or double sided PCB would have created a more beautiful art work, but it is good enough.



I hope you enjoy the video, it shows not only the work flow, but also a before and after sequence.

Edit:

I just noticed an error in the video. I mill the first pass at 0.04mm depth and the second pass at 0.07mm and nothing else. In the video I wrote that I mill the first pass at 0.4mm and the second at 0.7 and that is just too much for PCB milling. The copper layer is just 0.035mm, so there is no need to mill deeper but I double that value to be on the safe side, however, making it 20 times deeper than necessary would be crazy.

Friday, 2 December 2016

Making PCB with my upgraded DIY CNC


Upgrading to UCCNC and the UC300ETH means that the pulses are far too fast for the LEDs I have on the step pulse signals. Pulses are barely visible due to the 400kHz pulsing the UC300ETH allows, so I decided to make a simple circuit to stretch the pulses and make them visible. These stretched pulses are not affecting the milling, this is only a “good to have” feature for my electronic control box.

I used the same circuit before in some other project but never really bothered making a PCB, but now since I upgraded my CNC with a new high speed spindle, VFD, power supply, control electronics and new software as well as mechanical upgrade it is time to check how well everything turned out. So I decided to make a PCB for this circuit, as the first real job with everything finally in place and working.

The first thing I did was not really this PCB, but a test drawing to make sure the CNC was working as expected after the upgrade, and after that I levelled the MDF spoil board also, but the PCB was meant to be the first REAL job.

Workflow


Of course, before milling the PCB the circuit must be designed, routed and the G-code must be generated and so on. The work flow I am using is the following:

1.    Schematic design
2.    Board layout
3.    Routing
4.    G-code generation
5.    Adding text traces to g-code
6.    Editing g-code to generate multi pass milling
7.    Test drawing
8.    Levelled G-code generation (not always)
9.    Milling
10.  Drilling

All software and plugins are freely available if you can live with the limitations. For this project I skipped auto levelling, for reasons which will be mentioned later on.


Electronic schematic and board routing


To design electronic circuits I am using EAGLE PCB Design software from CADsoft.

https://cadsoft.io/

It is not always an intuitive tool, but it is very common in the business, not only among hobby designers but also among professionals, and is a complete tool for handling electronic projects, from schematic to PCB routing. It handles auto routing very well even if the art work is not always as logical as a pair of trained eyes can see and a human can do. Of course, even a simple circuit is routed faster automatically than manually, so unless visual impression is necessary, I prefer auto routing, though some connections are often necessary to route manually because for some reason the software occasionally creates all the routes but fails to route right and can create really ugly corners for no reason at all. I don’t know why, probably a bug of some sort, but no big deal. It can also create boards with several layers, but the freeware version is limited to two layers only, which is not really a limitation since we can only create double sided boards with a mill. The other limitation the freeware version has is that the card size is limited to 100x80mm, but that size, small as it sounds, is enough to create pretty complex boards anyway. Boards can also divided into several projects, so designing and milling larger sizes is not that difficult if it would be really be necessary. For this project the area needed is considerably smaller, so the limitations are really a non-issue. With this software I complete steps 1-3 of my workflow.


G-code generation


The software I am using for this is PCB-gcode.

http://www.pcbgcode.com/

It is a plugin for EAGLE PCB Design. It is pretty well documented on the Internet, so I will not go into details about it. When the plugin is started, there are some parameters to watch out for. In my opinion, some of the default values are wrong and must be adjusted, depending on the machine parameters and the cutter used. Parameters depend also on the type and quality of the PCB clad used. I am using FR4 with 35 micrometre copper layer, so the minimum depth to be milled to get isolation is 0.035mm. Of course, this is very optimistic, since these cards don’t have such precision, but inaccuracy is less than 100% so I decided to use a mill depth of 0.07mm, which gives me 100% error margin, more than actually needed.

I am using 30 degree 0.2mm V-bits. With this cutter tool the cut depth of 0.07mm, according to some trigonometric calculations, will result in exactly 0.02375mm isolation, which is good enough for me. The default G-code would generate three passes with slight position shifts and far too wide separation for my taste, so in the PCB-gcode settings I select single pass to keep the calculated 0.24mm.

The plugin generates several files, but only the etch and drill files are used. The etch file contains the traces and spot drilling for the holes. In the plugin I set 0.07mm Z depth for the etching and 22,000rpm spindle speed. I also set 450mm/min feed rate, which I know by experience is a good value. Since the plugin does not have a setting for milling in two passes with different Z depth, the file must be edited manually. Simply by opening the g-code file I separate the spot drilling part, copy the trace milling to get two identical passes, and in the first pass I replaced all Z-0.0700 with Z-0.04 and merge back the spot drilling at the end of the file. I changed also the feed rate of the second pass from 450mm/min to 650mm/min, but ONLY the second pass. I don’t want to break the tip halfway down the first pass, so being careful there is more important. Also to cut nicely through the cupper layer is easier with the slower speed. Perhaps another time I will optimize this and find more optimal values for the next PCB, but for now this feels safe and good. This manual editing takes 2-3 minutes and result in a multi pass milling of the same tracks, first pass at 0.04mm depth and with 450mm/min feed rate, and the second at the final 0.07mm and 650mm/min feed rate. The spot drilling depth is at default and is only done in one pass.


Engraving text


Now it is time to add the text which I intend to engrave. While it is possible to create the text in EAGLE, I prefer to do it with the help of F-Engrave, which is another freeware.

http://www.scorchworks.com/Fengrave/fengrave.html

I am pretty familiar with this piece of excellent freeware, so text generation takes just a minute or two, the code is saved and merged to the PCB g-code etch file. Engraving is also done in one single pass, the depth I set is 0,1mm which will result in 0,25mm wide lines.

This completes steps 4-6 of my work flow and the g-code is now ready for milling.

Test drawing


Normally I prefer not to be too eager in starting the milling, I prefer making a test drawing first. This can save cutters and a lot of extra work, in case something is wrong with the files or the machine settings. In Mach3 there is a g-code simulator which I normally use to get an approximate time needed for the job, especially if the g-code has many lines and the job contains a lot of moves. UCCNC does not have this possibility, so users can only guess how long time a job may take.

Drawing is done in real time, and it gives me an opportunity to check that the g-code works as expected and also that the traces are going to be milled where I want them to be milled, no short circuits and no cut/broken traces. It also gives me a way of checking trace widths, in case I would not be happy and need to reroute because of too thin traces or too thin/wide isolation.

Test drawing is straight forward, nothing special. My pen holder has a weak point, the pen tip has a large play, which is why lines are not always as straight as they will be after milling. The result of this weakness is clearly visible in the engraved text, but also the traces are not exactly matching the final board.

Never the less, I am happy with the results since the traces and isolations are the most important. I will make a new pen holder another time…


Auto levelling


Sometimes there can be issues with the PCB skewed, warped or bent and with the very thin copper layer even a slight error can cause air traces or demand too deep milling. With that in mind, I thought I will try the auto leveller plugin which comes with the UCCNC software. I gave up that idea pretty fast. The reason is simple, I did not like that the plugin picks the dimensions from the g-code and automatically sets the area, based on and starting from the work zero position. Work zero is the corner of the PCB, so the auto leveller plugin would make a probing pass along the edges of the PCB, which is totally wrong. I could not find any settings to change that and narrow down the probing area. I decided to try editing the levelled g-code manually, which was pretty simple. Started the g-code and the probing began, but for some reason halfway down the probing work, when about 50% of the area was done, the plugin gave up and sent a message that it lost contact with the probe (don’t know the exact word) and the probing stopped. This was it, I gave up, threw away the g-code and loaded a clean one again, and since my table is levelled and I had a 100% depth margin compared to the required minimum, I decided to try it without auto levelling.

Perhaps there are settings I missed, but for now I don’t care about auto levelling, at least not for small areas like this PCB is.

Milling and drilling


Really, nothing special, everything as expected. After the first pass was done, I could clearly see that the 0.04mm depth was enough to cut through the copper layer, so it seemed that the second pass was not necessary. Of course, this was just a quick view impression, I did not stop the job and let even the second pass finish as well as the engraving and the milling before I removed the PCB for inspection.


The results were fantastic. Very clean and nice cuts, trace edges are excellent, nothing more is needed to be done to clean the surface.

There is also nothing to complain about regarding the engraved text. Unlike in the test drawing, lines are nice and straight, exactly as shown on the screen, curves are even and all the letters are nicly drawn.

Visual inspection against light shows that there are no air traces or short circuits, tracks and isolations are even and everything seems fine. I am glad I skipped auto levelling, it would have just been waste of time.

One problem/fault with the PCB is the final drilling. Unfortunately I had no PCB drill of the right dimension, which for the large holes is 1.2mm, so I used an ordinary twist drill. This was not tight enough in the collet and the drill was not sharp enough for the plunge feed rate of 250mm/min for the drilling, so after a while the drill slide into the collet. I have seen it when it happened but didn’t care doing anything about it because drilling those holes on a pillar drill will not be a big issue. For the next job I’ll buy PCB drill bits even for the large holes. The smaller holes are drilled with 0.6mm high speed PCB drill bits, so those turned out nice.

Total job time was about 15 minutes. This includes milling and drilling, tool changing and zeroing the machine. I doubt this would have been possible to do in such short time using chemical etching, since in that case all the preparations and afterwork would have taken more time than that. My conclusion is that milling PCB is a better way of prototyping or making small series than chemical etching. It is also less messy and less hazardous.

Summary of technical information


Spindle speed: 22,000rpm
Cutter: 30 degree 0.2mm V-bit engraving cutter
Drill bits: high speed PCB drills, 0.6mm and 1.2mm
Maximum milling depth: 0.07mm
Isolation distance: 0.2375mm
PCB type: fibre glass 1.6mm, FR4 with 35um copper layer
Feed rates: 450mm/min first pass, 650mm/min second pass
Z plunge rate for drilling: 250mm/min