A4988 con Arduino



Codigo:

/*     Simple Stepper Motor Control Exaple Code
 *    
 *  by Dejan Nedelkovski, www.HowToMechatronics.com
 *
 */
// defines pins numbers
const int stepPin = 12;   //3;
const int dirPin = 11;    //4;

void setup() {
  // Sets the two pins as Outputs
  pinMode(stepPin,OUTPUT);
  pinMode(dirPin,OUTPUT);
}
void loop() {
  digitalWrite(dirPin,HIGH); // Enables the motor to move in a particular direction
  // Makes 200 pulses for making one full cycle rotation
  for(int x = 0; x < 200; x++) {
    digitalWrite(stepPin,HIGH);
    delayMicroseconds(1000);
    digitalWrite(stepPin,LOW);
    delayMicroseconds(1000);
  }
  delay(1000); // One second delay
 
  digitalWrite(dirPin,LOW); //Changes the rotations direction
  // Makes 400 pulses for making two full cycle rotation
  for(int x = 0; x < 200; x++) {
    digitalWrite(stepPin,HIGH);
    delayMicroseconds(1000);
    digitalWrite(stepPin,LOW);
    delayMicroseconds(1000);
  }
  delay(1000);
}


Fuente: https://chenfuguo.gitbooks.io/arduino/content/Shields/a4988Controller.html
             http://howtomechatronics.com/

Configuracion CNC v3


ATENCION!!! PARA QUE FUNCIONE EL GRBL CONTROLLER DEBE ESTAR CONFIGURADO A 115200!!!


Voltage de los A4988

A = 1.25 * V
V = A / 1.25

Valores de voltage actuales:

X = .464
Y = .640
Z = .000

Configuración GRBL (VERSION 0.9)

$0=10
$1=25
$2=0
$3=0
$4=0
$5=0
$6=0
$10=3
$11=0.010
$12=0.002
$13=0
$20=0
$21=1
$22=0
$23=0
$24=25
$25=500
$26=250
$27=1
$100=6.320
$101=6.320
$102=51
$110=1000
$111=500
$112=500
$120=10
$121=10
$122=10
$130=200
$131=200
$132=200


Inkscape con gcodetools

Version de inkscape: 0.48
Con "gcodetools dev..."


Instalar gcodetools en Inkscape

instalar python2.7.9    https://www.python.org/ftp/python/2.7.9/python-2.7.9.msi
elegir la instalacion custom y marcar "add python.exe to path"

renombrar C:\Program Files\Inkscape\python a
C:\Program Files\Inkscape\python-old   *esto es para que no use este python sino el que instalamos en c:\*

abrir cmd como admin.

C:\Python27>pip install numpy

instalar:
lxml-3.3.5.win32-py2.7.exe

*si dice que no hay python 2.7 en la registry hacer esto:

copiar la clave de este path

HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Python\PythonCore\2.7\InstallPath

a este otro

HKEY_LOCAL_MACHINE\SOFTWARE\Python\PythonCore\2.7\InstallPath

Abrir inkscape!!!


fuentes:
https://github.com/TurnkeyTyranny/laser-gcode-exporter-inkscape-plugin/blob/master/README.md
https://avaminzhang.wordpress.com/2011/11/24/python-version-2-7-required-which-was-not-found-in-the-registry/

Enviar model y parametros adicionales en llamado ajax

Javascript

            var datos = $('form').serializeArray();
            var usuarioSup = {
                name: "usuarioSupervisor",
                value: "abc"
            };
            var passwordSup = {
                name: "passwordSupervisor",
                value: "xxx"
            };
            datos.push(usuarioSup);
            datos.push(passwordSup);

            jqxhr2 = $.ajax({
                type: "POST",
                data: datos,
                dataType: "json",
                url: "@Url.Action(@Model.Accion, @Model.Controlador)",
                beforeSend: function () {
                }
            }).fail(function (jqXHR, textStatus) {
                $.unblockUI();
                $("#mensaje").html("Error: " + "Status: " + jqXHR.status + " detalle: " + textStatus + " detalle: " + jqXHR.responseText);
            }).success(function (data) {
                $.unblockUI();
                $("#mensaje").html(data.Mensaje);

                if (data.Codigo != "err_sup") {
                    $("#div_supervision").hide();
                    $("#@ViewBag.boton").removeProp("disabled");
                }
            });


MVC

[HttpPost]
public ActionResult Ejecutar(ConsultaViewModel modelo, string usuarioSupervisor, string passwordSupervisor)
        {
            return null;
        }

Configuracion GRBL 0.9

https://github.com/grbl/grbl/wiki/Configuring-Grbl-v0.9#grbls-xval-settings-and-what-they-mean

Compilar y subir GRBL 0.9 a arduino

Bajar el zip de este lugar:

https://github.com/grbl/grbl

luego descomprimirlo, y armar un .zip que solo tenga la carpeta que contiene los examples, los .h y los .c (este zip es el que luego hay que importar como libreria en Sketch / include library)

Primero hay que borrar la EPROM (ver este post para saber como hacerlo: http://expressraider.blogspot.com.uy/2015/02/arduino-midi-drums-paso-paso.html)

Instrucciones para subir el grbl:

https://github.com/grbl/grbl/wiki/Compiling-Grbl

Luego el grbl controller configurarlo a 115200