Author Topic: Simple way(s) to run a bipolar stepper motor?  (Read 13868 times)

Offline sorveltaja

  • Hero Member
  • *****
  • Posts: 627
Simple way(s) to run a bipolar stepper motor?
« on: July 11, 2023, 06:50:13 PM »
This should rather be "how not to use this or that to achieve this or that".

Anyways, I have few bipolar stepper motors, one from old printer and another from HP scanner and also Nema 17 ones, which I used to test as hand-cranked generators.

I think I'll stick with Nema 17, as it's easier to find specs for them.

Specs that are in the motor itself:

Made by Joy-It
Model Nema 17-04
Holding torque 0,5 Nm
Phase resistance 2.20 Ohms
Rated voltage 3.3V
Rated current 1.5A
Step angle 1.8 deg

As I don't have Arduino or any other such devices, I started to look for simpler ways to run a stepper motor. I mean, how were those buggers controlled before Arduinos and such software controlled hardware?

So far, as a starting point, I've managed to find rather simple schematic, which uses 4017(decade counter) and audio amplifiers(TDA2030): https://electronicscheme.net/stepper-motor-controller-using-tda2030/

As I don't have 2030's in my shelf, I decided to use what I have, as a leftover from past project - LM386's.

Anyways, that gave me an idea to test a schematic of 4017-386 based circuits to get a working sequence to run the this bipolar stepper - it's been (again) like a guessing game - like building something out of Lego blocks - whatever produces desired result, is a keeper.

It was positive surprise to see, that by using those wimpy audio amps, it is possible to drive this bipolar stepper(Nema 17-04) with 400mA at 5-6 volts without burning out involved components.

So far, this is the simplest circuit after some testing. 4017 uses function generator for supply and signal, and 386 uses bench psu (For clarity, I have omitted supply connections and spike-reducing diodes):



Signal rate/frequency, where the torque is most notable is from about 1-150 hz(or probably half of that, as that 4017 acts like a flip-flop), though. Above that the motor just jitters.

But that might well be more than enough for the purpose I have in mind, as it doesn't require as much torque/speed as that circuit provides.

But there is this serious issue of vibration when using full-steps (I guess this circuit  uses such).

Obvious solution - why not use microstepping? That's where I am at this point - trying to figure out how to approach it from an uneducated position.

Another (and perhaps a lot easier) possibility could be to just use something to absorb/dampen the vibrations.
« Last Edit: October 23, 2023, 05:30:51 PM by sorveltaja »

Offline efrench

  • Full Member
  • ***
  • Posts: 217
Re: Simple way(s) to run a bipolar stepper motor?
« Reply #1 on: July 12, 2023, 01:04:10 AM »
So do you just want to run the stepper as a dc motor or do you want to do indexing as well?

Arduinos, stepper drivers, and lcds can be had on AliExpress for less than $5 each. 

Offline sorveltaja

  • Hero Member
  • *****
  • Posts: 627
Re: Simple way(s) to run a bipolar stepper motor?
« Reply #2 on: July 12, 2023, 07:27:57 PM »
I'm just looking for running the stepper at a certain, stable speed. That's pretty much what I have already achieved.

I had two A4988-based drivers, but it's way too easy to fry them by accident.

What I'm also trying to find out, if I can make something, that produces a half-step sequence using only discrete, analog components. If I manage to do that, it's fine. If I don't, that's also fine. Be it either way, next step is to see what plan B has to offer.

I just like to test things and find out what I don't know, and perhaps learn thing or two, while at it.

From previous projects I learned how to make stepped voltage waveforms/sequences.

But here we have current, and difference between the two phases involved:


 
If memory serves, I haven't had projects before, which use that much(400-500mA) current.

I already tested one voltage-to-current converter schematic on a breadboard, and yeah, included transistor and resistor got really hot. Now I know at least one thing, of what not to do to melt a breadbord.
« Last Edit: October 23, 2023, 05:31:45 PM by sorveltaja »

Offline efrench

  • Full Member
  • ***
  • Posts: 217
Re: Simple way(s) to run a bipolar stepper motor?
« Reply #3 on: July 12, 2023, 07:45:29 PM »
I have a stepper driver from 2002 which doesn't need a microprocessor.  It's Kit #109 from kitsrus.com.

