Trying to communicate to bluetooth port and normal ethernet port at same time.

So I am using a raspberry pi 4 model B that is connected to the arduino mega 2560 and a ramps 1.4. I have the arduino flashed, and am able to control my printer fully from a program that I wrote in python on the raspberry pi. I do not use the Repetier host program, as I am controlling something that isn't exactly a 3D printer... It just uses a X and Y motor to move a tool around, and I am using repetier to bridge the communications between my program on the pi, and the gcode I send over the serial port ttyACM0 to the arduino.

I am now trying to implement another machine into my program. It is a welder that communicates over RS485 modbus and I thought that maybe I could use one of the serial lines in the arduino to communicate to it. I want to use the serial2 pins (17(RX), 16(TX)) but am unsure on if I can communicate to the welder through repetier. Can I specify which port I am talking to on the arduino output?

For example, I can open python on my raspberry pi and connect to the serial line on the arduino, then I will just send a command such as G28, and it will home. I do not specify that it should communicate with the motors, it just does it.

Now what I would like to do is for me to specify that I want it to send either to the motors, or to the welder. If anyone can help me with this, that would be great. If I did not explain this the best please let me know and I will elaborate.

Thanks!!

Comments

  • Can you just connect pins to pi serial? I mean mega is 5V and pi 3.3v so is the pin 5v tolerant?

    Anyhow, if you have ttyACM0 on pi you can use that port as well in server for communication.

    In firmware you can have up to 2 serial ports defined. So regular usb serial and via bluetooth select serial2 in addition. Firmware will then answer to both.
Sign In or Register to comment.