Posts Tagged ‘ c-bot

Building the C-Bot 3d Printer : Part 38 : PID Autotune on RepRap Firmware, fix z-artifacts

Jump to C-Bot blog index to see all the posts.


In my last post on the subject, I described how I completely rebuilt my C-Bot printer.  The main goal was to get better print quality based on some odd z-artifacting I’d been experiencing for some time.  But, the z-artifacing still persisted.

This post is to talk about both the solution to the artifact issue, and how to PID Autotune your hotend and heated bed with RepRap Firmware.

Solving the Z-artifacting

After the rebuild, the z-artifact was still there.  Was so frustrating to have a machine that printed so well, yet on the Z-axis, I’d get this:

z-ringing <- Click on it to make bigger, and look on the inside of the print.

The real oddity was that the artifact didn’t match the pitch of my leadscrew, which seemed like the obvious culprit, and the period of the artifact could vary based on what you were printing.  For example, a 20mm calibration cube showed off the issue much more than the above cylinder.  And it was more of a square-wave, not an s-curve.

3D printer people to the rescue:  I posted my issues to the ‘3D Printer Tip, Tricks and Reviews‘ Google Group, and through a lot of back and forth discussion (thanks JetGuy + several others), the users figured it was either one of two things:

  • Thermal expansion of the bed during the bang/bang heat cycle was causing these anomalies.
  • The hit the heated bed was making on my power supply:  When I built my machine 2 years ago I was recommended a fancy PC power supply (Corsair CTX 500), but as it turns out, this may not have been the right choice for a 3D printer.

Check Thermal Expansion

To troubleshoot the thermal expansion, user Joseph Chiu suggested a great idea:  Shine a laser off a mirror on the bed during the heat cycle, and track the dot on the wall.  If the dot moves during the bang/bang cycle, then it’s thermal expansion.  So, I gave it a shot:  Heated up the bed, waited for the temp to start banging back and fort, and then stared a dot on the wall…

frikkin_lasers The ol’ Replicator1 served as a based for the vice holding the laser.

That laser was bright, so I moved the mirror so it hit a “splotch” on it, and gave a nice diffusion pattern on the wall.  This was much easier to look at, and track the specks to see if the changed / moved : The did not.  This is not a thermal expansion issue.

Check Power Supply

The easiest way to check if this is a power supply issue?  Just ‘not print with the heated bed on’:  I normally always do, at 60c:  Not required, but sometimes helps large PLA prints stick better over time.

So, I did the same cylinder print with no heated bed and: The z-artifacting was gone!  Can’t believe I’ve been having this issue for a year-ish, and never realized it was the amp-draw the heated bed puts on the PSU, even though the PSU is rated for it, based on numbers.

Compare PID Tuning vs no heatbed

One thing I’d never done since upgrading the bot to RepRap Firmware, was PID autotune the hotend, or bed:  The defaults seemed fine, and the temp curves as shown in my slicer seemed “good enough” : I could easily see the bed overshoot based on the bang/bang setup, and a slight wobble on the hotend.  But I figured this would be a good time to PID autotune both the hotend and bed (discussed in more detail in the next section):  Would this help any of the z-artifacting?

Why, in fact it does.  Here’s a comparison shot:

print_compare

‘Bed off’ and ‘Bed with PID Autotune’ are nearly the same:  The artifacing caused by the bang/bang is completely removed, and only a very slight, larger-period artifact remains (which I’m happy enough with at this point).

I should also note that my temp curves, for both hotend and bed, are now dead flat.  PID tuning completely makes a difference.

However, I noticed that while the pid-tuned bed works, the LED strips on my bot flicker with the same frequency as the SSR controlling the bed:  The same power-hit that caused the bang/bang artifact is still there, it’s just happening at such a high rate, the artifact is being averaged out of existence.

For future improvement, I need to choose one of these:

  • Get a separate power supply for just the 12v bed.
  • Switch to an entirely separate 120v AC heated bed.  This is the option I’m currently investigating.
  • Switch all my electronics out to 24v (ugh).

But in the meantime, at least the stupid z-artifact is gone.

PID Autotune your hotend and heated bed in RepRap Firmware

