Archiv des Autors: hamster

3D Printer auto leveling print bed

In the last post about reactivating my 3D printer I stopped at installing the new inductive sensor.

After installing I tried it with my glass plate but that didn’t work very well so I removed the glass plate.

I struggled with the auto leveling tutorial mentioned in the last post, because the marlin firmware evolved quite a bit since then and I couldn’t find all those options mentioned in the tutorial. Basically I followed step 1 and skipped the rest.

The changes from my previous Configuration.h to the new one with auto leveling configured are (uncommented lines):
#define Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN
#define USE_PROBE_FOR_Z_HOMING
#define NOZZLE_TO_PROBE_OFFSET { -30, -30, -1 } (the nozzle offset is -30mm x-wise, -30mm y-wise and -1 z-wise)
#define PROBING_MARGIN 30 (increased from 10 to 30 because the bed leveling stopped/failed when the probe was almost outside the aluminium bed)
#define AUTO_BED_LEVELING_UBL
#define RESTORE_LEVELING_AFTER_G28
#define Z_SAFE_HOMING
#define EEPROM_SETTINGS

After it compiled successfully I followed the guide from marlin:

M502            ; Reset settings to configuration defaults...
M500            ; ...and Save to EEPROM. Use this on a new install.
G28             ; Home XYZ.
G29 P1          ; Do automated probing of the bed.
G29 P3 T        ; Repeat until all mesh points are filled in.
G29 F 10.0      ; Set Fade Height for correction at 10.0 mm.
G29 A           ; Activate the UBL System.
M500            ; Save current setup. WARNING: UBL will be active at power up, before any [`G28`](/docs/gcode/G028.html).

My new sensor at work 🙂

youtube-dl aborts download of video even with retry set to infinite

