Adventures in Klipper

Klipper

Let me start off by saying by no means am I an expert with Klipper, or 3D printing. I don’t really know wtf I am doing half the time, I just manage to get it working – hah! I few days ago I decided to take the plunge into Klipper with my printer, a Monoprice Maker Select v2.1 with an SKR 1.3. I had been running Marlin 2.x on my printer and it was all setup and configured and working perfectly. I decided apparently that “working perfectly” wasn’t good enough, and I needed to break it. Enter Klipper. From what I gather now that that I have a 32 bit board I wont really gain much in the way of performance with Klipper vs if I still had the 8 bit Melzi. What you do gain is a much easier way to configure the firmware over compiling and flashing the board after every change. You just save a file and reboot.

Now I wanted to document the process for others in case it helps, and I figured this would be a quick build process and a quick write up. Heheh, I was wrong. I has now been a solid week of tweaking and configuring Klipper as well as a few days of writing this post and attempting to get it finished. Every time I do something else comes along that I feel I need to add to the process. Well, I finally got it all done – I think. Now what started off as a nice clean post turned into a ton of sections that didn’t jive. I’ve done my best to make it all flow and make sense, if I missed something let me know.

 

View Post

OctoPrint-TFT on a Raspberry Pi

octoprint-tft

So I have been seeing the new kid on the block pop up a lot recently, no not that shitty fucking band. This is a new “plugin” for the famous and awesome OctoPrint, OctoPi actually – OctoPrint-TFT. I have seen the screenshots and it is looking slick I must say. A while back I tried to use the OctoPrint TouchUI plugin and didn’t have much luck with it, in the end as the Pi I had at the time was a lower model and I just found the responsiveness just too slow. Plus this gives it a nice TFT feel like it was stock and meant to be. Le’s try it. I am gonna use the same waveshare 3.5″ LCD screen I had before but this time a newer Raspberry Pi 3B+. So I wont need a WiFi dongle this time either cause its built-in.

 

Parts used

  • Raspberry Pi 3 B+
  • Waveshare 3.5″ LCD TFT screen
  • A micro SD card of course
  • Power supply and cord for the Pi
  • USB cable to connect the Pi to the printer
  • A 3D printer lol
  • A computer with some sort of SSH program or a screen and keyboard/mouse to work directly off the Pi (might work I am not sure, I used a terminal on my mac and SSH’d into the Pi).

 

Let’s Party

Let’s follow the directions from the Github page and see what happens?

After installing a fresh copy of OctoPi v0.16 I started the Github directions.

 

The file is actually “/etc/octoprint-tft-environment” not the location.

sudo nano /etc/octoprint-tft-environment
(this tidbit copied form the github page)

The basic configuration is handled via environment variables, if you are using the  .deb package you can configure it at  /etc/octoprint-tft-environment.

  • OCTOPRINT_CONFIG_FILE – Location of the OctoPrint’s config.yaml file. If empty the file will be searched at the  pi home folder or the current user. Only used for locally installed OctoPrint servers.
  • OCTOPRINT_HOST – OctoPrint HTTP address, example  http://localhost:5000, if OctoPrint is locally installed will be read from the config file.
  • OCTOPRINT_APIKEY – OctoPrint-TFT expects an API key to be supplied. This API key can be either the globally configured one or a user specific one if “Access Control”. if OctoPrint is locally installed will be read from the config file.
  • OCTOPRINT_TFT_STYLE_PATH – Several themes are supported, and style configurations can be done through CSS. This variable defines the location of the application theme.
  • OCTOPRINT_TFT_RESOLUTION – Resolution of the application, should be configured to the resolution of your screen, for example  800x480. By default  480x320.

So go to the browser on your working machine that you use and go to the Pies IP address and go thru the OctoPrint setup fun. Once done grab an API key from the config menu on OctoPrint and lets edit that config file for the OctoPrint-TFT.

Do a find -name "config.yaml" on your Pi and you will find the location of yours. Add that to the config. Host should be http://localhost . The API you grabbed from the config menu slap that where it needs to go. I left the last two alone.

It has come a long way since the last time I tried to get this screen to work. This time its is really freaking easy!

This should install with the screen to boot with the bottom being the power plug, if you want it the other way do this instead

Reboot your Raspberry Pi and make sure you get video on your LCD.

If your screen is not rotated correctly with the above command still, do the following.

And change the line for your display to add :rotate=270 as shown below

The Pi rebooted after downloading some files and holy shit! The screen is working, well it showed the boot up sequence and a login prompt. Let’s get touch working and the desktop.

sudo reboot

Let’s see?

Boot up sequence and…login prompt. Ugh. sudo raspi-config to desktop? That loads and wants lightdm, so no. TFT wants xserver, so its gonna get xserver. Lets Google and I mead Reddit. Google didn’t have shit, too new still. Found it.

