Notifications
Clear all

How to use GPIO connection  

  RSS
Jules
(@jules)
Active Member
How to use GPIO connection

I'm trying to use the GPIO pins of the MK3 to read error messages if there is one. But I don't want to use octoprint or even a raspberry Pi if I can avoid it, I'd rather use a Arduino board. What I want to do is to check through the GPIO pins if there is a error message and then send a message from my arduino to my phone. I searched for a while but I can't seem to find any documentation on how to connect to the mk3 or even the pin layout. Does anyone have an idea of the pin layout and the connection protocol?

Posted : 25/06/2019 9:22 pm
Nikolai
(@nikolai)
Noble Member
RE: How to use GPIO connection

Hello Julian,

Not sure why you're trying to solve a problem which is already solved (with raspi/octopi/apps) but here are some ideas to your project.

First of all the current MK3 firmware does not report any error states to free GPIO pins. This is the first step you need to clarify. Who is reporting what and how.

This is a pinout of the einsy board

Second Arduino is not the best solution to send something to a phone. More inexpensive is to use ESP8266 for example.

Once you've worked out your idea in more detail we can help you more.

Often linked posts:
Going small with MMU2
Real Multi Material
My prints on Instagram

Posted : 25/06/2019 11:49 pm
Jules
(@jules)
Active Member
Topic starter answered:
RE: How to use GPIO connection

First of all thank you.

I would probably use a ESP8266 or more likely a ESP32 but if I can't get to the error message its a little pointless or is there another way to get to them. How does octopi does it?

For the solving a problem that is already fixed. I like to tinker and build my own stuff, see how it works and so on. The second part is I think octoprint is a nightmare it has way to much overhead and is unnecessary slow. Simply the that it uses a raspberry is a little to much for my taste. I try to avoid using a OS with all its possibilities when I only need a few. I used octoprint for a while but was more disappointed then pleased, that is why I try a faster approach which does not more then I need it to.

Posted : 26/06/2019 7:59 am
Neophyl
(@neophyl)
Illustrious Member
RE: How to use GPIO connection

I'm pretty sure octoprint connects to the printer just like a normal 'full' size computer so it in effect has access to all the serial data that you would get like when you run Pronterface.  

You could possibly connect to the printer serially to send commands and get messages back.  Be aware though that if you do that when opening a serial connection to the printer it will stop any prints currently in progress

Posted : 26/06/2019 8:27 am
bobstro
(@bobstro)
Illustrious Member
RE: How to use GPIO connection
Posted by: julian.h6

[...] I would probably use a ESP8266 or more likely a ESP32 but if I can't get to the error message its a little pointless or is there another way to get to them. How does octopi does it?

Octopi just monitors and injects gcode into the serial stream via the USB port. It's monitoring the constant flow of status messages as well as issuing a few commands of its own.

I spent some time thinking about this a year ago. I originally had some of the same aspirations. Some considerations.

  • It is possible to use gcode commands to turn on and off unused GPIO pins. There is some documentation out there on this topic. I didn't bookmark it unfortunately. The problem is that you can only do this at the usual custom gcode locations (start print, end print, layer change, etc.). There's no async "error handler". Everything is hard-coded into the gcode by the slicer with no branching or other logic. This means your usage of GPIO is going to be limited to things like normal job status.
  • The other alternative is to monitor the serial data stream just like Octoprint does. This works, but you're continually tied down monitoring serial and parsing strings , not something Arduino is particularly good at. I'm not sure if a solution like micro python improves this situation much.
  • If you also want to be doing things with wifi without losing data, you're definitely going to want to look at the ESP32. I haven't delved into the ESP32 myself -- wound up buying a 3D printer and going down that rabbit hole -- but the 2nd core is mostly useful for dealing with wifi communications as I understand it.

For the solving a problem that is already fixed. I like to tinker and build my own stuff, see how it works and so on. The second part is I think octoprint is a nightmare it has way to much overhead and is unnecessary slow. Simply the that it uses a raspberry is a little to much for my taste. I try to avoid using a OS with all its possibilities when I only need a few. I used octoprint for a while but was more disappointed then pleased, that is why I try a faster approach which does not more then I need it to.

I finally gave Octoprint as shot this week, and I must say I was quite impressed. It seems to have matured a lot in the last 18 months. That said, I did manage to screw up a large print by playing around with the web interface mid-print. I have it running on a RPi 3B, so it was a bit of surprise, but I have seen all 4 cores go to 100%. I think there is some validity to your concern about it being a bit bloated.

I was thinking that a RPi Zero restricted to nothing but monitoring the serial stream and detecting interesting events would be a reasonable approach. Have it dispatch alerts (via MQTT perhaps) to ESP32/ESP8266 things controlling LEDs and other annunciators scattered in strategic locations. 

I'm looking at possibly running Octoprint on one of the beefier SBCs (the opposite of where you're going), but simply not loading it with too much stuff is another option. Video monitoring can certainly be done off-board. I have to admit the ability to print directly from PrusaSlicer to Octoprint is very compelling. I struggled with a Toshiba FlashAir card, and now regret the time I spent trying to get that thing to work before it gave up the ghost this week. Limiting Octoprint on a RPi to core printer control functions, then offloading functions to "things" where possible is my current line of thinking.

My notes and disclaimers on 3D printing

and miscellaneous other tech projects
He is intelligent, but not experienced. His pattern indicates two dimensional thinking. -- Spock in Star Trek: The Wrath of Khan

Posted : 26/06/2019 2:23 pm
Dave Avery
(@dave-avery)
Honorable Member
RE: How to use GPIO connection

the only time i have bogged down octoprint on a pi 3b+ is when I had multiple plugins active that streamed video. as long as only 1 streaming plugin was running i see CPU loads around 30-50%

Posted : 26/06/2019 3:57 pm
bobstro
(@bobstro)
Illustrious Member
RE: How to use GPIO connection
Posted by: david.a66

the only time i have bogged down octoprint on a pi 3b+ is when I had multiple plugins active that streamed video. as long as only 1 streaming plugin was running i see CPU loads around 30-50%

It generally does well.  I am surprised at how little mjpeg-streamer seems to task the CPU. I have been experimenting with Printoid on my phone and tablets, so it's possible there were several video streams running. I think I got into trouble firing up the 2D gcode previewer mid-print. I'm wondering if setting up a script to re-start octoprint between prints might be a good idea.

My notes and disclaimers on 3D printing

and miscellaneous other tech projects
He is intelligent, but not experienced. His pattern indicates two dimensional thinking. -- Spock in Star Trek: The Wrath of Khan

Posted : 26/06/2019 10:17 pm
OBELIKS
(@obeliks)
Member
RE: How to use GPIO connection

I was looking at ESP3D project, but I stopped because I simply do not have the courage to connect it to MK3S. At least not without someone sharing the info on how to do it.

And the 8.3 gcode file naming is also a bit old fashioned.

Posted : 01/07/2019 1:01 pm
Share: