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

Offline sorveltaja

  • Hero Member
  • *****
  • Posts: 598
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.

Offline efrench

  • Full Member
  • ***
  • Posts: 213
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: 598
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.

Offline efrench

  • Full Member
  • ***
  • Posts: 213
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: 1025
  • 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: 1071
  • 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: 598
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(4516_4028_4075_half_step):



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(4017_circuit):



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



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: July 15, 2023, 07:44:38 AM by sorveltaja »

Offline philf

  • Hero Member
  • *****
  • Posts: 1071
  • 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: 598
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"(317_digitally_sel_outputs):

That led to using 4017 to make a sequence(317_digitally_sel_outputs_2):

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. 

 

 

Offline sorveltaja

  • Hero Member
  • *****
  • Posts: 598
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 (small_stepper):



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(386_circuit):



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.

Offline sorveltaja

  • Hero Member
  • *****
  • Posts: 598
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: 1071
  • 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: 598
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: 1071
  • 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: 598
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: 598
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: 598
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.