Klipper - use Raspberry Pi to offload calculations from 3D printer mainboard


Klipper is a special firmware designed to perform the heavy lifting of kinematics on a Raspberry Pi and simplify the job of the existing 3D printer mainboard. This allows very precise stepper motor timing and potentially much higher speeds.

Works with Octoprint. This allows the printer to be controlled using a regular web-browser. The same Raspberry Pi that runs Klipper can also run Octoprint.

In this video, a step by step guide to installing and configuring Klipper on an Ender 3. It includes the base set up as well as how to get a BLtouch and pressure advance working.

In the next part, I will tackle other boards and stepper motor drivers, including a Klipper specific board called the Printhat from Wrecklabs. I have tried to be as comprehensive as I can in this video but there is a lot to cover. Please read carefully through the docs I have referenced below.

Klipper Installation Guide: https://www.klipper3d.org/Installation.html

Snowflake Example SQL

/**** ACCOUNT    ***************************************/
/* Show user SQL history with time and credits used */
use role accountadmin;
use database snowflake;
use schema account_usage;
use warehouse interactive_wh;
alter session set timestamp_output_format = 'YYYY-MM-DD HH:MI:SS';
select start_time, query_type, user_name, warehouse_name, to_number(total_elapsed_time/1000,10,2) as seconds, warehouse_size, (CREDITS_USED_CLOUD_SERVICES*300) as cost, query_text
from snowflake.account_usage.query_history
where warehouse_size is not NULL
--and query_type = 'SELECT'
--and warehouse_name = 'XXXXX'
--and role_name = 'XXXXX'
--and user_name = 'XXXXX'
order by 4 desc;

use role accountadmin;
use database snowflake;
use schema account_usage;
use warehouse interactive_wh;
select start_time, query_type, Role_name, user_name, warehouse_name, to_number(total_elapsed_time/1000,10,2) as seconds, bytes_scanned, rows_produced, rows_inserted, (CREDITS_USED_CLOUD_SERVICES*300) as cost, query_text
from snowflake.account_usage.query_history
where query_type <> 'GET_FILES'
and query_type <> 'PUT_FILES'
and query_type <> 'SHOW'
and to_date(start_time) between '2020-07-09' and '2020-08-25';

/* show space taken by tables */
select table_name, table_schema, to_varchar(active_bytes/1024/1024, 'F999,999,999,999.9') as Mbytes from snowflake.account_usage.table_storage_metrics
order b

Redshift locked tables

Redshift: Detect and Cancel Long running queries Per User Connection

Troubleshooting in Redshift

Show locked tables, highlight the query and run it, copy the pid

Show Locked Tables

/* Show locked Tables */
FROM pg_locks l 
JOIN pg_catalog.pg_class c ON c.oid = l.relation
JOIN pg_catalog.pg_stat_activity a ON a.procpid = l.pid
WHERE l.pid <> pg_backend_pid();Show locks, oldest first

Kill Session (note change "pid" to a process with a lock from above)

/* kill session, Redshift ends session and rolls back all transactions that are associated with it. */
select pg_terminate_backend( pid )

Show locks, oldest first

Docker on Ubuntu 20.04.01 Tips

Don't install Docker from the Ubuntu software app, instead:

Follow this guide from Docker

$ sudo apt install docker.io

$ sudo apt-get install docker-compose

Verify install

$ docker–compose –version

Verify Docker

$ sudo docker run hello-world

To remove docker-compose

$ sudo apt-get remove docker-compose

$ sudo apt-get autoremove

Show all Docker container names and IP addresses

$ docker inspect -f '{{.Name}} - {{.NetworkSettings.IPAddress }}' $(docker ps -aq)

List Docker Images and Containers

To display a list of all Docker images stored locally:

$ sudo docker images ls –a

The –a option shows all docker images. You should see a listing with the hello-world image.

To see a list all containers use:

$ sudo docker ps -a

To view all currently running containers:

$ sudo docker ps

Note that this list is empty. This shows you that once the hello-world image completes, it closes out automatically.

Remove a Docker Image and Container

To remove a Docker image, you need to know its IMAGE ID. Use the command for listing images from the passage above to copy that information.

VNC connection to Raspberry Pi "Unknown authentication scheme from VNC server: 13, 5, 6, 130, 192"

Trying to connect to VNC on Raspberry Pi 4b from Ubuntu gives the following error: 

Unknown authentication scheme from VNC server: 13, 5, 6, 130, 192

In VNC Server on Raspberry Pi 3

Go to the options on the VNC Server on Raspberry Pi 3 and you should have the sudo credentials when you started VNC server

Change the security authentication to VNC Password as shown belowVNC Options

Finally you need to add a user to use it to connect. In my case I created an administrator user (default username was admin)

In Remmina on Ubnutu

You will create a new connection with the given IP address of the Raspberry Pi on your local network (you should be able to know it using ifconfig) and using the admin user credentials created on VNC server as the following: Remote Desktop Preferences

Tinkercad meshes are limited to 300,000 triangles

This shape's mesh is too complex. Tinkercad meshes are limited to 300,000 triangles.  Try simplifying the mesh before re-importing it.

Sometimes a STL file has too much detail for Tinkercad.  If you just want to view what is in the file you can try gmsh.

$ sudo apt install gmsh
$ gmsh &

MeshLab, open source and free for Windows, Mac and Linux

Polygon reduction with MeshLab

Mesh reduction


$ sudo apt install meshlab

or Download MeshLab

From the menu, select Filters > Remeshing, simplification and construction > Quadratic Edge Collapse Detection. If your model is textured, there is also an option (with texture) that will do a good job at keeping your textures positioned properly. A panel with a few options will show up. 

Here are the optimal option settings: