ROHS Step motor 28BYJ-48

조회 수: 20 (최근 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 CenterFile Exchange에서 Arduino Hardware에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by