DrMistry - Welcome!

Welcome to DrMistry.co.uk! This is where the good Doctor gives details of the kinds of insanity he uses to fill his time on Earth.

Learn more about DrMistry»

Dual extrusion on a Prusa i3 Clone

Mike Bergenstjerna, posted 9/9/2017 1:19 AM

Posted under : 3D Printing

Well, this is someting I've been working on for a while - adding a second extruder to my i3 clone.  It's been a long and frustrating journey, made all the more complex by the spare ADC channel on my Trigorilla board going south and not being able to get a like-for-like replacement, but I've finally made it.  I thought it might be useful for people to know how I went about this madness.

To mount a second hotend, you need to have an x-carriage which can take it along with any bed sensor arrangement you may have, and of course a part cooling fan and any other fans for the hotends.  I've using E3D v6 clones, with 0.2mm nozzles, and they basically have chanber cooling fans strapped to them, which for me made things easier.  I'd already printed a custom X bracket for my single E3D configuration, so I started out by adapting that in TinkerCAD:

An image

This bolts on to the two pillow-block bearings which run on the X rails.  The E3D hotend is gripped in a 2-section block, which in turn is boled to the carriage through the vertial slots, allowing both hotends to be adjusted for height (this takes time and patience, but only needs doing once during the assembly and claibration phase).  I really like the design of the E3D hotends - they're nicely engineered, and once you get used to their operation I've found them very reliable and clog-free.  Here's a new, unused hotend in a test printed holding block:

An image

The blocks are a nice, snug fit and are tall enough to keep the entire assembly rigid in all 3 axis.  The last thing you want is for once of the hotends to start wiggling about mid-print...trust me!

Once all is assembled (8 M4 stubby hex head screws to attach to the pillow blocks, and 4x M4 long bolts with washers and nuts for the hotend mounts), I aligned the 2 hotends for height using an aluminium block and a little gentle persuasion with a small wooden block and a light rubber mallet - I realise now I should have at least lubricated the vertical slots (on the rear of the carriage, the slot is wider such that the nuts for the bolts can move un and down), if not modify the design to allow room for some PTFE tape to allow more smooth adjustment.  If I had to do it all again, I'd add adjustment screws to allow VERY fine adjustment, but with care and patience I was able to get the heights right.  

An image

Once that was done, I calibrated the Z probe offset.  Next, I simply measured the offset between Extruder 0 (which by definition is at X0:Y0) on the design, which was 35mm, and entered that in to my configuration.h and printed a calibration model - a nice 2-colour traffic cone.  The test print had a load of problems - over-extrusion from 0 and under-extrusion from 1, an error in the X offset I'd measured and a tiny misalignment in the Y axis.  Over about 20 tests, I got the errors nailed and am now in the process of printing my second "proof" traffic cone.  Printing a one-off is easy, but getting settings to hook up over multiple prints is what we really need.

The two big challenges were the extruder settings and the offset alignment.  For the bowden setup I have, I need to keep the retraction short during tool changes, because the heatsinks on the E3Ds are so efficient, the end of the filament cools and forms a "bulb" which won't go in to the heat brick area and screws the print.  That requirement has to be balanced with retracting far enough that there's no ooze while a given head is not in use.  It took a far amount of experimentation, and I had to reduce the retraction speed to avoid grinding the filament (that's another point - work out where you're going to deploy the second reel of filament!) and again screwing the print.  Battered filament is a really easy way to cause dirty great gaps in extrusion later in the print, or to bring extrusion grinding to a halt all together (haha, that's so bad I can't really justify not writing it better).

The X/Y offset really can only be tweaked with test prints.  Simplify3D makes it really easy to print dual extruder models, so I just had a hunt around on Thingiverse for dual extrusion calibration models and chose a couple I liked the look of.  This was a real drag, but I found a handy-dandy image to help which saved my a lot of time and frustration.

Now at this point, I should really point out that I replaced the mainboard last weekend with a GEEETech GT2560, which supports both dual Z drivers and 2 extruders, with 3 fans amd 4 thermisor inputs.  I went for the stock Marlin version (1.1.5 at the time of writing), and spent about 2 days getting everything set up just the way I wanted it with a single extruder - this was the configuration I used to actually print the carriage and associated parts.

Anyway, a couple of other points I'd like to point out:  Firstly, I re-insulated the heat bricks on both hotends.  This may sound like a small issue, but I really wanted to try at least to mitigate the additional power requirements by making sure I wasn't just leaking heat in to the room.  The hotends are a little faster to heat and much slower to cool so I guess it's made a little difference at least.  Secondly, and I can't emphasise this enough, if you're going to try this, then you MUST make sure that the nozzles are at EXACTLY the same height.  If they're not, you'll have 2 problems:  Firstly, dual extrusion prints will be bad, and secondly you WILL get head-drag on both dual and single extrusion prints.  So take your time, check it often, and don't put off correcting it if the levels drift over time.

Now I've attached the STL for the x-carriage I'm using, but DON'T expect it to work on your rig.  Not many i3 clones use pillow barings, and this is absolutely 100% designed with pillow barings in mind.

So , was it worth all the effort?  It think is was, and I'm glad I've done it because I got to do a lot of things which otherwise I wouldn't - replacing the board, configuring Marlin from scratch - and I can always print single extrusion models whenever I want.  But being able to add different materials to a print is a pretty big deal, and makes for much more interesting and useful models.  The next step is to get some flexible filament, and see if I can print gaskets in place!

An image


Time off for good behavior!

Mike Bergenstjerna, posted 7/15/2017 10:28 PM

Posted under : Personal Development CNC Router build

Well, I've managed to get out of the lab/workshop/code dungeon and am enjoying a couple of weeka with my extended Swedish family! Right now it's 2312hrs and still light enough to stagger home from a bar after some great food and drink. Fortunately we didn't have to fo out for food and drink, and I've been enjoying a strip-and-rebuild of a Honda lawnmower engine, digging an 80 meter slit trench for some cat6 cable and plenty of talk about fabrication techniques and woodworking machines, so as you may guess there's nothing to report on the CNC build. What I do know is that one of the first tasks the CNC will have to complete is a walnut dash for a classic Triumph, which is nice...

Another CNC change!

Mike Bergenstjerna, posted 7/1/2017 4:30 PM

Posted under : 3D Printing CNC Router build

Yet another change to the design of what I'm now calling CNCBot - the Y carriages and X axis gantries are now single pieces.  This means fewer parts to manage and print, which is a good thing.  I'd already assembled the parts I'd designed and printed so far, and put them in place on the work table:

An image

There's a lot of other fun stuff in the image but we'll ignore those for the moment and concentrate on the CNCBot.  The carriages move in sync (having retuned the stepper drivers) and are nice and smooth, and can take an amazing weight before any bend in the running rails - I recon somewhere around 20 kilos, which suits my purpose very nicely.  The motors are well mounted, the belts nice and tights, and everything squared up pretty easily (more on that later).

Right now, the updated carriage/gantry parts are printing, in what seems to be becoming the standard pea soup green:

An image

It's a reliable and robust filament - PrimaValue PLA, which is my current weapon of choice.  I have the same colour in ABS too, but haven't used it yet.  My wife and I had a design chat this morning, and I'm going to be designing and printing "shoes" for the corner posts, which will allow them to be screwed in to the work surface, and the bed will be drilled strategically to hold that in place too.  The forces on the bed will be all in the horizontal plane, with no up/down force.  The actual machine however will be undergoing all manner of stresses and strains while it's running, so I need to work out a way that I can anchor it without literally gluing the sucker to the table.  I suspect I'll be using a loop clip/brace which will clip over the lower threaded rods on the Y axis and allow the bed to be screwed down, rather like the ones I made for the 3d printer:

An image

Really simple, easy to make and make and make again, and I know they'll do the job.  3 on each bar should be more than enough and won't require any major revisions or reprints to the corner posts, which take a looooooong time to print (~2.5 days).

I've also just ordered the last bits of hardware:  A set of new collets for the Dremel, some plunge router bits for the same, and of course more smooth bar and timing belt.  They should be here for next weekend which incidently marks the start of a 2-week holiday to Sweden which I'm really, really looking forward to, so I'm hoping to have the thing fully assembled and running for the end of July.  The first cuts will be to drill clamping holes in the workbed, which will be used with some simple cam clamps.  Again there will be little or no up/down force indicent on the workpiece or bed except during plunges, and that force will be downwards, so this will do quite nicely.  As soon as I've finalised these designs, printed the lot and done some test cuts, I'll be zipping up all the 3d parts and making them available for download.

Well, pip pip!


On to version 2...

Mike Bergenstjerna, posted 6/22/2017 7:59 PM

Posted under : 3D Printing CNC Router build

As is so often the way, a small mishap has resulted in a new design.  My makeshift filament holder failed (well, it fell over not to put too fine a point on it) during the print for the corner posts.  They were still usable as test units - they were structurally complete - so I went ahead and put the threaded and smooth rods in place, mounted the carriages, put the motors on and belted them up to the carriages.  At this point, I realised I'd made quite a basic error - the motors and the idlers were mounted inside the bed area, meaning not only that the bed would be smaller than desired but also that the travel distance for the carriages was tiny - only just 220mm.  That's lousy.  So, I set to work on a second design:An image

This is a far better design.  The rails have better spacing to reduce rocking, the motors and idlers are tucked well out of the way, and the posts have a smaller build volume.  I've also redesigned the carriages so that the load on them is perpendicular to the barings, meaning less torsion on the running rails.  As I type, these new carriages are printing!

An image

I had tried to put a 0.4mm print nozzle on the printer to speed up the print, but couldn't seem to get the settings dialed in right so went back to 0.2mm and the print is lovely, considering it's running more or less as fast as I'm happy to print structural parts.  This is a 36 hour print and I'm better than half way through.  So this print will be done by the time I get home tomorrow, when I'll start in on the corner posts.

As far as the software goes, I managed to calibrate the motors in GRBL and I'm happy to report that I have similar levels of accuracy as on the printer, although I will think about upgrading from 1/16th step drivers to 1/32.  The only thing which was a little unexpected was the low travel velocity, but considering the load that the motors will have to handle I'd rather go slow and keep accuracy than go fast and get sloppy, which is another commonality with my approach to 3D printing.

All in all, although it's been a kind of frustrating week it's also been kind of fruitful, at least as a proof of concept and a first design iteration.  I know I have to deal with where I'm going to put an endstop switch, but I can cobble that for the moment and just reprint the single part where it will end up.  Right now I'm thinking that it should ultimately go on the gantry.  I've also got no further with thinking about the Z mount, but I'll sit down over the weekend and work something out.  In these kinds of situations, I find that getting started is the key - once you have even a basic design you can begin to analyise and optimise your way to a good solution.

Well that's all I have on this for today, but tomorrow I hope I'll be able to upload some images of the carriages with barings mounted.

CNC build update 1

Mike Bergenstjerna, posted 6/18/2017 7:54 PM

Posted under : 3D Printing CNC Router build

Right!  Progress! I've reached a couple of important milestones, and so now is the time to really start documenting the build.

Firstly, why bother in the first place?  I have a good, well-tuned 3d printer which I use a LOT to make models, parts for various other projects like Raspberry Pi cases and Arduino housings, and even a filter wheel for astrophotography.  But if I want to make more structural parts - say a VESA monitor mount, or a shelf bracket - then FDM isn't really what you want to be using, even with exotic materials.  Just in terms of fabrication time, FDM is really a bit of a non-starter.  Ideally you'd cut the shape you want out of a pre-existing material which has the mechanical properties you need, and really, 3D printers in my price range just can't beat subtractive fabrication.

There're other useful things a CNC mill can be used for, like etching circuit boards and drilling them accurately, or just plain old engraving something you already have.  I don't have the skill or temperament to hand-etch to be honest, and I also know that when we move from the UK to Sweden I'll be setting up a permanent fab shop which will contain LOTS of machines, many of which I'll build myself.  Aside from a table saw and a drill press, a CNC router/cutter would be amazingly useful for making all manner of stuff that we'll need to build or renovate the house we want.

