3D printer setup

Bob Mottram 22a3722ecb marlin changes 4 years ago
images dd0ffe510b initial 4 years ago
LICENSE dd0ffe510b initial 4 years ago
README.md 22a3722ecb marlin changes 4 years ago
test_print.stl dd0ffe510b initial 4 years ago

README.md

Kossel Mini 3D printer setup

    Copyright (c)  2017  Bob Mottram <bob@freedombone.net>
    Permission is granted to copy, distribute and/or modify this document
    under the terms of the GNU Free Documentation License, Version 1.3
    or any later version published by the Free Software Foundation;
    with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts.
    A copy of the license is included.

This document describes the setup of the Kossel Mini 3D printer, using the LJC18A3-B-Z/BX capacitive proximity switch for bed levelling and with the RepRap Smart Controller LCD screen. It's not intended to be a replacement for the build instructions, but may help to save time when setting up the software.

Capacitive Z probe sensor

This shows one way to fit the capacitive sensor using some 2mm aluminium strip and sheet metal made into a bracket. An alternative once the system is running would be to design and print a bracket for this.

Installing the software

The software packages described are for Parabola GNU/Linux (a libre variant of Arch) and package names may vary on other distros. Exclusively free software is used on this system, making both the hardware and software amenable to changes, fixes and improvements.

Get the packages with:

sudo pacman -S arduino printrun ncurses pronterface freeglut ncurses wget base-devel git
sudo ln -s /usr/lib/libncursesw.so.6 /usr/lib/libtinfo.so.5
mkdir ~/develop
cd ~/develop
wget http://dl.slic3r.org/linux/slic3r-linux-x86_64-1-2-9-stable.tar.gz
tar -xzvf slic3r-linux-x86_64-1-2-9-stable.tar.gz

If you need other versions of slic3r, or the 32bit version then visit http://dl.slic3r.org/linux

Create a configuration directory for slic3r:

mkdir -p ~/.config/slic3r

Obtain the latest Marlin software which will be installed onto the Arduino.

cd ~/develop
git clone https://github.com/MarlinFirmware/Marlin
cd ~/develop/Marlin
git checkout eb0a38d4bd29950f62ce2d2d76e54e34ff3f69f0 -b eb0a38d4bd29950f62ce2d2d76e54e34ff3f69f0

Configuring the software

There are three types of software to be configured: the Malin software for the Arduino which controls the printer, the slic3r software which turns STL CAD models into G-codes which can be sent to the printer and also some user interface configuration via pronterface.

Slic3r configuration

Add a configuration file:

# generated by Slic3r 1.2.9 on Sat Feb 25 17:49:51 2017
avoid_crossing_perimeters = 1
bed_shape = 99.4522x10.4528,97.8148x20.7912,95.1057x30.9017,91.3545x40.6737,86.6025x50,80.9017x58.7785,74.3145x66.9131,66.9131x74.3145,58.7785x80.9017,50x86.6025,40.6737x91.3545,30.9017x95.1057,20.7912x97.8148,10.4528x99.4522,0x100,-10.4528x99.4522,-20.7912x97.8148,-30.9017x95.1057,-40.6737x91.3545,-50x86.6025,-58.7785x80.9017,-66.9131x74.3145,-74.3145x66.9131,-80.9017x58.7785,-86.6025x50,-91.3545x40.6737,-95.1057x30.9017,-97.8148x20.7912,-99.4522x10.4528,-100x0,-99.4522x-10.4528,-97.8148x-20.7912,-95.1057x-30.9017,-91.3545x-40.6737,-86.6025x-50,-80.9017x-58.7785,-74.3145x-66.9131,-66.9131x-74.3145,-58.7785x-80.9017,-50x-86.6025,-40.6737x-91.3545,-30.9017x-95.1057,-20.7912x-97.8148,-10.4528x-99.4522,0x-100,10.4528x-99.4522,20.7912x-97.8148,30.9017x-95.1057,40.6737x-91.3545,50x-86.6025,58.7785x-80.9017,66.9131x-74.3145,74.3145x-66.9131,80.9017x-58.7785,86.6025x-50,91.3545x-40.6737,95.1057x-30.9017,97.8148x-20.7912,99.4522x-10.4528,100x0
bed_temperature = 70
before_layer_gcode =
bottom_solid_layers = 3
bridge_acceleration = 0
bridge_fan_speed = 100
bridge_flow_ratio = 1
bridge_speed = 60
brim_width = 0
complete_objects = 0
cooling = 1
default_acceleration = 0
disable_fan_first_layers = 3
dont_support_bridges = 1
duplicate_distance = 6
end_gcode = M104 S0 ; extruder temperature\nM140 S0 ; bed temperature\nG28 ; home all axes\nM84 ; disable motors\nM106 ; Fans on\n
external_fill_pattern = rectilinear
external_perimeter_extrusion_width = 100%
external_perimeter_speed = 50%
external_perimeters_first = 0
extra_perimeters = 1
extruder_clearance_height = 20
extruder_clearance_radius = 20
extruder_offset = 0x0
extrusion_axis = E
extrusion_multiplier = 1
extrusion_width = 100%
fan_always_on = 0
fan_below_layer_time = 60
filament_colour = #FFFFFF
filament_diameter = 1.75
fill_angle = 45
fill_density = 50%
fill_pattern = honeycomb
first_layer_acceleration = 0
first_layer_bed_temperature = 75
first_layer_extrusion_width = 200%
first_layer_height = 0.25
first_layer_speed = 10
first_layer_temperature = 190
gap_fill_speed = 20
gcode_arcs = 0
gcode_comments = 0
gcode_flavor = reprap
infill_acceleration = 0
infill_every_layers = 10
infill_extruder = 1
infill_extrusion_width = 100%
infill_first = 0
infill_only_where_needed = 0
infill_overlap = 15%
infill_speed = 80
interface_shells = 0
layer_gcode =
layer_height = 0.25
max_fan_speed = 100
max_print_speed = 80
max_volumetric_speed = 0
min_fan_speed = 35
min_print_speed = 10
min_skirt_length = 0
notes =
nozzle_diameter = 0.5
octoprint_apikey =
octoprint_host =
only_retract_when_crossing_perimeters = 1
ooze_prevention = 0
output_filename_format = [input_filename_base].gcode
overhangs = 1
perimeter_acceleration = 0
perimeter_extruder = 1
perimeter_extrusion_width = 100%
perimeter_speed = 60
perimeters = 3
post_process =
pressure_advance = 0
raft_layers = 0
resolution = 0
retract_before_travel = 2
retract_layer_change = 0
retract_length = 0.5
retract_length_toolchange = 10
retract_lift = 0
retract_restart_extra = 0
retract_restart_extra_toolchange = 0
retract_speed = 20
seam_position = aligned
skirt_distance = 6
skirt_height = 1
skirts = 1
slowdown_below_layer_time = 5
small_perimeter_speed = 15
solid_infill_below_area = 70
solid_infill_every_layers = 0
solid_infill_extruder = 1
solid_infill_extrusion_width = 100%
solid_infill_speed = 20
spiral_vase = 0
standby_temperature_delta = -5
start_gcode = M104 S215 ; extruder temperature\nM140 S70 ; bed\nM106 ; Fans on\nM109 S215 ; wait to reach temperature\nG28 ; home all axes\nG29 ; heatbed leveling\nG1 X0 Y0 Z50\n
support_material = 0
support_material_angle = 0
support_material_contact_distance = 0.2
support_material_enforce_layers = 0
support_material_extruder = 1
support_material_extrusion_width = 100%
support_material_interface_extruder = 1
support_material_interface_layers = 3
support_material_interface_spacing = 0
support_material_interface_speed = 100%
support_material_pattern = pillars
support_material_spacing = 2.5
support_material_speed = 60
support_material_threshold = 0
temperature = 215
thin_walls = 1
threads = 2
toolchange_gcode =
top_infill_extrusion_width = 100%
top_solid_infill_speed = 15
top_solid_layers = 3
travel_speed = 130
use_firmware_retraction = 0
use_relative_e_distances = 0
use_volumetric_e = 0
vibration_limit = 0
wipe = 0
xy_size_compensation = 0
z_offset = 0

Now make a script which can be used to run slic3r from pronterface:

sudo echo "#!/bin/bash
curr_path=$(pwd)
cd $HOME/develop/Slic3r
if [ $2 ]; then
    ./bin/slic3r --load $HOME/.config/slic3r/slic3r.ini $1 --output $2
else
    ./bin/slic3r --load $HOME/.config/slic3r/slic3r.ini $curr_path/$1