These are the steps I went through to PID autotune my hotend and heated bed in RepRap Firmare:  None of it hard, just took a good amount of digging online to figure out what exactly needed to be done.

In RRF gcode, ‘H’ Is the heater number: H0 is the bed, H1 is the first hot end, H2 the second etc.

PID Autotune the hotend

To PID autotune the hotend, these were the steps I took:

  • Position nozzle over bed
  • Turn on cooling fan 50% to simulate real printing environment.
  • Start with a cold hotend.
  • Enter this gcode, + the result returned as it’s ran:
    • I chose 230c as the target temp, since I print a lot of filament at that temp.
    • If you get an temp overshoot error during the tune, you may need to add / adjust your M143 in config.g:  The default value for hotends is 262c.

M303 H1 S230
READ: Auto tuning heater 1 using target temperature 230.0C and PWM 1.00 – do not leave printer unattended
READ: Auto tune phase 2, heater off
READ: Auto tune phase 3, peak temperature was 234.6
READ: Auto tune heater 1 completed in 228 sec
READ: Use M307 H1 to see the result, or M500 to save the result in config-override.g

  • Then entered this gcode, the result returned as it’s ran:
M307 H1
READ: Heater 1 model: gain 325.3, time constant 117.3, dead time 5.0, max PWM 1.00, mode: PID
READ: Computed PID parameters for setpoint change: P12.9, I0.110, D45.0
READ: Computed PID parameters for load change: P12.9, I1.026, D45.0
  • Finally entered this gcode to save the results out to config-override.g
M500
  • Which in turn, added this info (actually more, but this is what’s important to this operation) to config-override.g
M307 H1 A325.3 C117.3 D5.0 S1.00 B0 
  • Note, the B0 = PID tuned.  B1 = bang/bang.

PID Autotune the heated bed

To PID autotune the heated bed, these were the steps I took.  Note, it’s very similar to the hotend above.

  • Start with a cold heated bed.
  • Enter this gcode, + the result returned as it’s ran.
    • I chose 60c as the target temp, since I print a lot of filament at that temp.
    • If you get an temp overshoot error during the tune, you may need to add / adjust your M143 in config.g:  The default value for heated beds is 125c.
M303 H0 S60
READ: Auto tuning heater 0 using target temperature 60.0C and PWM 1.00 - do not leave printer unattended
READ: Auto tune phase 2, heater off
READ: Auto tune phase 3, peak temperature was 61.2
READ: Auto tune heater 0 completed in 1105 sec
READ: Use M307 H0 to see the result, or M500 to save the result in config-override.g
  • Note, it took forever for this to finish, since it wants the bed to cool down before it completes.  I had to point a fan at it to help it along after ‘phase 3’.
  • Then entered this gcode, the result returned as it’s ran:
M307 H0
READ: Heater 0 model: gain 111.6, time constant 814.0, dead time 20.5, max PWM 1.00, mode: PID
READ: Computed PID parameters for setpoint change: P63.5, I0.078, D911.1
READ: Computed PID parameters for load change: P63.5, I1.082, D911.1
  • Finally entered this gcode to save the results out to config-override.g
M500
  • Which in turn, added this info (actually more, but this is what’s important to this operation) to config-override.g
M307 H0 A111.6 C814.0 D20.5 S1.00 B0
  • B0 = PID.  Previously, it was B1, bang/bang.

Configure config-override.g

The M500 command entered above does a live update to the config-override.g script living on the SD card, which is a great feature.  However, I’d never used this feature before, so my config.g had no idea to execute this script.

To do so, simply (I did mine a the bottom), enter this gcode in your config.g

M501

This will then execute the contents of config-override.g from within your config.g, when the machine boots up.

Optionally, you could simply copy the M307 lines (as generated by M500) from config-override.g and paste them directly into config.g, and remove the M501 call.  Either will work.

PID Autotune related gcodes

  • M135 : Set PID sample interval
  • M301 : Set PID parameters
  • M303 : Run PID Tuning
  • M304 : Set PID Parameters – Bed  :  This command is identical to M301 except that the H parameter (heater number) defaults to zero.
  • M307 : Set or report heating process parameters

Jump to C-Bot blog index to see all the posts.

