Linear table using Arduino Mega and stepper motors (speed problems)

Hello guys,
so basically I’m a student doing a new project at a company I’m working in, its my first Project involving building a linear table that moves an Ultra sound device that scans Automatically, well I’m a beginner with Arduino and its my first project with it and have mainly 2 problems:
[1- speed Problem ]:
I’m using a ramps 1.4 attached to an Arduino Mega 2560, 2 Nema 17 stepper motors because I only need movements in the X and Y directions, to control the stepper motors I used the A4988 drivers with 2 jumpers for each driver to get the motors to 1/8 micro steps (High High Low), connected 2 end stops per motor to limit the movement, provided a 12V power supply with 1 Amp output, and wrote a code of course to control the movements, it works fine with max speed 1.2 cm/sec (I need 4 cm/sec) and above that the motors stop to move and start beeping, I tried to force more power through each driver by changing the resistance and it actually gave me better results with the speed but at the cost of overheating and eventually burning the drivers, so my take on this problem is :
1-it could be that I need to provide higher Voltage like 24 but the ramps 1.4 is only limited to 12 V so I need to upgrade it to 24 V.
2- maybe changing to other drivers like TB6600 that actually can take and provide more voltage.
3-getting a stronger motor like Nema 23 plus other drivers.
4- another thought of mine is, maybe the Accelstepper Library is limiting the speed because its a library that controls the position perfectly but not the speed so could that be the case ?
the A4988 are so easily mounted on the ramps 1.4 and I don’t even Know if its possible to connect 2 TB6600 to the ramps and how to do that, as I said im just a beginner :), so before even letting my company order them I need to know am I thinking right here or have I overseen something and the solution is totally somewhere else, I’m gonna attach the code that I wrote and a small doc that I made about the connections and the problems.

[2- printing current position]:
so in my code in the movePos function :
while (Xstepper.distanceToGo() != 0 || Ystepper.distanceToGo() != 0) {

I need to get the current position while moving but once I do that the motors starts to move really slow, so I thought maybe I need I higher Serial.begin than 9600, it got me to better results but still slower as normal any Ideas why and what can I do ?

I hope I provided enough Info’s to understand my project, if not Ask me Ill happily answer.

thanks in advance and best regards

piurlineartable.ino (11.6 KB)

Documentation.pdf (494 KB)

1-it could be that I need to provide higher Voltage like 24 but the ramps 1.4 is only limited to 12 V

I’m using a Ramps board with a 24v power supply. I have disconnected the diode that provides power to the Mega board - so the Mega needs to be powered separately. I have not used it this way for very long so I can’t guarantee is longevity. The A4988s will be perfectly happy with 24v.

If all your movements use stepper.runSpeed() then that in itself may be your problem. runSpeed() does not use acceleration and for higher speeds the motors must be accelerated. Use the run() function.