Saturday, October 29, 2011

Updated Bed Leveling

A big thanks to Ron Gerrits who has taken my original bed-leveling application and expanded on it. He's modified the Marlin Gen6 firmware to respond to the M117 code used during the bed leveling process. He's also made the process faster and automatically scaled the resulting plot.


The whole Marlin pack can be downloaded from here and selecting the Marlin.rar download. 

Wednesday, October 5, 2011

Skin Plug-in is Released

I've been busy with work and home renovations for the last few months, so I haven't had much time to play with my printer lately. However, I'm pleased to see that the Skin plug-in for Skeinforge has now been released.

I hope people have fun playing with it.

Wednesday, June 8, 2011

Bed Mapper Application and STL Files

I've finally got round to publishing the Bed Calibration Application that I discussed in this post.


The calibration application is now available, along with the STL for the bracket here.



This series of scripts requires the Python libraries: PySerial, Matplotlib and NumPy


Note: This script banks on the Mendel firmware supporting the M117 GCode. Without it, it won't work!


RepRapComms.py: Comms library for communicating with a Mendel.
ZCal.py: Main calibration routines.
PlotBed.py: Bed plotting routines.
gui.py: A GUI to make calibration easier.


To use the GUI:



  • Use the Printer Menu tab to configure the various settings to match your printer.
  • Calibrate Button, will perform a series of measurements across the whole bed at the specified X & Y step size.
  • Quick Cal Button, will perform a quick test at four specified points across the bed.
  • Variance Button, will perform a repeated measurement at a specified point to see what the variance is for the microswitch.

Wednesday, May 18, 2011

More Skinning Tests

I ran some more skinning tests this evening, its definitely got promise. This picture shows a 0.4mm carved cube skinned at 0.2mm in the middle. On the right is 0.25mm carved cube and on the left a 0.4mm carved cube for comparison. The outer shell feels very smooth to the touch. It would be good to transfer this to all top surfaces too. It would look better and may make closing PLA structures easier, mine always seem to have problems closing fully.


L: 0.4mm carve : M: 0.4mm carve w/ 0.2mm skin : R: 0.25mm carve




Tomorrow I think I'll try some of the more tricky prints, like the drive gear from the extruder.

Monday, May 16, 2011

Skinning

The best looking prints always have the thinnest layers, however, they take forever to print. It would be really good to have a print that has thin layers on the outside, but the inside is printed with much thicker traces. Now that Skeinforge can easily change layer thickness without lots of tweaking, it should be possible to do this on the fly during a print, rather than just selecting it during the carving process.


This is a concept I'm going to refer to as 'Skinning'. Printing the outer layers at a very thin height, while printing the inner layers at a thicker height. For example, one could print an object where the perimeter is printed with 0.25mm layers, but the inside is printed with 0.5mm layers.


Cross-section of a 'Skinned' print - note fine threads on front and thicker threads inside.




This would require printing at least two perimeter layers (probably first) for every  inner layer, but that shouldn't be a problem.


I've been developing some simple test scripts that take the GCode for a simple sliced object and 'skin' it with an external layer half the carve height. The script is rather basic, but the initial results look very promising. 
Left: 'Skinned' Cube 0.25mm external 0.5mm internal - Right: 0.25mm external & internal.


The 0.25mm default cube took 21m 30s to print, a 0.5mm default cube took 10m 0s to print, where as the hybrid 'skinned' cube took 16m 0s to print. The quality is not quite as good as the Skeinforge carved 0.25mm cube (the translucent PLA makes it hard to see), but my script just scaled the extrusion parameters from the 0.5mm carved cube as a quick and dirty test, it also doesn't take into account that the new perimeter paths are slightly longer (or shorter for the internal ones) than the 0.5mm carve.


Now that I know the concept works I'll work on refining the script to correctly adjust the extrusion rate for the skin height.


It's something that I'd like to turn into a Skeinforge plug-in and make part of the tool chain, it would probably much easier to handle the data within Skeinforge than trying to post-process it.


Eventually every print will look like it was printed with the finest nozzle, but take significantly less time!

Saturday, May 7, 2011

Adding M117 Support to Gen6 Firmware

