Loading

MakerBot Print is our newest print-prepration software, which supports native CAD files and STL assemblies,
allows you to interact with all your printers via the Cloud, and many other exciting new features.

Download Now

morganlowe

Octoprint and GPIO Control Tutorial!

by morganlowe Jan 21, 2019
Download All Files

Thing Apps Enabled

Please Login to Comment

Hello! From day one I had that issue but didnt pay too much attention - new with PI and for some reason I have all time Low Power Voltage warning. Any idea? Your recommended convertor 12v to 5v with 3Amp I was thinking should be more than enough.

And another thing - Is there any way using your automotive system still get 3.5'' touchscreen display for board? I noticed they are using all pins the one involved in your project and wasnt sure if there is a way to get touchscreen worked! any idea? That would be super handy for control, bypassing any external switches and monitor staff from screen + remote access. thanks

On my Pis I get that warning too, even with avoid_warnings=1 in the config.txt I think Octoprint has it implemented wrong or something.

As for the GPIO pins you can change them to anything, just use that pin number in the tutorial instead of what I used. You can reference the pinouts plus most those types of displays have another 26 pin connector on them that is pass-through for GPIO.

On my Pis I get that warning too, even with avoid_warnings=1 in the config.txt I think Octoprint has it implemented wrong or something.

As for the GPIO pins you can change them to anything, just use that pin number in the tutorial instead of what I used. You can reference the pinouts plus most those types of displays have another 26 pin connector on them that is pass-through for GPIO.

Yes you can! Most those displays have a connector on the back of them with certain pins passed through. You should be able to find a schematic of those pins and just use them instead of the ones I suggested, those are simply what I used.

Good luck!

Scripts not working!
Also if i try to add manually using different plugins getting 126 Error for permission problem.
Any idea?

How did you make the scripts? They need to be made in the directory /usr/local/bin/ with the command sudo nano /usr/local/bin/printer_on.sh as an example. This writes the script with Superuser permissions. Once you are done making the scripts you need to give them execute permission with the command "sudo chmod +x /usr/local/bin/*.sh" This will set the execute bit and allow them to be run on the system.

I noticed I forgot to add that, let me know if it fixes the scripts.

Yes...works. Have to play with script because copy-paste didnt work and octoprint would start. After some white space correction all works. Thanks
Is there any way to shut completly down printers motherboard, because now when I power Off printer its disconnect 12v power to printer but motherboard still feeds from 5v usb cabel?
And can you share the wiring way and script how i can add external button for lights on/off controled by octoprint /pi pins?

Thanks and great work

Ahh yes, ok. There are ways to address the 5v thing, I will have to add them to the tutorial later. I noticed with the Pi B+ that if there's no power draw or feed on the USB it wont activate that port and detect the printer so simply cutting the power lines in the USB failed.

What I wound up doing was putting a diode on the +5v in the USB cable to prevent the current from the Pi powering the motherboard. This worked out good on my Arduino which I removed the USB fuse from and replaced with a diode.

The other way is using small relay. I used ones like these from amazon I got off Ebay I think I paid $10 for 12 of them NOS. I used two so that they are powered from the printer side with a diode to prevent backfeed from the USB. I cut a USB cable in half and connected the data lines but put each power through a relay so the 5V+ and GND on the USB are cut off when the printer power is cut.

Last thing, you want a button so you can manually turn on the lights with a button, right? I would just use the 3.3v line from the Pi and run it to the button then to the signal on the MOSFET for the light so you can just bypass it all and turn it on manually. I would have to do some trial and error programming to have the Pi read the pin and change the light, BUT I would use this tutorial and this one too to start. Seems easy enough and you wont need any special Octoprint scripts.

Found from forums easier way - inside usb cable cut 5+ red cable and it works. Data signal works no problem.

Hi and thanks for taking the time to write this up.
I have gone this route myself but I used a SSR (solid state relay) to switch the mains supply (240v) to the printer PSU rather than switching the 12/24v supply from the PSU to the printer board.

Gerry

You're welcome and thank you!

That is one way to do it however I wanted to keep away from the high voltage wiring side of things for now.