help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Octave-Arduino- Slow Velocity Stepper Motor


From: Vicent
Subject: Octave-Arduino- Slow Velocity Stepper Motor
Date: Thu, 5 Sep 2019 12:23:52 -0500 (CDT)

  Hi!
  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
trajectories.

  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
Vicent


alfaStep = "d46"; # Firs Arm    step pin
alfaDir = "d48";  # Firs Arm    step direction
alfaEnable = "a8"; 

ar = arduino(); 

configurePin (ar, alfaStep, "DigitalOutput");
configurePin (ar, alfaDir, "DigitalOutput");
configurePin (ar, alfaEnable, "DigitalOutput");

writeDigitalPin (ar, alfaEnable, 0);   #Enable alfaMotor

function runMotor(ar, MotorStep, MotorDir, direction,  steps, time ) 
#Function to do a number of steps
      writeDigitalPin (ar, MotorDir, direction);
   
      for x = 1:steps  
          writeDigitalPin (ar, MotorStep, 1);                 # do the steps
          pause(time);
          writeDigitalPin (ar, MotorStep, 0);
          pause(time);
      endfor
      
  endfunction

running = 1;
while (running == 1)
  answer = input('Select Movement  ',"s");
  
  switch answer;
    case "q"                                                           #     
Alfa Motor Up;
      runMotor (ar, alfaStep, alfaDir, 0, 200, 0.00001);   #  Send to
arduino StepPin, DirectionPin, direction, steps and pause time
      
    case "a"                                                           #     
Alfa Motor Down;
      runMotor (ar, alfaStep, alfaDir, 1, 200, 0.00001);
      
    otherwise 
      running = 0;

  endswitch

 endwhile



--
Sent from: https://octave.1599824.n4.nabble.com/Octave-General-f1599825.html



reply via email to

[Prev in Thread] Current Thread [Next in Thread]