Let’s try this.

He has an extras step after installing OctoPrint-TFT.

Lastly we need to remove the 99-fbturbo.conf file from our Xorg directory he says.

Now on reboot OctoPrint-TFT should load and start attempting to connect says he?

Fucken eh right it did! If you see the Octoprint image but the error says

Unexpected error: Get /api/connection: unsupported protocol scheme

As mentioned earlier I found out on the Github issues page it was mentioned there to add “http://” to the config file instead of just localhost. So make sure you did that.

If you see the “Connecting to OctoPrint” and it never goes away, don’t wait too long! It simply means it has no connection to a 3D printer at that moment. You MUST plug it in for the TFT to do its job and actually work. Incredibly confusing I know. Hopefully they’ll fix that soon, and change the message soon.

After playing with it for a few minutes (no actual printing done) I find it pretty neat, and may possibly use it in the future if my LCD screen ever loses functionality for some reason. I could disable the control boxes screen lets say and enable more features in Marlin, after I did upgrade my firmware. But I am not too sure. Requiring the tethered connection to the Pi is a drawback for me, thats way more plugs sticking out of a screen than I would like. If I had the 7″ screen to hide the goop maybe, but this wasn’t designed for those. It was perfect size on the 480×320 I ave.

Or if I do some crazy new board installed over the Melzi and I don’t have a screen. I could use this. I wanted to try Klipper out and that loses the screen but I don’t think there is support for it just yet. I am not willing to try it out at this point in time.

But that was my trick to get OctoPrint-TFT to work on my Waveshare 3.5″ TFT screen and Raspberry Pi 3 B+. Hope it helps.

 

My OctoPrint (nightmare) Setup

octoPrint

While I was digging around for 3D printer stuff I came across OctoPrint (and OctoPi). OctoPrint acts as a print server for your printer. So you don’t have to do the SD card shuffle anymore, or waste a power hungry x86 for the task. My printer is not in the same room as my computers so this works a treat. Also, it allows you to monitor the entire process. It also supports a camera to watch the build. Perfect, I have a RPi camera available. I also found a tutorial to allow OctoPrint to support turning relays off and on to control other stuff (lights, the printer itself, etc…).

(Stay with me, this post is a little erratic)

I followed this and it helped me a lot: http://www.joemiketerranella.com/post/158553998358/octoprint4

If you have a cheap eBay Raspberry Pi LCD module you will most likely need to go here http://www.waveshare.com/wiki/3.5inch_RPi_LCD_(A)

For my 3.5″ Inch “RPi LCD” I needed this: wget http://www.waveshare.com/w/upload/7/74/LCD-show-170309.tar.gz sudo apt-get update sudo apt-get upgrade  (needed to get 109mb)

Install the driver and it toggles the mode to LCD display: Note: The Raspberry Pi must be connected to the network, or else the touch won’t work properly for some reason.

Your screen should pop on to show the command line, I also got booted from my SSH session, closed by remote host – as the Pi rebooted.

The OctoPi images runs off Jessie Lite, so there is no GUI which fucking sucks, so we need to install one.

Install lightdm (needed 222mb in downloads)

sudo apt-get install lightdm sudo raspi-config

Boot Options > boot go desktop and login as ‘pi’.

Fuck didn’t work.

https://www.raspberrypi.org/forums/viewtopic.php?f=66&t=133691

sudo apt-get install --no-install-recommends xserver-xorg sudo apt-get install --no-install-recommends xinit sudo apt-get install raspberrypi-ui-mods  (needed to get 140mb, 315mb used…Jesus…)

try again to…

sudo apt-get install lightdm

startx without lightdm

no go… Fuck.

https://raspberrypi.stackexchange.com/questions/43847/startx-command-not-found

[/crayon] startx……ok? tossed errors. Lets reboot. pixman.

./scripts/install-desktop  …. didn’t work either.

Black screen and cursor… ugh damn it all. Nothing but fucking grief… Damn you Jessie Lite, and damn you for removing the GUI guts, and while I’m at it damn you OctoPrint for not having the GUI shit either…

https://github.com/foosel/OctoPrint/wiki/Setup-on-a-Raspberry-Pi-running-Raspbian

Use the image that works with the screen, that i still have or ? Well the image is Wheezy so shit, nope. Lets try a new install of Raspbian on a SD card, then add the video driver. Will we get a desktop?

So Jessie (full) and lets try the newest drivers for the screen this time?

I finally got it fucking working, and I am not happy that it took this long, and I am not happy with the unit as a whole. Most likely because I m using an RPiB2 maybe? I have also tried a RPiB and that was soooo fucking slow… to the point it was unusable with a touch screen. Might have been ok for just the OctoPrint server but I didn’t even try it I switched back to the B2 immediately.