Building the C-Bot 3d Printer : Part 37 : 2017 Redux

Jump to C-Bot blog index to see all the posts.


Hard for me to believe I built the C-Bot just over two years ago.  During that time I’ve done a number of upgrades, but a weird z-wobble had shown up in the process, that I’d been completely unable to resolve.

After discussion on the C-Bot/D-Bot 3D Printer Google Group, I generated a new list of parts to re-3d print, to improve my bot.  So I really can’t call this a C-bot anymore, it’s more of a C-Bot/D-Bot/Spiffbot (+ others) mashup at this point.

So after two weekends of disassembly & reassembly, the CDSO-bot is back up and running.  Behold:

cbot_redux_web

The colors are a bit like a time machine:  Anything in blue is original prints. White was printed next, and latest is gray.

Overview of my updates below.  Huge thanks to all of those who have put time in to improve these files, and release them for free!

  • Printed all new lower corner brackets based on the Spiffbot designs.  These add the bulk of the rigidity to the new system.  Feels like a tank now.
  • I remixed the D-bot top XY-idlers, extending them down on Z an extra 20mm, to provide for even more z-rigidity.
  • Switched my X-endstop to now be on the X-carriage instead of the Y-gantry.  Used the ‘X-endstop mount for the direct-drive gantry’, by pizzachef.  This cleaned up a bunch of wiring from the left side.  While it added more mass to the toolhead, it seems pretty negligible.
  • From the D-Bot remix by spauda01, leadscrew brackets and bed supports:
  • All new smaller, 3-wheel brackets for my Y Gantry, by BucketOchicken.  These are nice in providing slightly more space on +/- Y.
  • Used some silicon caulk to affix a 12″ square chunk of cork under the heated bed.  Hopefully will heat up faster, and save some energy.
  • Switched from the front/back leadscrew design to the “middle, side-by-side design” (+ brass nuts), just to try something new, since I had the spare extrusion.  The extrusion is held in place by triangular aluminum brackets, making the base even more rigid.
  • The top front X-beam is now held in place my much stronger aluminum triangle-brackets.

Here’s another pic of some of the updated parts I printed, mocked up to make a very tiny printer 😉

smallxy_akeric

Successes:

  • Once I rebuilt everything, and got all the electronics re-hooked-up, everything still worked!  No magic smoke, nothing exploding.
  • The dumb z-wobble I was experiencing is gone!
    • Update:  Wait, no it’s not.  ARGH!

Issues:

  • With the new L/R leadscrew config, they now hit both my “beefy print cooler fan” (on the left), and my inductive probe (on the right) if printing all the way to the edge of the volume: I’ll need to remove them, and cut about an 1″ off to solve that problem.
  • I ran out of T-nuts:  I had a surplus during my last build, but this one used up all the remaining ones, and then some.  So waiting for that delivery slowed things down a bit.
  • Even with the giant new base-corners, it still wasn’t square on top:  While the based seemed to be nice and square, it took some time to get all the top extrusions back in line.

Overall, a very successful rebuild.  Here’s to another two years of 3d printing!


Jump to C-Bot blog index to see all the posts.

Building the C-Bot 3d Printer : Part 36 : Adding an inductive z-probe to RepRap Firmware / RADDS

Jump to C-Bot blog index to see all the posts.


Introduction

This post describes how I installed an inductive Z-probe on my C-Bot 3d printer, using RADDS hardware with RepRap Fimrware.

My C-Bot printer has a 12″ square build plate, with 4-point screw leveling: Not the easiest thing to keep level.  I decided to tackle installing an inductive Z-probe to help with the leveling, since RepRap Firmware supports it.

Very important:  Before you get started, you’ll either need an aluminum build plate, or some copper tape you can stick on your existing surface at the points you want to probe.

Other info:

  • This sensor works in conjunction with your Z-endstop:  You still home using the endstop.  But after the home, the probe takes over fine-tuning the leveling process.

Get the probe:

I picked up a LJ12A3-4-Z/BY inductive probe off E-bay some time back.  It’s stats:

  • 4mm sensing distance (to iron)
  • NO, PNP
  • 6-36v input, 300ma
  • Brown = Positive, Blue = Negative, Black = signal

