Keep it simple

My Z-Probe prototype used a standard sized servo. Of course, this kind of servo seems a little bit oversized for this use. Thus, I looked around for smaller alternatives.

I found some nice micro servos on ebay:


These servos not only are tiny, they are also cheap. I bought 3 of them for 4 Euros a piece.

I started to redesign the printed parts of the z-probe prototype. But compared to these micro servos, the mechanical construction was huge. Too huge!

After thinking about this for a while, I found a solution: Keep it simple!

Here’s what I came up with:

It’s basically just the servo with an opto endstop pcb glued to it…

Its smaller, it’s simpler, it’s adjustable and it works great.

Here’s a how to build the probe:

I also simplified the z-probe firmware, based on the latest G3Firmware. Since the firmware now natively supports servos (for the Unicorn pen plotter), I was able to reduce the code patches to just a few lines for the z-probe commands.

Unfortunately I wasn’t able to update my forked firmware repository on GITHub. I’m (still) really uncomfortable with using git! Each time, it’s a pain in the ass to merge new revisions from the remote repository with my forked repositories (locally and/or on GITHub). I’m pretty sure, that this is supposed to be easy, but there always are problems, errors or conflicts. And I’m still looking for a good tutorial for these hacker tasks…

Anyway, until I’m in the mood to check out git again, here are the few code changes necessary to support the z-probe in the newest firmware revision:

105 105 #define SLAVE_CMD_GET_SP			32
106 106 #define SLAVE_CMD_GET_PLATFORM_SP		33
107 107
    108+#define SLAVE_CMD_ENGAGE_Z_PROBE		128
108 110 #endif // SHARED_COMMANDS_H_
18 18 #ifndef HOST_HH_
19 19 #define HOST_HH_
20 20
   21+// ZProbe settings
   22+// 750ms
   23+#define ZPROBE_TIMEOUTINTERVAL ((micros_t)750000L)
   25+// Angles in Degree
   26+#define Z_PROBE_ENGAGE_ANGLE  0
   27+#define Z_PROBE_DISENGAGE_ANGLE 50
21 29 void runHostSlice();
149 149 			to_host.append8(RC_OK);
150 150 			return true;
    151+		case SLAVE_CMD_ENGAGE_Z_PROBE:
    152+			{
    153+				uint8_t angle = ((bool)from_host.read8(2))?Z_PROBE_ENGAGE_ANGLE:Z_PROBE_DISENGAGE_ANGLE;
    154+				board.setServo(1,angle);
    155+				micros_t endDelay = board.getCurrentMicros()+ZPROBE_TIMEOUTINTERVAL;
    156+				while(board.getCurrentMicros()<endDelay); // Wait for Servo
    157+				board.setServo(1,-1); // Switch Servo off
    158+			}
    159+			to_host.append8(RC_OK);
    160+			return true;
151 161 		case SLAVE_CMD_GET_SP:
152 162 			to_host.append8(RC_OK);
153 163 			to_host.append16(board.getExtruderHeater().get_set_temperature());

The ReplicatorG patch can be also simplified (no more EEPROM preferences for the Z-Probe). But I didn’t find time for this yet. For the time beeing, you can simply use the patched version from here.

Well, I still have 2 servos left…

I wonder what I can do with one of these and a slightly modified version of this thing, directly glued to the servo arm. I’m pretty sure it’ll work just as fine as that thing, only with 16 parts less…

Keep it simple!

Finding home

In view of my upcoming 3D printing talk at the Macoun Developer Conference in Frankfurt/Main in a few weeks, I thought that my Makerbot could use a little bit refurbishment.

Since a while it rattles a lot during printing, so at least I wanted to remove the X/Y stages from the bot, in order to clean the rods and to tighten all bolts.

I also wanted to find a better solution for the heated build platform’s cables. Until now, they somehow dangled in the back of the Makerbot on their way up to the extruder controller board.

After removing the X/Y stage from the bot, I saw another problem which needed to be solved:

Not only the acrylic build surface looks like reaching its end of life (it’s still the very first one, which came with the Makerbot kit more than a year ago), the main problem is that the whole platform has far too much play. Although my heated build platform is rather heavy (6mm aluminum + 3 big power resistors), I remember that this was also a problem with the original, unheated, wooden build platform.

