Installing Klipper on an Ultimaker Original (2023)

To keep this short and specific to the UMO I am going to assume you have installed Klipper before. Using Raspberry Pi Image flash Mainsail via Other specific-purpose OS > 3D Printing > Mainsail OS (32 Bit). Feel free to choose a hostname. I chose Ultimaker so Ultimaker.Local will provide us linux access via SSH and Mainsail access in a browser.

Login to the pi with the SSH client of your choice. Enter the following:

sudo service klipper stop
cd ~/klipper/
make menuconfig

You will likely find the settings are defaulted to your needs. Atmega AVR and atmega2560. Once set hit Q and save. Then enter make into the command line. Followed by the command to get your device id.

make
ls /dev/serial/by-id/*

In this case our device id is /dev/serial/by-id/usb-Arduino__www.arduino.cc__0042_74133353437351A0A241-if00
You will need to substitute your id but in my case the command will be:

make flash FLASH_DEVICE=/dev/serial/by-id/usb-Arduino__ www.arduino.cc__0042_74133353437351A0A241-if00

Once complete restart Klipper and proceed to your web browser to upload a config.

sudo service klipper restart

Warnings

This config will be for a stock UMO with a 1.5.7 board, UltiController and a 12×3 Leadscrew. If your printer differs from this please take some of the following into account.

Print Area
Advertised as 210x210x205 the Marlin config is 205 cubed.
XY might reach 210 with the endstops at their far positions. My X hit at 208.
Z I have set at 200 to start for safety. 205 is fine if you don’t have a magnet/sheet on the bed.

Z Speed
Keep in mind this thing is made of plywood. The Marlin config has Z homing at 4 mm/s. You can probably go a little faster with the 12mm leadscrew but I would not bump it up too far unless using the 8mm setup.

Config

The majority of this config started from a klipper help thread. Please check the Credits/Sources below for all references I used while working on my machine.

code

[mcu]
serial: /dev/serial/by-id/usb-Arduino__www.arduino.cc__0042_74133353437351A0A241-if00

[printer]
kinematics: cartesian
max_velocity: 500 #500 Stock
max_accel: 4000 #4000 Stock
max_z_velocity: 5 #5 Stock, 10 might be okay, higher hurts the plywood.
max_z_accel: 30

[stepper_x]
step_pin: PA3
dir_pin: !PA1
enable_pin: !PA5
microsteps: 16
rotation_distance: 40
endstop_pin: ^!PA0
position_endstop: 0
position_max: 205
homing_speed: 50.0
position_min: 0

[stepper_y]
step_pin: PC6
dir_pin: PC4
enable_pin: !PA7
microsteps: 16
rotation_distance: 40
endstop_pin: ^!PA4
position_endstop: 0
position_max: 205
homing_speed: 50.0
position_min: 0

[stepper_z]
step_pin: PC0
dir_pin: !PG2
enable_pin: !PC2
microsteps: 8 #Stock 1/8, 1/16 available via jumper
rotation_distance: 3 #12mm Leadscrew
endstop_pin: ^!PC7
position_max: 200 #Stock is 205, 200 for safety
position_min: -2
homing_speed: 4

[extruder]
step_pin: PL6
dir_pin: PL4
enable_pin: !PG0
microsteps: 16
rotation_distance: 23.5
gear_ratio: 49:8
nozzle_diameter: 0.400
filament_diameter: 2.850
heater_pin: PE4
sensor_type: AD597
sensor_pin: PK0
min_temp: 0
max_temp: 270

# Dual extruder support.
#[extruder1]
#step_pin: PL2
#dir_pin: PL0
#enable_pin: !PL1
#microsteps: 16
#rotation_distance: 33.500
#nozzle_diameter: 0.400
#filament_diameter: 2.850
#heater_pin: PE5
#sensor_type: AD595
#sensor_pin: PK1
#control: pid
#pid_Kp: 22.2
#pid_Ki: 1.08
#pid_Kd: 114
#min_temp: 0
#max_temp: 275

#[heater_bed]
#heater_pin: PG5
#sensor_type: PT100 INA826
#sensor_pin: PK2
#control: watermark
#min_temp: 0
#max_temp: 100

[fan]
pin: PH4
max_power: 1
shutdown_speed: 0.0
kick_start_time: 0.1
off_below: 0.1
hardware_pwm: True
#define FAN_PIN           7	>	ar7=PH4

[static_digital_output hotend_led]
pins: PB7

[display]
lcd_type: hd44780
rs_pin: PD1
e_pin: PH0
d4_pin: PH1
d5_pin: PD0
d6_pin: PE3
d7_pin: PH3
hd44780_protocol_init: True
line_length: 20
encoder_pins: ^PG1, ^PL7
click_pin: ^!PD2

[output_pin BEEPER_pin]
pin: PD3
pwm: True
value: 0
shutdown_value: 0
cycle_time: 0.001

[gcode_macro M300]
gcode:
    {% set S = params.S|default(1000)|int %}
    {% set P = params.P|default(100)|int %}
    SET_PIN PIN=BEEPER_pin VALUE=0.5 CYCLE_TIME={ 1.0/S if S > 0 else 1 }
    G4 P{P}
    SET_PIN PIN=BEEPER_pin VALUE=0

[include mainsail.cfg]

Credits/Sources


Marlin Config – https://github.com/gyohng/Marlin2-UltimakerOriginal/blob/2.0.x-UMO/Marlin/Configuration.h
Marlin Pin Reference – https://github.com/MarlinFirmware/Marlin/blob/1.1.x/Marlin/pins_ULTIMAKER.h
Klipper config for 1.5.7 – https://klipper.discourse.group/t/ultimaker-original-config-need-help/126/6
Klipper config for 1.5.6 – https://gist.github.com/JeremyGrosser/079d68fd2458c356b527be700c09efdb
Klipper config for v2 – https://github.com/Klipper3d/klipper/blob/master/config/generic-ultimaker-ultimainboard-v2.cfg

Updates

11/11/23 Added Beeper Pin and M300 Macro

For the web to be more secure Windows XP must die!

If you are reading any of my content or browsing any of the sites I host, it means you are not on Windows XP using Internet Explorer.  A lack of SNI support in all versions of IE on XP as well as a lack of support for SHA-2 certificates on Service Pack 2 or less spells incompatibility with the modern web.

More and more sites are switching to HTTPS by default.  This includes some of the most visited websites such as Google or Facebook.  As SHA-1 signed SSL/TLS certificates fall out of favor, support for older browsers and operating systems are left behind.  Projects like LetsEncrypt and services like Cloudflare aim to bring encryption to every website.  However a lack of IPv4 addresses means SNI is required to put multiple SSL websites on a single IP.  Internet Explorer on Windows XP does not support SNI period.  Making the future of IPv4 that much more bleak for an encrypted web.

Unfortunately many sites including Facebook are making the fatal mistake of allowing an SHA-1 fallback.  This renders the use of SHA-2 useless for security purposes and just saves face with modern browsers that would warn users of SHA-1.  Attackers will make use of downgrade attacks to exploit weaknesses and the cycle will continue.  However once XP and or use of IE on XP dies the world will finally be able to move on.

Configuring MySQL (5.6) for Low Memory Usage

I found myself frustrated that most guides on lowering memory usage in MySQL say to disable InnoDB.  With an InnoDB exclusive product like Xenforo this was not an option and as it turned out not necessary for low memory usage period.

I am working with Percona 5.6, this should apply to Oracle MySQL 5.6 as well as the same version of MariaDB.  Out of the box with no config MySQL was using 450mb of ram and with a config generated from Percona’s website it went up to 700mb.  But what if I told you it could be using as little as 75mb of ram and still using your favorite settings for MyISAM and InnoDB?

Apparently MySQL 5.6 preemptively allocates a lot of memory if the following 4 settings are over a certain amount:
max_connections
table_open_cache
table_definition_cache
open_files_limit

For example max_connections at 300 had MySQL starting with 150mb of memory but at 310 it allocated 450mb of memory.

However that isn’t the whole story.  This all boils down to Performance Schema. With performance_schema = off in my.cnf memory usage was down to 75mb to start and setting max_connections to 500 for example did not immediately increase memory usage.  Even with my InnoDB buffer pool at 592MB I was not seeing memory usage past 100MB in a load test.  Obviously we want MySQL to use as much memory as we can throw at it when it improves performance.  We also want to minimize unnecessary usage on a low end VPS.

So if you don’t need the data Performance Schema provides disabling it will reduce usage both at idle and load.  But keeping those 4 settings in check can also reduce usage even with it enabled.

 

Solving phpMyAdmin login issue with PHP-FPM/NGINX

If you are using multiple PHP-FPM configs you might have been unable to login to phpMyAdmin or similar software using cookie based auth.  The problem is with the session.save_path normally set in the PHP.ini.  This is set in the PHP-FPM config. Servers with per site configs containing multiple users or usergroups may be trying to use the same directory.  The problem comes from this directories owner or group not matching that of the site trying to use it.

Check the config for each site. The default is www.conf which depending on your install may be in /etc/php-fpm.d/:

; Set session path to a directory owned by process user
php_value[session.save_handler] = files
php_value[session.save_path] = /var/lib/php/session
php_value[soap.wsdl_cache_dir] = /var/lib/php/wsdlcache

The default group for my install was apache and the save path specified was owned by root:apache.  On a single config site you can chown this directory to the proper owner.  On a multiple config site the best option is to create a new directory per site and chown to that sites php handler user/group.

You may wish to use the test script in this wiki article to find what path is set – https://wiki.phpmyadmin.net/pma/session.save_path

Starting this blog…

I must be feeling all kinds -cidal. I can’t believe I just installed WordPress. I have wanted to write a front end for this site for years now. However who has time for that.

Setting up my Xenforo sales site I came to the decision I needed to blog my dev experiences out. So here we are… Nice.