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.

 

Creating a mini NES with a Raspberry Pi

Mini NES RetroPie
Mini NES RetroPie
Mini NES RetroPie

It all started with the Nintendo Classic craze. I had a friend that was rambling about one the other day. I mentioned that I could totally make him one but better because it would emulate more than just Nintendo. Enter RetroPie. I was looking at putting the bill of materials together and thinking of cases for the mini NES, then I realized why not just print one! So BAM and BAM.

 

https://www.thingiverse.com/thing:1887826 
then this https://www.thingiverse.com/thing:2011955 

Then this for giggles
https://www.thingiverse.com/thing:1710104

 

Here’s what we are doing

  1. Flashing RetroPie to an SD card for a Raspberry Pi
  2. Soldering header pins to the RUN pin holes on the RPi
  3. Soldering wires to some push buttons
  4. Soldering some wires to an LED
  5. 3D Printing a mini NES case for the RPi
  6. 3D Printing a bracket for the NES case
  7. Glueing push buttons, LED and bracket into the printed case
  8. Wiring the LED and buttons to the RPi
  9. Testing it all

 

Here’s what you need

  1. Raspberry Pi (save yourself a headache, get a RPi 3!)
  2. RPi power supply MINIMUM of 2.5A!
  3. SD card 8gb+ class 10
  4. HDMI cable
  5. USB keyboard
  6. Network cable (even though the RPi 3 has wifi you will at least need to do the initial wifi setup with a LAN connection)
  7. A 3D Printer to print the case and the bracket
  8. (2) push buttons
  9. (2) male header pins
  10. Super glue and hot glue
  11. (1) red LED
  12. (1) 100 ohm resistor
  13. (6) pieces of jumper wire with connections (you can cut some in half if long enough)

 

Whats Up

I will assume you have a network connection (non wifi) a USB keyboard a TV or Monitor or tv with an HDMI connection and that you have active internet. You will need to know how to solder, and be somewhat comfortable with a terminal and hopefully the Linux environment. I also assume you have and know how to use a 3D printer. I will also assume that you know and are comfortable with Raspberry Pies. Lots of ASSumptions.

This post is not designed as a how to install RetroPie but more of a how to get RetroPie installed and create the scripts for shutdown the Pi and lighting the LED, then you can follow the first install guide by RetroPie to get you going with the actual RetroPie software.

View Post

I am not responsible for any damage that may happen to you, your computer, or your Raspberry Pi etc. Take this adventure at your own risk.

ESP8266 and MQTT

ESP8266 and MQTT, Google that and see what happens (you most likely already did and that is how you got here). Shit is everywhere. It’s gobbin up the bandwidth of the intarwebs. And you know what? I couldn’t get any of that shit to work on my standard ESP8266-01. I have a few of them, I tried them all with all kinds of shit. I would get close but never a damn cigar (I can’t smoke it anyways). Until today for months I have been stuck on this. So if you are like me and have not been able to get the damn thing to work, for whatever reason, try this. Hope it helps.

This is the page that saved it all for me, thank these guys (I did not read or follow any guidelines on this page, I merely snagged their code):
https://developer.ibm.com/recipes/tutorials/connect-espressif-esp8266-to-ibm-iot-foundation/

I copied “mainIoTF.lua” and made some minor tweaks to get it working. I removed the orgID and changed the broker to my raspi IP address. Don’t forget to change the topic. I made those tweaks and uploaded it. BAM!! I was getting data send via MQTT to the Pi every 10 seconds.

This is what I was getting on Node-Reds debug window every 10 seconds (the number will change):  {"d": {"data":69}}

This is where it comes from, should be easy enough to modify:
m:publish(topic ,'{"d": {"data":'..t1..'}}', 0, 0,

I came back and edited this post because I hate it when I find a site that says they found the fix, but never posts it.. so heres the code. Like I said, its 99% the same code from the other site I linked/mentioned. But here it is for you anyways.