STEPPER MOTOR CONTROL WITH DM320T, RASPBERRY PI 3B AND MATLAB

17 次查看(过去 30 天)
Hi All,
Please, I need help troubleshooting my stepper motor control setup.
I am trying to rotate a stepper motor a certain angle at a given speed.
I connected and program the setup as follows but I can't get the stepper motor to move. I suspect it is my code, however, I found little coding resource online about this.
I would appreciate any help and/or suggestions. Thanks in advance.
UPDATE: My connections and program are right. I found out that the stepper motor driver (DM320T) I used requires a digital signal voltage of 4-5v (for High) for PUL. However, the raspberry pi digital pin doles out a 0-3.3v. In effect, it was still read by the DM320T as a Low.
As a result, I switched to an Arduino Micro which has a digital pin voltage of 0-5v and capable of providing the requirement for PUL.
Connections and Wiring:
MATLAB Program:
clear all; clc;
MainRasp = raspi('192.168.1.134', 'pi','raspberry');
ENA = 4;
DIR = 17;
PUL = 18;
configurePin(MainRasp, PUL, 'DigitalOutput');
configurePin(MainRasp, DIR, 'DigitalOutput');
configurePin(MainRasp, ENA, 'DigitalOutput');
writeDigitalPin(MainRasp, PUL, 1);
writeDigitalPin(MainRasp, DIR, 0);
writeDigitalPin(MainRasp, ENA, 1);
angle = 40;
steps_per_rev = 100;
micro_step = 8;
angle_per_step = 360/(steps_per_rev*micro_step);
numSteps = floor(angle/angle_per_step);
for step = 1:numSteps
writeDigitalPin(MainRasp, PUL, 1);
pause(0.001);
writeDigitalPin(MainRasp, PUL, 0);
pause(0.001);
end

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Raspberry Pi Hardware 的更多信息

产品


版本

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by