problems with stepper motor

Hi,
i got some strange problems driving a bipolar stepper motor using arduino.

i have used the circuit and code found on this site:
http://www.tigoe.net/pcomp/code/category/code/arduinowiring/51

i have a bipolar stepper motor (mitsumi M42SP-7)
i used the Bipolar stepper two-wire circuit because we couldn't get the SN754410 in any of the Hungarian shops.
for the arduino we used the program found at the end of the same page (Wiring Code (for Arduino board)..)

all that was happening was, that the stepper motor twitched back and for but could not step or move at all.

i also tried some other motors but all did the same.

could anyone help what to do?

big thanks!

it sounds like maybe one of your coils is reversed.

first: make sure you know which wires are the coils. take a multimeter and check wires. when you find wires that have a low but real resistance, then they are part of the same coil. mark them somehow.

second: when you hook them up and it doesnt work, try swapping the wires on one coil. hopefully that should work.

otherwise, check out your circuit. i built the same one referenced on that page, and it works great (but only for low power stepper motors....)

good luck.

I just tried yesterday and I had the same problem. I found the solution using the 4 wires and adding the 4 Digital output in the setup :
Stepper stepper(STEPS, 8, 9, 10, 11);
With lhe L293N and 4 wires, you dont need transistors and it's working perfectly or me.
jhoepffner

so u say, one can use L293DNE with the second circuit from the manual without the transistors?

Hi, VM.

I don't know if I can help, but I did an experience with a bipolar stepper motor last month. Just to test if it works. And it works!

The blog is in Portuguese, but you can see a clip it here:

It is an old and damaged Epson Inkjet Printer motor, 48v., 4 wired., controled by an LB1847 IC (original of the printer). I used the whole printer board, just because I needed the power source of the printer. Looks like a monster, but don't worry.

I just disconnected half IC pins and soldered in wires, connecting them to arduino outs 0 to 11 (pins 27 to 16 of IC, respectively), and Vcc and GND.
There is also a potencimeter (to control speed), a Infra Red receiver (to change the rotation direction - you can use a simple switch), and 2 leds (to indicate the direction) connected to arduino.

I got the sequence table on the the Datasheet of IC (LB1847 Datasheet pdf - LB1847-D.PDF - ON Semiconductor)

Wrote a simple code using Port D (0 to 7 out) and Port B (8 to 13 out) command.

Take a look, compare with what you've done, and verify if it is useful.

/* Stepper Bipolar Epson 740 LB1847 Controller
 * -------------------------
 *
 * Program to drive a stepper motor coming from an Epson 740i Inkjet Printer (CR Motor)
 * using a simple TV RC to control the rotation direction.
 * It is a bipolar stepper motor with 4 wires.
 * 
 * @author: Adilson Akashi
 * @date: 12 Nov. 2007
 */
 
int irRem = 0;     // variable for reading the pin status
int valPot = 0;       // variable to store the value coming from the potenciometer
int dirCW = 1;
int count = 0;
int motorPin[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11};
int ledPin1 = 12;
int ledPin2 = 13;
int potPin = 1;

void motorSpeed()  {
  valPot = analogRead(potPin);    // read the value from the sensor
  valPot *= 10;
  if (valPot < 250)  {
    valPot = 250;
  }
}

void clockWise() {
  dirCW = 1;
  motorSpeed();
  PORTD = B11001010;
  delayMicroseconds(valPot);
  PORTB = B100011;
  delayMicroseconds(valPot);
  PORTD = B01100100;
  delayMicroseconds(valPot);
  PORTB = B100010;
  delayMicroseconds(valPot);
  PORTD = B00111100;
  delayMicroseconds(valPot);
  PORTB = B101110;
  delayMicroseconds(valPot);
  PORTD = B01100100;
  delayMicroseconds(valPot);
  PORTB = B101010;
  delayMicroseconds(valPot);
  PORTD = B11001011;
  delayMicroseconds(valPot);
  PORTB = B001011;
  delayMicroseconds(valPot);
  PORTD = B01100101;
  delayMicroseconds(valPot);
  PORTB = B001010;
  delayMicroseconds(valPot);
  PORTD = B00111101;
  delayMicroseconds(valPot);
  PORTB = B000110;
  delayMicroseconds(valPot);
  PORTD = B01100101;
  delayMicroseconds(valPot);
  PORTB = B000010;
  delayMicroseconds(valPot);
}

