Wireless Arduino control of a large NEMA 34 stepper motor

Learn how to drive a large NEMA34 stepper motor using one of our motor drivers, a 12V power supply and an OSEPP R3 Uno controller running Arduino software.

4 CH RF remote control system provides wireless control: RXD4140-434 schematicImg4

Arduino code:

#include <Stepper.h>

int sensorPot = A0;
int sensorValue = 0;
int forward = 2;
int reverse = 3;

void setup() {
pinMode(8, OUTPUT); //direction pin
pinMode(9, OUTPUT); //step pin
digitalWrite(8, LOW);
digitalWrite(9, LOW);
}

void loop() {
sensorValue = analogRead(sensorPot);
sensorValue = map(sensorValue, 0, 1023, 3600, 1);

int f = digitalRead(forward);
int r = digitalRead(reverse);
if(f == 1 && r == 0){
digitalWrite(8, LOW);
digitalWrite(9, HIGH);
delayMicroseconds(sensorValue);
digitalWrite(9, LOW);
delayMicroseconds(sensorValue);
}
if(r == 1 && f== 0){
digitalWrite(8, HIGH);
digitalWrite(9, HIGH);
delayMicroseconds(sensorValue);
digitalWrite(9, LOW);
delayMicroseconds(sensorValue);
}
}

Circuit Specialists

Circuit Specialists has provided quality test equipment, components, and accessories for over forty years.

Leave a Reply