Moving print bed after receiving a 5v signal


#1

Hello!

Extremely new to Octoprint, and 3D printing in general. I was wondering if there's a way to programmatically listen for a 5v signal, then move the print bed, say 3 inches in the x-axis. If I can be pointed in the right direction, I would greatly appreciate it!


#2

Many OctoPrint installations are on a Raspberry Pi 3B single-board computer. The data logic level of its GPIO pins is technically 3.3v rather than the 5V you're suggesting. And you'd probably want to make sure that the full 5V isn't felt on one of those input pins.

There are ways of bringing that 5V signal down to 3.3v for the sake of safety and then use that as an input pin on the Raspberry Pi. There are alternatives to this of course.

  1. How good are you with electronics/electricity?
  2. From where is this input 5V signal you refer to?
  3. What manufacturer/model of printer are we're talking about?
  4. Did you install the OctoPi image on a Raspberry Pi or the OctoPrint on something else?

#3

Hi Outsourced Guru - Thank you for the quick reply. I'm not great with electronics, but it looks like I was able to piece some of the puzzle together.

From what I understand,

  1. I can downgrade the 5v to a 3.3v. The 5v signal is coming from a machine
  2. The 5v signal comes from a laser machine. I am essentially re-purposing an Ender 3 so I can use the print bed for a custom application. E.g., Laser engraves, finishes, sends out a 5v signal for the Ender to advance the bed a few inches so the next set of engraving can occur. I realize this isn't pertaining to 3D printing, per se, but the 3D printers have 90% of the functionality I am after, at an effectively low cost.
  3. Creality Ender 3, but will most likely purchase a CR10 for this purpose as I need the larger bed size.
  4. It will be on a Raspberry Pi in order for me to utilize the webcam as well to monitor/control the laser and printbed remotely.

It seems like after further digging, the REST API is what I was looking for?

Thank you in advance.


#4

As for matching the expected voltage, search for "When your input isn't 0 to 3.3V but e.g 0 to 5V, use an input voltage divider..." here in this thread. Notice how the ratio of the two resistors is essentially 1:2. Analysis: 1+2=3 and 2/3 of 5V is 3.33V so that's how that works for toggling a 3.3V input from a 5V signal.

Assuming that you could attach that "voltage divider" correctly to a pin on your Raspberry, the next step would be to do something when the pin reads high.

As for the movement, that depends. Print jobs can be in one of two modes: absolute or relative movement. If your print job happens to be in the relative mode, then moving 76 mm to the right (~3") is then accomplished by something that runs the corresponding gcode to do so.

The thing which talks to the REST API then is in question. It could be a plugin. It could be a separate service. It could be a command line program in Python, NodeJS, bash or go. There are many ways of talking to an API like this. There may be ways within the existing plugin space that I'm forgetting. I want to say that the Gcode System Commands plugin could be useful here.


#5

Thank you so much for that. I think that'll be more than what I need to get started. Thank you again.