Using L6474 and powerSTEP01

Hi,

I find a few threads and a couple of libraries concerning these chips on Arduino. Michel_F's library was particularly useful in getting the iron spinning. Many thanks.

Having spend many months hacking around I'm fairly happy with the SPI exchanges and have an interrupt set up to catch the FLAG line and check the chip status byte etc.

However, I just can't get a sensible amount of current into the motors. I suspect this may be a less than optimal configuration of the many timing parameters these chips have.

I'm using Wantai NEMA23 1.8 degree motors which the manufacturer says have an impedance of 68 uH 1.6mH and a DC resistance of about 1 ohm. I'm powering them with a stack lead acid batteries which gives around 52V. This should allow me to kick some serious current into the motors. But the most I have measured is 2.5A at 1400 mm/min ( GRBL talk ).

I'm running half-step mode on a 5mm pitch lead screw. I make that 373 pps , right down the bottom of the manufacturer's torque curve.

the inductance should be of order 0.1 ohm at that speed and the powerSTEP01 is supposed to be able to deliver 6A .

Does any one have actual measured currents higher that about 3A going into a motor using either of these chips?

Thanks for any info.

ardnut:
I'm using Wantai NEMA23 1.8 degree motors which the manufacturer says have an impedance of 68 uH and a DC resistance of about 1 ohm. I'm powering them with a stack lead acid batteries which gives around 52V. This should allow me to kick some serious current into the motors. But the most I have measured is 2.5A at 1400 mm/min ( GRBL talk ).

The important data for a stepper motor is the design current - which you have not mentioned. Post a link to the motor datasheet.

What stepper motor driver are you using - post a link to its datasheet. You MUST set the current limit in the stepper driver to match the motor.

...R
Stepper Motor Basics
Simple Stepper Code

Thanks for the reply.

http://www.zhengkemotor.com/product/product205.html
Its the 633 model I am using.

firstly I was mis-recalling the impedance ! it's 1.6mH. That brings impedance at 1400 up to about 3.75 ohm plus the wire = 1R. The graph is labelled as 3A @ 30V which is presumably the max torque at the low end, close to where I'm measuring.

The most I got into the board ( STM eval IHMO ) was 2.9A @ 800 mm/min = 213pps. nominal inductance = 2.14 R.
I'm measuring the voltage across a 50mohm resistance in series with Vin , using a DVM.

Any slower and it basically does not run properly even in half-step mode.

TVAL/HOLD =126 = 10A on STEP01

I've typically been testing much lower TVAL but just pushed it max to get a definitive reading.

My main problem is not low end but higher speeds. It stalls far too easily to be much use and this seems to be because , even with 52V on it , I'm not getting the current into the windings. Again I tried driving with a 30V PSU initially but recently boosted to try and stuff a bit more juice in there.

A similar problem was occurring with the L6474 eval boards. I use TVAL on that and HOLD on STEP01 since I am providing step pulses GRBL style, not using the internal motion engine.

I hope that is a little clearer.

ardnut:
I hope that is a little clearer.

Only a little.

You have not posted a link to the stepper motor driver board you are using.

...R

OK, IHM03A1

https://www.mouser.fr/ProductDetail/511-X-NUCLEO-IHM03A1?r=511-X-NUCLEO-IHM03A1

It looks as if that driver board has an SPI interface - is that correct?

What current limit have you set for the driver board?

Why have you not provided this information before I had to ask?
What other useful information do you have?

Post your Arduino program.

You need an oscilloscope to measure the fluctuating current for a stepper motor. A multimeter does not respond fast enough.

...R

Yes it uses SPI for configuration of things like the timing of the control waveform, max current etc. L6474 has step and dir pins like a classic GRBL / polulu set up. powerStep uses SPI for direection too. I assumed since you were replying that your were familiar with one or both of these chips indicated in the title.

What current limit have you set for the driver board?

Why have you not provided this information before I had to ask?
What other useful information do you have?

I did provide this info. it is set to 10A ,Since the titile refers to the two chips I presumed that anyone attempting to answer would know what TVAL referred to. if you do not understand some of the information provided please ask. There is an over-current alarm which I have set at 5A and this is not being triggered. It is unclear in the datasheet what these two currents are; maybe the OC is full cycle average and 10A is instantaneous peak.

