Notifications
Clear all

Big Stepper code  

  RSS

Ralphxyz
(@ralphxyz)
Active Member
Joined: 8 months ago
Posts: 6
2020-03-15 5:06 pm  

I am using the code from the Big Stepper tutorial and having unexpected operations.

There are no links for pictures or videos?

Stepper motor operation:

I am using the Big Stepper tutorial code

/*
Stepper Motor Test
stepper-test01.ino
Uses MA860H or similar Stepper Driver Unit
Has speed control & reverse switch

DroneBot Workshop 2019
https://dronebotworkshop.com
*/

// Defin pins

int reverseSwitch = 2; // Push button for reverse 4 now
int driverPUL = 7; // PULSE- pin
int driverDIR = 6; // DIR- pin
int spd = A0; // Potentiometer

// Variables

int pd = 500; // Pulse Delay period
boolean setdir = LOW; // Set Direction

// Interrupt Handler

void revmotor (){

setdir = !setdir;

}

void setup() {

pinMode (driverPUL, OUTPUT);
pinMode (driverDIR, OUTPUT);
attachInterrupt(digitalPinToInterrupt(reverseSwitch), revmotor, FALLING);

}

void loop() {

pd = map((analogRead(spd)),0,1023,2000,50);
digitalWrite(driverDIR,setdir);
digitalWrite(driverPUL,HIGH);
delayMicroseconds(pd);
digitalWrite(driverPUL,LOW);
delayMicroseconds(pd);

}

Even at slow speed you can hear something knocking, then at full speed it gets crazy, it really knocks and reverses itself.

This is using a Arduino UNO and a Micro Driver driver.

Thanks for the help!

Ralph


Quote
Topic Tags