PC + FT232H as GPIO for plugins?

What is the problem?
So I'm trying to run OctoPrint on a laptop I have lying around, and eventually build a cheap PC for it since I'm noticing a big difference in print quality after switching from my RPi4 (4gb RAM). My only issue is that now the plugins I used to use for my LEDs and Emergency Stop button used the GPIO on the Pi, which, obviously, a computer does not have. I'm wondering if I can somehow use the Adafruit FT232H board I have also lying around to add GPIO to the PC. Not sure if this would require redoing each plugin individually to utilize the new GPIO implementation, or if it might be any bit easier than that?

What did you already try to solve it?
Not much, wondering if anybody has experience with similar situations before I just start winging it.

Additional information about your setup (OctoPrint version, OctoPi version, printer, firmware, what kind of hardware precisely, ...)
RPi 4 4GB w latest OctoPi
Lenovo Thinkpad Edge i3 w/ 4 or 8GB RAM (not a fantastic laptop by any means) w/ latest OctoPrint
Adafruit FT232H Breakout Board
Plugins in question:
Emergency Stop Simplified
RGB Status

CR-10 w/ Stock Mainboard w/ Custom Marlin 2.0 (for now, will be upgrading to SKR 1.4 Turbo as soon as it arrives in the mail)

Moin.
Iss ja witzig. Ähnliche Überlegungen habe ich auch.

Meine bisherige Recherche:

Beschreibung/Anwendung mit Adafruitprodukten: https://learn.adafruit.com/circuitpython-on-any-computer-with-ft232h
@bepstein have you seen this?

Na ja und der PC, den ich verwenden möchte, ist ein Fujitsu FUTRO S550. FUTRO Datenblatt

Bisheriger Projektname für meine Überlegungen "FutrOcto". :grinning:
Ein Prototype läuft bereits mit UBUNTUserver 20.x, Octoprint und einer MS LifeCam HD-3000, der einen FLSun QQ-S pro steuern soll.

Denkbar sollte der Anschluß und Auswertung verschiedenster Sensoren (I²C, SPI) an den FutrOcto sein.

Integration in die Octoprintumgebung sollte rel. einfach sein, da auch Pyton. Allerdings bin ich kein Coder und habe im Umgang mit Programmzeilen 2 linke Hände.

Meinungen?

Gruß

1 Like

Moin.

More Brainfood rund um den FTDI FT2x: Installing pyftdi on Ubuntu 18.04 for FT232H and FT2232H boards

Gruß

A serial port usually has at least 1 in and 1 out (CTS etc.) which I guess Python on a PC should be able to access.

Perhaps thats what the German guy posted according to google "Iss ja witzig. Ähnliche Überlegungen habe ich auch." means "Eat funny. I have similar thoughts." so I guess the translation may not be word perfect

"since I'm noticing a big difference in print quality after switching from my RPi4" Any chance of more details?

1 Like

What do you mean?

Does this have anything to do with the incoming posting?
I am using https://www.deepl.com/ to translate

Greetings

No Nordrunner, that was a question to the original poster, bepstein.

Wow i thought this topic was deadzo! I was noticing that on small circles, the printer would occasionally pause before continuing on, sometimes for up for 10 seconds. After switching to a PC, the problem went away. Been great ever since. @Nordrunner inspired me to begin working on a plugin today, although I have no experience with it whatsoever. I got as far as implementing the settings page and building the package, but now I'm stuck on actually activating the e-stop. I can read the state of the button just fine via digitalio. Any assistance would be super appreciated!

1 Like

Eyes on you! :grin:

I have this module

Hint: https://learn.adafruit.com/circuitpython-on-any-computer-with-ft232h/gpio#digital-input-3041149-18

Greetings

I know, reviving old threads. I have been working on trying to get this working as well for about as long as this thread has existed. I also use an old computer with Ubuntu on it to run OctoPrint for my Ender-3. I would love to be able to have GPIO functionality for all the other fun stuff it enables.

I have the dependencies installed and working, both inside the virtual environment that has octoprint installed, and outside just in ubuntu. I just can't seem to get a plugin to access the FT232H no matter what I try. Maybe this bump may bring it to the attention of a few others who may have made some progress on this front as well. Sorry reviving it. I'm just starting to get a bit of time again to work on it.