I decided to bolt the aluminum plate directly to the Y stage with one central screw:

IMG_0813.JPG IMG_0814.JPG

In order to be able to easily remove the print stage, I got rid of the acrylic build platform (bolt to the aluminum plate before). Instead I tried three different “interface” sheets.

The first try was a aluminum cover for the build platform. I folded the cover out of .5mm aluminum sheet with Kapton tape as surface:

IMG_0817.jpg IMG_0821.jpg

To cut a long story short: It didn’t work. The cover wasn’t easy to install and remove from the build platform and it was impossible to get a good, leveled surface.

Next, I tried a piece of transparent LDPE. I had some leftovers of this from building the second filament box. I attached the LDPE with some foldback clips to the heated build platform.

It worked relatively well. However, the LDPE degenerates rather quick:


Also I have the problem that there are only very few spots on the build platform where foldback clips can be used without blocking the build platform’s movement. Since LDPE heavily warps when heated, there just weren’t enough clips to hold it down to the flat aluminum.

Finally, I cut a sheet of thin glass (from a cheap picture frame) to 10x10cm. Like the aluminum sheet, I used Kapton tape as “interface” material for the ABS. So far, this build surface seems to work great. The glass is nicely flat and leveled and keeps it that way when heated. And two foldback clips are enough to securely attach the surface to the aluminum plate:


Now, with the aluminum platform bolt down to the y stage, I was able to use a piece of ribbon cable to connect the cables from the platform with the x stage:


There was a connector on one end of the ribbon cable (it used to be a part of an old PC’s RS232 access), I glued this end of the cable to the y stage. After soldering a compatible connector to the platform’s wires, I was able to connect the heated build platform in a way which allows easy removal if needed.


Up until half way, I glued the ribbon cable to the x stage’s edge. Then the cable runs inside the drag spring from the x stage to the outside of the Makerbot. I already had the drag spring installed about a year ago to guide the y stepper motor’s and the y end stops’ cables.

Here’s a short video of the ribbon cable during a print:

It works great!

After playing around with my Mendel for a while, I very much like the autohoming feature of it’s firmware.

When I browsed the current Makerbot firmware, I was surprised to find support for automatic homing, ready to use. As far as I know, this code is currently not used by ReplicatorG, right?

Anyway, having endstops installed for the X and Y stage, it’s no problem to autohome these stages with the current firmware.

Just send the G-Codes G28, G161 or G162 with information on the axis to the Makerbot:

G28 is the “normal” ‘return to home’ G-code, also used by the RepRap firmware. However, in the Makerbot firmware, there are two more variants of the homing functions:

G161 is ‘home negative’, which means, that the respective stages are moved in direction of the MIN endstop until they reach the end of the line. Currently, G28 and G161 are exactly the same in the Makerbot firmware.

G162 is ‘home positive’, which means, that the respective stages are moved in direction of the MAX endstop until they reach the end of the line.

Concerning the X and Y stage, you might use either of them to bring the Makerbot into a “well known position”. If you have installed all four MIN/MAX endstops for the X&Y stages, that is.

In case you have only one endstop per axis you should call G161 for those axes with a MIN endstop and G162 for those axes with a MAX endstop.

My Makerbot, for example, has only one endstop per axis: MAX on the X axis, MIN on the Y and Z axes. So in order to home my Makerbot, I’d send

G162 X
G161 Y Z

The Z-axis endstop isn’t as easy to install as the X/Y endstops. Depending on the build platform and/or extruder or frostruder you’re using, the Z-axis endstop needs to be adjusted for the correct height.

Quite a while ago, I already tried some possible solutions on my Makerbot. Back then, I designed the Z-stage endstop trigger (my very first published thing on Thingiverse!). I also designed  a X-stage endstop trigger and an adjustable Z-stage endstop trigger. But since I wasn’t too happy with the results, I never published these.


I always thought, that the best way to do homing of the z-stage would be a probe as near as possible to the nozzle, sensing the actual build surface.

I also did some test on this back a year ago, but again the results weren’t too promising:


The main problem is, that the probe needs to be retractable during the print process. A year ago I tried to solve this with a manual retraction mechanism. But it didn’t work reliably. Also, adjusting the probe wasn’t very easy.

