Control Stepper motor

Hi everyone, this is my firt try with industruino. I'm trying to use an external drive controll (DM542T) connected with industruino, but i can't understand where i'm wrong. The same sketch work perfectly with arduino.

Industruino is connected with an esternal power supply at 24V. When I upload the sketch the motor seems to move, but immediately stop.

Thanks for your help.

 

#include <Indio.h>
#include <Wire.h>

#include <AccelStepper.h>
#include <MultiStepper.h>

#include <UC1701.h>

static UC1701 lcd;
AccelStepper stepper(1, 2, 3);//set up the accelStepper intance; the "1" tells it we are using a driver; 2 -> ch2; 3 -> ch3

void setup() {
  lcd.begin();
  stepper.setMaxSpeed(1000);
  stepper.setSpeed(500);  
  Indio.digitalMode(2,OUTPUT); // set ch2 as output
  Indio.digitalMode(3,OUTPUT); // set ch3 as output  
}


void loop() {
  // Just to show the program is alive...
  static int counter = 0;

  // Write a piece of text on the first line...
  lcd.setCursor(0, 0);
  lcd.print("Hello");

  // Write the counter on the second line...
  lcd.setCursor(0, 1);
  lcd.print(counter, DEC);

  counter++;
  
  stepper.runSpeed(); // move the stepper
  }

Pietro
Pietro
30
| 1 1 1
Asked on 3/30/19, 4:44 PM
0
vote
2140 Views

Hi,

Please note that for the INDIO's digital output channels, the max switching frequency is 400Hz as mentioned https://github.com/Industruino/documentation/blob/master/indio.md#digital-io and in the datasheet. This will limit the speed of your stepper; the max speed of 1000 and set speed of 500 seem beyond this limit. Please try with lower speeds, e.g. 100 steps/sec, and move up to find the limit.

If you are using a unipolar stepper, you can drive it directly by the INDIO: https://industruino.com/blog/our-news-1/post/industruino-as-stepper-motor-driver-25

The datasheet of your driver seems to say that it can be driven by TTL signals as well, so in case you are not using the IDC port for Ethernet or GSM/GPRS, you could use 2 of those GPIO pins, with pull-up resistors to 5V https://github.com/Industruino/documentation/blob/master/indio.md#idc-expansion-port-pinout

 

Tom
Tom
5675
| 1 1 3
Answered on 4/1/19, 1:40 AM
0
vote

Hi Tom, thanks for your help. I'm trying to use the AccelStepper library, but seems it doesn't work. Did you now a library for industruino? I need to move a bipolar stepper at a variable speed. Thanks

Pietro
on 4/2/19, 5:59 PM

Hi, if you want to use that library you will have to modify the library code to use Indio.digitalWrite instead of the normal digitalWrite

Tom
on 4/3/19, 2:00 AM

Your answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

Ask a Question

Keep Informed

About This Forum

This community is for professionals and enthusiasts of our products and services.

Read Guidelines

Question tools

55 follower(s)

Stats

Asked: 3/30/19, 4:44 PM
Seen: 2140 times
Last updated: 4/1/19, 1:40 AM