Musings and Experiments on the Art and Science of 3D Printing

Followers

Browsing "Older Posts"

FSR Auto Calibration Setup for Duet Controller

By SublimeLayers → Sunday, January 24, 2016
A lot of folks have pinged me for information about setting up FSRs for auto calibration using the Duet controller and dc42 branch of the RepRapFirmware. So I'll document what I've done here. Please feel free to post questions in the comments section so everyone can learn from them.

By far the easiest way to interface FSRs is with the JohnSL board. Several vendors sell them singly or in a kit with the FSRs and wiring harness. I like the UltiBot FSR Kit as it is competitively priced, the FSRs are the short variety with PRE-ATTACHED connectors (a significant feature), the JohnSL board and the wiring harness. Oh, and there are silicone pads for properly distributing the force on the FSR surface. I've equipped 12 printers with FSRs now and this is by far the easiest route.

I'll leave mounting the FSRs for another post as each printer has it's own requirements. To date, I've created printable mounts for Rostock Max, Mini Kossel, Kossel 250 and TAZ 4 and 5 printers. These can probably be adapted to any other delta or Cartesian printer. If you need them before I add them here, let me know. I also have a little JohnSL board holder to attach the board securely to the printer.

Wiring Up

On to the Duet and wiring...
Here's a photo of a Duet 0.8.5 on a Kossel 250. The Duet 0.8.5 has a dedicated connector for Z probes (upper right corner next to the PanelDue connector in the photo) but the folks at Think3DPrint3D recommended using the extruder end stop connector (labeled P above) for this type of probe (which actually makes the FSR output look like a standard mechanical endstop switch to the controller).

The wiring harness that comes with the UltiBot kit to connect the JohnSL to the Duet needs to be modified as the Duet has a different pin ordering than Arduino-based controllers. Take a look at the grey-red-black wires in the photo above. Grey is the Signal, red is 3v3 and black is ground. You can use a needle or thin wire to press the little tab in the connector housing slot to remove and rearrange the pins.
The JohnSL board is connected to the other end of this 3 wire harness. The photo above shows the wire order. The JohnSL also has jumpers to set the sensitivity - but leave those alone for now. There is also a jumper to set the switch behavior NC or NO. The jumper MUST BE installed to make the JohnSL behave like a NC switch. That is documented along with the sensitivity jumpers at the bottom of this page. The three FSR wiring harnesses attach to the two pin connectors at the bottom of the photo - the wire color order does not make a difference. It is good practice to twist the two wires to minimize signal noise.

Configuring Firmware

With the FSRs connected to JohnSL and the JohnSL connected to Duet, you can give your sensors a dry run test. First, edit your config.g file to let Duet know about the "Z probe". It is located near the bottom of the file. (TIP: with the Duet Web Control 1.08 you can edit this file right from the Web UI). Look for the section:

; Z probe and compensation definition
;*** If you have an IR zprobe instead of a switch, change P4 to P1 in the following M558 command
M558 P4 X0 Y0 Z0         ; Z probe is a switch and is not used for homing any axes
G31 X0 Y0 Z-.08 P500     ; Set the zprobe height and threshold (put your own values here)

The above is configured correctly for the FSR probe. Note the G31 line "Z" parameter. We'll come back to that later but for now set it to Z0.

While you are editing config.g, also set the primary delta parameters. Look for the M665 line:

;*** The homed height is deliberately set too high in the following - you will adjust it during calibration
M665 R97.336 L217.71 B85 H210 X0.33 Y-0.11 Z0.00   ; set delta radius, diagonal rod length, printable radius and homed height
M666 X-0.31 Y1.32 Z-1.01    ; put your endstop adjustments here, or let auto calibration find them

Set the delta radius R to a reasonably close value wither by measuring or using the manufacturer's recommendation. Set diagonal rod length L either by measuring your rods or using the lengths from the manufacturer, set the printable radius B, and set the homed height H to the distance from your nozzle tip when homed to the bed surface - 10mm to give a little clearance for calibration later.

Now power up your Duet. Press a finger tip on each of the FSRs one at a time. You should see the corresponding LED on the JohnSL light up and you should also see the LED above the extruder endstop connector on the Duet turn off (it is normally lit up with an NC switch). Once you've verified everything is working correctly, you can mount your FSRs and button up the installation.

