Hi, I am trying to control the speed of a unipolar stepper motor using a potentiameter.
The specification of the stepper motor is as below.
-Unipolar
- 1.8°/Step
-Operating voltage : DC 4V
-Current:0.95A/Phase
-Resistance:4.2ohm/Phase
-Inductance:2.5mH/Phase
-Holding Torque:1.6Kgf-cm
-Detent Torque:120gf-cm
-Rotor Inertia:38g-cm
I just need this stepper motor to turn one direction and hopfully, I need to increase or decrease its speed by adjusting a potentiameter.
I once arranged a stepper circuit using two ULN2003 chips to cope with the above stepper motor before. The arranement is this.
The circuit diagram of the stepper motor is this.
Could you advise me where and how can I put a potentiameter?
Also, for the sketch to control the motor, I came up with this sketch.
#include <Stepper.h>
#define motorPin1 8
#define motorPin2 9
#define motorPin3 10
#define motorPin4 11
#define ledPin 13
Stepper myStepper(motorSteps, motorPin1, motorPin2, motorPin3, motorPin4);
int potentiameter = 5;
int val = 0;
void setup() {
myStepper.setSpeed;
Serial.begin(9600);
pinMode(ledPin, OUTPUT);
}
void loop() {
val = analogRead(potentiameter);
digitalWrite(ledPin, HIGH);
delay(sensorValue);
digitalWrite(ledPin, LOW);
delay(sensorValue);
}
}
// Blink the reset LED:
void blink(int howManyTimes) {
int i;
for (i=0; i< howManyTimes; i++) {
digitalWrite(ledPin, HIGH);
delay(200);
digitalWrite(ledPin, LOW);
delay(200);
}
I am wondering whether this will do.