Make a bracket:

I modeled up a bracket for it in Autodesk Maya, that would hang off the rear of my hotend gantry.

After the probe was mounted to the bracket, I adjusted the probe so it was about 1mm from the build-plate, if the nozzle was touching the plate.  Basically, a different in 1mm from nozzle to probe-base.

probebracket_web

You can download the bracket from Thingiverse here.

Wire it up:

Voltage Divider:

Update:  I’ve been told you can drive these sensor directly off 5v:  I’ve not tested this,but if you’re going to attempt it, it’s worth a shot.  Save you from having to deal with the voltage divider below, and it means you can wire + & – directly into the RADDS board itself.

The probe needs 6-36v, the signal input on the RADDS board only accepts 5v, and my PSU is 12v:  Need to make a voltage divider!  Generally speaking, you need two resistors, with the smaller one half the value of the larger one. Like 10k & 5k.  Of course none of my resistors worked this well, and even when I did find some that may ‘sort of match’, they value they split wasn’t 5v.

After MUCH combinations, I came up with this:  Big 2k (really 1970 on my meter).  Small was two in a series: 1k (really 970) and 670 (really 660) for a total of 1730:  1730 isn’t remotely half of 1970, not even close.  However when setup on my beadboard, it was splitting out to 5.6v, which was the closest I got all day.

Later I read that anything over 3v would trigger things fine, so I was probably making this way harder on myself than I should have.

Mockup on the breadboard, using my Macbook Air as the ‘inductive aluminum surface’ 😉

breadboard_web

Final shrink-wrapped setup.  Resistors hidden beneath the wrap.

voltage_divider_web

RADDS Board:

The signal line needs to run into the “Servo PWM3 pin” (aka Due digital 39, AKA E0_AXIS endstop[3]), which is located in a cluster of solder-points on the corner of the board:  I soldered in a header, so that I could plug my signal line into it.

radds_web

Connect the wires:

Signal from probe (since having it’s voltage lowered above) -> ‘Servo PMW3’ 5v pin on RADDS board (image above).

Positive & Negative probe leads -> PSU 12v +- terminals.

Update the Firmware:

G32 is the command that triggers the probing on the board.  But the probing can be setup two different ways:

  • Use a bed.g macro filled with M30 commands (and others).
  • Use config.g filled with M557 commands, no bed.g.

I like the idea of having a separate macro file to configure my probing:  If bed.g exists, when you execute a G32, the bed.g is parsed.  If there is no bed.g, G32 instead looks for pre-configured M557’s, that live in config.g.

Initial setup

Below, I discuss how I setup config.g and bed.g

config.g

When you first add the code for the probing in config.g, it’s important that you set the ‘Z offset’ in G31 to 0: You’ll later calibrate it and edit it with the final setting.  Here’s my probing section:

M558 P4 X0 Y0 Z1 ; M558 must come before G31.
G31 X49 Y52 Z.4 P500

To break it down:

  • M558 – Set Z Probe Type
    • P4 : Set the sensor type.  When using an inductive sensor plugged in to the PMW3 pin, you need to set this to 4.
    • X0 Y0 Z1 : Use the sensor for the Z axis only.
  • G31 – Set Current Probe
    • X49 Y52 : This is the distance in mm that the sensor is away from the nozzle (used my calipers to roughly figure this out).  Since my sensor is behind and to the right of my nozzle, these are both positive values, since 0,0 is in the front left of the bed.  You can leave these zero, but I’ve read that having them set makes the calibration more accurate.  However, it makes setting up bed.g more complicated (more on that below).
    • Z.4 : This is the difference in height between the sensor and the nozzle.  Set this to zero the first time you set it up, it will be calibrated later.
    • P500 : The ‘trigger value’ : Really only important if using an IR probe, but I read for switches just set this to 500.

bed.g

This is where you define the points to probe/sample.  I’m doing a 5-point probe, but you can use as few as 3.

The only really confusing part is if you’ve entered any probe offsets in config.g’s G31 (above):  They need to be accounted for below, since you’re telling the system where to send the probe.  If the probe has a 50x, 50y offset from the nozzle, and you tell the probe to go to 0,0, it’ll try to run the nozzle outside the bounds of your printer, and much stepper chattering / printer shaking will ensue until you kill the power.