Post your Arduino program.

I'm using a modified GRBL,which has about 30 files I don't think there is much point in posting all that. I can post the config section where I set up the timing values via SPI but if you are not familiar with the chips that is unlikely to be informative.

I have a 'scope. The waveform on the windings is quite complex since the current is modulated during each individual pulse. I suspect the problem may be with complex config of the timing parameters , which is why I posted asking for anyone with specific practical knowledge and experience of these chips.

I used a DVM to assess the overall energy going into the board at different step speeds since this allows me to quickly measure at several different pulse rates and confirms that the problem is that not enough current is being delivered.

If you have no knowledge of these chips maybe you can point out some other factor I'm over-looking.

I realised an error I was making in calculating the impedance.

2.9A @ 800 mm/min = 213pps. nominal inductance = 2.14 R.

800 /5./60. *200 = 533 pps

800 /5./60. *200 2pi *1.6e-3 = 5.36 ohm

52 / (5.36+1) = 8.17 A cf 2.9A measured being pulled from the supply , feeding two phases. One or other phase should be energised at any time, or both at 70% during a half step. So the supply draw should be somewhat more than the simple phase current. The chip is designed to ramp up I max and then pulse modulate to keep it there. That modulation is where all the timing params come in. I'm unsure whether that is optimally set up.

The motor is 6 wire bipolar, I am assuming that the 1.6mH is each of phase two windings, not each half measured at the centre tap. The measurement technique is not specified.

It would not be desirable to push more than 3A RMS into the windings since they will saturate, but I should be able to get 3A at a higher speed and this is not happening.

Slow down a bit. I can't keep up with you. :slight_smile:

ardnut:
I did provide this info. it is set to 10A

Unless I am misunderstanding something this is silly. The motor spec says 3 amps.

Since the titile refers to the two chips I presumed that anyone attempting to answer would know what TVAL referred to. if you do not understand some of the information provided please ask

Your motor driver is not the sort of product that is regularly used by Arduino hobbyists so don't assume that anyone is familiar with it.

No, I certainly don't want you to post the GRBL code. You did mention it in your Original Post but only very obliquely. I had assumed you were using your own software.

If your problem really lies within the GRBL software then you will need to ask on some Forum that is specifically familiar with that. This Arduino Forum is for helping people write their own Arduino programs.

...R

Unless I am misunderstanding something this is silly. The motor spec says 3 amps.

see the last line of my last post !

This Arduino Forum is for helping people write their own Arduino programs.

Not just write programs but interface with hardware. This section is entitled "Motors, Mechanics, and Power" not software. But it's fine if you can't help. Thanks for trying.

I have no issues with GRBL, and if I did I would be on their github page. The part I am having trouble with is driving motors plugged into a Uno. In fact I'm just using GRBL as command console to generate pulse streams in this context.

There are a couple of libraries posted for these chips so I guess there is at least some experience here using them. Now it may well be that this is not an issue with the chips/boards at all and I'm expecting something unrealistic from these motors, or I'm messing up my calculations.

Hopefully someone with more experience will be able to help.

ardnut:
see the last line of my last post !

Still does not make sense. If the motor driver limit is set to the max for the motor (3 amps) then I believe it is safe to assume that the driver is applying the limit correctly.

The part I am having trouble with is driving motors plugged into a Uno.

That statement does not make sense either because one NEVER "plugs motors into an Uno". You are not describing your problem with sufficient precision.

Maybe it would help to explore the motor's and driver's capabilities with a simple program such as in my link in Reply #1 without the complexity of GRBL getting in the way.

...R

Thanks, I had not noticed those links in #1 , I just thought it was a sig. or part of the forum padding . After someone signs off, I stop reading.

... without the complexity of GRBL getting in the way.

GRBL is not getting in the way, it is being very useful. It provides acceleration which is tested with my h/w then a few seconds of constant pulses, the speed of which I set with a gcode command. $110=1400 , for ex.

Also I have added SPI communication and an IRQ to handle error conditions on the chip when they occur. and I've extended the GRBL gcode with a few commands to allow me to set the various registers on the driver chip . This is very necessary for the testing I am doing.