This article details how I added support for the M117 GCode that I used for the Auto Bed Leveling approach. The standard Gen6 firmware doesn't support this GCode.


This is more for my own recollection in case I need to add it to future builds.


process_g_code.pde: Line 680 (in the switch statement after case 116)


Handle the M117 GCode and return the data in the appropriate format.



case 117:
Serial.print("C: X");
        Serial.print(zeroHit.x);
        Serial.print(" Y");
        Serial.print(zeroHit.y);
        Serial.print(" Z");
        Serial.print(zeroHit.z);
        Serial.print(" E");
        Serial.println(zeroHit.e);
break;


cartesian_dda.pde: Line 391 (in the if (read_switch(min_pin, inv) ) statement)

When an end-stop is hit, store the current step count.

   if (min_pin == X_MIN_PIN)
       zeroHit.x = current;
   if (min_pin == Y_MIN_PIN)
       zeroHit.y = current;
   if (min_pin == Z_MIN_PIN)
       zeroHit.z = current;

configuration.h: Line 329 (just before #endif)

Increase the variables scope.

extern LongPoint zeroHit;

FiveD-GCode_Interpreter.pde: Line 121 (after FloatPoint where_i_am;)

Variable declaration.

LongPoint zeroHit;


That's all there is to it, a quick recompile and upload later and the Gen6 hardware should now support M117.

Thursday, April 28, 2011

A More Advanced Way to Level the Bed

Ever since I first built my Mendel I've felt there has to be a more advanced way to level the bed than rolling a bit of dowel under the extruder nozzle. The Mendel is a very advanced CNC machine, but relies on a bit of wood to level the bed. Leveling the bed is important because even a deviation of 0.1mm can make the difference between the first layer sticking or not. A spirit-level is not accurate enough and measures the plane between the bed and the bench, not the plane between the extruder and the bed.


I wanted to find a way to use the Mendel itself to calibrate the level between the bed and the extruder. After thinking through various different approaches over the last few months, I settled on the following solution.


It would be based on a micro-switch that could be suspended beneath the extruder. The micro-switch would be connected in place of the normal Z-axis end-stop. The micro-switch would then be used to 'probe' the bed at various spots, each time the end-stop registered it should be possible to determine how many steps ahead or behind of where the end-stop was expected to be the extruder head had moved. The GCode M117 is already specified to provide this kind of information, mainly for determining if an axis is skipping steps, but it works here too.


The Micro-Switch Holder


Micro-Switch Bracket
I needed a way to hold the micro-switch that wouldn't require the extruder to be removed. I also wanted an approach that would allow the micro-switch to be added and removed easily. The easiest way to achieve this was to use magnets to attach the holder to the nuts on the bottom of the X-carriage. I designed a bracket that could be easily printed. The bracket was U-shaped, so that the magnets could contact the nuts but it would clear the extruder head. There was a foot on the bottom of the bracket to hold the micro-switch, which was offset so the switch lever was under the extruder nozzle.


Developing the Test Code


I had to create a simple application that controlled the Mendel to perform the calibration and collate and graph the results. I wrote it in my favorite language, Python. The program essentially takes a reference reading on the bed, then probes the bed at a number of points across its surface, recording the number of steps above or below the expected stop point. Since the Z-axis  is screw-drive, it has incredibly high accuracy. My Mendel requires about 2700 steps per mm in the Z-axis. There does appear to be some variation in the micro-switch activation. Making repeated measurements in the same spot shows that it doesn't always return to zero, but the variation is relatively small, +/- 12 steps. Compared to a layer of blue-tape at ~230 steps, I'll live with the variance.


The firmware that is running on my Gen6 Mendel does not actually support the M117 command, so I had to port the appropriate code across from the current firmware into my version. The changes were relatively straightforward, but due to some interim changes in the firmware builds, not just a cut-and-paste job.


The First Test Results


The first set of results for my bed, which I considered to be relatively level, where quite surprising to say the least. The plot showed that the bed was bowed, clearly being pulled down in the corners by the screws and forcing the middle up. The total variation across the bed was 0.18mm, which explains why I was having some first layer adhesion problems on large prints. I could clearly do better.




Bowed Bed
Tuning the Bed


My first task was to remove the bed and look at it more closely. Holding a straight edge across it clearly showed that there was some initial level-ness issues. The aluminium bed is too thick to bend by hand, and the deviations were rather small (0.1mm), so I decided to grind the bed flat.


Using some 220-grit sandpaper taped to a sheet of 1/2" plywood, I ground down the bed until the visible gaps under the straight-edge were gone. I then reattached the bed very loosely and repeated the auto-calibration. It clearly wasn't level.
Unfortunately, not level straight out of the gate.


Using a spirit level was a bad idea, it measured the level-ness of the bench!


The bubble was between the lines!
Using the old-dowel method was pretty good, but still not perfect.
The trusty old dowel wasn't actually that bad.


Tweaking the bed screws and repeating the calibration it was clear that the force of the bed springs was distorting the bed. To get one side level, it skewed the opposite corner.
Adjusting one corner pulled the others out of whack.


To try to correct this I decided to switch out the printed springs with wire springs. The same problem occurred. The upward force of the springs caused problems when leveling the bed.


No springs, just screw pillars
In the end I opted to do away with the springs completely and use bolts fixed to the bed as pillars, resting on nuts on the Y-carriage for easy adjustment. It was much easier to adjust the bed to be completely level with this approach. I think I'll change the regular nuts out to locking nuts though, it will prevent them moving through vibration. 


The downside with this approach is there is no give in the bed if the extruder plows into it. To overcome this, I think I'm going to put some small compression springs on top of the extruder connection screws. This should allow the extruder to move up slightly if anything goes wrong.


Level At Last


After six-days of tweaks and experiments, the bed is finally level and I'm happy. It is now level to within 0.08mm. I'm ignoring the last set of measurements at the back of the bed. They were made at the very back edge of the bed where I can't print anyway and no amount of screw adjustment can fix it.


Looks bad, but look at the scale!
Next Steps


Now I have a calibration method that allows me to either perform very detailed mapping of the bed flatness without removing the extruder or breaking out the dowel. If I do have to make adjustments, I won't spend ages adjusting bolts to find that they have changed something on the other side of the bed.


I also have the ability to perform very quick verifications of bed flatness. A four point test at the four screw locations takes under 2-minutes and is very good indicator of how flat the bed is now.  I can also save the resulting graphs for future reference to see if things have changed over time. 


Also, because I now know the deviation of the bed in millimeters, it takes the guess work out of how much to adjust the bed by. Each revolution of a M4 screw moves the nut by 0.7mm. Since the nuts are 6-sided, by moving the nut by one face I can get 0.116mm of adjustment very easily.


This work has some other potential uses that I am going to investigate. It could be possible to take the surface map of the bed and use it to dynamically adjust the first layer of GCode to overcome any minor surface variation by changing the Z-height while printing. I might try developing a Skeinforge plug-in that does this. Another use might be to use it to make point-clouds of objects placed on the bed  - allowing me to create crude 3-D scans. I think that I'll need something more pointy than a micro-switch lever for the probing, but the calibration utility I have written will definitely work.


I'm just tidying up the calibration application and will post it shortly, along with the bracket STL file, if anyone is interested. I should also document the changes I made to the Gen6 FW to add the M117 command, because I'm sure I'll forget before the next release comes out!


8-Jun-11 - Update:


The calibration application is now available, along with the STL for the bracket here.



This series of scripts requires the Python libraries: PySerial, Matplotlib and NumPy


Note: This script banks on the Mendel firmware supporting the M117 GCode. Without it, it won't work!


RepRapComms.py: Comms library for communicating with a Mendel.
ZCal.py: Main calibration routines.
PlotBed.py: Bed plotting routines.
gui.py: A GUI to make calibration easier.


To use the GUI:



  • Use the Printer Menu tab to configure the various settings to match your printer.
  • Calibrate Button, will perform a series of measurements across the whole bed at the specified X & Y step size.
  • Quick Cal Button, will perform a quick test at four specified points across the bed.
  • Variance Button, will perform a repeated measurement at a specified point to see what the variance is for the microswitch.