How to control a stepper motor?

Status
Not open for further replies.
Hello,

I want to start moving a stepper motor that I just bought, but I have no experience and I can't move forward with my project.

I have this configuration
http://eu.stepperonline.com/1-axis-...driver-cnc-mill-router-lathe-robot-p-410.html
http://eu.stepperonline.com/switchi...or-cnc-router-kits-115v230v-s35060-p-178.html
and a teensy 3.2

I power up my power supply and wire to the stepper driver. Then I wire the stepper motor to the driver.
I wire the pulse + and the dir + pins of the stepper driver to teensy vin pin.
Then I wire pulse - and the dir - of the stepper driver to teensy 8 and 9 pin.

I've try to use this code, but nothing happen on the driver output to motor. I measure the A+, A-, B+, B- on the driver and there is no output voltage.
I don't know if I set the switches right on the stepper driver also.

Please help me to make my motor alive :(.



#include <AccelStepper.h>

// Define a stepper and the pins it will use
AccelStepper stepper(1, 9, 8);

int pos = 3600;

void setup()
{
stepper.setMaxSpeed(3000);
stepper.setAcceleration(1000);
}

void loop()
{
if (stepper.distanceToGo() == 0)
{
delay(500);
pos = -pos;
stepper.moveTo(pos);
}
stepper.run();
}
 
Teensy3.2 is 3.3V logic and that driver has labels for 5V. Would suggest as a test removing the teensy and trying to get it to enable from a 5V supply and confirm it can at least get one output drive to go active.

If the voltages are the issue you would need to either get a level converter, move to a 5V native Arduino or use a different driver IC.
 
As far as I remember the drivers are disabled by default. So try to add a connection to the EN inputs (+VIN -> ENA+, GND-> ENA-). This should at least power your motors (try to rotate the shaft manually). Im quite sure that the 3.3V of the teensy are sufficient to drive the opto coupled input. Anyway, if you passed first tests recommend to buffer the teensy output pins with something like a 74HCT245 (https://octopart.com/search?q=74HCT245)
 
Last edited:
Hello, and thx for answers.

I was in holiday for a week, and I didn't have time to test more. Somebody else suggest me to use the code bellow.

I try this also and I have the following measurements on the pins

I connect Puls+(+5v) to ground on teensy and Puls-(pul) to 8 pin
I connect Dir+(+5v) to ground on teensy and Dir-(DIR) to 9 pin

I measure +1V between Puls+ and Puls-; and +1.5 V between Dir+ and Dir-;
I also measure some tension on B+ 8.3 V. The AC from the power switch is 60V.
I am complete a newbie here, please tell me if I have a list a clue for what I am try to do.

void setup(){
pinMode(8,OUTPUT);
pinMode(9,OUTPUT);
}
void loop(){
digitalWriteFast(9, HIGH);
for (int i=0; i < 500; i++){
delayMicroseconds(10);
digitalWriteFast(8, HIGH);
delayMicroseconds(10);
digitalWriteFast(8, LOW);
delayMicroseconds(10);
}
digitalWriteFast(9, LOW);
for (int i=0; i < 500; i++){
delayMicroseconds(10);
digitalWriteFast(8, HIGH);
delayMicroseconds(10);
digitalWriteFast(8, LOW);
delayMicroseconds(10);
}
}
 
Status
Not open for further replies.
Back
Top