ROHS Step motor 28BYJ-48

9 visualizzazioni (ultimi 30 giorni)
Madison Gladstone
Madison Gladstone il 27 Set 2020
Risposto: Amrtanshu Raj il 2 Ott 2020
Hello
I have been trying to get my ROHS Step motor 28BYJ-48 to run using matlab code (without simulink) and have had no success. Hoping someonoe may know how.
Here is how my motor is hooked up:
Thanks!

Risposte (1)

Amrtanshu Raj
Amrtanshu Raj il 2 Ott 2020
Hi,
There can be 3 ways to control a stepper motor in MATLAB.
  • Adafruit Motor Sheild. You can refer to this example for the implementation.
  • Basic Arduino commands to control the motor in steps. (The speed will be slow)
a=arduino()
configurePin(a,'D2','DigitalOutput');
configurePin(a,'D3','DigitalOutput');
configurePin(a,'D4','DigitalOutput');
configurePin(a,'D5','DigitalOutput');
pins={'D2', 'D3', 'D4', 'D5'};
steps={'1100', '0110', '0011','1001'};
steps_size=size(steps,2); %steps = 4
for i = 1:100
step = steps{mod(i,steps_size)+1}; % step=1,2,3,4
for j=1:4
writeDigitalPin(a, pins{j}, str2double(step(j)));
end
%pause(0.01);
end
  • Serial Communication (requires programming on the Arduino side)- You can setup a serial communication between Arduino and MATLAB. Depending upon the character sent by MATLAB to Arduino over Serial. The stepper can be programmed to move or stop.

Categorie

Scopri di più su Arduino Hardware in Help Center e File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by