I have an Arduino based 3d printer. I will be buying a raspberry pi with pi camera to be triggered to capture pictures for every change in the z direction. I've heard about octoprint and I'm asking if the octoprint can let the camera capture images by receiving digital output signal from arduino to the raspberry pi? Also any ideas about the communication between the arduino and the raspberry pi. I'll be really thankful.
Do you literally want to send GPIO from Arduino to the Raspberry Pi?
Generally, the way the picture captures work is that OctoPrint streams gcode to the printer, and on every Z change it takes a picture that is later stitched together to a timelapse.
Exactly. Because my printer runs on Arduino. Since Arduino is not enough to take pictures with high quality, I want to buy a raspberry pi + pi camera.
What I'm thinking of is that the gcode on the Arduino should be used to trigger the camera. So my plan is that in every new layer, the gcode order the Arduino to send GPIO to the raspberry pi. Then the Raspberry pi with the octoprint can trigger the camera.
I don't know if my solution correct? Or if you have better idea?
What code is your printer running? Something that's your own? You can't stream gcode to it from Pi?
But sure, that should work, just wire across a pin on each (3.3v only!), monitor it on the Pi side, and then, uh, call the API (?) or call raspistill yourself.
If you run octoprint on the Pi there is no need to trigger the cam from outside (from your Arduino), an octoprint plugin can do this very well:
Or did I missinterpret your intention?
I think there's a data logic level mismatch between Arduino and Raspberry Pi. The voltage level on the Raspberry is 3.3v and the Arduino is 5V. It might require the standard logic level converter or some fun wiring a 7400 Quad NAND gate as a pair of converters.
Not all arduinos are 5v. Depends what the OP is using.
(edit) or a third way- use 3.3v from the Pi, drive a transistor on/off from the Arduino and back to the Pi.
Thanks. I have simplify3D which takes the STL model, turns it into gcode, and sends it to the Arduino. The Arduino runs an open source Repetier Arduino code. I can get into the code of course, but since the Arduino is the controller, then it analyses the gcode, checks inputs, runs the program, and sends outputs. So the orders in my case should be given from the Arduino not from the Raspberry. What I was thinking, that is it possible that the octoprint receives signal to trigger the camera or it should be the opposite?
Then how does the raspberry pi know when to trigger the camera? since the controller and the gcode analyser in my case is the arduino.
Thanks. I'll need this!
I have mega2560 + ramps 1.4. I think all GPIO's are 5V. So I think I need the logic level converter.
I think you are thinking about this all wrong. You hook your Pi up to the Arduino, then you upload the gcode to the Pi. The Pi will stream it to the Arduino, line by line, so the Pi is controlling the print.
Since it is doing that, the Pi can give you a lot of feedback about the print progress, and it can also trigger its camera based on the Z changes or any other way you want to do a timelapse.
Does that make more sense?
(I'm using 'Pi' as a simplified term for "the machine you are running OctoPrint on, which may or may not be a Raspberry Pi).
Yes. You're right. It's now clearer for me. Thank you.