Okay, again replying to the old thread.

with the help of jneilliii on the discord, we have got some progress getting the FT232H working.

Within the virtual machine environment, you have to install pyftdi and adafruit-blinka. You have to make sure the "export ADAFRUIT_FT232H=1" command has been issued as well.

if you manually start octoprint, you can get plugins to work using the FT232H. I'm just trying to figure out how to get the export command to issue automatically at startup. I'm trying to figure out how to get octoprint to start as a service and have the plugins work, because thats a roadblock i am gitting now.

okay. I got it figured out with some very good help from jneillii.

Install OctoPrint on Ubuntu following these instructions:

Setting up OctoPrint on Ubuntu 20.04 with Python 3 | Illuminated3D

At the part where you make the script to start as a service, don't do that yet. go ahead and install adafruit-blinka while still in the venv you already have open from installing octoprint. use these instructions:

Linux | CircuitPython Libraries on any Computer with FT232H | Adafruit Learning System

now, add the environment variable to /etc/environment using the text editor of choice and add "BLINKA_FT232H=1" to the second line.

next step is to create the service but to use systemd/systemctl to create it. Create a file at "/etc/systemd/system/octoprint.service", and put the following code in it, making sure to update the user and the path parts of the file if you didn't install octoprint at the default user "pi".

[Unit]
Description=Octoprint Server
After=network.target
[Service]
Type=simple
Restart=always
RestartSec=10
User=pi
ExecStart=/home/pi/OctoPrint/venv/bin/octoprint serve --port=5000
Environment=BLINKA_FT232H=1
[Install]
WantedBy=multi-user.target

save that, then run

"sudo chmod 777 /etc/systemd/system/octoprint.service"

and finally run

"sudo systemctl enable octoprint"

I have installed a subplugin for psu control written by jneilliii that uses a pin on the FT232H to run an led. The LED is installed on C0 on the FT232H breakout board. I commented out the "os.environ["BLINKA_FT232H"] = "1"" on line 10, not sure if that matters or not. The script is here:

https://gist.githubusercontent.com/jneilliii/d218c2b3e02f603002169686a346b508/raw/93c557c3b0c8a7c9615ce781f5509e5c99e30f7d/psucontrol_subpluginblinka.py

If you install PSUcontrol and that subplugin, it will turn the led on and off.

In your plugin, if you add "adafruit-blinka" to the setup.py, and install octoprint/adafruit-blinka in the way i laid out, and figure out how to get the button press to call the M112 command, it should work for you.

I hope some of this helps you out.

Amazing work! I kept getting updates on this thread and wanted to reply with suggestions each time, but before I could there was a new update posted in which you did exactly the thing I was going to recommend, so this definitely saved me a decent amount of time and energy. Thank you for your hard work, and well done. I’ll take a look at this when I have a moment and see if there are any additions I can make!

We were able to get a fork of OctoLight working as well with the FT232H device. Not sure if @Mike_Gyver has updated the repo with the latest changes, but it's over here.

1 Like

why yes @jneilliii, the code on github is updated for the OctoLight FT232H plugin.

I have started to look into getting your plugin working as well, @bepstein

I had to double check that it was working and updated. I uninstalled the octolight plugin then reinstalled the zip i had, and it failed. i just spent 30 minutes troubleshooting the fact that i unplugged the ft232h to design a case for it....

1 Like

Sounds like something I would have done! I wouldn’t even bother with mine, i never even started working on it, i think it’s just a fork of the plug-in template still

I have one made up. I will test it tomorrow. It's a bit late, and I don't feel like wiring up a button right now. Plus, i am going to install octoprint locally on the computer I use to make stuff, so I can work on it a bit easier.

This method we figured out should work with the FT2232H as well, as it is just 2 FT232H's in one package. There is some stuff on the adafruit forums regarding using this instead of the FT232, but it was all the same really, so it would be no issue to get plugins working with it as well.

Here is one working as an emergency stop. The default Button is on pin D4.

oldmanbluntz/OctoPrint-EmergencyStopFT232H (github.com)