Topic: Firmware Z wobble compensation
Hello Forum!
I've been working hard on a compensation for the well-known banding problem at a firmware level, and I've made an attempt to write a class that can help with that.
It compensates for uneven layer height generated by a wobble of the Z axis that makes the translation rod movement->bed (extruder) movement nonlinear. Instead of assuming Zactual (the Z coordinate that you get in the bed) == Zrod (the Z coordinate that you multiply by the step size to control the motor), the function assumes that Zaxtual = Zrod + A*sin(w*Zrod + phase). Since the user wants to specify Zactual, we need to invert the formula to obtain Zrod, which is the value that will serve as the input of the motor.
This code is now part of the mlaws repository - If you have a recent version of the firmware (>=February 24 2013) you can directly use this feature. Otherwise just follow the usual instructions for the firmware upgrade and skip to the "Usage" section, or even better check the wiki page: http://www.soliwiki.com/Calibration_of_the_Z_wobble.
Update 1: I've forked lawsy's repository, so if you would like to try the mod, you can download this zip file, install it like you do with the official firmware (howto) and skip all the steps until "Usage" below
Update 3: I included TealVince's modifications (see below) in the github repo and put all the instructions on the soliwiki: http://www.soliwiki.com/Banding and http://www.soliwiki.com/Calibration_of_the_Z_wobble . Please refer to these pages to avoid reading all the posts here below to find the most recent information.
To use it, you will have to place the two files ZWobble.h and ZWobble.cpp in your Marlin folder and do the following changes in your code.
1) In Marlin.pde, at the beginning:
#include "ZWobble.h"
2) In Marlin.pde, after the code:
else if(code_seen('M'))
{
switch( (int)code_value() )
{
Insert:
DECLARE_ZWOBBLE_MCODES(96, 97)
(this defines the GCodes M96 and M97 as "report ZWobble status" and "set ZWobble status" respectively, you can change the values if you wish)
3) in planner.cpp, at the begining:
#include "ZWobble.h"
4) in planner.cpp, at the beginning of the function plan_buffer_line, ie after:
void plan_buffer_line(const float &x, const float &y, const float &z, const float &e, float feed_rate, const uint8_t &extruder)
{
add:
zwobble.InsertCorrection(z);
Usage:
To use it, set the parameters Amplitude, Period and Phase of the sinusoid function using the M97 code like this:
M97 A<Amplitude_in_mm> W<period_in_mm> P<phase_in_degrees>
This code can be inserted at the beginning of the GCode of the print you are about to do, or can be sent manually (eg from RepetierHost, in the tab "manual control", you can send your own gcode instructions to the printer)
A good value for the period is the thread step of the Z rod (in the Solidoodle2 it is 1.41)
The other two parameters need to be determined experimentally (Amplitude will be <0.1 typically).
In my SD2, this is the result I obtain for A0.03 W1.41 P120 (top uncorrected, bottom corrected, .3mm slicing):
Please keep in mind that this will not fix all your banding problems, it is just the "final touch" when all other sources are removed. I will shortly post something in the general discussion section about what I learned in the last weeks of research and experimentation.
Update 2: I've added a zip file with some test prints that should make the calibration process easy. Download "ZWobble-calibration.zip" and follow the instruction of the README file.