$P0:9=64 , for ex. sets TVAL

The GRBL code itself in no way affects the current control of the driver board, so is not "getting in the way".

I have just re-run tests with a different motor with lower nominal voltage ( 1.65V ) . It is a SLO-SYN , made in USA. I get essentially the same current limitations. That has expelled the doubts I had about the chinese motor being a factor.

here is a graph of the current going into the board using the chinese motor. There is a curious plateau. This is not reproduced with the US motor, which is more monotonic.

Image from Reply #12 so we don't have to download it. See this Simple Image Guide

...R

Without a great deal more information about how you are gathering that information I can't see how anyone can comment.

To be honest, I can't understand what your problem is. Is it that the motor is not delivering the specified torque? Or is it simply that some electrical measurements are not what you expect?

If my motor was performing properly I would not care what the measurements were saying. As you, yourself said in Reply #6 "The waveform on the windings is quite complex since the current is modulated during each individual pulse"

...R

I do not have a calibrated brake to measure the torque. but the motor seems to stall too easily and has a very low rate at which it will reliably run off load. That led me to start looking at current values and check TVAL and friends.

When I see that upping TVAL does not change anything I wonder why not. If I limit the current output I would expect what I am getting : weak motor and low stall. If raising TVAL does not change anything then that means that something is limiting the current other than TVAL. A rough estimation of the impedance does not seem to be the limiting factor either.

When I see a very different motor showing almost identical power consumption, again it does not seem to be the motor.

I have also measured with a 10 mohm resistor in series with one of the phase windings. This is showing some odd variation of the winding current with different values of TVAL at the same speed. 2nd and 3rd column are current x10 in each direction. up/dn differences presumably due to motor geometry.

     TVAL UP / Dn
$P0:9=14  54 / 87
$P0:9=18  49 / 81
$P0:9=25  43 / 71
$P0:9=38  32 / 57
$P0:9=48  45 / 45  TVAL circa 3.9A; meas 4.5
$P0:9=56  39 / 37
$P0:9=60  34 / 33
$P0:9=64  30 / 30
$P0:9=72  36 / 37
$P0:9=78  42 / 48
$P0:9=84  60 / 58
$P0:9=96  50 / 48  TVAL circa 8A ; meas 5.0

The largest RMS phase current seems to be with the smallest TVAL. :?

The anomalously weak mean current around TVAL=60 matches the plateau in the previous data. Some odd resonance , maybe.

ardnut:
I do not have a calibrated brake to measure the torque. but the motor seems to stall too easily and has a very low rate at which it will reliably run off load.

How about providing some hard data.

If you use a simple program that you can post here how many steps per second can the motor operate at?

...R

OK, having spent all day splashing around in phase space, I've got a substantial improvement. First I ran a range of TVAL settings at a low speed ( 1200 mm/min = 800 pps ) and found a sweet spot where it was getting more current into the motor.

hard data:

$110=1200
[GetParam(09) = 19]

$P0:9=14  54 / 87
$P0:9=18  49 / 81
$P0:9=25  43 / 71
$P0:9=38  32 / 57
$P0:9=48  45 / 45  TVAL circa 3.9A; meas 4.5
$P0:9=56  39 / 37
$P0:9=60  34 / 33
$P0:9=64  30 / 30
$P0:9=72  36 / 37
$P0:9=78  42 / 48
$P0:9=84  60 / 58
$P0:9=96  50 / 48  TVAL circa 8A ; meas 5.0

Then using that TVAL I wanted to see how fast it could run without stalling with just a bob weight adding a bit of inertia.

[$P0:9=48] # circa 3.9A
$120=140.000 

