Sunday, 15 January 2017

Tales of a Pi Installation

With the new mount in, I needed to upload new firmware - even though slic3r can take a Z offset, it seems the heating position doesn't take that into account and just goes to Z min, which is now about 7 mm below the plate.

Unfortunately, new security software on my laptop blocked some of the sub-programs used by Arduino, so I figured it was time to switch to the Raspberry Pi I got for the same purpose. Hook up a monitor, a (German) kezboard, and a mouse (I am still amazed that you can plug in random things in USB and they just work and know what they're supposed to do), and up and running.

Except not quite. The Arduino in rpi is rather old, so I decided to try a new one with proper board management and all, compiled from scratch. Took a while to install all the dependencies and everything, but I got it. Except... the Marlin firmware isn't compatible with Arduino 1.5+ :( So back to the old one (with an interregnum of a Chromium update making it fail and requiring a kernel update, and various crashes when I asked too much of my little Pi).

I did update to a newer version of Marlin, though getting that to compile right was tricky. I don't have the Melzi definition installed and remember installing it as a frustrating task, but some sites say Sanguino works as well - and it does! (Specifically ATMega1284p 16MHz). I set the Z_MAX_POS to 200 but allow it to go to -1, in case the frame expands. The Z axis is exceedingly slow, though, until I changed the steps to 200.0*16/1.25 - that's what I had before, I'm honestly not sure where the calculation comes from. I might be able to speed it up... nope, that caused a crash! I'll keep it low.

The bed height when manually calibrated turned out to be 1.1mm above 0, a bit higher than I hoped for, so let's reduce the height to 199mm.

The newer firmware version seems in particular to have better autolevelling support, which I want to include soon. Also, it connects immediately rather than after about 5 seconds, which is nice.

I also need to recompile Slic3r, of course. And somehow it seems every app involved uses a separate set of languages and libraries, so each time I install something 20+ other things get installed. Sigh. But the strangest thing will have to be this requirement for Slic3r:

$ sudo apt-get install libopengl-perl
The following packages will be REMOVED:
  cura gstreamer1.0-plugins-bad libalien-wxwidgets-perl libgl1-mesa-dev
  libgl1-mesa-glx libglew1.10 libgltf-0.0-0 libglu1-mesa-dev libgtkglext1
  libopencv-calib3d2.4 libopencv-contrib2.4 libopencv-core2.4
  libopencv-features2d2.4 libopencv-flann2.4 libopencv-highgui2.4
  libopencv-imgproc2.4 libopencv-legacy2.4 libopencv-ml2.4
  libopencv-objdetect2.4 libopencv-video2.4 libreoffice
  libreoffice-avmedia-backend-gstreamer libreoffice-base libreoffice-base-core
  libreoffice-base-drivers libreoffice-calc libreoffice-core libreoffice-draw
  libreoffice-gtk libreoffice-impress libreoffice-math
  libreoffice-report-builder-bin libreoffice-sdbc-hsqldb libreoffice-writer
  libvisual-0.4-plugins libwx-perl libwxgtk-media3.0-0 libwxgtk-media3.0-dev
  libwxgtk2.8-0 libwxgtk2.8-dev libwxgtk3.0-0 libwxgtk3.0-dev openjdk-8-jdk
  openjdk-8-jre python-opengl python-pyglet python-wxgtk3.0 python3-uno
  raspberrypi-ui-mods vdpau-va-driver xserver-xorg xserver-xorg-core
  xserver-xorg-input-all xserver-xorg-input-evdev xserver-xorg-input-synaptics
  xserver-xorg-video-fbdev xserver-xorg-video-fbturbo

I was not done with those! In fact, I just specifically installed libwx-perl to make Slic3r happy. I'm sure stuff is going to break stuff. And it doesn't make Slic3r run, it wants both wx and opengl, but those two cannot live together. What's with that?

Huh. Despite setting the height to 199mm, it still hits the bed at 1mm Z height. Maybe that's because I didn't actually change it.

It seems sometimes the Z movement is a lot slower than normal. It would be nice if Pronterface had a display of what it thinks the state of the world is - where the axes are and how fast they're moving.

Truly, language-specific package managers are a pain, a pestilence, and a pox upon the Linux world. To get slic3r to run, I've been led a merry chase between installing Debian packages, installing CPAN packages, installing Debian packages because installing the CPAN package failed without it, running slic3r again to find another package is needed, etc etc. Only to get to where slic3r runs for two seconds and then segfaults.

This is probably caused by, and can be cured in the same way by not having the plater. I only occasionally use the plater, so that's ok.

Since I don't feel like digging up the standard (if any standard exists) way to install a Perl program, I'm just pointing at the build dir for now, so my slicer command is /home/pi/src/Slic3r-1.2.9/ --gui --no-plater $s --output $o  --load "/home/pi/3DPrint/Slic3r/filament/Simple Mode.ini" --load "/home/pi/3DPrint/Slic3r/printer/Simple Mode.ini" --load "/home/pi/3DPrint/Slic3r/print/Simple Mode.ini". Slic3r is a rather quirky program, all told.

An unfortunate side-effect of switching to a Linux system is that I can't use Google Drive as my shared filesystem any more. But I can mount my home directory from my main machine, which in turn contains a Google Drive mount. Using afpfs, that was pretty simple, except Slic3r without a plater doesn't automatically slice like it used to, so I have to "Quick Slice and Save As" until I find the right commands. Update: No, I just needed to remove the -gui argument.

Trying to print - and no heat. I probably missed a thermistor setting. Or not - the hotend thermistor is definitely the right setting, and setting the bed to something that looks sensible (some numbers have changed) gave wonky results. Trying again, they both heated.

Now I got it to print (with a cold bed), but oddly the print was done a full centimeter above the bed! The new firmware is nice, though, that it heats the bed and extruder while homing. Much time saved. The print is absolutely 9.95mm above the bed, desipte the settings saying Z offset of 0. Odd.

Friday, 13 January 2017

Switching mounts in the middle of the ford

When last we met our intrepid 3D printer, there were signs of trouble: The Settlers pieces came out more and more jagged, for unknown reasons, and the proximity sensor holder was quite wobbly. This was followed by some test pieces showing semi-systematic shift in Y mainly:

Not good. Was my belt too loose? No, it strums nicely. Was there a piece of junk interfering with it? Well, there were two pieces of metal sticking out of it:

But that wasn't it, either. Just when I was about to despair, I noticed that the hotend was wobbling back and forth during a print. I should have known - it had once again come loose, probably when hitting the side of that piece that warped up. Alright, that's it, I'm switching over to the new extruder holder I printed earlier, the one that has nophead's sneakier mount system.

Fiddling around with that took a bit of time, but wasn't so horrible. I have to mount the hotend before putting the extruder on the carriage, but it's at least solidly mounted now. Also lots of nut traps.

When testing the mount, it turns out I've lost about 5 mm of build height - oh noes! Had to recalibrate X as my fiddling around had moved things. What's worse, and somewhat strange, is that even after setting a Z offset in Slic3r, it goes several mm too far down when the head goes into position to heat up. It appears to be ignoring that offset, I should probably make the firmware have the right limit instead. Not tonight, though.

You can see here how the new mount works: Three screws with washers (two visible here) hold the top of the hotend into the hole. As long as the washers hold up, this will be very solid - possibly solid enough that I should worry about what part would break instead if there was a bad head crash. The 5 mm less height comes from the mount having a much shallower hole, for not having to have space for screws under the top of the hotend.

Overall a better mount also in other way - nut traps rock my world.

I'm also concerned that the Z rods are noisier and more wobbly than earlier.

Tuesday, 10 January 2017

Printing this and that

Printing some Settlers of Catan pieces for fun. Works nicely, though I forgot to take off a skirt of one print so some roads got a little funny. I'm printing one set in purple, but the spool is almost out, so here's some numbers to make sure there's enough:

One meter of 2.85mm filament contains 1000 * pi * (2.85/2)^2 cubic millimeters = 6379mm^3. I have 9 windings of filament left, each roughly 100mm diameter, so 9 * pi * 100 mm ~= 2800mm, Totally I have about almost 18k mm^3, which is plenty, Slic3r thinks the remaining pieces (after printing roads) take 12k, and after printing I have 4 coils left, so my calculations were pretty accurate. And these pieces are totally adorable!

The Aztec set done in white is less interesting, though if I brush up my miniature painting, I could make the cities look like there's the blood of 50000 sacrificed slaves running down the sides;)

I also designed some little clip-on markers for the standard IKEA glasses, so we can keep track of which is whose rather than having to break out new ones all the time and wash them. In the design of those, I confused radius and diameter at first, ending up with some rather thin ones and being surprised that my printer would be off by that much.

I've also been designing a spool for USB cables, since I have a lot of those lying around. The trick with those is that USB cable doesn't like to bend nearly as much as headphone cable. This makes in particular fastening the end of the cable difficult. I have yet to come up with a good solution for that.

Returning to the dog bag issue way back, I decided the rods holding up the sides of the bag were just too thin and bendable (3mm rods). I got some 5mm tubes instead and made little end pieces to make them not sharp and potentially sew-in-able:

In random other prints, I did a new extruder holder adapted to the E3Dv6. The holes came out on the small side, so I since invested in a small round file.

I also got a proximity sensor from +Richard Jørgensen and printed a holder for that. Unfortunately, it looks like my Y belt is under-tensioned, see how the cylinder has wobbles on it:

Tuesday, 27 December 2016

Testing an inductive proximity sensor

Let's take at the sensor I got from +Richard Jørgensen. As I mentioned, it's a LJ12A3-4-Z/BX, and came with this little extra print board to pull it down to 5V:

Now I don't have all my normal stuff with me, but I found a 12.6V battery in a drawer, which should be enough to power it. Plus it has an LED in it to show when it's detecting something. So if I just wire it up right (maybe reusing part of that board), I should be able to get it to light up.

According to this video, the wiring is: Brown = Vin, Black = Signal, Blue = Gnd, and I can just use a 9V battery with Brown on + and Blue on -. Didn't work with the 12.6V battery, but I don't know the state of that. With a fresh 9V, it works! It detects the copper tape at about 2mm distance, nice. I guess the '4' in the name is the maximum sensor distance (at full voltage?), which is nice for keeping it somewhat away from the bed.

There's an Instructable on how to enable auto-leveling with Marlin. I don't think I want the full auto-leveling to adjust for the shape of my bed just yet, just getting the height right is the important part. Plus I think I would rather work to get a level bed than have the print adjust, I expect a properly flat bed gives a better result than adjusting the Z axis during printing.

I'll clearly need a mount. I've been pondering various sneaky magnetic ways to raise and lower the sensor, though with the measurement distance being so long, I can probably just mount it close to the nozzle and still avoid crashes. There's this one by DanielBull which is just an add-on, or he has a full X carriage with a built-in probe mount. I'm not about to change out my carriage, that's a larger operation, though it might eventually be useful in order to properly mount an E3D and bed fan and probe. My one concern is that the probe would come loose enough during printing that it starts to offset itself. We'll see.

This video goes through the process very nicely. He warns against using PLA, since it melts at fairly low temperature. Maybe that's a good time to use that sample of PETG I got.

Marlin only supports three-point and grid levelling (tramming). Given that I need to put copper tape on the bed to measure it (unless I switch to an aluminium bed instead of glass), I can't have the points be on the middle of the bed. 

Do I want to replace the normal Z-endstop, or use the option to have them both on one input? I'm thinking the latter is more complex and prone to weird interactions. Some talk on how to connect to a Melzi here and here. Since this is an NPN, I shouldn't need extra components, which is nice (though I do like the PNP feature of a failed sensor counting as being triggered).

Fun with FreeCAD

On to the FreeCAD tutorials, starting with something basic, and taking notes.

Having auto-constraints on is rather nice. However, it can lead to oddities - at the 26mm length constraint, my design flipped out and only became orderly once I deleted the coinciding constraints and then added them back with Undo. Wut?

Scrollbars within scrollbars don't work well on Mac at all. Also, the Macbook Air has a delete button, but not backspace, so deleting items is tricky. But aha! You can use Fn-Delete to delete. And, as soon as I delete one of the lines in the tutorial object this way, FreeCAD crashes. Delightful.

"Now in the Combo View, click on the OK button" - yeah, well, there isn't one. ITYM "Close".

Non-dialog panels that have an OK button is one thing - having several that differ between "Ok" and "Close" is annoying - but it gets really confusing when you can make all manner of other changes in the meanwhile. OTOH, I don't like modal dialogs.

Ah, joy. Random "Overconstrained" errors. For some reason my sketch is rotated 90 degrees compared to the normal axis, so trying to set horizontal length on something that looks horizontal gives a conflict with the verticality constraint. This program could do with better error messages for some common constraint conflicts, e.g. "A vertical line cannot have a horizontal length". But why it's rotated I do not know, the axes look just fine. I tried reconstructing the initial model in a few different ways, but it always switches to XZ plane when adding a sketch on the back.

Curious. The "Angle" property of the sketch is 240 degrees, but degrees of what? 240 is the XZ plane, 120 is the YZ plane, and 0 is the XY plane. I still don't see the property that defines which way is up. Regardless of Axis properties, the coordinates are clearly (y,x) format. Bizarre.

The next picture does indeed show the element standing on end, there's just no explanation of why this happens. Nor is there an explanation of things like having to press 'Esc' to get out of a given tool. Maybe that's in the very beginners intro.

I like that the view buttons cause a little animation, makes it easier to understand. In OpenSCAD, clicking one just snaps to that view, which in some cases is indistinguishable from other views.

I like how the tutorial starts out by saying it's using Auto Refine, but that they recommend not doing that. Do as we say, not as we do. So now my sketch looks different, hopefully it won't behave differently.

External geometry selection requires holding Cmd, but internal selection doesn't. Confusing? Slightly. Mentioned in the tutorial? Nah.

I am amused by the final step: Call out to OpenSCAD to get rid of the extra lines.

For my Macbook, the Touchpad navigation is pretty nice once I get used to it, especially the click-less panning. There's just something odd about exactly when the Shift press is registered, probably related to what happens to have focus. Using just Shift and Alt, I can avoid clicking entirely to change my view.

I'll have to try designing a few "real" things, but it does look like there are objects more easily defined in FreeCAD than in OpenSCAD - things where constrained relations are the defining features in particular.

Monday, 26 December 2016

Christmas doodling

Over the holidays, I've AFP (Away From Printer), so doing some thinking and reading up. +Richard Jørgensen showed me around FreeCAD a bit. It looks nice, definitely easier for some kinds of models, and the Bezier support is promising.

He also gave me an inductive proximity sensor (LJ12A3-4-Z/BX) he'd switched away from in favor of a bottom Z end-stop. I would like to use this for the auto-calibration, to take care of the frame size changes. I have a piece of copper tape from him, too. Now I just need to hook it up to appropriate power (comes with a hacked-up 5V adapter), feed it into the controller, and add applicable firmware support. 

Problem is the controller is out of inputs. I could theoretically put it on the same input as the existing Z-stop and somehow switch between them - or can the Marlin firmware understand that a Z-endstop input is both ends? Looks like it can (from

// Enable Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN to use the Z_MIN_PIN for your Z_MIN_PROBE. // The Z_MIN_PIN will then be used for both Z-homing and probing.

We did his first print with the E3D hotend, switched from a mk7. While the old one was working fine, the surface quality improved a lot, and temperature setting was lower. E3D rocks!

We also both want to do a bed fan duct. I keep thinking that two separate pieces with tubes between them would reduce a lot of the mounting problems inherent in combinations of different hotends, X beds, mount points, and fans. I haven't seen a design like that, though.

Playing around with FreeCAD some more shows a quirky interface, some weird errors, and a whole new way of thinking about geometry compared with OpenSCAD. On the bright side, it does have proper, if less nicely done than in Dia, Bezier curves. Now if I can make the Bezier curves partake in constraints, I'm all set. Unfortunately, it looks like the constraint solver isn't keep on distance-from-curve constraints. Also, constraining is only inside sketches, which can't be right. More tutorials are needed.

Sunday, 27 November 2016

Spare parts

After +nop head 's reply to my previous post, I decided to go ahead and print the new extruder holder, after tightening down the hotend as much as possible. I had a few early failures due to miscalibration:

This is what printing too high looks like (after being taken off the bed) - the filament doesn't get pressed together, so it separates into strings.  It's quite the piece of art.

I eventually got a decent print, though not without problems:

The support inside the roller bearing hole was extremely hard to cut.

There's quite a bit of ringing, not surprising with a poorly fastened hotend. The far side of the hotend hole is stringy.

There are offsets in the wall near the filament hole. Since there's no such offsets on the far side, I guess it's a sideeffect of the hole being nearby.

The top layer has gaps near the edges.

Using a hobby knife to cut out the support was really difficult. In the end I just cut out enough for the hobbed bolt and put the roller bearing on top. It might end up not rolling so well. Putting the nuts into the various nut traps took some force when going sideways and was impossible when dropping it in from the top - I had to melt the hole larger.

If I also have to print the extruder carriage to match e3d, this is going to be a larger bit of rework, and I should take the opportunity to also add an autoleveller, since the frame does change size, and the bad prints in the beginning of this post was due to poor alignment.

I've been looking at various autolevelling options, and the ones that are not stupid expensive are rotated away when not in use. Seems a simpler system would use magnets to lower and raise the levelling tip, maybe combined with a spring. The real problem is that I'd have to add more wiring and probably a new controller board.