ROHS Step motor 28BYJ-48

10 ビュー (過去 30 日間)
Madison Gladstone
Madison Gladstone 2020 年 9 月 27 日
回答済み: Amrtanshu Raj 2020 年 10 月 2 日
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!

回答 (1 件)

Amrtanshu Raj
Amrtanshu Raj 2020 年 10 月 2 日
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.

カテゴリ

Help Center および File ExchangeArduino Hardware についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by