Welcome! Log In Create A New Profile

Advanced

My RAMPS1.4 doesn't work when controlled by Raspberry PI 5 via Python3

Posted by civil.shakeri 
My RAMPS1.4 doesn't work when controlled by Raspberry PI 5 via Python3
March 17, 2024 01:22PM
Hello,
When I use my Windows device to control ramps1.4 (mounted on mega Arduino) via Python3, by g code like this:
...
import serial
import time

myPort = serial.Serial('COM7', 250000, parity='N')
time.sleep(1)

myPort.write('M302 S0\n'.encode())
myPort.write('G1 Z-50 F1000000\n'.encode())
myPort.write('M84\n'.encode())
...
everything is good and my step motors work. Next, when I connect this board to my Raspberry Pi5 device and change the 'myPort' code to 'myPort = serial.Serial('/dev/ttyACM0', 250000, parity='N')' connection is established and RAMPS1.4 light flashing to tell us that port is connected but my g code does not work and step motors remain motionless (without any error). First I thought that's issue relates to the Baud rate. So, to solve this problem I tried to change the baud rate in Raspberry Pi 5 via this code 'stty -F /dev/ttyACM0 115200' and checked it again, but that did not work either. Also, I tried any other standard baud rate and failed at all of them. And now, I don't know how to solve it.

Edited 1 time(s). Last edit at 03/17/2024 01:28PM by civil.shakeri.
Sorry, only registered users may post in this forum.

Click here to login