void counterClockWise() {
  dirCW = 0;
  motorSpeed();
  PORTB = B010010;
  delayMicroseconds(valPot);
  PORTD = B01100101;
  delayMicroseconds(valPot);
  PORTB = B010110;
  delayMicroseconds(valPot);
  PORTD = B00111101;
  delayMicroseconds(valPot);
  PORTB = B011010;
  delayMicroseconds(valPot);
  PORTD = B01100101;
  delayMicroseconds(valPot);
  PORTB = B011011;
  delayMicroseconds(valPot);
  PORTD = B11001011;
  delayMicroseconds(valPot);
  PORTB = B001010;
  delayMicroseconds(valPot);
  PORTD = B01100100;
  delayMicroseconds(valPot);
  PORTB = B001110;
  delayMicroseconds(valPot);
  PORTD = B00111100;
  delayMicroseconds(valPot);
  PORTB = B000010;
  delayMicroseconds(valPot);
  PORTD = B01100100;
  delayMicroseconds(valPot);
  PORTB = B000011;
  delayMicroseconds(valPot);
  PORTD = B11001010;
  delayMicroseconds(valPot);
}

void setup() 
{
  DDRD = DDRD | B11111111;  // sets Arduino pins 7 – 0 as outputs
  DDRB = DDRB | B111111;    // sets Arduino pins 13 – 8 as outputs
  for (count = 0; count < 12; count++) {
    pinMode(motorPin[count], OUTPUT);
  }
  pinMode(ledPin1, OUTPUT);
  pinMode(ledPin2, OUTPUT);
}

void loop()
{
  dirCW == 1;
  do  {
    irRem = analogRead(0);  // read IR input value
    clockWise();
  } 
  while (irRem > 200 && dirCW == 1);
  delay(200);
  
  dirCW == 0;
  do  {
    irRem = analogRead(0);  // read IR input value
    counterClockWise();
  } 
  while (irRem > 200 && dirCW == 0);
  delay(200);
}

Hi Adilson, I'm trying to implement a driver LB1847 but do not understand how to interpret the sequence table to load the driver code, review your code but can not find the relationship with the sequence table, and I hope you can help me if you can show me the schematic of LB1847 with arduino card help me a lot.
Greetings
Sorry for my English
:slight_smile:

It is the bit that goes:-

PORTD = B11001010;
  delayMicroseconds(valPot);
  PORTB = B100011;
  delayMicroseconds(valPot);
  PORTD = B01100100;
  delayMicroseconds(valPot);
  PORTB = B100010;
  delayMicroseconds(valPot);
  PORTD = B00111100;

The binary number is in each one of these PORTB lines is defined from one of the lines in the sequence table in the data sheet.

However, the program does use pins 0 & 1 which are normally used for the serial communications so it might not be too practical.

Note that using PortB and PORTD.
But that bit entry corresponds to each driver (IA4, IA1, ENA1, PH1, IB1-IB4, ENA2, PH2), which port to each group of entries?
IA4 IA3 IA2 IA1 ENA1 PH1 IB4 IB3 IB2 IB1 ENA2 PH2
PortD or PortB ? PortD or PortB ?

One more question on this driver used the 32 combinations of sequence table?
Thanks for the help

which port to each group of entries?

That is defined in the array:-
motorPin[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11};

One more question on this driver used the 32 combinations of sequence table?

Sorry I can't understand that question.