So what exactly am I building in mechanical terms?  Well, I need to be able to shift a cutting spindle around in all three axis, but the Z axis will have much less travel than X and Y (which are both arbitary and really, the XY plane bed can be as big as you can make a rigid motion system).  Rather than just replicate the motion of a 3D printer, where it's usually the bed that moves in the Y axis (or sometimes in Z), I'd rather be moving something which I know the mass of - throwing a block of oak or aluminium around would really put a stress on the system and increase torque and stability requirements.  So the bed of the machine will be static, meaning I have to drive the spindle in all 3 axis.  I've settled on using 2 steppers on the Y axis to move carriages along both Y edges of the bed, on to which will be a gantry which forms the X drive and carries the cutting head and Z motion components.  So I've done a lot of fiddling in TinkerCAD, and knocked together 2 Y carriages to which I can attach both driven belts and the gantry parts which I'm still designing:

An image

The 2 cylinders will contain some good barings - you can just see inside the right-hand carriage that there's a baring inserted already - I need to add a shorter baring so the entire length of the carriage is supported.  The longer the baring length, the more stable the gantry will end up being.  These suckers are exactly 70mm long - I think they'll be OK, but the beauty of it all is that I can just extend the baring housing out as far as I need to and reprint. At the same time I was designing the carriages, I was also designing the rails on which they will run and how they're anchored.  I'll be using 4 corner blocks in to which the smooth rod will be inserted, and for rigidity the corners will also take 2 threaded rods on both the X and Y axis.

I've got the Y and X steppers hooked up and working with the Arduino UNO, running GRBL 1.1 and using what seems to be the standard GRBL shield (this exact one here).  The rig responds to commands sent by the Universal GCode Sender exactly as I would expect.  So that's milestone number one.  Here're the rig components sitting on my workbench!

An image

So here you can see the shield atop the (genune) arduino UNO, with the 2 Y axis motors facing away from eachother and the X stepper with shaft forward.  The threaded stepper will be used to control the Z axis height.  I've configured the shield for 1/16th steps, and the motors perform well under load, which is going to be important.

I've also taken delivery of some key parts - the threaded and smooth M8 rods which will form the bed frame and Y axis runners, some timing belt and idlers, and a bucket load of M3, M4 and M6 nuts and bolts (with washers of course).  I've cut the threaded rod to 500mm lengths and chamfered off the cut, but I made a slight error in ordering left-handed thread rod, would you believe.  So I've had to order some left hand thread M8 nuts, which should be here in a couple of days.  Once I have those I'll have all the parts I need to complete the bed frame and runners, and to test the motors in place with the Y carriages mouned on the rails.

Of course before that can happen I need to complete the printing of the corner posts, and happily the LONG print job (54 hours) is almost complete:

An image

This is the third attempt at the print - I had filament feed issues and a temporary nozzle clog on the previous 2 runs but have dailed the problems out.  Note that I'm running this print pretty quick and not in the highest quality my printer can manage - they're prototype units anyway, but once I've ironed out any issues, I'll print them at a higher quality and make the .STL files for each part available here.  In any event, they should be finished around 10 o'clock tonight, just as I'm going to bed ready for work in the morning...but at least they'll be ready for checking over when I get back home.

When I do get back home, I intend to fit all the smooth rod and at least put the threaded rod and motors in place, and see how things fit together when adjusted for my bed size.  I won't be able to test the Y axis until I get those pesky left-handed nuts.

I've also come to the point where I need to start thinking about what spindle I'm going to use for this unit.  Considering the size of the work platform, I really can't see much value in going all-out and getting a crazy high torque spindle, so I'm going to use a run-of-the-mill Dremel rotary tool, for which I already have some cutting and engraving bits - so that will at least allow me to test the fundamentals of the design. I have some VERY thin aluminium sheet and plenty of scrap wood to use for test runs, and of course there's always the option of making a pen mount to use a Sharpie or similar to at least test the XY motion.  Can't plunge a pen in to working material, obviously.

I have 2 weeks in Sweden coming up soon, so a little build and tinker time will be lost (oh poor me), but I'm hoping to have a working unit by the end of July - that gives me 3 weeks, discounting the time in Sweden.  I'll update as often as I have something useful to add, and I'll also be adding an HTML5 video player to the site so I can record video when the time comes.

Installing Xephem on the Raspberry Pi

Mike Bergenstjerna, posted 6/15/2017 10:00 AM

Posted under : Physical Computing

(NOTE This is an old post migrated from the previous incarnation of the site.  Some instructions may be out of date, and the process may no longer work)