To calculate the below values, this was my process:

  • Home the printer, G28.
  • In my software (Simply3D), manually jog the toolhead around to the 5 points I want to sample  When I get the probe to a sample spot, I note the current X,Y value (which is for the nozzle), and I add the offset values  to it.
  • Make sure the probe is always over the bed!  If you position the probe off-bed, when it goes to sample that point, it’ll drive the bed straight up into your nozzle :(

My bed.g:

M561 
G28
; Probe the bed and do 5-factor auto calibration
; These are the same toolhead points, but with the sensor offsets added. Note, to use these points, you must set config.g's G31 X49 Y52
G30 P0 X49 Y52 Z-99999 ; Four... - Front Left
G30 P1 X49 Y305 Z-99999 ; ...probe points... - Back Left
G30 P2 X299 Y305 Z-99999 ; ...for bed... - Back Right
G30 P3 X299 Y52 Z-99999 ; ...levelling - Front Right
G30 P4 X149 Y152 Z-99999 S5 ; 5th probe point + store the levelling - Center
G1 X0 Y0 ; Send X & Y back to zero before print starts. This is commented out during the initial calibration.

To break it down:

  • M561 – Set Identity Transform : Clear out any previous probing transformation done.
  • G28 –  Home : Must always home before probing.
  • G30 – Single Z Probe :
    • P# : Each sample point must be assigned an index, from 0-4.
    • X# Y# : the location on the bed to send the probe.  These include the offset set in config.g’s G31.
    • Z -99999 : A value less than -9999 tells the system to probe here.
    • S5 : The final probe has the S value entered, telling it to store all 5 points.
  • G1 X0 Y0 : Send the toolhead back to X0 Y0 before print starts.  Just something I like to do, since I purge the nozzle there.  Note, during the initial calibration stage this is commented out, which makes setting the probe to nozzle z-height easier (more below).

Calibrate the nozzle-to-probe height

As discussed above, I set my proximity sensor to be about 1mm above my nozzle height.  These sensors have a 4mm detection distance for highly inductive materials like iron, but for aluminum, it’s much closer, around 1mm it seems.

Once the config.g and bed.g have been updated, fire up the printer, heat up the nozzle and bed (if you can) and execute a G32:  This will both home, and then start the probing sequence (based on what you’ve defined in bed.g).  Be excited as you watch your printer automatically drive around probing for points!  It’s important the nozzle/bed is heated up, because thermal expansion.

When the probing is done (and everything is still hot), use this process to determine the nozzle-to-probe height difference:

  • You can either enter the below commands, or use some other control software (Simplify3D) to do it.
  • G1 Z0 ;  Send the bed\nozzle to the current Z0 position.  This should move the plate close to the nozzle, but not touch it: Should be 1mm or less away.
  • G92 Z10 ; This tricks the machine so it thinks the toolhead is actually 10mm above the bed.
  • Slip a piece of paper between the nozzle and build plate.
  • G91 ; Set Relative moves.
  • G1 Z-.1 ; Start raising the bed\lowering the nozzle by -.1mm values.
  • Track how many moves you make.  Keep raising the bed\lowering the nozzle until the paper just barely moves:  You should still be able to slip the paper under the nozzle.
  • Write that number down.  Mine was -.4mm.
  • Let your machine cool, power it down.

Update config.g and bed.g

Take the positive value of that number from above, and update your config.g’s G31 Z# with it:  This is now your calibrated offset!

G31 X49 Y52 Z.4 P500

In your bed.g, enable the last line to send the toolhead back to G1 X0 Y0 if you want.

The next time you run a G32 and then send the nozzle to Z0, it should be just touching the build plate, allowing you to slip a piece of paper under it with the same friction as above.  If not, something is amiss.

However, it’s possible this position still isn’t optimal for printing the first layer:  I did a test print with a hollow cube (no roof, no floor, 2 shells) just slightly smaller than my build volume.  The nozzle was still slightly too high for good first layer adhesion.  Rather than constantly updating your firmware value to try and tweak this, you can use your slicer software, covered below.

Update your print Profiles:

My slicer software is Simply3D, but I’m guessing other slicers (Slic3r, Cura, etc) work similarly.

Start Script

The start script is the gcode that is execute before a print starts.  The only change I had to make was switch out the line that did the home operation (G28) with the new G3d command, which calls to bed.g, which homes and probes.  This is what mine looks like:

G92 Z0 E0 ; Set current z position to zero.
G1 Z2 ; Lower Z to be safe 2mm.
G32 ; bed.g - home and probe bed - If not probing, this would be G28 instead to just home.
G1 E50 F600 ; Purge nozzle 50mm 10mm sec When a print ends it's retracted by 30mm.
G92 E0 ; zero extruder
G1 X0 Y10 ; Move nozzle to left front corner of build platform.
G92 X0 Y0 ; Zero X & Y here to start the build.

Refine the Z-height

As mentioned above, my first layer was a bit too high, and wasn’t quite sticking right.  Simplify3D has a section in its ‘G-Code’ menu called ‘Global G-Code Offsets’: These allow you to provide an additional global offset to all values in the gcode.  As it turns out, setting XYZ to 0,0,-.025 mm made for a great first layer.  Iterating with this value is far easier/faster than updating the firmware.

Thoughts for dialing this in:

  • With the Z value set to zero (the default), do a test print of a box with a solid bottom.
  • If the first layer doesn’t stick well enough, cancel the print, lower by -.02 and try again.  If you see the extrusion curling up and off the bed as it extrudes, it’s actually to close, and add .02 and try again.
  • Keep iterating on this process until you get a nice stuck first layer.

Final Thoughts

Now that it’s working, I’m so sad I did’t do this sooner.  Full-volume first layers are just ‘spot on’ now.  It’s almost magical to watch it work.  Get an aluminum plate and do this mod!

Resource List:


Jump to C-Bot blog index to see all the posts.

New 3D Print: Millennium Falcon

Decided to print (nearly) a whole roll of MakerGeeks Gray Matter Gray PLA on a cool Millennium Falcon model I found on Thingiverse.

Took 17h30m on my C-Bot, using a .6mm E3d-v6 Volcano nozzle, 450 micron, 60mm\sec @ 230 deg:

falcon

It’s pretty big.  Check out the timelapse here:  17 hours in 17 seconds:

Building the C-Bot 3d Printer : Part 35 : Updating the heated bed controller

Jump to C-Bot blog index to see all the posts.


A few weeks ago the relay controlling my heated bed had a meltdown, literally.  Magic smoke released.  It’d been running for a year, and I guess it was time.  Since I never wanted that to happen again, and I was tired of the “click click click” sounds it made I decided to go solid state.

After querying  the C-Bot Google Group for this issue, this board was suggested: (ebay link, $12.69):  It’s a HA210NO6 mosfet in a nice breakout board.  And it has the longest product name ever: “3D Printer Power Module for Higher Power Heated Bed upgrade RepRap RAMPS 1.4″.  I’m guessing that’s a direct translation from the Chinese…

mosfet_module

But I didn’t like the idea of all the exposed electronics, so I built a nice little enclosure for it in Autodesk Maya, which includes an active cooling fan in the back.  According to the specs (Ebay link) and the current I’m drawing the passive cooling via heatsink should be enough, but better safe than sorry.

This pic shows the three stage prototyping process I went though:

mosfet_enclosure

It includes a top-hole for a screwdriver to access the terminals inside, plus other top-holes giving your hex-wrench easy access to the bolts below.

Each box took about an hour to 3d print, using a .6mm E3d-v6 volcano nozzle on the C-Bot, 450 micron, 60mm/sec-ish.  The final two were in MakerGeeks HD Vivid Blue PLA (& dishwasher safe to boot!).

After an hour or so of splicing & soldering, the electronics were in place, and it was up and running without a hitch:

mosfet_in_action

You can download the enclosure from Thingiverse here.

Heats up in no time, and no more “click click click” like the relay used to.  A red LED shows it has power, and a nice soothing blue LED kicks on when the bed is heating.

When I find a bit more time I’ll look into configuring RepRap Firmware to use PID to control it, rather than the default bang/bang.


Jump to C-Bot blog index to see all the posts.