More than a year later, I learned a lot about electronics, microcontrollers and embedded systems programming…

So here’s what I came up with:


The Z-Probe

This new design contains a standard endstop PCB and a needle-like sensing-probe. The head of the sensor is motorized retractable with help of a standard servo.


The Z-Probe is designed to be mounted behind/under the extruder on the z-stage:

IMG_0855.JPG IMG_0856.JPG

That way, the Z-Probe is able to sense the build platform only 1-2 cm from the nossle.

The servo, lowering and rising the sense-pin, is controlled by the extruder controller board. There are two digital pins on the extruder controller board v2.2, currently unused on a Makerbot (D9 and D10).

These pins are ready to use with a servo. Just plug the servo connector to the 3 pins of D9. Make sure to put the black wire (GND) on the pin marked with “-“:


Of course, some firmware/host software changes are needed in order to drive the Z-Probe.

The D9 and D10 pins are even PWM enabled. So usually it’s quite easy to add support for servos on an Arduino controller.

Unfortunately, since v2 of the extruder controller firmware Adam from Makerbot Inc. decided to move away from the Arduino IDE and API. The firmware is now “native AVR”, i.e. no more access to the Arduino libraries. Of course, there are several valid reasons to abandon the Arduino IDE, especially when projects grow and get more complex. But this also makes it harder  to “hack” the software.

What’s even worse: The current firmware already uses the hardware timer of the ATMega, which ususally drives the PWM pins D9 and D10. So I needed quite a while to understand how to solve these problems.

I think, I’ve found a way to solve the problem with the timer. The current firmware uses this timer for a general software interrupt routine. So I hooked the servo driver for the z-probe into the same interrupt routine.  So the servo PWM signal now is created by the CPU in software (and not by the hardware PWM driver). I tried some other ways around this timer conflict, but this was the only way both, the servo and the rest of the firmware, are working. I guess it’s not the best idea to mess around with one of the firmware’s central timers…

After solving these problems, I was able to extend the firmware with a new class “ZProbe”. This class handles the lowering and raising of the ZProbe hardware.

The upper and lower positions of the ZProbe are configurable in the extruder’s EEPROM preferences (well, they will be, as soon as I’ll find the bug which currently prevents the firmware to write new values to the preferences…).

In order to control the Z-Probe from within Replicator-G and -even more important- from within G-Code files, I added some new “M-Codes” to the GCode-Parser: M140, M141 and M142

M140 “Engage Z-Probe”: This M-Code lowers the Z-Probe into working position.

M141 “Disengage Z-Probe”: This M-Code raises the Z-Probe into parking position.

M142 “Adjust Z-Proble Angle”: This M-Code takes a S argument and moves the Z-Probe’s servo int the given angle (e.g. M142 S45 moves the servo to 45°). This code is intended for internal use only.

One thing to keep in mind is, that the zeroed Z-stage with engaged Z-Probe mustn’t be moved in X or Y direction. Since the Z-Probe pin touches the build surface in this case, moving the build platform could cause scratches in the build surface or -worse- damage of the Z-Probe itself. So always either disengage the Z-Probe or raise the Z-stage a little before moving the X/Y stage.

Here’s the G-Code for a complete autohome sequence on a Z-Probe equipped Makerbot:

G21 (Metric FTW)
G91 (relative positioning)
G0 Z7.0 (move up the z-stage for security)
M141 (Disengage Z-Probe)
G90 (Absolute Positioning)
G162 X (home positive)
G161 Y (home negative)
G92 X0 Y0 (Reset reference position)
G0 X-55.0 Y20.0 (Center ** Z-Probe-Pin **)
G92 X0 Y-25 (Reset reference position)
M140 (Engage Z-Probe)
G161 Z F500 (home negative [fast])
G92 Z0 (Reset reference position)
G0 Z2.0 (Back up z-stage 2mm)
G161 Z F25 (home negative [slow])
G92 Z0 (Reset reference position)
M141 (Disengage Z-Probe)
G1 F150 (Reset Z-speed)
G0 Z1 (backup Z for Y move)
G0 Y0 (center Y *** Nozzle ***)
G0 Z0 (return Z to zero)

