Connecting raspberry pi to Rambo 1.4 using usb and controlling the steeper motors

Hi guys! i am working on a project and my issue is i want to give a g code in raspberry pi and that should operate the x y motors which are connected with Rambo 1.4 and Rambo has marlin installed

can someone guide me like i am kind a new to this so i exactly don’t know how to do this

V1P1 image should get you setteled.
v1p1

so iam writing some own type of code and in that code i need to just add x,y coordinates so when i start running the program it should take the x y coordinates generated and those need to be send to motors so can i directly write something in g code to send by using marlin ?

Yes. You could send the gcode commands through the r pi to the Marlin board several ways.

Save it as a file and upload it to the r pi like a 3D print job. This can be done using the Octoprint web browser interface or programmatically (PrusaSlicer does this). Then you can execute the file and it will send all of gcode commands in order.

Or you could send the gcode commands one at a time. In Octoprint there is a terminal tab that you can type commands into.

You could also write a plugin that will send any commands you want.

There are many plug ins that you can install and send custom commands as well. Macro plug in lets you create one button macros that send a bunch of commands etc…

There is a custom control plug in that will let you create any number input/output controls. you can use text boxes with buttons, slider controls, multiple choice selectors and build anything you want to send gcode to the machine.

It sort of depends on what you want to send and where you are generating the commands from.

I’m still a bit confused. Are you trying to do something we all normally do on CNC (like set the origin, so the pattern is offset to the workpiece) or something unique (like generative art, performed by a cnc machine from special code)?

To answer your actual question, you can write python that will open a serial port (using python-serial) and send gcode to it. You can generate the strings to send in python as well. You can also pretty easily read gcode to extract x and y coordinates.

There was a post this week about doing that (weird, because it doesn’t come up that often):

But I think what you may be interested in is just moving your machine to some coordinates, like X=88.1, Y=22.7, Z=0.8, and then setting your zero to be there. If that’s the case, wall away from the python and just use G92 X0 Y0 Z0 when you get to where you want your origin. More at
https://docs.v1engineering.com/learn/coordinates/

awesome thanks for the lead and i have got that but when ever i send the commands the Rambo first restarts and then it is executing the code.

import serial
import time

ser = serial.Serial(’/dev/ttyUSB0’, 115200)

time.sleep(1)
ser.write(“G0 x40 y40\r\n”)
time.sleep(1)

so when ever i run this on raspberry pi the Rambo board gets rebooted and then starts working like moving to the given coordinates

Yeah. That is what is happening in the other thread too.

What are you trying to do?