In addition to the config.g edits above, you also need to edit your bed.g file. bed.g contains all the auto calibration configuration, mine looks like this (for a Kossel 250):

; Auto calibration routine for delta printers
; Before running this, you should have set up your zprobe Z offset to suit your build, in the G31 command in config.g.

; About the G30 S parameter
; Used to specify what calibration computation to perform.
;
; S=-1 Don't adjust anything, just print the height error at each probe point
; S=0 Equivalent to S=
; S=3 Adjust homing switch corrections only
; S=4 Adjust homing switch corrections and delta radius
; S=6 Adjust homing switch corrections, delta radius, and X and Y tower position offsets
; S=7 Adjust homing switch corrections, delta radius, X and Y tower position offsets, and diagonal rod length

M561    ; clear any bed transform, otherwise homing may be at the wrong height
G31 X0 Y0    ; don't want any probe offset for this
G28    ; home the printer

;*** Remove the following line if your Z probe does not need to be deployed
;M98 Pdeployprobe.g    ; deploy the mechanical Z probe

; The first time the mechanical probe is used after deployment, it gives slightly different results.
; So do an extra dummy probe here. The value stored gets overwritten later. You can remove this if you use an IR probe.

;G30 P0 X0 Y0 Z-99999

; Probe the bed and do 6- or 7-factor auto calibration
G30 P0 X-69.28 Y-40.00 Z-99999 H0.0   ; X tower
G30 P1 X0.00 Y-80.00 Z-99999 H0.0   ; between X-Y towers
G30 P2 X69.28 Y-40.00 Z-99999 H0.0   ; Y tower
G30 P3 X69.28 Y40.00 Z-99999 H0.0   ; between Y-Z towers
G30 P4 X0.00 Y80.00 Z-99999 H0.0   ; Z tower
G30 P5 X-69.28 Y40.00 Z-99999 H0.0 ; between Z-X towers
G30 P6 X-34.64 Y-20.00 Z-99999 H0.0   ; X tower
G30 P7 X0.00 Y-40.00 Z-99999 H0.0   ; between X-Y towers
G30 P8 X34.64 Y-20.00 Z-99999 H0.0   ; Y tower
G30 P9 X34.64 Y20.00 Z-99999 H0.0   ; between Y-Z towers
G30 P10 X0.00 Y40.00 Z-99999 H0.0   ; Z tower
G30 P11 X-34.64 Y20.00 Z-99999 H0.0   ; between Z-X towers
G30 P12 X0 Y0 Z-99999 H0.0 S6   ; center and auto-calibrate 6 factors

;*** Remove the following line if your Z probe does not need to be retracted
;M98 Pretractprobe.g   ; retract the mechanical Z probe

G1 X0 Y0 Z150 F10000   ; get the head out of the way of the bed
There are a couple of important things here. Firstly, read my comments on the S value at the top. I always do S=6 calibration. I don't want auto calibration messing around with my delta arm length as that can affect the part X-Y scaling and is easy enough to figure out and set independently. You can do an S=3 or S=4 once you have the machine calibrated, but since it only takes 30 seconds to do a full S=6 I just use that all the time.

Also note the commented out M98 lines. FSRs do not retract! I left them here commented out as a reminder since the default has them uncommented.

Next, you need to set the bed probe points. David has a nice web-based bed.g file generator here to sett all of this up. I use 13 point, 6 factor with a probing radius = 100 for my calibration above. TIP: it is best to start with a smaller probe radius than your bed actually supports to make sure your hot end, arms, carriages or wiring interferes. You can then sneak up on the maximum probe radius.

Make the edits to bed.g and upload or copy it to the CF card on Duet into the /sys folder.

Commisioning

Everything is ready to go, now what? Now it's time to test and make sure everything is working properly. I recommend doing a dry run with the hot end and bed cold. Once you have things working correctly, you always want to calibrate with the hot end and bed up to printing temperatures.

Power up your printer and Home it. Verify that the FSRs are working properly by tapping gently on the bed - you should see the LEDs blink on the JohnSL board and the endstop LED on Duet blink off-on. Test all three FSRs by tapping directly over them. With everything ready to go, enter G32 into the Web interface G-Code console or press the Auto Cal button on the PanelDue. Be ready to turn off the printer quickly in the event of a problem. The printer should home then descend to about 10mm above the bed. Then it moves out and probes each of your probe points, ending with a probe at 0,0. Finally, the nozzle raises 150 mm off the bed (that's the last line in the bed.g file that says G1 X0 Y0 Z150 F15000. You can change that to anything you'd like.

Presumably the probing worked. You can check the results easily. If you ran from PanelDue, click the Console tab and the auto calibration results will be printed. The deviation value tells you the least means square deviation for the calibration. You'd like to keep this below 0.05 for the best results. If you auto calibrated from the web interface, the output will be in the G-Code Console log output. Here's an example:
Calibrated 6 factors using 12 points, deviation before 0.208 after 0.045
If you issue an M665 command, you'll get the calculated delta radius, homed height, and tower position offsets.
M665 
Diagonal 215.53, delta radius 96.64, homed height 208.92, bed radius 85.0, X 1.59°, Y 1.31°, Z 0.00°
M666 shows the end stop adjustments.
M666 
Endstop adjustments X0.21 Y1.41 Z-1.63
Once you have calibration tested and working, bring the hot end and bed up to temperature and run calibration (G32) again. If your deviation is too high, run auto calibration again. Sometimes 2-3 runs will improve things. If after 3 runs it is still too high, I recommend checking your printer carefully for mechanical issues. In particular, check that the FSRs are triggering reliably with little force.

After you have a good calibration, you can transfer the M665 and M666 values to your config.g file so the next time you start your printer, you are ready to go. I find calibration so quick to perform that I just run G32 everytime I startup my printer. In fact, you can add a shortcut to the Duet Web Control menu for it. Click the Settings menu and the List Items tab. In the Add new G-Code box enter G32 for G-code and Auto Calibrate for the description. Click Add G-Code and Apply Settings. Now you can run Auto Calibrate from the pull-down menu at the top left of the Web Control screen.

Post Script

Once you have FSR based auto calibration working you may find that it needs a little tweaking to set Z=0 properly. FSRs require force to trigger. Depending on how rigid your bed and FSR mounting system is, you may get a little flex before the FSR triggers. This can result in the nozzle being too low - the nozzle will drag on the bed on the first layer or the layer height will be too thin. The G31 line in the config.g file can offset this. I have a very rigid bed and mounting system and find I need -0.05 mm compensation using the Z parameter for Z probe height.

G31 X0 Y0 Z-.05 P500 ; Set the zprobe height and threshold (put your own values here)

In the dc42 firmware, David has built-in some very flexible probe height offset with the G30 H parameter. Basically, this allows you to correct for any offset differences at the probing points. Here's how you go about doing that:
  1. Above each probe point (from the bed.g file) lower the nozzle using the paper grip test.
  2. Send a G92 Z0.
  3. Raise the nozzle 5mm.
  4. Send G30 S-1 and write that down.
  5. Read the trigger height (if you did the above from the web interface, read it there, otherwise read from the PanelDue console).
  6. Repat 3 - 5 several times and average the results. I like to do 3 probes.
  7. Repeat 1 - 6 for each probe point from the bed.g file.
  8. Edit the G31 Z parameter in config.g to the trigger height you measured at the bed center: X = Y = 0.
  9. In bed.g set the H parameter for for each of the probe points like this:
H = (trigger height measured at the point) - (trigger height at the bed center)

I'd like to thank David Crocker (dc42) for his great firmware and guidance in understanding his probing and configuration.


Updating to new versions of DuetWebControl independantly

By SublimeLayers → Wednesday, January 20, 2016
As I wrote in yesterday's post, the DuetWebControl is bundled with the dc42 branch of the RepRapFirmware. But, it is possible to update the DuetWebControl independently, here's how.

First, make sure the new version of DuetWebControl is compatible with your firmware version. For this example, we'll update the DuetWebControl 1.07 that comes with the latest dc42-r firmware to the new DuetWebControl 1.08.

DuetWebControl is found in the /www folder on the compact flash card with your other Duet configuration files. The first thing you need to do is download the new version of DuetWebControl from GitHub at the link above. Click the Download Zip button. Rename the downloaded folder to www.

Next, insert the Duet's flash card in your computer's card reader. Find the www folder and rename it. I like to use the version number in the new name, so for this example I'd rename to www-107 to reflect the 1.07 version. Now copy the newly downloaded www folder to the flash card. When the copy is complete, you can eject the card and reinsert it into Duet and restart.

To check that you have successfully completed the update (or just to check the current version) open the DuetWebControl in your browser. Click the Settings menu on the left side of the screen and make sure the General tab is selected. The current RepRapFirmware and DuetWebControl versions are displayed as shown here.


DuetWebControl v 1.08 mini review...

By SublimeLayers → Tuesday, January 19, 2016
It's no secret that I love the dc42 branch of the RepRapFirmware to control my delta printers. On top of that great firmware is a very nice web control interface developed by chrishamm. The dc42 firmware installs with the DuetWebControl but you can also download and install the latest and greatest directly from GitHub. Earlier today, a gent on the google Delta robot 3D printers group asked for screenshots. I obliged and posted a set there but thought it might be useful to add them here too. So here they are basically in top-to-bottom order. The only major UI I didn't include is the g-code console page as it is very simple. This is for the 1.08 version that was posted a few days ago. It includes the ability to edit config.g and upload changes directly from the web interface - a real time saving feature. Other new features include:

  • French and Swedish translations
  • layer times
  • web cam integration
  • drag & drop on G-code and Macro file pages
  • ZIP file uploads
  • and a few bug fixes
Overall a really great release.














Water cooled Diamond hot end idea

By SublimeLayers → Friday, January 8, 2016
I just picked up a Diamond hot end that has three filaments in with one orifice. By design, it uses three E3D Online's heat breaks. This makes for a very large setup. I prefer water cooling and this also allows for a more compact setup. Here's the basic idea:

3mm ID tubes will run into the top of each jacket for the water. The jackets will be connected by short lengths of flexible plastic tube and an inlet and outlet will run from/to the water pump. Compare this with a stock setup with three E3D heat breaks. The black cylinders are the water cooled setup so it's easy to compare.


This will be quite a bit more compact and have the benefit of water cooling. I'll use the press-in Bowden fittings like E3D uses on their hotends. Since I only intend to print PLA and ABS with this hotend, I'll line the entire path with PTFE tubing down to the stainless steel heatbreak. This simplifies fabrication but also minimizes friction.

I'm thinking about mounting options for my Rostock Max or Kossel 250 now. I like the 3 post designs that some of the Rostock users have printer. I think I could do something similar that the heat jackets snap into.

Musings on the impact of STL triangle count on print quality

By SublimeLayers → Thursday, January 7, 2016
I posted part of this on the SeeMeCNC forum a few weeks ago as part of a discussion on the dc42 branch of RepRapFirmware's delta motion calculations vs other firmwares. Most mainstream firmwares (Marlin, Repetier, Smoothieware, MachineKit, etc) interpolate print moves as short line segments. The dc42 firmware calculates each and every point of movement. So, in theory, prints made with dc42 - all other factors being the same - should result in higher quality prints. To date, I have not seen any actual evidence that this is borne out in practice (*if you know of any examples, please let me know!). There are other factors at play that might obscure the benefit of dc42's precise calculations. I have converted all but one of my delta printers to dc42. Even though I can't definitively prove the printed parts are better, I do believe there is a subtle difference.

By it's very nature, a 3D print originating from an STL file is going to sacrifice some resolution due to the meshing (or tessellation) process that converts the mathmatically precise CAD model into a triangle mesh. Here's an example of a sphere drawn in a CAD application and an example mesh (which is what is saved in an STL file):
left: CAD sphere             right: triangle mesh
The higher the triangle count in the mesh, the more closely it represents the original sphere. But it's a tradeoff between file size and model accuracy. In practice, even with reasonably high triangle counts, the mesh is a close, albeit pretty good, approximation of the original.

Take a look at the image below of a 20mm diameter sphere converted to five meshes, each with differing triangle counts. The CAD tool uses sophisticated math to calculate the geometry and display it. It looks like a perfect sphere on screen. The image shows five different resolutions from a low number of triangles to a high number of triangles (left to right).
Effect of increasing triangle count (left to right)
Imagine printing each of these meshes. The printed part from the mesh on the far left would not look very spherical at all. The printed part would look better from the 224 triangle mesh and best from the 99856 triangle mesh.

NOTE: When you download an STL file from Thingiverse or another sharing service, you have no control over the mesh count. The original author made the resolution choice for you and depending on their level of sophistication, the resulting mesh may not be optimal.

Back to the example - to take this one step further, imagine your slicer creating gcode from these meshed models. To demonstrate, I created an imaginary slicing plane at 12mm above the sphere's base that is .02 mm thick to represent a typical slicing layer. These are the red polygons circumscribing the meshes in the image above. I then projected these slices up above the models so you can see them more clearly (the black polygons "floating" above the meshes).

The 48 triangle model has a slice with 8 sides. It should be a perfect circle so this is a very low resolution slice. As you move left to right, each slice has more line segments to represent the circle. Higher segment counts to represent the circular cross section will result in a finer/higher resolution print all things being equal. But they are not! In addition to the slicer converting curves into short line segments, the firmware also imposes its own line segmentation on top of that - that is all of them except dc42 RepRapFirmware. dc42 draws each point along the way completely tracing the original path it was given within the resolution of the printer's mechanics. Smoothie, Repetier, Marlin and the others actually break the path up into short line segments and draw those. This does not always match the original path exactly.

As you can see, if the STL had a low triangle count, you are going to get a course print. Increasing the triangle count will improve the print quality until you reach the segmentation threshold of the firmware, at which point, increased # of triangles won't have an effect and might actually make things worse. That is except dc42, which will faithfully trace each of the tiny line segments exactly point by point.

To test if dc42's precise movement calculations have a positive effect, one would have to perform a side-by-side comparison using the same printer and filament, printing the same STL file (which was meshed with a high triangle count) once with a Smoothieboard running smoothieware and once with a Duet running dc42. I'm thinking about what the best test model should be to perform this test. If anyone has any suggestions or comments, please let me know.



RepRapFirmware dc42 branch config files

By SublimeLayers → Wednesday, January 6, 2016
As per the comment request on my Current Rostock Max "ultimate configuration" post, here is my RepRapFirmware config.g file. Please note, I have15 tooth pulleys so my axis steps/mm are not compatible with the later and Rostock Max V1 and V2 20 tooth pulleys. Use 80.0 steps/mm as a starting point for these machines.  Also note that the MAC address and network parameters are unique to this printer and you will need to edit these for you config. I have a wifi bridge to my Duet that dictates the IP address, gateway and subnet mask.

config.g
; Configuration file for Rostock Max early V1
; Communication and general
M111 S0                             ; Debug off
M550 Pmaxie      ; Machine name and Netbios name (can be anything you like)
M551 Pmypassword                    ; Machine password (used for FTP)
M540 P0xBE:0xEF:0xDE:0xAD:0xFE:0xEE ; MAC Address
;*** Adjust the IP address and gateway in the following 2 lines to suit your network
M552 P192.168.1.211             ; IP address (0 = use DHCP)
M554 P192.168.1.210             ; Gateway
M553 P255.255.255.0                ; Netmask
M555 P2                             ; Set output to look like Marlin
G21                                 ; Work in millimetres
G90                                 ; Send absolute coordinates...
M83                                 ; ...but relative extruder moves
M575 P1 B57600 S1                   ; Set auxiliary serial port baud rate and require checksum (for PanelDue)
; Axis and motor configuration
M569 P0 S1     ; Drive 0 goes forwards
M569 P1 S1     ; Drive 1 goes forwards
M569 P2 S1     ; Drive 2 goes forwards
M569 P3 S0     ; Drive 3 (extruder) goes backwards
M569 P4 S1     ; Drive 4 goes forwards
M574 X2 Y2 Z2 S1     ; set endstop configuration (all endstops at high end, active high)
 
;*** The homed height is deliberately set too high in the following - you will adjust it during calibration
M665 R133.87 L269.0 B120 H341.92 X0.194 Y0.72 Z0.00    ; set delta radius, diagonal rod length, printable radius and homed height
M666 X-0.32 Y-0.09 Z0.41           ; put your endstop adjustments here, or let auto calibration find them
M92 X106.667 Y106.667 Z106.667 ; Set axis steps/mm
M906 X1000 Y1000 Z1000 E500 ; Set motor currents (mA)
M201 X1000 Y1000 Z1000 E1000 ; Accelerations (mm/s^2)
M203 X20000 Y20000 Z20000 E3600 ; Maximum speeds (mm/min)
M566 X1200 Y1200 Z1200 E1200 ; Maximum instant speed changes mm/minute
; Thermistors
;*** If you have a Duet board stickered "4.7K", change R1000 to R4700 to the following M305 commands
M305 P0 T100000 B4388 R1000 H-3 L475 ; Put your own H and/or L values here to set the bed thermistor ADC correction
M305 P1 T100000 B4388 R1000 H7 L470 ; Put your own H and/or L values here to set the first nozzle thermistor ADC correction
M305 P2 T100000 B4388 R1000 H7 L470 ; Put your own H and/or L values here to set the second nozzle thermistor ADC correction
M570 S180 ; Hot end may be a little slow to heat up so allow it 180 seconds
; PID
; Bed
M301 H0 P-1 ; negative P means use bang-bang control
; Heater 1
M301 H1 P20 I.027 D100 T1.1 S1 W300 B30
; Tool definitions
M563 P0 D0 H1                       ; Define tool 0
G10 P0 S0 R0                        ; Set tool 0 operating and standby temperatures
;*** If you have a dual-nozzle build, un-comment the next 2 lines
;M563 P1 D1 H2                      ; Define tool 1
;G10 P1 S0 R0                       ; Set tool 1 operating and standby temperatures
M92 E458.55:458.55 ; E478.63:478.63                  ; Set extruder steps per mm
; Z probe and compensation definition
;*** If you have an IR zprobe instead of a switch, change P4 to P1 in the following M558 command
M558 P4 X0 Y0 Z0 H3 ; Z probe is a switch and is not used for homing any axes
G31 X0 Y0 Z-.35        ; Set the zprobe height and threshold (put your own values here)
;*** If you are using axis compensation, put the figures in the following command
M556 S78 X0 Y0 Z0                   ; Axis compensation here
M208 S1 Z-0.2 ; set minimum Z
;
T0 ; select first hot end

TIP: A little alignment trick for Bondtech QR extruders

By SublimeLayers → Tuesday, January 5, 2016
The only critical step in assembling the Bondtech QR extruder is getting the filament path aligned with the geared cogs properly. Here's a simple trick - use a short length of brightly colored filament to align the cogs precisely! As you can see here, the red filament contrasted against the steel cogs allows you to center the cog precisely. Quick and easy.


Geared Stepper Motor Wiring (for Bondtech QR Extruders and in general)

By SublimeLayers → Sunday, January 3, 2016
A few people have emailed and PM'd me about how to connect the geared stepper supplied by Bondtech with the QR extruder. Also, Kysan 1040229 geared stepper is popular and is the stepper I use with my QRs since I had a few of them already. After a bit of research and email exchange with Martin at Bondtech, I put together the following chart:

Phase    Kysan Stepper    QR Stepper
1(A)     Red              Red
1(C)     Green            Gray

2(B)     Yellow           Yellow
2(D)     Blue             Green

With any 4 wire stepper it is easy to find the two phases. Here are two simple methods:

Method 1
Make sure none of the wires are touching and spin the shaft of the stepper to feel how much resistance there is. Now, connect any two wires and spin the motor shaft again. If it is much harder to turn, you have identified a phase! If it has about the same resistance to turn as when unconnected, connect one of the connected wires to a different wire and test again. Once you've identified one phase, connect the other pair of wires and verify that the motor is harder to spin. That is the second phase.

Method 2
If you have a volt meter, set it to measure resistance. Then hook up any pair of stepper wires. If you measure any resistance, you have identified a phase. For the Kysan stepper, the phase resistance is about 2.4 Ω. For the Bondtech stepper, it is 1.7 Ω.

Once you know which pair of wires form a phase, you simply connect them to your control board matching the phases. You don't need to worry about which phase goes where as long as you have the phases connected properly. A simple firmware change (to change stepper direction) is all that's required if the wires are hooked up reversed so it is much easier to just hook the stepper up and deal with it in firmware.