Building the C-Bot 3D printer: Part 20 : Electronics Day 3: Swapping stepper drivers

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


Update:  Since authoring this post I have switched my electronics to RADDS, and my firmware to Repetier.  See the “Part 31 post” for the latest on it.


Total time:  about 3.5 hours.

My Rumba board originally came with 6x A4988 Motor Stepper Drivers that have a 1/16 microstep resolution (I won’t pretend to know that that really means.  Sounds small).  Their ‘continuous current per phase’ is rated at 1A.  I’d had previous problems trying to drive both my Z-steppers off a single driver, so I switched to a driver per stepper.  In the meantime though, I ordered a five-pack of DRV8825‘s:  They have 1/32 microstepping resolution (ooohh…) and their ‘continuous current per phase’ is 1.5A (which I figured may be enough to drive two z-steppers, which is how Mason does it).

My thought was go back to the ‘single stepper driver controls two steppers’, but since I’ve already got my paired steppers and drivers working, I’ll just leave it that way for the time being.  I may only never need to change if I decide to go to dual-extrusion.

Removing the A4988’s and swapping in the DRV8825’s was seamless: I didn’t even need to flip any of the dip-switches living under each driver, on the Rumba:  In both instances, {on,on,on} was exactly what I needed set.  However, it’s VERY IMPORTANT you mount them the correct direction (see below pic):  The trimpot on the DRV8825 mounts 180 from the A4988:  Towards the ‘top’ of the board, rather than towards bottom.  I figured this out my checking the silkscreen on both the boards and (luckily) realizing the difference.  DRV8825:  Trimpot over capacitor.  A4988: Trimpot away from capacitor.

Like before, I needed to tune them.  Previously I tuned them by adjusting their resistance (rather than voltage) values while they were un-plugged from the Rumba.  Later I found these values to be off, and ended up manually tuning them via the trimpot while driving the steppers back and forth.  Second time is always better, and I grasp the whole process more fully:

This post from the RepRap Wiki spells it out pretty plainly:  To set the reference voltage,  you take 70% of the steppers current, and divide by two.  So the maths:

How to actually tune it?  They have a nice pic on the above link, but the steps I went though were:

  • Turn on the Rumba.  I then energized the stepper drivers by manually driving the x\y gantry from the LCD.
  • Once energized, I set my multimeter to volts, touched the positive probe to the trimpot, and the negative lead to the negative pin on the driver itself.
  • From there, I’d adjust the trimpot slightly until I got to around .58v on each.
  • drv8825 tuning

    Checking the DRV8825’s reference voltage: One probe on the trimpot, the other on negative.

When that was done I thought I’d try and print the calibration cube again:  Suddenly everything started printing 2x as small.

AH!  A4988 drivers have 1/16 microstep resolution, but the DRV8825’s have 1/32 : You need 2x the steps to go the same distance.  So it was back into Marlin’s Configuration.h file to retune the ‘DEFAULT_AXIS_STEPS_PER_UNIT’ variable.  By default I doubled everything to: {200, 200, 800, 300}, then individually started tuning them via the process I used before.  My final numbers:

#define DEFAULT_AXIS_STEPS_PER_UNIT {199.7403,  200.5415,  804.90995, 300}

Noooow, I can get back to final wiring and tuning my print settings…


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

Building the C-Bot 3D printer: Part 19 : First print!

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


May as well show the good stuff first:

Even though the electronics still look like a giant pile of spaghetti out the side of the bot, there wasn’t much left stopping me from actually printing something.  But, a few things still needed addressed:

  • My build-platform wasn’t remotely level, it was drooping way too much on the front.  With the help of my wife and son, I loosened up all the bolts holding the cantilevered 20×40 beams to the Z-stage, had my son slightly lift up on the end of it, and I re-tightened everything while my wife helped hold a wrench on the rear of the nuts where needed:  That got me able to level it with some z-endstop adjustments.
  • Based on where the hot-end homes, there’s a 2mm X & 25mm Y offset from the corner of the build platform (calculated my manually moving the toolhead on X&Y via the LCD to the corner of the build platform).  I couldn’t figure out where in Marlin to enter these values:  Obviously the head needs to move to this position from home and ‘start’ the print there, as 0,0,0.  I slice using Simplify 3D, and I finally found these offsets in the “G-Code” section of the Process window, under “Global G-Code Offsets”.