I've had a request or two asking for details of how to get Xephem running on a Pi, so I decided that since I was rebuilding my astroPi I would document what I do to get it going on.  It's actually pretty easy compared to some installs, so here we go, let's get started!


Go to a shell, and get all the packages you'll need to build xephem.  These aren't the xephem packages themselves, we need to install these dependancies in order to get xephem to build and run, so let's go apt-get them from a terminal:

sudo apt-get install lesstif2-dev libx11-dev libxmu-dev libxp-dev libxt-dev x11proto-print-dev


That'll take about 10 minutes to chug through, so go make a coffee or whatever and when it's done you can download a tarball of the xephem source code, again from a terminal:




That won't take long at all if you have a good internet connection.  Now we need to unpack the source code, and make a slight modification to the Makefile (which tells the Pi what it's got to do to build the program).  To extract the files, enter


tar -zxvf xephem-3.7.6.tar.gz


in to your terminal.  This will create a directory, called xephem-3.7.6 in which we'll find the entire source code for Xephem.  From here on, I'll pass you over to someone else, who's provided great instructions on how to actually build the program.  These instructions are at  http://www.tc.umn.edu/~brams006/xephem_ubuntu.html so go and build as described - warnings are OK, errors not so much ;)


That should be your lot!  I'll shortly be writing up getting the INDI drivers working with an LX200 Classic (since that's the scope I've got) and maybe drivers for my LPI and DSI cameras, we will see.  Let me know how you get on!


** Breaking news! **

You may well need to install some (usually standard) fonts to get things going smoothly.  You can get them in package form using 

sudo apt-get install xfonts-base xfonts-75dpi xfonts-100dpi

You'll need to reboot for the fonts to register properly.

CNC Router - early stages

Mike Bergenstjerna, posted 6/14/2017 12:19 AM

Posted under : 3D Printing CNC Router build

Having got right in to my 3D printer and upgraded and generally fiddled with it, my mind naturally turned to other computer-aided manufacturing machinery.  For years I've wanted to be able to fabricate whatever I want, and while the 3D printer is great for parts, it's not so great at cutting things, making panels or other structural parts.  For that I really want a CNC router - it will be able to cut out arbitary 2D shapes in wood, softer metals and other sheet materials.  

A little research and thought has led me to an idea to make a machine based around an Arduino shield which controls 4 stepper drivers, has pinouts for endstops and rotor control, and can process GCode to stepper movements.  I bagged a handful of 12v NEMA 17 steppers, the arduino shield and some other sundries (barings, wire, lube, DuPont crimp connectors and so on) and started thinking about how I could make a working, robust CNC router table using easily found materials and as many printed parts as possible.

Lookiong around the web, I found that a good number of home builders have been here before.  But ever one to be all too happy to reinvent the wheel, I decided to go from scratch.  I'm planning on using lengths of M8 threaded rod as the main structural component, and make a dual-Y axis system on which the X and Z drives and carriage are mounted.  After spending a good few hours thinking and playing with TinkerCAD, I came up with what I think is a workable design:  2 steppers, mounted one on the left and one on the right of the table bed, driving belts which will pull 2 sleds along M8 runners on standard barings (LM8UUs if you're interested, at least for this first iteration).  Between these 2 sleds will be the X axis, again using 2 lengths of M8 threaded rod to belt-drive the Z axis.  The Z axis carriage will contain a 400 watt motor, at least to start with - Im fully aware that I'll need to replace this, most likely with an off-the-shelf router stripped down - driven on a threaded rod driven by a stepper.  I'm not 100% clear on how much travel I'll need in the Z axis - I know I'll want to be cutting at least 12mm wood sheet, but would like to have the option to work much thicker material, maybe as much as 40mm.  More travel means more weight on the X axis though, so I think more research is needed.

At this stage, I'm waiting for the Y sleds to finish printing (28 hour print, with a 0.1 nozzle and 0.08mm layer height, 40% infill).  This print is my second - the first failed due to tangled filament, and I also noticed that the way I was going to connect the belt to the sleds wasn't really good enough, so I modded the models before restarting.  Rather than having lugs on the sleds, I'm now using a printed plate, 5mm thick, which will be screwed in to the sled and has stronger lugs.

Once those are printed, I will move on to the bed frame corners, and drive/idler sections.  Then it'll be time to out the bed and Y axis together and do some tests!