fi" > /usr/bin/slic3r
sudo chmod +x /usr/bin/slic3r

Marlin configuration

Now we need to change the Marlin configuration so that it's suitable for the Kossel Mini. You might need to change measurements such as DELTA_DIAGONAL_ROD, DELTA_SMOOTH_ROD_OFFSET and Z_PROBE_OFFSET_FROM_EXTRUDER. The more accurate you can get the physical measurements, the better the printing results will be.

cp ~/develop/Marlin/Marlin/example_configurations/delta/kossel_mini/*.h ~/develop/Marlin/Marlin/
sed -i 's|#define MOTHERBOARD .*|#define MOTHERBOARD BOARD_RAMPS_14_EFB|g' ~/develop/Marlin/Marlin/Configuration.h
sed -i 's|#define PANEL_ONE|//#define PANEL_ONE|g' ~/develop/Marlin/Marlin/Configuration.h
sed -i 's|//#define REPRAP_DISCOUNT_SMART_CONTROLLER|#define REPRAP_DISCOUNT_SMART_CONTROLLER|g' ~/develop/Marlin/Marlin/Configuration.h
sed -i 's|#define DISPLAY_CHARSET_HD44780.*|#define DISPLAY_CHARSET_HD44780 WESTERN|g' ~/develop/Marlin/Marlin/Configuration.h
sed -i 's|//#define ULTRA_LCD|#define ULTRA_LCD|g' ~/develop/Marlin/Marlin/Configuration.h
sed -i 's|//#define SDSUPPORT|#define SDSUPPORT|g' ~/develop/Marlin/Marlin/Configuration.h
sed -i 's|//#define SD_CHECK_AND_RETRY|#define SD_CHECK_AND_RETRY|g' ~/develop/Marlin/Marlin/Configuration.h
sed -i 's|#define DELTA_SEGMENTS_PER_SECOND.*|#define DELTA_SEGMENTS_PER_SECOND 120|g' ~/develop/Marlin/Marlin/Configuration.h
sed -i 's|#define DELTA_DIAGONAL_ROD.*|#define DELTA_DIAGONAL_ROD 220 // mm|g' ~/develop/Marlin/Marlin/Configuration.h
sed -i 's|#define DELTA_SMOOTH_ROD_OFFSET.*|#define DELTA_SMOOTH_ROD_OFFSET 151.0 // mm|g' ~/develop/Marlin/Marlin/Configuration.h
sed -i 's|#define DELTA_EFFECTOR_OFFSET.*|#define DELTA_EFFECTOR_OFFSET 20 // mm|g' ~/develop/Marlin/Marlin/Configuration.h
sed -i 's|#define DELTA_CARRIAGE_OFFSET.*|#define DELTA_CARRIAGE_OFFSET 15.9 // mm|g' ~/develop/Marlin/Marlin/Configuration.h
sed -i 's|#define DELTA_PRINTABLE_RADIUS.*|#define DELTA_PRINTABLE_RADIUS 90 // mm|g' ~/develop/Marlin/Marlin/Configuration.h
sed -i '/#define ULTRA_LCD/a #endif' ~/develop/Marlin/Marlin/Configuration.h
sed -i '/#define ULTRA_LCD/a   #define LCD_HEIGHT 4' ~/develop/Marlin/Marlin/Configuration.h
sed -i '/#define ULTRA_LCD/a    #define LCD_WIDTH 20' ~/develop/Marlin/Marlin/Configuration.h
sed -i '/#define ULTRA_LCD/a #ifdef ULTRA_LCD' ~/develop/Marlin/Marlin/Configuration.h
sed -i 's|#define MANUAL_Z_HOME_POS.*|#define MANUAL_Z_HOME_POS 250.11 // Distance between the nozzle to printbed after homing|g' ~/develop/Marlin/Marlin/Configuration.h
sed -i 's|#define DEFAULT_AXIS_STEPS_PER_UNIT.*|#define DEFAULT_AXIS_STEPS_PER_UNIT   {79, 79, 79, 94}|g' ~/develop/Marlin/Marlin/Configuration.h
sed -i 's|#define DEFAULT_MAX_FEEDRATE.*|#define DEFAULT_MAX_FEEDRATE          {200, 200, 200, 200}    // (mm/sec)|g' ~/develop/Marlin/Marlin/Configuration.h
sed -i 's|#define X_MIN_ENDSTOP_INVERTING.*|#define X_MIN_ENDSTOP_INVERTING true|g' ~/develop/Marlin/Marlin/Configuration.h
sed -i 's|#define Y_MIN_ENDSTOP_INVERTING.*|#define Y_MIN_ENDSTOP_INVERTING true|g' ~/develop/Marlin/Marlin/Configuration.h
sed -i 's|#define Z_MIN_ENDSTOP_INVERTING.*|#define Z_MIN_ENDSTOP_INVERTING false|g' ~/develop/Marlin/Marlin/Configuration.h
sed -i 's|#define X_MAX_ENDSTOP_INVERTING.*|#define X_MAX_ENDSTOP_INVERTING true|g' ~/develop/Marlin/Marlin/Configuration.h
sed -i 's|#define Y_MAX_ENDSTOP_INVERTING.*|#define Y_MAX_ENDSTOP_INVERTING true|g' ~/develop/Marlin/Marlin/Configuration.h
sed -i 's|#define Z_MAX_ENDSTOP_INVERTING.*|#define Z_MAX_ENDSTOP_INVERTING true|g' ~/develop/Marlin/Marlin/Configuration.h
sed -i 's|#define X_PROBE_OFFSET_FROM_EXTRUDER.*|#define X_PROBE_OFFSET_FROM_EXTRUDER 0     // X offset: -left  +right  [of the nozzle]|g' ~/develop/Marlin/Marlin/Configuration.h
sed -i 's|#define Y_PROBE_OFFSET_FROM_EXTRUDER.*|#define Y_PROBE_OFFSET_FROM_EXTRUDER 42   // Y offset: -front +behind [the nozzle]|g' ~/develop/Marlin/Marlin/Configuration.h
sed -i 's|#define Z_PROBE_OFFSET_FROM_EXTRUDER.*|#define Z_PROBE_OFFSET_FROM_EXTRUDER -4.1  // Z offset: -below +above  [the nozzle]|g' ~/develop/Marlin/Marlin/Configuration.h
sed -i 's|#define Z_PROBE_ALLEN_KEY_STOW_1_X.*|#define Z_PROBE_ALLEN_KEY_STOW_1_X 40|g' ~/develop/Marlin/Marlin/Configuration.h
sed -i 's|#define Z_PROBE_ALLEN_KEY_STOW_1_Y.*|#define Z_PROBE_ALLEN_KEY_STOW_1_Y 82|g' ~/develop/Marlin/Marlin/Configuration.h
sed -i 's|#define Z_PROBE_ALLEN_KEY_STOW_1_Z.*|#define Z_PROBE_ALLEN_KEY_STOW_1_Z 23|g' ~/develop/Marlin/Marlin/Configuration.h
sed -i 's|#define DELTA_PROBEABLE_RADIUS.*|#define DELTA_PROBEABLE_RADIUS (DELTA_PRINTABLE_RADIUS - 10)|g' ~/develop/Marlin/Marlin/Configuration.h
sed -i 's|//#define AUTO_BED_LEVELING_BILINEAR|#define AUTO_BED_LEVELING_BILINEAR|g' ~/develop/Marlin/Marlin/Configuration.h
sed -i 's|#define ABL_GRID_POINTS_X.*|#define ABL_GRID_POINTS_X 9|g' ~/develop/Marlin/Marlin/Configuration.h
sed -i 's|//#define Z_PROBE_ALLEN_KEY|#define Z_PROBE_ALLEN_KEY|g' ~/develop/Marlin/Marlin/Configuration.h
sed -i 's|#define Z_PROBE_ALLEN_KEY|//#define Z_PROBE_ALLEN_KEY|g' ~/develop/Marlin/Marlin/Configuration.h
sed -i 's|//#define FIX_MOUNTED_PROBE|#define FIX_MOUNTED_PROBE|g' ~/develop/Marlin/Marlin/Configuration.h
sed -i 's|#define XY_PROBE_SPEED.*|#define XY_PROBE_SPEED 3000|g' ~/develop/Marlin/Marlin/Configuration.h
sed -i 's|#define Z_PROBE_SPEED_FAST.*|#define Z_PROBE_SPEED_FAST (HOMING_FEEDRATE_Z / 4)|g' ~/develop/Marlin/Marlin/Configuration.h
sed -i 's|#define Z_PROBE_SPEED_SLOW.*|#define Z_PROBE_SPEED_SLOW (Z_PROBE_SPEED_FAST / 2)|g' ~/develop/Marlin/Marlin/Configuration.h
#sed -i 's|//#define PROBE_DOUBLE_TOUCH|#define PROBE_DOUBLE_TOUCH|g' ~/develop/Marlin/Marlin/Configuration.h
sed -i 's|#define Z_CLEARANCE_BETWEEN_PROBES.*|#define Z_CLEARANCE_BETWEEN_PROBES  15 // Z Clearance between probe points|g' ~/develop/Marlin/Marlin/Configuration.h
sed -i 's|#define Z_MIN_ENDSTOP_INVERTING.*|#define Z_MIN_ENDSTOP_INVERTING true|g' ~/develop/Marlin/Marlin/Configuration.h
sed -i 's|//#define ENDSTOP_INTERRUPTS_FEATURE|#define ENDSTOP_INTERRUPTS_FEATURE|g' ~/develop/Marlin/Marlin/Configuration.h
sed -i 's|#define TEMP_SENSOR_0.*|#define TEMP_SENSOR_0 7|g' ~/develop/Marlin/Marlin/Configuration.h

The above works with the NPN version of the LJC18A3-B-Z/BX capacitive bed levelling sensor. If you are using a PNP sensor then enter:

sed -i 's|#define Z_MIN_ENDSTOP_INVERTING.*|#define Z_MIN_ENDSTOP_INVERTING false|g' ~/develop/Marlin/Marlin/Configuration.h

Ensure the printer's Arduino is connected via USB, then:

lsusb

And note the ID codes. We can now create a udev rule so that sudo isn't required to access the printer.

sudo nano /etc/udev/rules.d/3dprinter.rules

Add the following, changing code1 and code2 to the values you observed for the Arduino via the lsusb command.

ATTRS{idVendor}=="code1",ATTRS{idProduct}=="code2",MODE="0666",GROUP="users"

Save and exit with CTRL-o Enter CTRL-x.

Now activate the udev rule:

sudo udevadm control --reload

In the Arduino IDE under Tools/Board/Board Manager select Arduino Mega 2560

Under Tools/Port select /dev/ttyACM0

Unplug and reconnect the Arduino USB cable.

Under File/Open select the Marlin project from ~/develop/Marlin.

On the menu select Sketch then include library then manage libraries and search for LiquidCrystal. Install the first result.

Search for the library U8glib and install.

Search for the library U8g2 and install.

Select the upload button (second from left). If this doesn't work at first then try again. You should eventually see "done uploading".

Pronterface configuration

Run pronterface.

Select settings/options

Set X home pos and Y home pos to 100

Check Circular build platform.

Select settings/options/external commands

Set slice command to:

slic3r $s $o

Set Slicer options command to:

/home/$USER/develop/Slic3r/bin/slic3r --load /home/$USER/.config/slic3r/slic3r.ini --ignore-nonexistent-config

Testing the Printer

You can do the following tests to ensure that the most basic things are working.

Homing end stops and Z probe sensor

Run pronterface.

Connect to /dev/ttyACM0 with baud rate 250000.

Hold an end stop switch then enter the code M119 bottom right within pronterface.

You should see the axis end stop as open and the rest TRIGGERED.

With an NPN Z probe its state should normally be open and when close to the heatbed it should be TRIGGERED. This will be in reverse if you are using a PNP sensor.

Cooling fans

To turn on the fans use G-code M106.

To turn off the fans use G-code M107.

Check that nothing is obstructing the fans and that the airflow is towards the top of the extruder.

Homing

To test homing use the G-code G28. If an axis is moving in the wrong direction then remove electrical power to the printer and flip the motor plug around the other way, which will make it move in the opposite direction.

Manually moving

To manually move around first home with G28 and then use the code G1 X[value] Y[value] Z[value].

Bed levelling

Check that the LED on the Z probe sensor ligts up when it gets close to the heatbed and also that the bottom of the probe is a few millimetres higher than the tip of the extruder nozzle.

To start bed levelling use G-code G28 to home and then G29.

First print test

As a first test you can use the STL file in this repo, which won't waste much filament and should print a 10mm square a few millimetres in height. Adjust the slic3r ini file settings to get the best possible print quality.