For my 3D printed turntable I obviously need some way to turn the turntable, and preferably for video and scanning, some method to control speed.
Fortunately, I have a whole box full of those cheap and ubiquitous stepper motors, the 28YBJ-48 plus the ULN2003 driver board.

These guys are 5v DC, the boards accept 5-12v, but each 28YBJ-48 motor can draw up to 320mA, so while
To control the motor the stepper attaches to the driver board with 4 data lines and power. Our Arduino connects four pins, (3, 5, 4 and 6) to IN1-IN4 on the ULN2003 controller board.
Our potentiometer supplies an analog signal which we attach to A0, 3v and ground.
Arduino C Code
Also find the code at this Gist
//Arduino stepper library
#include <Stepper.h>
// different steppers have different
// amount of steps to do a full
// turn of the wheel.
#define STEPS 32
// connections need to be done carefully
// In1-In4 are added in the sequence 1-3-2-4
Stepper stepper(STEPS, 3, 5, 4, 6);
// the number of steps to take
int numSteps;
// Only serial to setup here
void setup() {
Serial.begin(115200); // start serial
}
// loop runs constantly
void loop() {
// full revolution
numSteps = (STEPS * 64) /100;
// max power is 1024
stepper.setSpeed( getMotorSpeed() );
// take the steps
// you can reverse direction with -numSteps
stepper.step(-numSteps);
}
int getMotorSpeed() {
// read the sensor value:
int sensorReading = analogRead(A0);
Serial.println(sensorReading);
// map it to a range from 0 to 1024:
int motorSpeed = map(sensorReading, 0, 769, 0, 1024);
// set the motor speed:
if (motorSpeed > 0) {
return motorSpeed;
}
}