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

20 views (last 30 days)
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

Answers (0)

Categories

Find more on Raspberry Pi Hardware in Help Center and File Exchange

Products


Release

R2020a

Community Treasure Hunt

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

Start Hunting!