2
\$\begingroup\$

I'm trying to controll a Nema 34 stepper with a motrordriver(EM-314) and Arduino Uno.

I have gotten the motor to rotate(slowly) by setting pin 5 on the Arduino to high. Pin 5 is connected to Preset 4 on the motordriver. I would like it to speed up, but im not sure how to do this.

Do any of you guys know how i can get it speed up?

Datasheet for the motordriver: http://media.oem.se/Archive/FilesArchive/102826.pdf

Currently i'm using a powerslupply on 0-48V 10A.

Every answer is apprciated!

Edit:

Pin 7 on arduino is connected to STEP IN Pin 6 is connected to DIR/STOP/RESET And i'm using a potentiometer to controll the speed.

Here is the code im using in Arduino.

int sensorPin = A0;
int sensorValue = 0;

void setup() {
  //Serial.begin(9600);
  pinMode(6, OUTPUT);
  pinMode(7, OUTPUT);
  digitalWrite(6, LOW);
  digitalWrite(7, LOW);


  }

void loop() {

 sensorValue = analogRead(sensorPin);
 sensorValue = map(sensorValue, 0, 1023, 3600, 1);
 //Serial.print(sensorValue);
 //Serial.print("\n");
  if(sensorValue > 3000){
    digitalWrite(7, LOW);
   }
 if (sensorValue < 3000){
 digitalWrite(7, HIGH);
 delayMicroseconds (sensorValue);
 digitalWrite(7, LOW);
 delayMicroseconds(sensorValue);
 }
 }  
\$\endgroup\$
4
  • \$\begingroup\$ So we are supposed to just guess the code and schematic? \$\endgroup\$
    – Bort
    Jul 7, 2017 at 11:38
  • \$\begingroup\$ @naSSa Did you set the preset run frequencies using the EM-236 unit? \$\endgroup\$
    – Macit
    Jul 7, 2017 at 14:10
  • \$\begingroup\$ @Majid_L No, i don't have the EM-236 unit. Is that the only thing i can change the frequencies? \$\endgroup\$
    – naSSa
    Jul 7, 2017 at 16:29
  • \$\begingroup\$ @naSSa You can change the speed by applying pulses on STEP IN input (It does not need to be PWM), but, from my understanding of the EM-314 manual, you can not exceed the preset run frequency which is set to 10 (100 Hz) unless you increase it using the EM-236 unit. As a result, I am afraid that you can't achieve higher speed than what you have got till you increase the preset run frequency. \$\endgroup\$
    – Macit
    Jul 7, 2017 at 17:55

2 Answers 2

1
\$\begingroup\$

You control a stepper motor speed by controlling the step pulse frequency. It appears from your code that you are using a "sensor" but more likely a potentiometer to control the speed.

void loop() {
    sensorValue = analogRead(sensorPin);               // returns 0 to 1023
    sensorValue = map(sensorValue, 0, 1023, 3600, 1);  // returns 3600 to 1
    if(sensorValue > 3000){
        digitalWrite(7, LOW);
    }
    if (sensorValue < 3000){
        digitalWrite(7, HIGH);
        delayMicroseconds (sensorValue);     // delay depends on sensor
        digitalWrite(7, LOW);
        delayMicroseconds(sensorValue);      // delay depends on sensor
    }
 }  
  • If the control voltage from "sensor" is low then the map() function sets the step delay to the longest value of 3.6 ms.
  • As the control voltage is turned up towards maximum the delay will decrease to a minimum of 1 µs.

I suspect that your potentiometer is not connected properly. Enable the serial print function again to check. (This will completely mess up the timing of the rest of the program and slow down the step sequence.)

\$\endgroup\$
0
\$\begingroup\$

I would like it to speed up, but im not sure how to do this.

Short answer:
From the datasheet:

STEP IN is the input for stepping pulses. One steps is done with the positive edge of the input pulse.

DIR/STOP/RESET input is normally used to choose the rotational direction.

That's it. Actually you don't need more control signals.
The motor speed depends on the step mode and the frequency of your STEP signal, which could be a PWM signal from your Arduino.
With the DIR signal you can change rotation direction. Be aware not to exceed the motor's specified start/stop/max speed, otherwise steploss will occur.

\$\endgroup\$
1
  • \$\begingroup\$ Okey, thanks. But it says its at deafult at "2 = quarterstep", and i guess i need it to be at "0 = fullstep". Do you have any idea how i do that? Also, i'm using STEP IN and DIR/STOP/RESET, but i still doesnt getting the full rpm. \$\endgroup\$
    – naSSa
    Jul 7, 2017 at 16:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.