Unipolar stepper motor speed control

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.
Imgur
The circuit diagram of the stepper motor is this.
Imgur
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.

You have :-
-Current:0.95A/Phase
you can't get that much current with a ULN2003 chip. You will need a FET driver at least. You still have to put current through the coils in both directions with a stepper even if you don't want the motor to turn in both directions therefore you need a H bridge type circuit.

Also:-
int potentiameter = 5;
So you should wire the pot, middle wiper to Analogue input 5, and the two outer connections to +5V and ground. However you don't appear to do anything with the reading in the sketch. You need to use this value to set the speed of the stepping motor. Look at the examples in the stepping library to see how to do this.

Also look at Arduino Playground - InterfacingWithHardware for stepping motor hints.

Thanks a lot. That's very helpful.

I think this is exactly what you want:-

Wow. Yes, it is.
Thank you very much! :slight_smile: