Driving a mini 2-phase 4-wire stepper motor

Well, it's working, but it doesn't have hardly any torque at all. Just touching it lightly stops it. Still pretty cool.

https://vine.co/v/MuXxz3TitWd

Thanks for the help!

Nice! So how fast can you drive it before it mis-steps?

MarkT: I have some of these or similar motors, from eBay (£3 for a dozen or something crazy). Mine have 50 ohm windings (both the same).

I haven't come across anything like this before. What should I use to search Ebay for them?

...R

MarkT: Nice! So how fast can you drive it before it mis-steps?

Pretty fast. I'm not sure how fast, I had it running at 1 ms delays between steps without any noticeable skips. But I'm not sure yet how man steps per revolution there are. I can test that and let you know.

Robin2: Here's the listing I got mine from: http://www.ebay.com/itm/10PCS-4-Wire-2-Phase-Mimi-stepper-motor-for-Canon-micro-stepping-motor-D6mm/370953776904

For those interested, here's the code I used to drive the motor. The coils are wired on consecutive pins, and in this case the first coil is on pins 2 and 3, and the second is on 4 and 5.

void setup()
{
}

void coilForward(int pin)
{
  pinMode(pin, OUTPUT);
  digitalWrite(pin, HIGH);
  
  pinMode(pin+1, OUTPUT);
  digitalWrite(pin+1, LOW);
}

void coilBackward(int pin)
{
  pinMode(pin, OUTPUT);
  digitalWrite(pin, LOW);

  pinMode(pin+1, OUTPUT);
  digitalWrite(pin+1, HIGH);  
}

void coilOff(int pin)
{
  pinMode(pin, OUTPUT);
  digitalWrite(pin, LOW);

  pinMode(pin+1, OUTPUT);
  digitalWrite(pin+1, LOW);
}

int step = 0;
boolean blink = true;

void loop()
{
  switch(step)
  {
    case 0:
      coilForward(2);
      coilOff(4);
      break;
      
    case 1:
      coilForward(2);
      coilForward(4);
      break;
      
    case 2:
      coilOff(2);
      coilForward(4);
      break;
    
    case 3:
      coilBackward(2);
      coilForward(4);
      break;
      
    case 4:
      coilBackward(2);
      coilOff(4);
      break;
      
    case 5:
      coilBackward(2);
      coilBackward(4);
      break;
      
    case 6:
      coilOff(2);
      coilBackward(4);
      break;
    
    case 7:
      coilForward(2);
      coilBackward(4);
  }
  step++;
  if(step == 8) step = 0;
  delay(10);
}

Thanks for the link and the code. I must get some when the guy gets back from holidays.

You should put the pinmode statements in setup() as they only need to be called once.

...R

So I got some QSBT40’s and hacked up a breakout board, now on order:

Board is 11x16mm in size, I added a 1206 decoupling capacitor for good measure
as well as the QSBT40 and 0805 resistors. I’m going to try 100 ohms or so for
Arduino and 47 ohm for another(*) 3.3V microcontroller I use (which can source upto 40mA,
ie NOT the Due which is much less beefy).

(*) The P8X32A “Proepeller” - its got 32 pins so could drive 7 motors (allowing for serial
comms).

Another thought I had was that an RS485 driver chip can source/sink into a 50 ohm
load safely (they are designed to drive a 100 ohm twisted pair terminated at each end),
so could be used to drive the motor at higher currents from 5V. Dual RS485 transmitters
are pretty cheap…

Those are the cutest little steppers but what will you use them for?

Erm, the worlds smallest 3D printer?! Tiny robot…

One use is indicators, attach a drum with graphics around the edge, visible through a
slot in the front panel… Or a faked needle-style meter (need some gearing though).

Probably too big for a PicoSumo Bot! picobot's first steps - YouTube

Have you discovered what is the max current they can take?

How does their torque compare with a similarly sized DC motor?

...R

Im not really sure how to measure a torque that small to be honest! Perhaps wind a single hair round the 0.92mm shaft?

Gear it down and measure the output torque? It would be a crude measure with lots of error, but better than nothing. (Borrow some gears from a small servo).

...R

Hi,
I have been for a long time searching for a way to control via arduino these micro steppers and nothing worked so far.
No I saw MarkT post and breakout board and it would be super to have finally found something working!
Unfortunately I have some troubles understanding the circuit and wiring from his pictures, due to my electronics knowledge being wosre than I tought.
Can you help me? I have attached what I was able to figure out (pretty nothing :~)
A very raw sketch of arduino code on jow to control it and pinout would be a dream.
Regards

For code something like this would sequence appropriately

#define Aplus 2
#define Aminus 3
#define Bplus 4
#define Bminus 5

byte phase = 0 ;

void update_motor ()
{
  for (byte i = Aplus ; i <= Bminus ; i++)
    digitalWrite (i, LOW) ;
  switch (phase)
  {
  case 0:
      digitalWrite (Aplus, HIGH) ;
      break ;
  case 1:
      digitalWrite (Bplus, HIGH) ;
      break ;
  case 2:
      digitalWrite (Aminus, HIGH) ;
      break ;
  case 3:
      digitalWrite (Bminus, HIGH) ;
      break ;
  }
}

void step (boolean dir)
{
  if (dir)
    phase += 1 ;
  else
    phase -= 1 ;
  phase &= 3 ;
  update_motor () ;
}

just call step (false) or step (true)

Thank you so much for the fast reply about the code. If you would be so nice to also explain me a bit about the circuit, It would be very kind of you :grin:. I have been trying to control those motors for my mini robot project for a while.

An old thread but while trawling eBay I came across these and thought of this thread.

I also ordered those 2 phase steppers. I assumed that they were used for auto adjust on camera lenses in some planetary gear configuration. I would expect low torque and high speed for the application. The 20.7 ohm and 43.4 ohm values do seem a little flaky. It is like measuring across a single coil then parallel coils or some such thing. That may be why they are essentially giving them away. I looked at the provided specs and got this : Two-phase, four-beat: (+ A) (+ B) - (-A) (+ B) - (-A) (-B) - (+ A) (-B) -

Single-phase, four-beat: (+ A) - (+ B) - (-A) - (-B) -

Eight-shot, half: (+ A) (+ B) - (+ B) - (-A) (+ B) - (-A) - (-A) (-B) - (- B) - (+ A) (-B) - (+ A) -

I do not understand the nomenclature. Does it make sense to anyone?

My circuit has two resistors to protect the output pins from over current and each pin needs 2 schotty diodes to protect from inductive voltage spikes. Conveniently there are little packs of multiple schottky diodes available (for protecting from a logic bus, not a motor, but same function), so that made the component count nice and low. All tiny surface mount stuff.

I got it working, but then I broke the motor off the PCB by accident - very delicate, and tricky to repair that size. No miss-stepping from standstill to max speed, since there is so little inertia (the mechanical time constant must be a millisecond or something ridiculous!)