Offline BillTodd

  • Hero Member
  • *****
  • Posts: 1127
  • Country: 00
  • Colchester Essex (where the lathes were made)
Re: Simple way(s) to run a bipolar stepper motor?
« Reply #4 on: July 13, 2023, 04:02:21 AM »
Just make a sine oscillator and add a 90 degree phase shifter for the second phase. The motor doesn't have to step.

Bill

Offline philf

  • Hero Member
  • *****
  • Posts: 1127
  • Country: gb
Re: Simple way(s) to run a bipolar stepper motor?
« Reply #5 on: July 13, 2023, 04:58:29 AM »
What I'm also trying to find out, if I can make something, that produces a half-step sequence using only discrete, analog components. If I manage to do that, it's fine. If I don't, that's also fine. Be it either way, next step is to see what plan B has to offer.

In 1984 I made some 1/2 step drivers for a plotter I was building. They just used cmos chips to generate the 1/2 step sequence.

The basic circuit:



The power circuit (to use constant current):



(Transistors used BC107 and BD645 Darlingtons)

And the finished board:



Phil.
Phil Fern
Location: Marple, Cheshire

Offline sorveltaja

  • Hero Member
  • *****
  • Posts: 627
Re: Simple way(s) to run a bipolar stepper motor?
« Reply #6 on: July 14, 2023, 05:54:32 PM »
Thanks for all for the replies.

I had to test, how to 'emulate' a correct sequence, to get a 'hands on' -feeling, using four spdt switches.

Finally, I think I got it right, as the stepper rotates in the same direction - step by step, when turning the switches on and off in certain order.

First image(stepper_and_switches_1) is just to show how I connected switches and stepper motor's wires, while the second one is the actual breadboarded circuit(rest of the breadboard wires and stuff isn't involved):




Anyways, I simulated Phil's circuit to see what kind of waveforms it makes:



As I don't have 4028's and 4075's, it was time to test how to make similar-ish waveforms, using 4017 and some diodes:



Then comparison, first is Phil's circuit and second one is 4017-based:



It seems to be kind of there, but after all, it's just a simulation.

I'll do breadboarding and see how it goes.
« Last Edit: October 23, 2023, 05:34:49 PM by sorveltaja »

Offline philf

  • Hero Member
  • *****
  • Posts: 1127
  • Country: gb
Re: Simple way(s) to run a bipolar stepper motor?
« Reply #7 on: July 16, 2023, 03:15:39 AM »
If you were in the UK I could have sent you plenty of chips and a driver board. I'm unlikely ever to use them. I also have several L297/L298 stepper ics.
Phil Fern
Location: Marple, Cheshire

Offline sorveltaja

  • Hero Member
  • *****
  • Posts: 627
Re: Simple way(s) to run a bipolar stepper motor?
« Reply #8 on: July 20, 2023, 07:00:48 PM »
Phil, I'm from Finland, but thanks anyway for the offer  :beer:

I've been testing how to keep stepped waveform - to preserve its form - when there is a load.

I guess, when there is enough current, that's what gives the voltage(be it in stepped form, or whatever) "power" to maintain its shape under load (Nema 17 stepper coils are about 4 ohms).

Circuit that I used for testing, is based on LM317's datasheet, which has several examples of how it can be used. One of them is "Digitally Selected Outputs":



That led to using 4017 to make a sequence:



It keeps its waveform under load, after adjusting the pots. I had to put a heatsink to 317, as I was using max 1300mA. So far so good, but then I realized, that the waveform appears only as a positive voltage. I was like: "how to get the dark negative side involved?"

I think it may well require a split power supply to get both sides. I remember using diy one on one of past projects, but haven't yet found where the heck it is.     

In the meantime, I was looking another ways to test how to make the stepper turn smoother than choppy full-wave. I was getting frustrated, but then I remembered Bill's reply about using sine waves 90 degrees apart. At first, I have to admit, I thought that nah, it just can't be that simple.

But in practice, it works. I tested it with function generator, and it made that Nema 17 turn rather smoothly. There isn't awful lot of torque, but I think still enough(using finger-meter) to take the idea further.

Also, it was surprising to see, that this kind of stepper doesn't require hefty current to run(at least for the purpose I have in mind).

Next thing that came to mind was, "how about little more grunt, if some future project requires it".