So… load the OctoPi image (Jessie lite bastards) and once that is done, do the LCD show bullshit… it should reboot and give you a desktop…

Now the god damn camera wont work…I tried the B no go, tried the B2 no go. Tried the B2 again wtf? Oh maybe I should enable the camera via raspi-config?….wtf no where does it mention that, not anywhere… after i found a forum post saying to enable the camera it finally fucking worked…wtf guys.

Now another fucking problem… the browser. Chromium wont load, requires a kernel upgrade or some bullshit… dude wtf, I just downloaded your “complete” image. Complete my ass, I have to do extra shit then it ain’t fucking complete. Epiphany works but no supports for kiosk mode. Jesus…

Is this fucking worth it??

On top of that I hear transferring files via wifi to the SD card is horribly slow. Most people seem to just stick to using the SD card and use the screen on the printer… all for touch control and a camera…gah.

Three fucking days….solid days so far… trying to get this bullshit working.

So to get chromium to work I had to upgrade the kernel, rpi update….

Which broke the fucking LCD screen….fuck this shit. I give up. I’m going back to square one. reflashing the SD card with OctoPi (Jessie lite) enabling the camera and leaving it as is..no touch screen.

I feel depressed now, and lost three days of my life. Dont make the same mistake… or buy an official RPi screen and a new RPi 3. I would actually recommend a 7″, as the 3.5 is way too small. It doesn’t even fill the whole screen.

 

(Update: this shit was a pain in my ass. I turned out just flashing a straight copy of OctoPi to the card and running it as is. And to correct my mi-information, OctoPrint allows you to transfer files to the Pi or the printer SD card. Going to the Pi is fast, the printers SD card is where it takes FOREVER. Just don’t do it.)

 

OctoPrint and Email Notifier woes

Email Notifier Woes

Update 3-22-19: It appears that the plugin is broken, dead, and abandoned by its creator. I currently know of no other way to send notifications besides Twilio or IFTTT.

I have OctoPrint (via OctoPi) setup and I wanted a way to be notified when my print was done without constantly walking into the garage. So I searched the plugins one day and found the Email Notifier.

After I installed it I could not get it to work for the life of me. I followed the instructions of adding my username and password to the keyring but it always produced an error NameError: global name ‘keyring’ is not defined”. Tried some fixes here and there but nothing had worked. So I bailed.

I tried to install the SMS Notifier (Twilio) instead, and that seems to have broken my plugin installation manager. Great. Now whenever I try to install a plugin after I tried to install the SMS Notifier I get the error message about pip not understanding the output or some shit. Great. I have flashed an SD card 2x and tried this twice, it always causes this issue. Damn you SMS Notifier. I have not looked at their Github for a fix yet, so… (Update: it did not break my plugin manager, that was another issue.)

I went back to the Email Notifier, and this time I got it working. I spent some more time digging on the net and found the solution to the issue I had of the keyring not defined. Then… I ran into a different error of yagmail not wanting to send mail via Google because of some reason (it didn’t say exactly) just gave me the generic error code of “send-mail: Authorization failed 534 5.7.14”. Looking that up had no help. But… I did find the answers to my problems and now my Email Notifier is up and running!

I get the error message of there being a new pip version but I have ignored this so far. These are the steps I took to get it working, YMMV.

First make sure that your Google account is setup to allow less secure sign-ins.
https://support.google.com/accounts/answer/6010255

Then SSH into your OctoPrint and update yagmail then install keyring.

Install yagmail (its probably already installed but hey)
/home/pi/oprint/bin/pip install yagmail[all] --upgrade /home/pi/oprint/bin/pip install keyring --no-deps

Start OctoPrint Python
/home/pi/oprint/bin/python

then

(control+z to exit)

Reboot the Raspberry Pi for all the changes to take effect. I tried just restarting OctoPrint but that didn’t work. After the reboot I ran into another issue (of course).

“sending failed. Reason :: send() got an unexpected keyword argument “validate_email”

Modify the file init.py (__init.py__ is how it showed on my system with ls ) found in /home/pi/oprint/lib/python2.7/site-packages/octoprint_emailnotifier and change the line:
mailer.send(to=emails, subject=subject, contents=body, validate_email=False)

to
mailer.send(to=emails, subject=subject, contents=body)

(here is the fix https://github.com/anoved/OctoPrint-EmailNotifier/issues/41#issuecomment-315799836)

Places I found my answers:

https://github.com/anoved/OctoPrint-EmailNotifier/issues/8#issuecomment-187017056
https://github.com/anoved/OctoPrint-EmailNotifier/issues/27#issuecomment-295525220
https://github.com/anoved/OctoPrint-EmailNotifier/issues/27#issuecomment-302890618