I found it on stackoverflow. Here for reference a powershell loop that starts youtube-dl till it is finished without an error.
Do { .\youtube-dl.exe --all-subs --continue -R infinite https://www.bbc.co.uk/iplayer/episode/p093wpgw/cant-get-you-out-of-my-head-series-1-1-part-one-bloodshed-on-wolf-mountain } until ($?)

Prusa i3 Hephestos 3D printer again after some years

After some years I finally decided to bring back my 3D printer from my basement. The only productive thing I ever did with it was to replace a part of my Denon AH-D1100 headphone. The headphone has a predetermined breaking point with those weak plastic constructs. I first tried to replace the earcup brackets with this thing https://www.thingiverse.com/make:223203 and the endresult was quite promising (printed with PLA)

Too bad that it broke again where the earcup is connected to the headband.
Even filling the holes and surroundings with epoxy was doomed to fail.
It worked for about 4 years. Longer than the original but not satisfying.

And I don’t want to throw away those headphones just because some plastic is broken. So years after first creating those I researched thingiverse for any updates on that matter…. and got lucky 🙂

Someone who seems to have shared experiences with failure with other „fixes“ really created something new for my headphones. https://www.thingiverse.com/thing:4603540

During reenabling my 3D printer I got curious about what has happened since abandoning my printer in the basement.

The first thing I purchased a heatbed, insulation mat, PETG filament, printing surface and a new power supply.
The heatbed because I remembered having a lot of warping.
The PETG because the guy on thingiverse said it is more robust and other good stuff about it.
The printing surface because I was working with hairspray years ago and that worked so so.

The power supply died on the first day so I ordered another one that sill holds.
The heatbed was slightly uneven and I had to use my glass plate on top of it. Currently I print without the new printing surface and it works quite well.

Luckily my Orange Pi was still lying around and someone had created an AUR package for the newest OctoPrint, nice.
Next was the update of the Marlin firmware for my bq Prusa i3 Hephestos.
I first tried the official bq firmware from github and enabled heatbed support almost like the tutorial here. Adding the power cable to D8 and the thermistor cable to T2. I also had to modify the heatbed thermistor cable connector so it fitted on the T2 pins.
The new firmware worked and also the heatbed, but after some minutes there where lost USB connections. Sometimes after 15 minutes, sometimes after half an hour.
I suspected the old Marlin bq firmware so I was looking for the official Marlin repository on github.
They even have the Configuration.h for my printer, so not too much work customizing or merging the old Configuration.h with the newer one.
I first tried to adapt the building procedure with Arduino IDE but failed miserable.
There were missing dependencies and other bugs when building.
Then I tried the vscode platformIO version and it worked immediatly (after setting TEMP_SENSOR_BED to 1 and TEMP_SENSOR_1 back to 0. The tutorial from above got that wrong) and the dependencies just got downloaded without needing to do it manually, nice.
With the newest Marlin I still got the USB disconnects.
The error was shown in the kernel logs like:

Mar 2 17:07:14 orangepiplus2e kernel: [269172.289411] usb usb7-port1: disabled by hub (EMI?), re-enabling…
Mar 2 17:07:14 orangepiplus2e kernel: [269172.295779] usb 7-1: USB disconnect, device number 3
Mar 2 17:07:14 orangepiplus2e kernel: [269172.301677] ftdi_sio ttyUSB0: error from flowcontrol urb
Mar 2 17:07:14 orangepiplus2e kernel: [269172.312715] ftdi_sio ttyUSB0: FTDI USB Serial Device converter now disconnected from ttyUSB0
Mar 2 17:07:14 orangepiplus2e kernel: [269172.327059] ftdi_sio 7-1:1.0: device disconnected
Mar 2 17:07:14 orangepiplus2e kernel: [269172.666095] usb 7-1: new full-speed USB device number 4 using ohci-platform
Mar 2 17:07:15 orangepiplus2e kernel: [269172.911610] usb 7-1: New USB device found, idVendor=0403, idProduct=6001, bcdDevice= 6.00
Mar 2 17:07:15 orangepiplus2e kernel: [269172.919950] usb 7-1: New USB device strings: Mfr=1, Product=2, SerialNumber=3
Mar 2 17:07:15 orangepiplus2e kernel: [269172.930667] usb 7-1: Product: FT232R USB UART
Mar 2 17:07:15 orangepiplus2e kernel: [269172.940302] usb 7-1: Manufacturer: FTDI
Mar 2 17:07:15 orangepiplus2e kernel: [269172.947236] usb 7-1: SerialNumber: AI02CZOJ
Mar 2 17:07:15 orangepiplus2e kernel: [269172.959920] ftdi_sio 7-1:1.0: FTDI USB Serial Device converter detected
Mar 2 17:07:15 orangepiplus2e kernel: [269172.970583] usb 7-1: Detected FT232RL
Mar 2 17:07:15 orangepiplus2e kernel: [269172.981257] usb 7-1: FTDI USB Serial Device converter now attached to ttyUSB0

The OctoPrint log said:

2021-03-02 21:11:17,721 - octoprint.util.comm - INFO - Communication timeout while idle, trying to trigger response from printer.
2021-03-02 21:12:04,752 - octoprint.util.comm - ERROR - Unexpected error while reading from serial port
Traceback (most recent call last):
File "/opt/octoprint-venv/lib/python3.9/site-packages/OctoPrint-1.5.3-py3.9.egg/octoprint/util/comm.py", line 3831, in _readline
ret = self._serial.readline()
File "/opt/octoprint-venv/lib/python3.9/site-packages/OctoPrint-1.5.3-py3.9.egg/octoprint/util/comm.py", line 6455, in readline
c = self.read(1)
File "/opt/octoprint-venv/lib/python3.9/site-packages/pyserial-3.5-py3.9.egg/serial/serialposix.py", line 595, in read
raise SerialException(
serial.serialutil.SerialException: device reports readiness to read but returned no data (device disconnected or multiple access on port?)
2021-03-02 21:12:04,759 - octoprint.util.comm - ERROR - Please see https://faq.octoprint.org/serialerror for possible reasons of this.
2021-03-02 21:12:04,797 - octoprint.util.comm - INFO - Changing monitoring state from "Operational" to "Offline (Error: SerialException: 'device reports readiness to read but returned no data (device disconnected or multiple access on port?)' @ comm.py:_readline:3831)"

There is a help topic for OctoPrint when one has randomly USB disconnects and how to debug.
Since I only had a spare USB cable I tried that and what a surprise… it worked and never got a disconnect anymore. I was lucky there 😀

I just forgot how anoying the surface leveling was, so the next thing is to install an auto level sensor LJ18A3-8-Z/BX.
I found a tutorial for how to install a auto level sensor, will try.
So today (03 March 2021) I print a sensor holder for my printer and see if everything works out 🙂

Update 05 March 2021:
My glassplate doesn’t work that well. Trying the new printing surface.

How to make a full adb backup with a broken android phone screen

With a broken screen and not a absolutely up to date backup I wanted a complete backup with everything to the latest.
I was able to unlock my phone with my fingerprint but couldn’t see anything besides a black screen.
Searching for a tool to backup I found a blog post that helped a lot because I also wanted to use Titanium Backup to restore apps and other data. The command is:
.\adb.exe backup -f FullBackup.ab -apk -all
(oh my, am I happy to have usb debugging enabled already)

Update 2019-07-28:
Not that easy with the adb Backup. The restore didn’t work with the backup I made above.
Searching for answers I found a post on stackoverflow that explains a bit more on how to verify a adb backup. I haven’t tried it and my backup is encrypted so I propably should try https://github.com/nelenkov/android-backup-extractor
https://lyubomyr-shaydariv.github.io/posts/2016-08-27-when-android-backup-and-restore-tools-may-fail/
Also Titanium Backup didn’t work. Fuck Android and their backup/restore capabilities.

My phone is encrypted so the adb command asked on my phone for a password to encrypt my backup. I could enter the password with the command
.\adb.exe shell input text <password>
and selecting the „start backup“ button with two tabs:
.\adb.exe shell input keyevent 61
.\adb.exe shell input keyevent 61
and finally „press“ enter with:
.\adb.exe shell input keyevent 66
(more keyevents can be found here)

Later I found a java tool called AndroidScreencast that allowed with the help of adb to connect to my phone and cast my screen to a small window where I could use my mouse and keyboard to navigate 🙂

1&1 Digital TV Senderliste ohne großen Schnickschnack

Da Senderliste von 1&1 ein Graus ist zum ausdrucken, habe ich sie mal aufgeräumt.
Vielleicht kann jemand noch was damit anfangen:
Aufgeräumte 1&1 Digital TV Senderliste zum Drucken
Update 28.08.2018:
Kaum erstellt man die abgespeckte Datei ändert sich die Senderreihenfolge.
Hier die neue Senderliste gültig ab 28.08.2018.

Hier ist das Original: https://hilfe-center.1und1.de/bin_dea/article/797115/Senderliste_SD.pdf

Install Arch on OrangePi Plus 2e

There is already a howto on how to install Arch on a Orange Pi One.
The only difference for me was to compile it with another OrangePi defconfig and toolchain with hardware float (apt-get install gcc-arm-linux-gnueabihf).
You can find the appropriate defconf for your OrangePi here.
The config for u-boot looks like:

make -j4 ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- orangepi_plus2e_defconfig
make -j4 ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf-

The only thing that didn’t work was the wifi adapter. I found an aur repository for the kernel module. It uses the same git repo as this howto.

After the restart the right kernel module was loaded and wifi worked, yeeeehaaaa 🙂
More information about the OrangePi Plus 2E.

compile a cuda program with gcc-6

If one experiences this example message while compiling:

/usr/local/cuda/include/crt/host_config.h:119:2: error: #error -- unsupported GNU version! gcc versions later than 6 are not supported!
 #error -- unsupported GNU version! gcc versions later than 6 are not supported!
  ^~~~~

Try the flag CUDA_NVCC_FLAGS and set the gcc compiler to version 6:
cmake -D CUDA_NVCC_FLAGS="-ccbin gcc-6" .. && make

awk script to remove objects from a pdf

First uncompress the pdf if it is compressed with pdftk:
pdftk myfile.pdf output unc.pdf uncompress

Then remove all objects that contain the keywords PDF-XChange|pdfxviewer.com|PDFXCViewer20|Click to buy NOW:

awk '
    BEGIN {
        found=0
    }
    {
    if ( $0 ~ /^[0-9 ]+obj/ ) {
        objectFound=1;
        objectLineCounter=0;
        objektZeilen[objectLineCounter]=$0;
        objectLineCounter++;
    } else if (objectFound == 1) {
        objektZeilen[objectLineCounter]=$0;
        if ( $0 ~ /PDF-XChange|pdfxviewer.com|PDFXCViewer20|Click to buy NOW/ ) {
            found=1;
        }
        if ( ( $0 ~ /endobj/ ) && ( found == 0 ) ) {
            for (i=0; i<length(objektZeilen); i++) {
                print objektZeilen[i];
            }
            delete objektZeilen;
            objectFound=0;
            found=0;
        }
        if ( ( $0 ~ /endobj/ ) && ( found == 1 ) ) {
            delete objektZeilen;
            objectFound=0;
            found=0;
        }
        objectLineCounter++;
    } else {
        print $0
    }
    }
' unc.pdf > test.pdf

Recompress and repair pdf with pdftk:
pdftk test.pdf output comp.pdf compress

Too bad it also removed the OCR layer. I couldn’t find out which layer is responsible for the OCR.

extract all rars in all subdirectories with find

Findet alle multipart rars in allen subdirectories von . außer dir1 und dir2 und entpackt in dem Ordner die Dateien.


find . \( -path "./dir1" -o -path "./dir2" \) -prune -o -name '*.r00' -execdir unrar x {} \;

Wenn schon Dateien vorhanden sind, die nicht überschrieben werden sollen:


find . \( -path "./_GameRetroPacks" -o -path "./_Konsol" \) -prune -o -name '*.r00' -execdir bash -c "echo E | unrar x {}" \;

Löschen aller Rardateien in allen Unterordnern:


find . -regextype posix-extended -iregex ".+\.r[0-9ar]{2}" -exec rm {} \;

Create a guest WLAN with OpenWrt

It’s enough to do it like this tutorial says:
https://wiki.openwrt.org/doc/recipes/guest-wlan-webinterface

If you want a log of the surfing history for maybe avoid being held responsibly for the things your guest does (Störerhaftung) you can log the DNS queries:
https://superuser.com/questions/632898/how-to-log-all-dns-requests-made-through-openwrt-router/897413#897413

Now you need a rsyslog server that collects those logs:
https://kimkil.nietsniehu.net/raspberry-pi-as-a-log-server-with-rsyslog-2/