I also needed to configure Simplify 3D to actually recognize this machine:  Luckily version 3.0 came out just yesterday, and has a new machine ‘Configuration Assistant’ that made the process of ‘building’ my machine pretty easy.

From there, I imported a simple 1cm calibration cube, slapped some blue painters tape on my build platform, and fired it off.  It’ immediately started moving, but not extruding:  Come to find out, even though I had all my stepper wiring in the Rumba the same, I had to flip the harness on the Bowden extruder 180 to get it to extrude the direction.  With that resolved, take two worked flawlessly:  A few minutes later, a tiny 1cm cube appeared:

first print

1st print!

This was printed with a 1.0mm E3d-v6 Volcano nozzle, at 500micron layer height.  Beefy!  Surprisingly using my calipers, it was within .02mm tolerance on all axes:  Not bad for a first print!

Safe to say I’m pretty happy that it ‘just worked’ on the first try.  Now that I know it works I’m going to clean up all the wiring next, then get into the print calibration phase.


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

Trouble in paradise: The Replicator quit extruding…

I’ve been using my Makerbot Replicator (1) to print all the parts for my new C-Bot build.  However as of a few days ago, it suddenly quit extruding correctly.

I print almost entirely in PLA, usually from 200-210 degrees.  Suddenly, I couldn’t get anything to print unless I raised the temp to 230-245:  Pretty crazy for PLA.  And the surface quality was terrible.  Any lower in temp and I could hear the extruder stuttering, and it wouldn’t really extrude much at all.

Leading up to this I had been printing at 120mm\sec, at .3mm layer height:  Squeezing a lot of plastic out of the nozzle at that rate.  I noticed a bunch of melted filament around the top-rear of the heater block (you only noticed it when specifically looking for it, couldn’t see it from the front\sides):  The only way it could have got there would have been backpressure from the nozzle squeezing it out of an improper location up-stream.  My guess is that this somehow started the domino effect to cause whatever was screwing up my current extrusion.  It had completely encased the back of the heater cartridge and wrapped around the thermocouple wires.  I had to heat the whole block up and carefully pick it away without damaging any of the wires.

Thanks to tips from this forum I got it resolved:  One suggestion was that the kapton tape that insulates the thermocouple had worn through, and by grounding to the heater-block it was giving inaccurate temperature readings.  This seemed like a prime culprit since I had to crank my temp settings so much higher.

I’m not sure specifically which steps fixed it, but this is what I did:

  • Did a complete teardown on the hotend, to the last bolt.  Removed old kapton, cleaned up head, wrapped in new kapton.
  • Removed heater cartridge and thermocouple : Didn’t noticed any wear-through on the thermocouple kapton, but added more just in case.
  • Did however noticed where the wire leaves the thermocouple and bends up around the heater block : one of the bends looked a bit frayed, and was mighty close to the heater block itself:  Added extra insulatory kapton at that junction.
  • Added a new nozzle, just to weed that out.
  • Re-bed level, etc.
Extrusion was immediately was back to normal after that, thankfully.  I was beginning to think the Replicator was getting jealous of the C-Bot build…. 😉
Some words of wisdom from Ryan Carlyle on the above thread:
General rule of thumb is that PLA does not print reliably over 10 mm^3/sec with a typical Replicator type hardware setup. At 0.3mm layer height, 0.4mm extrusion width, and 120mm/s, you’re doing 14.4 mm^3/sec. That’s reasonable for ABS (which melts faster) but not for PLA. Raising the temp may cover the symptoms for a while but it can also lead to charred filament and worse clogging issues later on.

Building the C-Bot 3D printer: Part 18 : Software Day 3 : Tuning movement settings

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


Update:  Since authoring this post I have switched my electronics to RADDS, and my firmware to Repetier.  See the “Part 31 post” for the latest on it.


Now that my z-stage is moving down and up, and I can ‘auto home’ my printer through the LCD, it was time to get the movement settings and max travel extents calibrated.

Total time:  About two.5 hours.

Tuning Movement Settings:

You need to make sure that when the g-code tells your printer to go 100 mm’s, it really goes 100mm.  Not 90mm.  Not 100.1mm: 100 mm.  On bots like my Makerbot Replicator (1) this is already done for you.  But when building your own machine from scratch, you need to figure all this out.  Otherwise you get ovals where you should get circles, and rectangles where you should get squares.

First I had to get some info for my hardware:

  • Stepper :
  • Stepper Driver:
  • XY Pulleys:
    • GT2
    • Teeth : 16
  • Belts:
    • GT2
    • Pitch : 2mm (distance between each tooth)
  • Lead Screw :
    • 8mm ACME
    • Pitch : Listed at 2 (distance in mm between each peak), but this value was incorrect for the below calculator.  Info below.  The value needed in this instance was 8 (the distance in mm traveled with one revolution).

Armed with those numbers, I accessed the “RepRap Calculator” to get me the base values for my bot.  I wanted to see if they’d match values Mason had already pre-plugged into Marlin (that mine should very closely match), but I wanted to understand how this system worked:  In Marlin’s Configuration.h, I found the line with ‘DEFAULT_AXIS_STEPS_PER_UNIT’ with an array of four values plugged into it {x, y, z, extruder}.  Based on the calculator, my ‘belt steps per mm’ came out to 100, which was around what Mason had given me.  However, the ‘leadscrew steps per mm’ were 4x (1600) what was listed in the firmware (400).  After a bit of research, I realized the calculator wanted to know the distance the lead screw travels in one revolution, not the tooth-to-tooth pitch (2mm).  Armed with my calipers, I figured out one revolution traveled 8mm, and plugging that into the calculator gave me a value of 400.  Success!

Now for the tuning:  I found this great guide (on the Marlin Configuration page) by Neil Underwood that goes through the manual process of telling your bot (in my case, via the LCD) to go 100mm, and then measure with calipers to see how far it really went.  Do maths, enter new values into firmware, re-measure, over and over.  Not hard, just a bit time consuming:

My final values:

#define DEFAULT_AXIS_STEPS_PER_UNIT {100.2166,  100.20469,  401.770921, 145.5687675196672}

Gotchas:

I just hit one major problems:  Very often the Rumba would reject the upload from the Arduino IDE.  At a certain point, it took me half an hour to get three uploads.  It turned this already slow process into an incredibly slow and frustrating process.

I’ve been programming Arduino’s for years and never encountered anything like this (but never on a 2560 like the Rumba uses):  Sketch would compile, but when it would go to upload it would timeout, saying this:

avrdude: stk500v2_ReceiveMessage(): timeout

Searching the internets, I found many other people with complaints (not Rumba specific, Arduino Mega specific), but no solutions.  Finally, I read one post (which I’ve lost the link to) that had this issue.  The fix?  Simply swapping USB ports on your PC between uploads.  Suddenly I was back in business.

Setting the max travel extents

For each axis, there is an endstop telling the printer to ‘stop moving’ when it hits it.  Most printers (like mine) only have one endstop per axis, although you could setup two per axis (min & max) and probably skip this step.  If the endstop stops the toolhead\build platform going in one direction, what stops it going in the other?  The firmware.

In Marlin’s Configuration.h, there’s a section called “Travel limits after homing”, where you can setup these constraints for X, Y, and Z_MAX_POS.  To start, I edited these values to be something much larger than my current volume, since I was going to dial this in manually on my own and didn’t want a small value to stop me before the true extent was reached.

After re-uploading the firmware with the ‘big’ values, via the LCD I manually drove each X, Y & Z axis to what I considered was the ‘safest max position’: Just before a X/Y gantry would hit something on the opposite side with maybe 10mm to spare, or about 50mm above the lead screw flexible couplings so as to not cause any binding.  I copied those numbers down from the LCD and plugged it back into the firmware.  My final values are:

// Travel limits after homing (units are in mm)
#define X_MIN_POS 0
#define Y_MIN_POS 0
#define Z_MIN_POS 0
#define X_MAX_POS 320
#define Y_MAX_POS 315
#define Z_MAX_POS 530

So my X & Y are clearly over a foot (304.8 mm), so I have no problem filling my whole 12×12″ bed.  But the Z is just under 21″, 3+” short of the 24″ build height I was after.  This is due to a few reasons:  I have maybe an inch before the z-gantry hits the flexible couplings on the leadscrews, and my E3D volcano easily sticks down over 2″ from the X/Y-gantry : If I did a bit of redesign on the extruder mount I could probably move it ‘up’ more and get 2+” back, and I’d be closer to my 24″ height goal.  But 21″ isn’t too shabby to start… 😛