Besides, I'd like to use something else to run the stepper, than function generator.

So I'm trying to figure out, how to amplify a sine wave against 4 ohms load.

What comes to that 90 degrees phase shift, I already have an idea, of what to try - one or two stages of an op-amp based phase shifter, which was originally controlled with ldr-led based optoisolators, and was intended for musical use.   

Earlier I breadboarded that phase shifter(four stages, everything else stripped, most basic version of it), and yeah, it was rather easy to use just pots to adjust difference between phases. 


 
« Last Edit: October 23, 2023, 05:37:38 PM by sorveltaja »

Offline sorveltaja

  • Hero Member
  • *****
  • Posts: 627
Re: Simple way(s) to run a bipolar stepper motor?
« Reply #9 on: August 07, 2023, 08:16:33 PM »
After some testings with Nema 17, there is still a problem with vibrations it makes, when  driven with amplified sine wave. I guess it has to do with something like 'flywheel effect' - in other words, mass of the rotating part(rotor?), which would need a specific driver to compensate that(slow decay, mixed decay and that kind of stuff), in order for it to run smoothly.

Since I'm looking for a lot simpler way to accomplish what I have in mind, I thought that why not try the smaller stepper from HP flatbed scanner:



When using same setup(with pesky LM386's), as it has far less mass, it might be more suitable for the purpose. And when used with gears on the picture, it obviously has more torque.

This stepper's coils are about 3,5 ohms.

For testing it I used 4-5V and max 400mA.

Usable driving frequency is about 50-200Hz

So far I've tested it through 386's with function generator, and it seems that with this smaller motor, there isn't much of a difference, whether it's driven with sine- or square wave(unless higher voltages and therefore more amperage is used).

Well, the circuit I'm using is far from perfect, but if one has small bipolar steppers and likes to see if they could be used for something, or maybe just take first steps to learn how to make these buggers run at all(like I did), it doesn't have to be overly complicated.

And, if sine wave (generator) isn't required, it alone makes things simpler. Two square wave generators(based on cmos ic's), that have 'quadrant' or 90 degrees phase difference(at least for bipolar steppers) - I think I'm going to revisit that one at some point(to replace function generator), if(when) possible next project proceeds.

In the end, here is the most 'dirtiest and simplest' circuit, that I've found when (ab)using it:



Besides the + and ground connections and two caps, as it can be seen, there is no connection to 386's second pin. Usually it's tied to ground, but leaving it unconnected seems to lessen or remove the excess noise.

2,2uF caps help to keep the noise/stuttering of stepper down, when there is no input. And the 1000uF(I guess more might be better) ones add a 'punch' to drive the stepper's coils.
« Last Edit: October 23, 2023, 05:39:00 PM by sorveltaja »

Offline sorveltaja

  • Hero Member
  • *****
  • Posts: 627
Re: Simple way(s) to run a bipolar stepper motor?
« Reply #10 on: August 23, 2023, 07:30:10 PM »
I've been looking ways to make something that produces 'quadrature' wave forms. Not 'quadrant', a term that I mistakenly used.

There are some schematics online, of how to use a D flip flop to make waves, that are 90 degrees apart, but although I have 4013's and 4049's, I just can't figure out how to get desired output.

