I'm trying to control a robotic hand with stepper motors using arduino
with octave because I'm doing the angles calculations to get predefined
The problem is the slow velocity I get in the steppers (using Octave and
arduino toguether) because to get one complete turn (200 steps ) it last
almost 11 seconds whereas only with arduino (without Octave) it goes really
fast but I prefer use Octave to be able to do the trajectory calculations.
I'm using ubuntu 18.04 , arduino package 0.3.0 and Octave 4.2.2 in a
Desktop Intel® Core™2 CPU 6600 @ 2.40GHz × 2 and 4GB RAM
I've used also windows 10, arduino package 0.4.0 and Octave 5.1.0 in a
laptop 4GB RAM intel core i3 2GHz with more or less the same result.
The steppers are connected using the RAMPS 1.4 Board and the pololu driver
A4988. The stepper motors are Longruner 17HS16-2004S
This is an extract of my test program.
Thanks in advance
alfaStep = "d46"; # Firs Arm step pin
alfaDir = "d48"; # Firs Arm step direction
alfaEnable = "a8";
On 9/5/19 10:23 AM, Vicent wrote:
> I'm trying to control a robotic hand with stepper motors using arduino
> with octave because I'm doing the angles calculations to get predefined
I wonder if running something like grbl on the Arduino to control
the motion, and use Octave to calculate and write the G-code to
the Arduino might be useful. Send the motion controls as blocks
of data rather than try to send individual movement commands.
Using a non "real time" OS to control motion is not going to result
in smooth operation. Adding something like Octave on top of that
would exacerbate that problem even more I would expect.
> The problem is the slow velocity I get in the steppers (using Octave and
> arduino toguether) because to get one complete turn (200 steps ) it last
> almost 11 seconds whereas only with arduino (without Octave) it goes really
> fast but I prefer use Octave to be able to do the trajectory calculations.
> function runMotor(ar, MotorStep, MotorDir, direction, steps, time )
> Alfa Motor Down;
> runMotor (ar, alfaStep, alfaDir, 1, 200, 0.00001);
You put far too much trust into pause()'s ability to execute short
delays. 10 microsecond pause is just not practical in the interpreted
environment: on my 3GHz Linux box I see a factor of 67 discrepancy:
Elapsed time is 0.000674963 seconds.
Since that delayed delay happens in your step loop i'ts going to slow
things down significantly.
On 9/5/19 2:38 PM, Vicent wrote:
> I forgot to say before that without the pause instruction the result was
> almost the same. I got 10 seconds for a complete turn.
Use the tic/toc technique to time writeDigitalPin()--you will probably
find that it's slower than you think.
It is well known than stepping pulse train in software is not a good
idea---you need speed AND regularity in the timing sequence, or else the
motor will run slowly and unreliably.
As the others have said, redesign your system so that Octave calculates
the high-level parameters like the total number of steps, and send it to
a hardware step generator or at least a real-timish software step
Thanks again Przemek , I didn't know the tic/toc technique.
I see I have to redesign the system and try to use grbl or LinuxCNC , I'm
newbie in this and I need to collect more information.
Thanks for your help and quick response.