Other Notes:

In my previous post I showed how my Y-endstop was at the rear of the bot:  This actually blocked the gantry from moving all the way back, and since the extruder is mounted on the front of it, I couldn’t get all the way to the rear of the build platform:  I moved it to the front corner instead, and got that clearance back.  Now my  endstops are all Xneg,Yneg,Zneg, when before they were Xneg,Ypos,Zneg.  In the firmware, the settings are thus:

// ENDSTOP SETTINGS:
// Sets direction of endstops when homing; 1=MAX, -1=MIN
// :[-1,1]
#define X_HOME_DIR -1
#define Y_HOME_DIR -1
#define Z_HOME_DIR -1

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

Building the C-Bot 3D printer: Part 17 : Electronic & Software day 2

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


Update:  Since authoring this post I have switched my electronics to RADDS, and my firmware to Repetier.  See the “Part 31 post” for the latest on it.


After posting my z-stage problems to the C-bot forum, they suggested I try a couple things:  Loosen up the bolts on the ACME lead-screw blocks, and switch to using dual motor drivers, rather than one, like I’m currently doing.

I loosened things up, and it helped a negligible amount, but I was still unable to predictably raise the build platform.  So, I decided to dig into Marlin and enable dual-z-steppers.

Which I did, and then added an additional A4988 driver to the Rumba board to make use of it:

motor drivers

A4988 Drivers, with dual-z support.

I added the additional A4988 to the “Extruder 2” plug (on the far right), plugged the right z-stepper into it, and gave it a go:  The steppers would only lower, not raise.  NOW what?

Looking at the Marlin code, I noticed that the block I enabled (starting with ‘#define Z_DUAL_STEPPER_DRIVERS’) to support this looked different from the same block in the “Marlin Configurator“:  It appeared that it was also enabling “dual z endstops”, which I didn’t want to happen.  Rearranging the code resolved this, and now I have a bed that both lowers, AND raises.  Finally.  I was going to post this code-fix, but I diff’d the Configuration_adv.h file Mason had given me with the one I pulled down from GitHub, and that code section was radically different.  I’m not sure which is newer\older.  At least mine works now…


Now that I have the z-stage working, I decided to focus on the endstops:  I had mocked them up earlier, but didn’t have them wired properly… at ALL.  I spaced out and thought I only needed two wires (+-), but in reality you should also hook up signal, so the LEDs light up.  More splicing and crimping ensued, and I got the Geeetech v1.2 endstops wired up correctly, based on this great pic Mason pointed me to…

endstop diagram

… living in this thread, that explains it pretty plainly.  Thus the end results:

endstop wiring

From there, it’s getting them plugged into the Rumba correctly:

endstop connections

Note: Since I took this pic, I’ve changed my Y endstop so it is now Y-

 

Here’s the logic behind it:

  • Looking down on the build platform, zero XYZ is in the bottom left corner. +X is to the right, +Y is towards the back, and +Z is up.
  • The X-endstop is on the left side of the Y-gantry, that the extruder blocks hits when traveling left:  It is in the “negative” position, thus X-.
  • The Y-endstop is mounted on the top-left-rear corner of the printer, and the Y-gantry hits it when it moves back in a ‘positive’ direction.  So it’s Y+.
    • Note: Since I authored this page I’ve moved my Y endstop to the top-left-front corner, so it’s really Y- now.
  • The Z-endstop is mounted towards the top of the left rear leg of the printer, that the Z-stage hits when it lifts up.  Since when the build platform drops it’s going in a ‘positive’ direction (or, instead, imagine the build platform on the bottom of the printer, and the nozzle lifting up instead, which is effectively the same thing), it means it starts at the negative position, thus -Z.
endstop locations

Note: Since I took this pic, I’ve changed my Y endstop so it is now Y-, or on the front-left of the bot, rather than rear-left as in this pic.

 

Once the endstops were wired up, I was able to ‘auto home’ the whole system from the LCD, and… it worked.

Finally, no more blockers… next up will be calibrating the XYZ travel distances.


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