When testing, they(4013's) give only 'flip', and therefore they flop(pun intended).

Anyway, there seems to be at least one other way to get quadrature waveforms.

In this case, it takes two 4017's (Decade counters, and a generator to run them), and four 1K resistors:

 



Offline philf

  • Hero Member
  • *****
  • Posts: 1127
  • Country: gb
Re: Simple way(s) to run a bipolar stepper motor?
« Reply #11 on: August 24, 2023, 02:23:07 PM »
sorveltaja- How do you provide the 4 outputs for a stepper motor? - Phil
Phil Fern
Location: Marple, Cheshire

Offline sorveltaja

  • Hero Member
  • *****
  • Posts: 627
Re: Simple way(s) to run a bipolar stepper motor?
« Reply #12 on: August 25, 2023, 03:06:34 PM »
The setup that I'm testing, uses two 4017's that are fed to two 386's. It's just two stepper wires connected to ground, and two other are connected to signal outputs. I've noticed that this circuit has a serious drawback: sometimes the stepper starts to rotate in opposite direction than previously, although I didn't change its wiring, or anything in the circuit.

 
   

Offline philf

  • Hero Member
  • *****
  • Posts: 1127
  • Country: gb
Re: Simple way(s) to run a bipolar stepper motor?
« Reply #13 on: August 26, 2023, 12:46:59 PM »
The setup that I'm testing, uses two 4017's that are fed to two 386's. It's just two stepper wires connected to ground, and two other are connected to signal outputs. I've noticed that this circuit has a serious drawback: sometimes the stepper starts to rotate in opposite direction than previously, although I didn't change its wiring, or anything in the circuit.

 


What waveform(s) do the coils see?

An awful lot of trouble to spin a stepper when you can buy 5 driver boards off eBay for £7.90: eBay item number:203578822101

Phil.
Phil Fern
Location: Marple, Cheshire

Offline sorveltaja

  • Hero Member
  • *****
  • Posts: 627
Re: Simple way(s) to run a bipolar stepper motor?
« Reply #14 on: August 26, 2023, 07:46:40 PM »
The setup that I'm testing, uses two 4017's that are fed to two 386's. It's just two stepper wires connected to ground, and two other are connected to signal outputs. I've noticed that this circuit has a serious drawback: sometimes the stepper starts to rotate in opposite direction than previously, although I didn't change its wiring, or anything in the circuit.

 



What waveform(s) do the coils see?

An awful lot of trouble to spin a stepper when you can buy 5 driver boards off eBay for £7.90: eBay item number:203578822101

Phil.

The waveforms are rather distorted, although there are some faint(perhaps imaginary) remnants of waves 90 degrees apart. I should have taken scope screenshots of how crappy they are.

But I already removed involved components to test another setup(one can never have too many breadboards). Reason that I use infamous 386's instead of power transistors, is that they can take a lot of abuse without burning out(unless intentional or mistake). It's like a sort of first step to using more current, than I've used in any of previous projects. 

So I guess one thing is the current demand of low ohm coils, that distorts the signal of already mis-used 386's. I have to admit, that it's quite steep learning curve for me.

I have some power transistors, but as they require proper setup/circuit (to not use them simply as heating elements), I'll save them for later use, if I get some sense about that current stuff.

Phil, I appreciate your view, and yeah I know that it's a lot of trouble, but I just have this need to re-invent the wheel, and to show others, who might be looking for 'simple ways' to drive/run a stepper, of what kind of problems newbie(like me) might face, while at it :beer:

Offline sorveltaja

  • Hero Member
  • *****
  • Posts: 627
Re: Simple way(s) to run a bipolar stepper motor?
« Reply #15 on: September 06, 2023, 07:38:39 PM »
Well, after testing quite a few things that don't work, I think it's time for a sub-project. It has to do with voltage vs current, and how to visualize it, using a scope.

For me, just that - visual preference - has been really helpful in making sense of what happens in certain circuits. But so far, that has only been about voltage.

What comes to alternating or pulsing current, it apparently isn't as simple to 'show nice current waveforms' on a scope, although it seems to be possible by using 'current probe' or 'current clamp'.

Commercial ones tend to be rather expensive (like Owon's model that is available from my local supplier, is over 200 euros).

Obviously I started to look for a cheaper diy version. One possible candidate is at https://electronoobs.io/project/48#

He uses Hall effect sensor and a simple circuit to amplify its output. I should have most, if not all required components (plus some ferrite cores to butcher), except SS49E, which is 'linear' one.

I'm not sure if unipolar TLE4905L's or bipolar TLE4935L's (Hall effect sensors), that I have, are suitable, as there is no mention about linear(linearity?) in their datasheet. 

I'll test them anyway with that circuit, to see how it goes. And if it doesn't, I'll order some SS49E's.

Offline sorveltaja

  • Hero Member
  • *****
  • Posts: 627
Re: Simple way(s) to run a bipolar stepper motor?
« Reply #16 on: September 07, 2023, 04:31:40 PM »
Previously mentioned Hall sensors that I have, doesn't seem to be suitable for this purpose, as they behave like on-off devices. In other words, when waving a strong magnet near the sensor, its output is either 9V(or whatever the supply voltage is) or near zero volts.

With that in mind, the term 'linear' makes more sense (at least for me). If a Hall sensor is mentioned to be linear(like SS49E), it somehow implies, that its output could be anything between, lets say, its supply voltage and zero/ground. And linearity is perhaps a way to explain, how faithfully it follows(or reacts to)  'path', that has variable values (relation between input and output).

But enough of that babbling for now.
     

Offline sorveltaja

  • Hero Member
  • *****
  • Posts: 627
Re: Simple way(s) to run a bipolar stepper motor?
« Reply #17 on: October 22, 2023, 12:21:27 PM »
Bit more testing - this time something that uses split power supply. First one was a simple 'class B' or push-pull amplifier using dual op-amp and two pairs of transistors to feed the stepper coils.

It sort of worked, but the output was far from being smooth, causing the stepper to rumble quite badly.

From what I understand after some searching, transistors are current devices, while mosfets are voltage devices. I have no idea what that might mean in practice.

Anyways, I remembered having some old mosfets, J50's and K135's, and that they were meant to be used as complemetary pairs.

So I started to look info about 'mosfet push-pull amplifier'. One of the simplest circuit I could find is just that - simple.



That circuit might work without an op-amp, but it would have cross-distortion, unless there is something else to alleviate that issue.

I breadboarded a "stereo" version of that circuit, and so far have tested it using two 9V batteries in series to form a split supply.


Quite a mess at this point, but for some reason it seems to drive the stepper coils  smoother, and when the outputs are viewed on a scope, they retain sine waveform a lot better than any other circuits I've tested.

Also there appears to be plenty of torque (again, using finger meter), so perhaps the driving voltage and current follow each other more closely?

Working frequency range of that circuit appears to be from 1(and perhaps below that) to about 100Hz, when nema 17 was driven.

I'll take scope shots once I get more permanent split power supply hooked up.

Offline Noitoen

  • Full Member
  • ***
  • Posts: 143
  • Country: pt
Re: Simple way(s) to run a bipolar stepper motor?
« Reply #18 on: November 29, 2023, 07:41:46 AM »
Old post but to run a simple stepper motor as a regular small speed motor, an AC supply of 24V and 2 none polarized 4,7 uF capacitors in parallel will drive the motor like a single phase motor at mains frequency. Capacitors may vary depending on the motor

Offline JHovel

  • Jr. Member
  • **
  • Posts: 97
  • Country: au
Re: Simple way(s) to run a bipolar stepper motor?
« Reply #19 on: December 02, 2023, 07:13:38 AM »
Would you like to elaborate? Principles of function, likely speed of motor wave form to the motor etc?
Because I don't think that works at all. My expectation would be that the stepper motor will just sit there humming or growling, certainly not running. It needs 2 offset phases at 90 deg and reversing at 180 and 270 to make 400 steps per revolution. 50hz - with a phase shifted close to 90 deg would make it try to run at 3000rpm, when a stepper driver would make it run at 400steps : 50hz x 60 sec= 480rpm.... just my take on the idea.

Cheers,
Joe

Offline sorveltaja

  • Hero Member
  • *****
  • Posts: 627
Re: Simple way(s) to run a bipolar stepper motor?
« Reply #20 on: December 02, 2023, 03:14:22 PM »
Old post but to run a simple stepper motor as a regular small speed motor, an AC supply of 24V and 2 none polarized 4,7 uF capacitors in parallel will drive the motor like a single phase motor at mains frequency. Capacitors may vary depending on the motor

I've seen some Youtube videos of how to do that, and from what I understand, it's rather limited way. Also, I doubt if there is any useable torque available.

I haven't watched all videos of the subject, but generally they just seem to show, that it's possible to make a stepper motor rotate using that method. But how does it handle even modest load?

As Joe mentioned, there just has to be certain signal for both coils(when talking about bipolar stepper) in certain order.  I guess, that's what makes it possible to produce torque.

--
I know it's been a while since I last posted. I really would like to get back to this project, but meh, there are other things that keep me occupied. It just sucks when that happens.

Offline Muzzerboy

  • Full Member
  • ***
  • Posts: 129
  • Country: gb
    • The Mighty Shiz
Re: Simple way(s) to run a bipolar stepper motor?
« Reply #21 on: December 02, 2023, 03:29:56 PM »
You have to realise that stepper motors need to be current driven, rather than voltage driven. Most drivers regulate or limit the current once it has reached the level needed to index the motor to its next position. If they didn't do that, there is nothing to limit the winding current in the motor. If you had a 30V power supply and a 3 ohm motor, you would end up with a steady state current of 10A (for a fairly short time!). Instead, they typically use a full bridge with PWM modulation to limit the current and hold it at a sensible (programmable) level.

When you control the position with multiple microsteps, you come closer to driving the windings with 2 sinusoidal currents that are 90 degrees out of phase. However as noted, these need to be currents, not voltages and they need to be a sinusoidal function of the rotor position, not uncontrolled.

As the motor speed rises, you need more voltage to overcome the inductance. Or if you like, the motor develops a back emf (voltage) that is proportional to speed - and when that back emf reaches the power supply voltage, you can't drive any current into the windings. As torque is proportional to current, that means your torque has fallen to zero. This is something that often gets overlooked when people focus on the headline (stall) torque, not appreciating that the torque will fall to zero with speed.

That opamp circuit with the MOSFETs is a (linear) voltage driver, so not really suitable. Ideally it would be a current source, either PWM or linear.

Take the time to study a modern microstepping driver IC, like the I've linked to here. You may not want to take the easy route out but if you digest the datasheet and application notes, you will gain a better understanding of what is needed to successfully drive a stepper motor.
https://www.allegromicro.com/-/media/files/datasheets/a4988-datasheet.pdf

Offline Noitoen

  • Full Member
  • ***
  • Posts: 143
  • Country: pt
Re: Simple way(s) to run a bipolar stepper motor?
« Reply #22 on: December 15, 2023, 06:28:10 AM »
Many years ago, on a plant that I used to do some maintenance, there was a need to automate a 6 meter high recycled water tank. We needed to know where the water level was with some accuracy. At the time, analog ultrasonic range sensors were very expensive so, I designed an "electromechanical" level sensor. It consisted of a 200 mm diameter nylon flat drum/pulley with a rounded thread with the pitch of the diameter of a thin 2 conductor + shield cable (around 4 mm) and 3 concentric grooves were cut on the side of the drum. These accommodated 3 brass rings to make up 3 simple slip-rings to connect the cable to a regular level relay. The drum was driven by a small stepper motor with a gearbox. A 5 K/ohm, 10 turn potentiometer was connected to the shaft to give feedback of the drum position. On the end of the cable, a small weight was hung and 3 probes (ref., Lower and Upper) were soldered to the wires.

These probes would indicate if the tip was touching the water or fully submerged. The stepper motor was driven by 24 VAC with a capacitor rolling or unrolling the cable. If the upper probe was touching the water, the cable would be pulled until it wasn't and if the lower wasn't touching, it would lower the probes. The level was determined by the feedback potentiometer's value. This type of AC drive was chosen because there were no brushes to wear out on the motor since it was always moving up and down "hunting" for the water surface.

The system worked for many years without any issues.

Offline Muzzerboy

  • Full Member
  • ***
  • Posts: 129
  • Country: gb
    • The Mighty Shiz
Re: Simple way(s) to run a bipolar stepper motor?
« Reply #23 on: December 16, 2023, 09:33:49 AM »
FWIW, many of the commercial tank level meters use a submerged pipe (to the bottom of a tank) and a small pump to supply a continuous (but low) flow of air through the pipe. If you know the density of the liquid, you can directly relate the back pressure to the depth of the fluid. No moving parts, apart from the pump itself.

Offline Noitoen

  • Full Member
  • ***
  • Posts: 143
  • Country: pt
Re: Simple way(s) to run a bipolar stepper motor?
« Reply #24 on: December 16, 2023, 04:34:00 PM »
FWIW, many of the commercial tank level meters use a submerged pipe (to the bottom of a tank) and a small pump to supply a continuous (but low) flow of air through the pipe. If you know the density of the liquid, you can directly relate the back pressure to the depth of the fluid. No moving parts, apart from the pump itself.

Been there, done that  :D I've built the controls of a sinkable floating dock where the "sinking part was controlled by the filling of 20 ballast tanks. The control systems are built in the 4 corner towers where the pumps and fill/empty valves were located. The level inside the tanks were monitoring by a constant air flow regulator and a manifold of multiplexing valves which took turns of measuring the blowoff pressure of 5 tanks on each corner to determine the water levels at each ballast tank.