5-wire Unipolar Stepper, L298N H Bridge

No idea what I'm doing...

I have a 5 wire unipolar stepper motor and a L298N H Bridge (probably not what I need, but it is what I have).

The packaging for the motor labels the wires as:
blue - A
purple - /A
yellow - B
orange - /B
white - com

I wired the motor leads to the H Bridge as follows:
blue - motor A
purple - motor A
yellow - motor B
orange - motor B
white - VMS

I wired the H Bridge to the arduino as follows:
LN1 - 9
LN2 - 10
LN3 - 11
LN4 - 12
VMS - 12V supply
GND - ground
I didn't wire up ENA or ENB

So far so good???

No idea how to write code for this. Basically, I just want the stepper to turn a certain number of steps clockwise at a certain time of day and then to turn the same number of steps counterclockwise at another time. It'll repeat this day after day.

I have an RTC connected to my arduino already. I'm adding the stepper. The RTC and everything else already connected works.

It is a unipolar stepper motor with 5 wires:
red: power connector, I have it at 5V and works fine
orange and black: coil 1
brown and yellow: coil 2

5 Wire steppers are unipolar by defenition/design
A L298 is an H-bridge and such will drive the coils in a bipolar fashion
You can drive a 6 wire stepper in either mode, but not a 5 wire one (because of the common between the two coils)

Blue smoke will be seen.

There's another recent thread on this - in brief with care you can cope with 5 wire and bipolar
drive, but you have to be careful. The insight is that the centre of each winding is common,
but if each winding is energized then the centre will be at V/2 so commoning them isn't a problem.

In fact each winding can either be energized or completely open-circuit, no where inbetween.

