Add acceleration tower generator

This commit is contained in:
lawgicau
2020-08-13 15:57:25 +10:00
parent f027d82eea
commit f55dee14ab
7 changed files with 7991 additions and 12 deletions

View File

@ -41,12 +41,19 @@ p {
}
input {
margin: 20px 0;
font-size: 1.2em;
}
input[type="checkbox" i] {
/* Double-sized Checkboxes */
-ms-transform: scale(2); /* IE */
-moz-transform: scale(2); /* FF */
-webkit-transform: scale(2); /* Safari and Chrome */
-o-transform: scale(2); /* Opera */
transform: scale(2);
margin: 20px;
}
input[type="radio" i] {
-ms-transform: scale(2); /* IE */
-moz-transform: scale(2); /* FF */
-webkit-transform: scale(2); /* Safari and Chrome */
@ -109,10 +116,11 @@ iframe {
margin: 0 20px;
}
#warning {
.warning {
background-color: #ffcccc;
border: 1px solid red;
border-radius: 15px;
padding: 20px;
}
.exp {
@ -122,6 +130,10 @@ iframe {
border: 1px solid #00c5ad;
}
.jdtd {
display:none;
}
.thumb {
max-height: 240px;
max-width: 600px;
@ -182,11 +194,6 @@ iframe {
margin: 0 20px 20px;
}
.warning {
color: red;
font-weight: bolder;
}
#footer li {
margin: 10px 30px;
float: left;

BIN
files/accelerationtower.stl Normal file

Binary file not shown.

BIN
img/accelerationdiagram.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 87 KiB

BIN
img/m205.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 532 KiB

View File

@ -43,9 +43,9 @@
<p>It aims to make calibrating your 3D printer as easy as possible. If you find it helps you and you would like to say thank you, here is a donation link: <a href="https://paypal.me/testlawgicau" target="blank">PayPal.me</a></p>
<p>Special thanks to my <a href="http://www.patreon.com/teachingtech" target="_blank">Patrons</a> for suggesting this video, helping define the contents and testing/proofing.</p>
<p>Watch the video and then work through each tab. I have created a custom gcode generator to assist in making testing towers.</p>
<div id="warning">
<div class="warning">
<h2>Warning - Read carefully!</h2>
<p>Every attempt has been made to ensure this is safe but ultimately there always is risk in running presliced gcode from the internet. Preview the gcode in your slicer or <a href="http://gcode.ws/" target="_blank">Gcode.ws</a> and <span class="warning">print at your own risk.</span></p>
<p>Every attempt has been made to ensure this is safe but ultimately there always is risk in running presliced gcode from the internet. Preview the gcode in your slicer or <a href="http://gcode.ws/" target="_blank">Gcode.ws</a> and <span style="color:red; font-weight: bolder;">print at your own risk.</span></p>
<p>Only print this gcode when you are present, alert and capable of stopping the printer in case of emergency.</p>
<p>Validation has been built into the forms to only allow sensible min and max values, however this is not foolproof.</p>
<p>The gcode generated by this page has the following general characteristics:</p>
@ -57,7 +57,7 @@
<li>Nozzle priming has been turned off to avoid bed clips or problems with deltas</li>
<li>A single layer skirt</li>
</ul>
<p>To be compatible, your printer should have a miniumum bed size of 100 x 100mm.</p>
<p>To be compatible, your printer should have a miniumum bed size of 100 x 100mm. The largest print is 85x 95 x 30mm</p>
</div>
</div>
@ -662,7 +662,7 @@
<pre>G1 F50 F240</pre>
<pre>G1 F50 F300</pre>
<pre>G1 F50 F360</pre>
<pre>G1 F50 F420</pre>
<pre>...</pre>
<li>After you find the limiting speed, back off and repeat the test at a lower feedrate several times in a row until you are confident of reliable and repeatable extrusion.</li>
<li>Enter your reliable feerate and filament diameter below:</li>
<label>Reliable feedrate: <input type="number" min="60" max="1000" name="maxFeed" value="180" step="10" onchange="maxExt(); maxFee();"></label>
@ -694,10 +694,134 @@
</tbody>
</table>
<p class="result">Your maximum reliable XY feedrate is <b><span id="maxFee">90</span> mm</b> per second.</p>
<p class="warning">Warning: This value is dependent on a number of variables such as filament type, brand, colour, ambient temperature, etc. Be conservative to ensure success.</p>
</ol>
<p></p>
</form>
<h2>Acceleration Tuning</h2>
<p>We will now produce an acceleration tower to conveniently test back to back settings in a single print. If you would like to slice the model yourself, here is the STL: <a href="files/accelerationtower.stl">accelerationtower.stl</a>. It should be sliced with a normal base, but hollow, no top layers and only 2 perimeters.</p>
<p>The only thing you need to know before this test is whether your firmware is set up for jerk (older) or junction deviation (newer). Entering <b>M503</b> via terminal will give a list of printer variables:</p>
<ul>
<li>If the <b>M205</b> line contains the letters <b>X, Y & Z</b>, your printer is running jerk. The numbers after the X,Y & Z are your current jerk values for each axis.</li>
<li>If the <b>M205</b> contains the letter <b>J</b>, your printer is running junction deviation. The number after the J is your current junction devation value.</li>
</ul>
<p>The image below shows an example of each of these scenarios:</p>
<a href="#" data-featherlight="img/m205.jpg"><img class="thumb" src="img/m205.jpg" /></a>
<p>Use the following form to customise the gcode to you liking:</p>
<form name="accelerationForm" id="accelerationForm" onsubmit="return false;">
<h4>Bed dimensions</h4>
<p>Inputting the correct number will attempt to move the print into the centre of the bed. In the centre button is checked, the bed size is irrelevant. Please check the gcode to ensure it will fit on your bed.</p>
<label>0,0 at centre of bed (Delta):<input name="centre" type="checkbox" onchange="toggle(this.checked, '#accelerationXY')" value="centre"></label>
<span id="accelerationXY"><label>Bed X dimension (mm): <input type="number" name="bedx" value="100" min="100" max="600" step="1"></label>
<label>Bed Y dimension (mm): <input type="number" name="bedy" value="100" min="100" max="600" step="2"></label><br /></span>
<h4>Temperatures</h4>
<p>For the hot end and bed respectively, typical PLA temperatures are 200 and 60, PETG 235 and 80, ABS 250 and 100, TPU 230 and 5 (effectively off).</p>
<label>Hot end temperature (deg C): <input type="number" name="hotendtemp" value="200" min="160" max="450"></label>
<label>Bed temperature (deg C): <input type="number" name="bedtemp" value="60" min="5" max="150"></label><br />
<h4>Part Cooling Fan</h4>
<p>PLA typically has the part cooling fan come o n from layer 2. Alter thi default bahaviour here:</p>
<label for="pc">Select part cooling fan behaviour:</label>
<select name="pc">
<option value="0">100% fan from layer 2</option>
<option value="1">50% fan from layer 2</option>
<option value="2">No constant fan</option>
</select>
<h4>Auto Bed Levelling</h4>
<label for="abl">Select which method of ABL is in place.</label>
<select name="abl">
<option value="0">No ABL</option>
<option value="1">Probe new mesh at the start of print - G29</option>
<option value="2">Restore saved mesh - M420 S1</option>
<option value="3">Prusa MK3 - G28 W followed by M80</option>
</select>
<h4>Retraction</h4>
<p>For intial tests, you can leave the retraction speed at 40 mm/sec. For a bowden tube printer, 6mm is a likely retraction distance. For direct drive, a starting value of 1mm may be suitable.</p>
<label>Retraction distance (mm): <input type="number" name="retdist" value="5" min="0" max="20"></label>
<label>Retraction speed (mm/sec): <input type="number" name="retspeed" value="40" min="5" max="150"></label><br />
<h4>Base feedrate/speed</h4>
<p>You can specify the deefrate for X and Y movements. The inner perimeter will be set to this speed and the outer perimeter 50% of this speed.</p>
<label>Base feedrate (mm/sec): <input type="number" name="feedrate" value="60" min="20" max="500"></label>
<h4>Acceleration and jerk/junction deviation</h4>
<p>After entering <b>M503</b>, I have determined my printer firmware runs:</p>
<label>Jerk: <input type="radio" value="jerk" name="selector" checked="checked" onchange="toggleJ()"></label>
<label>Junction deviation: <input type="radio" value="jd" name="selector" onchange="toggleJ()"></label>
<p>Based on the values you saw from <b>M503</b>, enter variables around this below.</p>
<p>Junction deviation requires a single value, where as jerk has separate values for X and Y. You can leave them the same or enter independent values.</p>
<p>You should only change either acceleration or jerk/junction deviation for each test print, otherwise it will be impossible to know which parameter is responbsible for any changes.</p>
<table>
<thead>
<tr>
<th>Reference diagram</th>
<th>Segment</th>
<th>Acceleration</th>
<th class="jerktd">Jerk X</th>
<th class="jerktd">Jerk Y</th>
<th class="jdtd">Junction deviation</th>
</tr>
</thead>
<tbody>
<tr>
<td rowspan="6"><img src="img/accelerationdiagram.jpg" /></td>
<td style="text-align: center;">F</td>
<td><input type="number" name="f1" value="500" min="10" max="5000" step="100"></td>
<td class="jerktd"><input type="number" name="f2" value="8" min="1" max="30" step="1"></td>
<td class="jerktd"><input type="number" name="f3" value="8" min="1" max="30" step="1"></td>
<td class="jdtd"><input type="number" name="f4" value="0.05" min="0.01" max="20" step="0.01"></td>
</tr>
<tr>
<td style="text-align: center;">E</td>
<td><input type="number" name="e1" value="500" min="10" max="5000" step="100"></td>
<td class="jerktd"><input type="number" name="e2" value="8" min="1" max="30" step="1"></td>
<td class="jerktd"><input type="number" name="e3" value="8" min="1" max="30" step="1"></td>
<td class="jdtd"><input type="number" name="e4" value="0.05" min="0.01" max="20" step="0.01"></td>
</tr>
<tr>
<td style="text-align: center;">D</td>
<td><input type="number" name="d1" value="500" min="10" max="5000" step="100"></td>
<td class="jerktd"><input type="number" name="d2" value="8" min="1" max="30" step="1"></td>
<td class="jerktd"><input type="number" name="d3" value="8" min="1" max="30" step="1"></td>
<td class="jdtd"><input type="number" name="d4" value="0.05" min="0.01" max="20" step="0.01"></td>
</tr>
<tr>
<td style="text-align: center;">C</td>
<td><input type="number" name="c1" value="500" min="10" max="5000" step="100"></td>
<td class="jerktd"><input type="number" name="c2" value="8" min="1" max="30" step="1"></td>
<td class="jerktd"><input type="number" name="c3" value="8" min="1" max="30" step="1"></td>
<td class="jdtd"><input type="number" name="c4" value="0.05" min="0.01" max="20" step="0.01"></td>
</tr>
<tr>
<td style="text-align: center;">B</td>
<td><input type="number" name="b1" value="500" min="10" max="5000" step="100"></td>
<td class="jerktd"><input type="number" name="b2" value="8" min="1" max="30" step="1"></td>
<td class="jerktd"><input type="number" name="b3" value="8" min="1" max="30" step="1"></td>
<td class="jdtd"><input type="number" name="b4" value="0.05" min="0.01" max="20" step="0.01"></td>>
</tr>
<tr>
<td style="text-align: center;">A</td>
<td><input type="number" name="a1" value="500" min="10" max="5000" step="100"></td>
<td class="jerktd"><input type="number" name="a2" value="8" min="1" max="30" step="1"></td>
<td class="jerktd"><input type="number" name="a3" value="8" min="1" max="30" step="1"></td>
<td class="jdtd"><input type="number" name="a4" value="0.05" min="0.01" max="20" step="0.01"></td>
</tr>
</tbody>
</table>
<p><input type="button" onclick="processAcceleration()" value="Download Gcode"></p>
</form>
<h2>Interpreting Results:</h2>
<p>Inspect your finished print. Hopefully there will be a clear difference between the segments that reflect the acceleration values you entered. In the example below (Ender 3 direct drive, PLA, linear advance enabled), acceleration varied from 300 to 800 in 100 mm/sec/sec increments"</p>
<a href="#" data-featherlight="img/accelerationresults.jpg"><img class="thumb" src="img/accelerationresults.jpg" /></a>
<p></p>
<p>One you have a value you are happy with, you can update with:</p>
<pre>M204 P600</pre>
<p>where <b>600</b> is a value of the acceleration with the best compromise based on the tower test print. We can store the value to EEPROM by sending:</p>
<pre>M500</pre>
<p>You would then repeat the test with all of the acceleration values locked at 600 for each segment, but this time varying jerk/junction deviation.</p>
<p>To save for a printer with jerk (with a determined best compromise of <b>8</b>), we would enter:</p>
<pre>M205 X8 Y8</pre>
<p>To save for a printer with junction deviation (with a determined best compromise of <b>0.05</b>), we would enter:</p>
<pre>M205 J0.05</pre>
<p>Either way, we save to EEPROM afterwards with:</p>
<pre>M500</pre>
</div>
<div id="linadv">

7708
js/acceleration.js Normal file

File diff suppressed because it is too large Load Diff

View File

@ -69,6 +69,16 @@ function maxFee(){
$('#maxFee').html(maxFeedRate);
}
function toggleJ() {
var value = document.accelerationForm.selector.value;
if(value == "jerk"){
$(".jdtd").hide();
$(".jerktd").show();
} else {
$(".jdtd").show();
$(".jerktd").hide();
}
}
function processBaseline(){
var hotendTemp = document.baselineForm.hotendtemp.value;
@ -343,4 +353,134 @@ function processTemperature(){
downloadFile('temperature.gcode', temperature);
}
function processAcceleration(){
var hotendTemp = document.accelerationForm.hotendtemp.value;
var bedTemp = document.accelerationForm.bedtemp.value;
var centre = document.accelerationForm.centre.checked;
var bedX = Math.round((document.accelerationForm.bedx.value-100)/2);
var bedY = Math.round((document.accelerationForm.bedy.value-100)/2);
var retDist = document.accelerationForm.retdist.value;
var retSpeed = document.accelerationForm.retspeed.value*60;
var abl = document.accelerationForm.abl.value;
var pc = document.accelerationForm.pc.value;
var feed = document.accelerationForm.feedrate.value*60;
var selector = document.accelerationForm.selector.value;
var a1 = document.accelerationForm.a1.value;
var a2 = document.accelerationForm.a2.value;
var a3 = document.accelerationForm.a3.value;
var a4 = document.accelerationForm.a4.value;
var b1 = document.accelerationForm.b1.value;
var b2 = document.accelerationForm.b2.value;
var b3 = document.accelerationForm.b3.value;
var b4 = document.accelerationForm.b4.value;
var c1 = document.accelerationForm.c1.value;
var c2 = document.accelerationForm.c2.value;
var c3 = document.accelerationForm.c3.value;
var c4 = document.accelerationForm.c4.value;
var d1 = document.accelerationForm.d1.value;
var d2 = document.accelerationForm.d2.value;
var d3 = document.accelerationForm.d3.value;
var d4 = document.accelerationForm.d4.value;
var e1 = document.accelerationForm.e1.value;
var e2 = document.accelerationForm.e2.value;
var e3 = document.accelerationForm.e3.value;
var e4 = document.accelerationForm.e4.value;
var f1 = document.accelerationForm.f1.value;
var f2 = document.accelerationForm.f2.value;
var f3 = document.accelerationForm.f3.value;
var f4 = document.accelerationForm.f4.value;
var acceleration = originalAcceleration;
if(pc == 1){
acceleration = acceleration.replace(/M106 S255/, "M106 S130");
}
if(pc == 2){
acceleration = acceleration.replace(/M106 S255/, ";M106 S255");
}
if(abl == 1){
acceleration = acceleration.replace(/;G29 ; probe ABL/, "G29 ; probe ABL");
}
if(abl == 2){
acceleration = acceleration.replace(/;M420 S1 ; restore ABL mesh/, "M420 S1 ; restore ABL mesh");
}
if(abl == 3){
acceleration = acceleration.replace(/G28 ; home all axes/, "G28 W ; home all without mesh bed level")
acceleration = acceleration.replace(/;G29 ; probe ABL/, "G80 ; mesh bed leveling")
}
acceleration = acceleration.replace(/M140 S60/g, "M140 S"+bedTemp);
acceleration = acceleration.replace(/M190 S60/g, "M140 S"+bedTemp);
acceleration = acceleration.replace(/M104 S210/g, "M104 S"+hotendTemp);
acceleration = acceleration.replace(/M109 S210/g, "M109 S"+hotendTemp);
acceleration = acceleration.replace(/G1 E-5.0000 F2400/g, "G1 E-"+retDist+" F"+retSpeed);
acceleration = acceleration.replace(/G1 E0.0000 F2400/g, "G1 E0.0000 F"+retSpeed);
if(centre == true){
var accelerationArray = acceleration.split(/\n/g);
var regexp = /X\d+/;
accelerationArray.forEach(function(index, item){
if(accelerationArray[item].search(/X/) > -1){
var value = parseInt(accelerationArray[item].match(regexp)[0].substring(1)) - 50;
accelerationArray[item] = accelerationArray[item].replace(regexp, "X"+String(value));
}
});
var regexp = /Y\d+/;
accelerationArray.forEach(function(index, item){
if(accelerationArray[item].search(/Y/) > -1){
var value = parseInt(accelerationArray[item].match(regexp)[0].substring(1)) - 50;
accelerationArray[item] = accelerationArray[item].replace(regexp, "Y"+String(value))
}
});
acceleration = accelerationArray.join("\n");
} else {
if(bedX > 0){
var accelerationArray = acceleration.split(/\n/g);
var regexp = /X\d+/;
accelerationArray.forEach(function(index, item){
if(accelerationArray[item].search(/X/) > -1){
var value = parseInt(accelerationArray[item].match(regexp)[0].substring(1)) + bedX;
accelerationArray[item] = accelerationArray[item].replace(regexp, "X"+String(value));
}
});
acceleration = accelerationArray.join("\n");
}
if(bedY > 0){
var accelerationArray = acceleration.split(/\n/g);
var regexp = /Y\d+/;
accelerationArray.forEach(function(index, item){
if(accelerationArray[item].search(/Y/) > -1){
var value = parseInt(accelerationArray[item].match(regexp)[0].substring(1)) + bedY;
accelerationArray[item] = accelerationArray[item].replace(regexp, "Y"+String(value))
}
});
acceleration = accelerationArray.join("\n");
}
}
acceleration = acceleration.replace(/F3720/g, "F"+feed);
acceleration = acceleration.replace(/F2790/g, "F"+feed);
acceleration = acceleration.replace(/F1860/g, "F"+feed/2);
acceleration = acceleration.replace(/raise/g, "M201 X5000 Y5000");
acceleration = acceleration.replace(/accel1/g, "M204 P"+a1);
acceleration = acceleration.replace(/accel2/g, "M204 P"+b1);
acceleration = acceleration.replace(/accel3/g, "M204 P"+c1);
acceleration = acceleration.replace(/accel4/g, "M204 P"+d1);
acceleration = acceleration.replace(/accel5/g, "M204 P"+e1);
acceleration = acceleration.replace(/accel6/g, "M204 P"+f1);
if(selector == "jerk"){
acceleration = acceleration.replace(/j1/g, "M205 X"+a2+" Y"+a3);
acceleration = acceleration.replace(/j2/g, "M205 J"+b2+" Y"+b3);
acceleration = acceleration.replace(/j3/g, "M205 J"+c2+" Y"+c3);
acceleration = acceleration.replace(/j4/g, "M205 J"+d2+" Y"+d3);
acceleration = acceleration.replace(/j5/g, "M205 J"+e2+" Y"+e3);
acceleration = acceleration.replace(/j6/g, "M205 J"+f2+" Y"+f3);
} else {
acceleration = acceleration.replace(/j1/g, "M205 J"+a4);
acceleration = acceleration.replace(/j2/g, "M205 J"+b4);
acceleration = acceleration.replace(/j3/g, "M205 J"+c4);
acceleration = acceleration.replace(/j4/g, "M205 J"+d4);
acceleration = acceleration.replace(/j5/g, "M205 J"+e4);
acceleration = acceleration.replace(/j6/g, "M205 J"+f4);
}
downloadFile('acceleration.gcode', acceleration);
}