Of course, this G-Code would need to be adjusted if the Makerbot has an other endstop configuration than mine. Also the ‘move to center’ distance is likely different on each Makerbot.

Here’s a video, showing my Makerbot while running the above G-Code:

As you can see, the Z-Probe just works, even if the height of the build platform was changed. No manual adjustmens needed. This is not only a nice feature for operators using differnt types of build platforms or surfaces, it also might be quite useful for people using the brand new Automated Build Platform.

You want?

First and frontmost: This is all still in a very early stage, both hardware and software.

I released the printable parts for the Z-Probe on Thingiverse:

The design is for use with a Futaba servo S148. That’s the servo I found in my junk box. I guess each servo has a different size. So the design might be more a draft for your own design. I plan to try the same thing with a smaller (and cheaper) “micro servo” in the future. I hope I’ll find the time to create a parametric OpenSCAD design until then.

Since it’s still a prototype, the servo is currently glued to the base plate with some hot glue.

Both, the new extruder firmware as well as the extended ReplicatorG host software, are available on GitHub. I forked both projects from Makerbot:


ReplicatorG: (ZProbe branch)

Please remember: This is all beta (at best). As mentioned above there’s still a known bug with saving the Z-Probes EEPROM settings.

Feel free to improve!

Boxing (Round 2)


With a second working 3d printer in the house, I needed an extra filament spindle box. It was easy enough to build the first one for my Makerbot, so why not build a second, improved one?

The most wanted improvement was a window.

It turns out, that it’s not only nice looking but sometimes also important to see what’s going on inside the box. So I changed the design slightly to sport a window on the front.

Since it turned out, that the second disk above the filament spool on the turntable isn’t really needed (the spindle’s construction is self-supporting and the box’s top keeps the filament on the spindle), I recycled the spare plywood disk in the second filament box: It got promoted to be the turntable. (If you don’t have an extra plywood disk at hand, see here how to cut the disk out of a rectangular sheet of plywood with a Dremel).

Needing even less wooden parts (no front side, no plywood for the turntable), the remaining material was even cheaper to get. Including the sheet of transparent plastic (“Hobby Glass”, a sheet of 2mm transparent LDPE, 25x50cm), the whole stuff cost me less than 5€ (!).


Here’s the updated part list for the box:

QtySize (mm)Material
2310 x 310MDF 10mm
2310 x 120MDF 10mm
1290 x 120MDF 10mm
1280 x 280Plywood 4mm
1~ 300 x 130 Transparent plastic, acrylic, glass...

There were some requests for detailed drawings, so here you go:

(These drawings are also available as PDF. I added them to thing 3640 on

The change in design is, that -instead of a front wall- there’s a groove for a sheet of transparent plastic (or acrylic, or glass, or whatever).

If you got a circular saw, the grooves are quite easy to make: Adjust the circular saw blade’s height to about half the MDF thickness (i.e. if you use 10mm MDF, adjust the saw to 5mm). Then use the saw’s stop to saw the groove 10mm from the front side of the bottom, top, left and right parts (I hope I’ve got the technical terms about right in English…).

If you don’t have a circular saw at hand (I don’t!), you might use a Dremel to cut the grooves. That’s slightly more work and probably not as exact, but it’s good enough:


After cutting the grooves and drilling all holes, the assembly of the box is quite easy. I used some glue for additional stability.


Then I did measure the final width of the front window (including the depth of the grooves).

Cutting the LDPE sheet was very easy: After slightly slitting the sheet with a box cutter, the sheet can be broken at a table’s edge. It’s like cutting glass, only with a knife and without the cullets.


Now I was able to mark the final height of the window:


Another LDPE-cut later, the box was almost finished:


I didn’t change the inner construction of the box. So all printed parts, ball bearings and rods are the same as in the first box.

I added one last improvement to the box’s turntable: Since the filament roll tends to loosen up a little bit on the turntable, it can happen that some loose filament “falls” from the turntable. That’s usually not a big problem, but it could lead to a turntable-jam.

To avoid that, I used some paper (160g/m2) to build kind of a “cake setting ring” around the turntable (maybe one could actually use a real cake setting ring for this?).


The paper ring catches the loose filament windings, but it doesn’t interfere with the unwinding mechanism itself.