$110=700  54 / 78  # slight motor body warming. sat ??
$110=800  49 / 72
$110=900  44 / 67
$110=1000 38 / 59
$110=1200 42 / 44
$110=1400  25
$110=1600 40
$110=1800 47
$110=2000 25
$110=2200 17
$110=2400 11
$110=2600  10.5 / 9
$110=2800  9.5 / 8
$110=3000  8.8 / 7.5
$110=3200 8.5 / 7
$110=3400 8.5 / 6.8
$110=3600 8.2 / 6.6
$110=3800 8.0 / 6.6
$110=4000  8.6 / 7.2
$110=4200 9.0 / 7.8
$110=4400 8.9 / 7.7
$110=4600 12.3 / 11
$110=4800 7.8 / 6.8
$110=5000 5.8 / 4.5
$110=5200 6.2 / 4.8
$110=5400 6.8 / 5/3
$110=5600 7.5 / 5.8
$110=5800 8.1 / 6.2
$110=6000 8.7 / 6.8
$110=6200 10 / 7.8
$110=6400 11.4 / 9.1
$110=6600 12 / 9.4
$110=6800 12.6 / 9.8 
$110=7000 13.1 / 10.2
$110=7200 13.4 / 10.6
$110=7400 14.1 / 10.8
$110=7600 14.4 / 11.2
$110=7800 15 / 11.6
$110=8000 15.5 / 11.9
$110=8200 15.7 /12.2
$110=8400 16.1 / 12.4
$110=8600 16.3 / 12.8
$110=8800 16.6 / 13
$110=9000 16.7 / 13.4
$110=9200 17.2 / 13.7
$110=9400 17.8 / 13.9
$110=9600 17.8 / 14.2
$110=9800 17.9 / 14.3
$110=10000 19.3 / 14.6
$110=10400 19.7 / 15.2
$110=10800 19.9 / 15.6
$110=11200 21.1 / 16.2  # x33
$110=11600 21.5 / 16.7
$110=12000 23 / 17.3
$110=12400 23 / 18
$110=12800 23.5 / 18.2  # x44
$110=13200 25.2 / 18.8
$110=13600 24.2 / 19.3
$110=14000 35 / 30
$110=14400 27.3 / 20.3
$110=14800 35.5 / 31
$110=15200 34.5 / 30
$110=15600  29.3 / 21.2 # x55
$110=16000 31 / 28
$110=16400 29 / 22.5 # x66
$110=16800 31 / 23
$110=17200 31 / 23.5
$110=17600 32 / 24
$110=18000 33 / 24
$110=18400 33 / 25
$110=18800 34 / 25
$110=19200 35 / 25.5
$110=19600 35.5 / 26
$110=20000 36 / 26.6  # ~ 14kHz

[$P0:9]  # end confirm.
[GetParam(09) = 0x30]

Hard data. :wink:

$110=20000 = 13300pps = 4000 rpm.
who says stepper motors don't turn fast ?

That's about 10 times faster than it was going this morning :o and I'm getting some sensible current into it. I stopped at 4000 rpm since I don't know how fast the armature can stand. That's already twice the speed of the end of the published torque curve.

It will still stand light frictional load at that speed, so there is a little torque to spare still.

Now I know why I chose these driver boards instead of Pololus.

ardnut:
Now I know why I chose these driver boards instead of Pololus.

I never suggested that a Pololu driver would be better, or even that it would be suitable for your motor. However without doing like-for-like comparisons one cannot say that X is better than Y.

And this Thread is certainly not an introductory tutorial to your chosen driver. :slight_smile:

...R

I never suggested that you suggested ... neither did I suggest this was a tutorial. I came here hoping to find some one with knowledge of these chips who could give me some pointers.

I did consider Pololu at first since it is a frequently used and cheap solution but I did not think the current capacity was enough and I did not like the idea that if they end up pushing more that 2A you blow and throw. This inevitably means that you have to under-rate the already light current supply to maintain a margin.

One of the nice features of the STM chips is that they just shut down instead of burning themselves out. There is also a pre-emptive thermal warning before thermal shut down. When this triggers the interrupt line, I tell GRBL to do a controlled stop which maintains the machine position and does not ruin the work piece.

It's been quite a lot of work but it's starting to pay off. This looks about ready to bolt back on to the machine and get those ball-screws spinning.

The above data shows what looks like a resonance around 10k and the 50V starting warm the core as the motor slows down. [ re-ran and did not find the 10k peaks, maybe spurious ]

Also ran at 37V but stalls easily 3k-4k and this is useful cutting speeds. Odd the current drops this low.

That was the voltage across a small 10 mohm resistor in series with one of windings.

That's AC btw, which pw modulated.