BLTouch on CR-10

September 12th, 2021

The bed on my CR-10 printer is definitely not flat.  It seems to be higher around the edges then dip down in the middle.  For small prints, it's OK but the larger ones are more troublesome since the level changes enough to mess up the first layer.  

I found out that there is a bed leveling sensor that Creality makes for the CR-10 called the BLTouch and they only run about $40.  I bought one and tried to follow the included instructions to install it.  Unfortunately, all the website links in the documentation resulted in 404 errors.  I wrote to Creality's support departmant and got a response back but it was very generic and still did not have include necessary information such as where to download the firmware or the progisp program used to flash the firmware to the memory of the CR-10.  

I used a mix of information from a number of sites to get it installed, install new firmware to work with the BLTouch and figure out how to configure it properly.  

These are the links that Creality support sent:

CR-10 ISP Wire brush firmware tutorial
Service tutorial CR 10 online print
Service tutorial CR 10 the BL Touch installation

And here are a number of other relevant links.  The first two were the most helpful.

Installing BLTouch Auto Bed Leveling On The Creality CR-10 3D Printer
BLtouch for any 3D printer - Comprehensive step by step guide
Creality BL Touch Auto Bed Leveling Sensor Installation Tutorial
Marlin 2.0.x firmware - Add preheat profile?
Help! After installing BLTouch, cannot get nozzle close enough to bed to print.

I ended up using the TH3D Unified 2 firmware and compiling my own firmware.  

TH3D CR-10 Firmware
Creality BL Touch Probe Mount Offsets (Metal Bracket)

When all is said and done, these are the steps I used to calibrate the Z-offset:

Use the terminal window in Octoprint.

Send the following commands:

M502 ;reset printer settings to default
M500 ;save default settings
G28 ;home head to middle of bed
G1 F60 Z0 ;move printer head to absolute zero position (defined by EEPROM settings)

Lower Z axis in .1 increments until print head lightly touches piece of paper between print head and bed.  Go back to home screen and note the position of the Z axis.  Enter that number in the M851 command below for +/-x.x

M851 Zx.x ;Z offset - Note that for negative numbers it will be Z-x.x
M500 ;save default settings

 

Arch Linux Information

September 4th, 2021

Python

September 2nd, 2021

Lately I've written several Python programs.  I'm going to document links to a number of general/common tasks here and try to add some degree of organization to them.

XML / BeautifulSoup4
set XML attribute value with BeautifulSoup4
How to Parse XML Files Using Python’s BeautifulSoup
Changing element value with BeautifulSoup returns empty element

RegEx
Python regex multiple search

Python SFTP
pysftp Cook Book
pysftp 0.2.9
How to check if a file exists in ftp with pysftp?
Verify host key with pysftp
PySFTP connection works but get() fails

Audio
Sound alarm when code finishes
Play a Sound with Python

Files
Copy / Move Directory - distutils.dir_util
Recursively copy an entire directory tree - shutil
Move, copy, delete and rename python files and folders
How to read a file line-by-line into a list?

Excel Files
Reading an excel file using Python openpyxl module

CSV Files
How to update rows in a CSV file

Zip Files
How to create a zip archive of a directory in Python?
Create (zip) archive using shutil

Config Files
configparser — Configuration file parser
Change value in ini file using ConfigParser Python

Command Line Arguments
Python argparse - the Perl Getopt equivalent
Argparse Tutorial

Database
Using Bind Variables
Executing a SQL Statement with bind variables on Oracle with Python
Oracle Database Connection in Python
export oracle query result set to excel sheet using python script in linux os

Oracle Pandas (dataframe)
CX_Oracle - import data from Oracle to Pandas dataframe
pandas-oracle 2.1.4
Pandas Oracle
Working with Python Pandas and XlsxWriter
Display the Pandas DataFrame in table style

Docker
Python Docker official image

Unicode / UTF8 / Language Codes
Python3 Chinese file read write method
How to auto detect text file encoding?
Character detection in a text file in Python using the Universal Encoding Detector (chardet)
python utf-8-sig BOM in the middle of the file when appending to the end
Unicode (UTF-8) reading and writing to files in Python
UnicodeDecodeError: 'charmap' codec can't decode byte X in position Y: character maps to <undefined>
UnicodeDecodeError: 'utf8' codec can't decode byte 0x9c
Unicode HOWTO

Strings
string — Common string operations
Python: Check if String Contains Substring
Converting from a string to boolean in Python?
Remove all special characters, punctuation and spaces from string

Tk/tkinter
Visual TK

General
Create object from class in separate file
Yes/No prompt in Python3 using strtobool
How to convert a file into a dictionary?
Python Dictionary – Create, Append, Update, Remove
What does a b prefix before a python string mean?
What does the if __name__ == “__main__”: do?
Understanding if __name__ == “__main__” in Python
How to print without newline or space?
How to install packages using pip through corporate proxy with configuration script?
How to Install Python 3.9 on CentOS/RHEL 7 & Fedora 32/31
Extract file name from path, no matter what the os/path format
How to Do Ternary Operator Assignment in Python
Ignore KeyError and continue program
Switch Case in Python (Replacement)
Check if a large file exists without downloading it
Handling Exceptions

NUT UPS Monitoring Software

August 27th, 2021

I have a number of UPSes deployed throughout the house to mitigate power outages.  Most of the UPSes supply power to more than one system so automated shutdown has been an issue.  I recently found an article on setting up NUT (Network UPS Tools) on a Raspberry Pi to monitor a UPS and allow multiple clients to automate shutdown from a shared UPS.  Additionally, I can now monitor the UPS state via a web page and even monitor and add automation via Home Assistant.  

Note: there is some sort of issue with the USB timing on boot.  The workaround is to unplug and replug the USB connections then restart the nut-driver service.

Network UPS Tools
How to Monitor UPS with Raspberry Pi
Monitor a UPS with a Raspberry Pi Zero W
Best NUT (Network UPS Tools) clients (for Windows)?
NUT UPS on Windows 10
Windows NUT client
Alert via SMS on power failure and hibernate the system
[Guide] Using NUT to power down multiple systems
How to hibernate Windows from command line
NUT
Configure NUT Sensor on Home Assistant
Windows 10 UPS NUT Client to Hibernate that actually works?
Network UPS Tools (NUT Server) Ultimate Guide
NUT Download Information
Please improve Windows port documentation/packaging #262
Detailed NUT Configuration
Network UPS Tools (NUT)
Raspberry Pi NUT Server
How to stop nut broadcast messages
Trouble starting Network UPS Tools with a Eaton 3S UPS
Problem to get data from UPS (nut "Error: Data stale")
Windows NUT client
NOTIFYCMD doesn't work from Windows service
Low Battery event not occurring
How to change battery low for ups in nut server
Modifying NUT UPS shutdown delay

HA SwitchPlate - HASPone

August 27th, 2021

The HASPone is a DIY in-wall Touchscreen Home Assistant Controller.  I've built one and haven't had a chance yet to figure out the best way to put it to use.  Here are a number of links I used in the process.

HA SwitchPlate HASPone: DIY In-Wall Touchscreen Home Assistant Controller
HASPone Core Functionality Blueprint
HA SwitchPlate HASPone
Project Enclosure
3D Printable Models
Bill of Materials
Home Assistant Automation Example
Flash firmware to ESP8266
Automations for handling Scene select buttons on page 1