Use Arduino to control 3 Steppers by Matlab

Hello all,

Now I have a project to use Arduino to control 3 steppers by Matlab. I have a gshield board purchased from Inventables. I can get Arduino talk to Matlab now, but somehow I have a problem of making gshield talking to matlab. I think I might use the wrong library for the gshield. Is there anyone having knowledge of the gshield?


Here is the codes trying to get one motor move:

ardObject = arduino('COM3','uno', 'Libraries', 'Adafruit\MotorShieldV2');

addOnShield = addon(ardObject, 'Adafruit\MotorShieldV2');

stepperX = stepper(addOnShield, %port number here, %steps per revolution)

stepperX.RPM = 10;

move(stepperX, 200);


So far there is no error coming out to run the 4 lines, but there is still no response from the motor.

Do you have any comment on the codes? Any tip is welcomed. Many thanks!

What is gshield ?
Have you a link to its datasheet ?

What stepper control software are you running on your Arduino?
What format does it require the data to be provided in ?

...R

Thanks for your kind reply!

It said that the gShield (formerly known as grblShield) is a complete hardware solution for Dank’s CNC motion control system called grbl. All the information I found is from the link : grblShield | Synthetos.com

I'm not using any software to control the steppers since we want to use Matlab to control everything. How to know the format of data required?I'm fairly new to this

GRBL is the software that is controlling the stepper motors.

I have not used it but I understand it needs to be given GCode commands to control the motors. I presume there is nothing to prevent Matlab generating or sending GCode - but (again) I have no experience with Matlab.

Of course you could write your own Arduino code to take the place of Grbl.

...R
Stepper Motor Basics - does not deal with GCode or Grbl

You can possibly hack directly into the motor driving code in GRBL - although it may be quite
complicated to pick apart the DDA stuff, I haven't looked at the code for a while now.

Feeding it Gcode might be easier (especially if you already know Gcode)

You can always look up the pinout and drive step/direction pins, perhaps using
3 instance of AccelStepper.