Well last time I did it, I was not "carefull" enough. It depends on the Hbridge driver I presume (it wasn't a L298).
@MarkT:Do you have a link to that thread handy?

google with this keyword "5 wire bipolar stepper MarkT site:forum.arduino.cc"
remove ";wap2" from url, I think SMF make version for search engine.

and for the lazy -> 5 wires unipolar stepper motor + L298? - #2 by MarkT - Motors, Mechanics, Power and CNC - Arduino Forum

OK, so back to the OP - Full Step Only and a dumb L298N may work. Make any small mistake ....

MarkT:
There's another recent thread on this - in brief with care you can cope with 5 wire and bipolar
drive, but you have to be careful. The insight is that the centre of each winding is common,
but if each winding is energized then the centre will be at V/2 so commoning them isn't a problem.

In fact each winding can either be energized or completely open-circuit, no where inbetween.

Couple of years late here. But I don't understand what is meant by the details above. My understanding is that the centre of the windings is usually connected to a supply voltage, such as 'V' volts. For a 5 wire motor, if the centres of the windings are both at 'V' volts, then how can the centre voltage become V/2 Volts? Thanks!

If you treat a 5-wire motor as bipolar but always energize both coils, the centre of each coil must be at
V/2 whichever way round you energize it. This is not the normal way of driving bipolar motors though.

Of course to treat a 5-wire as bipolar you have to identify the phases correctly.

MarkT:
If you treat a 5-wire motor as bipolar but always energize both coils, the centre of each coil must be at
V/2 whichever way round you energize it. This is not the normal way of driving bipolar motors though.

Of course to treat a 5-wire as bipolar you have to identify the phases correctly.

Hi MarkT! Thanks for your help and explanation. Just to make sure I got the correct understanding - do you mean that supply voltage of 'V/2' volts needs to be applied to the centre of each coil?

I was thinking that supply voltage applied to the centre was typically 'V' volts (rather than V/2), so was confused about the reason for V/2. Is using V/2 related to maximum power handling requirements of the coils?

Thanks MarkT.

do you mean that supply voltage of 'V/2' volts needs to be applied to the centre of each coil?

No. If you apply "V" to one end of the coil and ground the other end, the center tap is at potential V/2. It also doesn't matter which end is at "V".

5-wire steppers work fine with bipolar motor drivers, but use full step mode only.

jremington:
No. If you apply "V" to one end of the coil and ground the other end, the center tap is at potential V/2. It also doesn't matter which end is at "V".

5-wire steppers work fine with bipolar motor drivers, but use full step mode only.

Thanks for your help JRem. I see what you mean there. My error was due to thinking that the 5-wire motor was meant to be wired with both centres connected to a supply voltage V. But now I realise that (if we want to use a bipolar drivers like a L298N), then we connect the supply voltage to a coil end (and not to a coil centre).

So it appears that the 5-wire stepper is really going to be used as a 4-wire (with the common centre-tap wire unused), right?

Thanks again. Much appreciated!

Yes, but it requires non-standard drive mode - so no-one does it.

MarkT:
Yes, but it requires non-standard drive mode - so no-one does it.

Hi MarkT, I was assuming that you meant that a 5-wire stepper motor (meant for uni-polar operation) can become a 4-wire stepper motor to give bipolar operation. And since it becomes a bipolar motor, then it can be driven using an H-bridge, right? I was thinking that using an H-bridge for driving a bipolar stepper motor is 'standard' or typical.

You don't understand - H-bridges are commonly used in fast or slow decay mode, where one
connection is left to float to whereever the backEMF takes it - this cannot be used for 5-wire
as it won't float if the winding centres are commoned.

MarkT:
You don't understand - H-bridges are commonly used in fast or slow decay mode, where one
connection is left to float to whereever the backEMF takes it - this cannot be used for 5-wire
as it won't float if the winding centres are commoned.

I see. Thanks Mark. You might not have understood my question. I was just asking if a 5-wire motor can be treated as a 4-wire motor where it is operated as a 4-wire bipolar motor (with 5th wire disconnected).

Before, I didn't understand what was meant by non-standard drive mode. Thanks for explaining. I think that you mentioned somewhere that it is possible to use the 5-wire as a 4-wire device. I assumed we could then drive the 4-wire using a dual H-bridge in the typical fashion, even though we would be limited to full stepping (ie. no support for half-stepping).

I was interested to see whether or not the O.P. was able to operate his/her 5-wire stepper (uni polar mode) by using it as a 4-wire stepper (bipolar mode), and driving it with an L298N.

I had a L298N dual H-bridge circuit board and a YM2754 on hand, but didn't know how to configure them at that time. So I searched on the net to see what info there was.

At first, I didn't know that the uni-polar 5 wire motor could be used as a typical bipolar motor by leaving the centre tap wire(s) disconnected. I only found out that this could be done after you mentioned it.

Today I set up an L298N h-bridge circuit board according to the diagram figure 5 at this site:

The only difference is that motor 1 in figure 5 becomes coil #1 of the bipolar stepper motor, and motor 2 becomes coil #2. I chose to use 1N5822 diodes for the 8 protection diodes.

I used 12V DC to drive each of the two 'full' coils of the YM2754 stepper motor (with 5th wire not used). The motor is rated for 12V DC for uni-polar operation. I decided to choose 12V DC for bi-polar operation - even though a full coil is meant to take 24V DC, and half coil is meant to take 12V DC.

I needed to find out what polarity to apply to the pair of coils in order to go clock-wise and anti-clockwise (with the motor working as 4-wire and with 5th wire disconnected).

For the YM2754, I have a blue-purple pair of wires for one coil, and a yellow-orange pair of wires for the other coil. For each of these two coils, I chose the blue and the yellow wires to be 'positive' reference wires.

While looking directly at the shaft itself from birds eye view -

To make the shaft go clockwise in steps, I drove (simultaneously) blue to 12V, purple to 0V, yellow to 12V, orange to 0V, then I added a delay (eg 1 second delay), then simultaneously drove blue, purple, yellow, orange to 0V, 12V, 12V, 0V respectively, then added a delay again, then simultaneously drove blue, purple, yellow, orange to 0V, 12V, 0V, 12V respectively, then added a delay, then simultaneously drove blue, purple, yellow, orange to 12V, 0V, 0V, 12V respectively, then added one more delay. Then repeated the whole cycle.

The above sequence for clockwise stepping in terms of high (12V) and low (0V) voltages are:

clockwise: blue purp orange yellow simultaneously made to be high low high low, then 1 second DELAY, followed by low high high low, then 1 second DELAY, followed by low high low high, then 1 second DELAY, followed by high low low high, then another DELAY, then repeat the whole cycle.

anti-clockwise: high low low high, then another DELAY, low high low high, then another DELAY, low high high low, then DELAY, then high low high low, then DELAY, then repeat the whole cycle.

I used an Arduino MEGA 2560 to control the input pins of the L298N h-bridge circuit board.

The L298N 5V pin caused confusion. I now understand that this '5V' pin can be an input or an output pin, depending on whether a jumper-wire is connected or not. I initially guessed that I needed to hook up that pin to a 5V DC supply in order to supply the logic circuity in the L298N. Then I learned that the '5V' pin is actually an output pin by default, unless I pull out a jumper. When the jumper is connected, the L298N bridge board has its own 5V regulator supply, and the '5V' pin will not only output 5V DC, but will also supply the logic circuitry of the L298N chip. But when the jumper is pulled-out, then the L298N logic circuitry needs to get 5V from somewhere, so the '5V' pin will be an input pin, which can then receive 5V DC from say the Arduino 5V output pin. So, for my setup, I removed the '5V enable jumper' from the L298N board, and I connected the 5V output of the arduino to the '5V' pin of the L298N board. This provides 5V DC for running the L298N logic circuit.

Anyway, the L298N is driving the YM2754 stepper in the 4-wire configuration. Getting the full 48 steps.

Although, I think I need to either drive the coils with a lower voltage (maybe 6V or 8V instead of 12V), or need to put some current limiting resistors in there..... as the motor temperature builds up after a while. Otherwise..... it steps nicely in forward direction as well as reverse direction.

I decided to write a little about what I did for those that want to drive their YM2754 stepper motor with a L298N H-bridge circuit board.

Kenny