Notifications
Clear all

[Solved] Mal-justed A4988


Inq
 Inq
(@inq)
Honorable Member
Joined: 5 months ago
Posts: 711
Topic starter  

I'm using Bill's video

as a guide and wanting to adjust the maximum current potentiometer.  I've done this once before using the voltage/Math version, but hadn't heard of Bill's direct reading method before starting at 46:30.  It makes far more sense to me.

I have an A4988 hooked up as follows per Bill's instructions:

  1. Logic GND to NodeMCU GND
  2. VDD to NodeMCU 3.3V
  3. 1A and 1B connected to volt meter set on 10A current range
  4. 2A and 2B not connected
  5. VMOT / GND to inexpensive bench power supply set with voltage set to 12V and maximum current set to 2.0 Amps.  I also have a 100uF capacitor set across these connections.
  6. DIR not connected.
  7. STP - connected to NodeMCU 3.3V
  8. SLEEP connected to RESET.
  9. Enable, MS1, MS2, MS3 - unconnected.
  10. The NodeMCU is connected to/powered by my computer USB.

Maljusted Behavior

No matter where I adjust the potentiometer, my current only varies between 0.09 amps and 0.19 amps.  It is very non-linear.  For 350 degrees of the pot, it is 0.09 and there is only about a 10 degree sweet spot that moves up to 0.19 and then back down.

Any ideas why I can't get it up to the maximum value of my stepper motor (1.5amps) ??? 

VBR,

Inq

3 lines of code = InqPortal = Complete IoT, App, Web Server w/ GUI Admin Client, Access Point Manager, Drag & Drop File Manager, OTA, Performance Metrics, Web Socket Comms, Easy App API, All running on ESP8266...
Even usable on ESP-01S - Quickest Start Guide


Quote
Will
 Will
(@will)
Noble Member
Joined: 1 year ago
Posts: 1929
 

@inq

What happens if you feed 5V into VDD (and maybe STP) ?

I was kidnapped by mimes.
They did unspeakable things to me.


ReplyQuote
Inq
 Inq
(@inq)
Honorable Member
Joined: 5 months ago
Posts: 711
Topic starter  
Posted by: @will

@inq

What happens if you feed 5V into VDD (and maybe STP) ?

Thanks Will... Ok... I've tried your suggestion.  

When I move the pot, I now range between 0.09 amps and 0.22 amps.

Spooky $#!+... One other thing I didn't see when at 3.3V logic... I got it adjusted where it stayed at 0.22 amps.  Then I removed the screwdriver, it went down to 0.09 amps. 

  • Even barely touching it... it jumps up to 0.22 amps.  The screwdriver is not connected electrically to anything else.
  • If I touch it the same way with something non-conductive, it doesn't do it.  It's not pressure making something make contact in the pot/board.
  • I just barely touched it with one end of a resistor, me holding the other end and it jumped up to 0.25 amps.
  • I did the same thing holding the resistor with a wooden cloths-pin and it jump up to 0.13 amps.

I'm so confused!  😫 🙄 

VBR,

Inq

3 lines of code = InqPortal = Complete IoT, App, Web Server w/ GUI Admin Client, Access Point Manager, Drag & Drop File Manager, OTA, Performance Metrics, Web Socket Comms, Easy App API, All running on ESP8266...
Even usable on ESP-01S - Quickest Start Guide


Inst-Tech liked
ReplyQuote
Inst-Tech
(@inst-tech)
Reputable Member
Joined: 9 months ago
Posts: 320
 

@inq 

"

Thanks Will... Ok... I've tried your suggestion.  

When I move the pot, I now range between 0.09 amps and 0.22 amps.

Spooky $#!+... One other thing I didn't see when at 3.3V logic... I got it adjusted where it stayed at 0.22 amps.  Then I removed the screwdriver, it went down to 0.09 amps. 

  • Even barely touching it... it jumps up to 0.22 amps.  The screwdriver is not connected electrically to anything else.
  • If I touch it the same way with something non-conductive, it doesn't do it.  It's not pressure making something make contact in the pot/board.
  • I just barely touched it with one end of a resistor, me holding the other end and it jumped up to 0.25 amps.
  • I did the same thing holding the resistor with a wooden cloths-pin and it jump up to 0.13 amps.

I'm so confused!  😫 🙄 

VBR,

Inq"

Sounds like a little bit of Inductive reactance going on here.. Have you tried another A4988 board to see if you get the same results?.. I would be interested to see what effect that has..

regards,

LouisR

LouisR


Inq liked
ReplyQuote
Inq
 Inq
(@inq)
Honorable Member
Joined: 5 months ago
Posts: 711
Topic starter  
Posted by: @inst-tech

Sounds like a little bit of Inductive reactance going on here.. Have you tried another A4988 board to see if you get the same results?.. I would be interested to see what effect that has..

The second one has the same behavior.  I broke out a third (buying 10 for $14 gives one that luxury 😉 or lets me sacrifice several to the Smoke gods) and left the heat sink off.  Same behavior.  So... I have 3 that are consistently bad or the procedure itself is not valid???

I re-read my observation notes above again... I should clarify one thing... the screwdriver I'm using is an all metal jewelers screwdriver (not a typical plastic handle job).  So when I get a reading bump (0.09 to 0.22 amps) I am connected to the other end of the screwdriver.

I can handle Ohm's law and voltage dividers... I don't think I've ever read/heard "Inductive reactance"  together in the same sentence...  Does that lead to some conclusion???

Not being hardware savvy, I'm simply shooting in the dark... usually these things are hooked up to motor coils.  In this test, I have one pair 1A/1B hooked up to a zero ohm load (current meter) and the second 2A/2B to an infinite load (unconnected).  In my logical mind, that seems like it should back feed into the supplying circuit and make spooky $#!+ happen.  

VBR,

Inq

3 lines of code = InqPortal = Complete IoT, App, Web Server w/ GUI Admin Client, Access Point Manager, Drag & Drop File Manager, OTA, Performance Metrics, Web Socket Comms, Easy App API, All running on ESP8266...
Even usable on ESP-01S - Quickest Start Guide


ReplyQuote
robotBuilder
(@robotbuilder)
Noble Member
Joined: 3 years ago
Posts: 1373
 

@inq

I can handle Ohm's law and voltage dividers... I don't think I've ever read/heard "Inductive reactance" together in the same sentence... Does that lead to some conclusion???

That there is much more electronic magic for you to discover 🙂

I assume the issue here is in adjusting the motor current. Looking at Bill's tutorial it isn't all that clear to me how to do this. I don't actually have an A4988 to play with. I would search for other tutorials on this actual requirement.

 


Inq liked
ReplyQuote
DaveE
(@davee)
Honorable Member
Joined: 1 year ago
Posts: 507
 

Hi @inq,

   Sorry, you have at least 10 more of these boards than I have ever seen ... so this is just a stab or two in the dark, having watched a few minutes of Bill's video, plus a little light Google-ing for data sheets. No responsibility for any mistakes on my part or magic smoke decreasing your board stockpile!

I haven't read + digested this ref, but you may find it helpful:

https://www.pololu.com/product/1182

I did however spot " we therefore recommend careful reading of the A4988 datasheet (1MB pdf) before using this product. " near the beginning, which is the (original?) Allegro chip maker's sheet.

Also a link to a schematic at :   ("https://" removed to stop it showing the schematic directly)

a.pololu-files.com/picture/0J3359.1200.png

------------------------

Hence:

The pot seems to be connected to "REF" .. maybe pin 17(?) of the main chip ... first glance at a block diagram suggests this is connected to an amplifier, the output of which is the reference for a DAC that controls the PWM etc. ... so maybe your screwdriver touch is injecting some local noise, or even causing enough feedback to produce oscillations ... all totally speculative, but it looks like it could be a 'sensitive' pin.

-------

Probably more importantly, my reading of your test circuit is not the same as Bill's. Bill starts with a 'working' circuit, with stepper moter wired up 'normally', and inserts a multimeter switched to 10A IN SERIES with one of the motor windings.

Thus in Bill's case, the current will initially rise 'slowly', 'limited' by the inductance of the motor winding, until it reaches a value controlled by the chip, at which point, the chip will stop the current continuing to rise, using its PWM tricks. The chip will think it is in circuit, and 'play nicely'.

In your case, you are connecting your multimeter, also switched to 10A range, directly cross the chip output pins that will be expecting a motor winding.

Your meter will present a very low resistance .. e.g. wildly guessing the meter needs 200 mV for full scale of 10A, the R = V/I .... R = 0.2 (V) /10 (A) ... R = 20 milliOhms

I reckon, if the chip "sees" a load resistance of only 20 milliOhms, it will think it has a short-circuited output. Luckily, but perhaps confusingingly, for you, the chip claims to have another protective trick up its sleeve ... otherwise I think you would have seen some magic smoke ...

looking at the data sheet I referenced earlier in today's sermon...

On Page 9, a section starts ..

Shorted-Load and Short-to-Ground Protection.
If the motor leads are shorted together, or if one of the leads is

shorted to ground, the driver will protect itself by sensing the

overcurrent event and disabling the driver that is shorted, protect
-
ing the device from damage.

It goes onto describe the actions in more detail... I haven't read all the small print, but I wouldn't be surprised if your metal screwdriver is further confusing the protection circuit in some way, as I mentioned earlier.

---------------------

So, assuming you have your stepper motor, I suggest you connect it in series with your multimeter, as described by Bill, and try setting it up again.

.... Sorry .. I just noticed you said you were using a controllable power supply ... I'll leave the following unchanged, since it is still all valid ...

I don't know if your motor power supply has any voltage and current controls, but if it has you may INITIALLY wish to (ideally) limit the current, or otherwise reduce its voltage, so that even if the chip does not current limit, the maximum current through the motor is kept within 'reasonable' limits,  whilst you get an approximate setting for the pot ...

... when the pot has been approximately set, you can then progressively increase the motor power supply voltage or current setting to the full working setting .. and hopefully see the chip keep the motor current at the same value.

I would expect your motor to stand a modest overcurrent for a short time, but there is no point in stressing it more than necessary, so maybe start with your power supply able to deliver about 110% of the rating, knowing the motor resistance winding ... you can then set the chip using its pot, to reduce this to say 90%, which gives a modest margin.

I noted some comments in the chip data sheet suggesting that once it had detected a 'short circuit', then it is likely to stay in that 'protected mode' until the power is cycled. I didn't read it carefully, but maybe something to be aware of whilst you are setting it up.

.........

Good luck and best wishes, Dave


Inst-Tech and Inq liked
ReplyQuote
Inq
 Inq
(@inq)
Honorable Member
Joined: 5 months ago
Posts: 711
Topic starter  
Posted by: @robotbuilder

I assume the issue here is in adjusting the motor current. Looking at Bill's tutorial it isn't all that clear to me how to do this. I

It starts at 46:30 in his video... using a direct method that just makes sense... but it doesn't seem to work as described.  I went back and did it as your video describes... to the calculate some "equivalent" voltage for the desired maximum current and measure that while turning the pot.

Strange thing was... the calculated voltage for 1.5 amps is:

Vref = 8 * 0.1 ohms * 1.5 amps = 1.2 Volts.

The reading never got above 1.01 volts... which will have to do.

VBR,

Inq

3 lines of code = InqPortal = Complete IoT, App, Web Server w/ GUI Admin Client, Access Point Manager, Drag & Drop File Manager, OTA, Performance Metrics, Web Socket Comms, Easy App API, All running on ESP8266...
Even usable on ESP-01S - Quickest Start Guide


ReplyQuote
Inq
 Inq
(@inq)
Honorable Member
Joined: 5 months ago
Posts: 711
Topic starter  
Posted by: @davee

so maybe your screwdriver touch is injecting some local noise, or even causing enough feedback to produce oscillations ... all totally speculative, but it looks like it could be a 'sensitive' pin.

That's interesting.  You must be right... since standard way of adjusting the max current is via adjusting the pot using a screwdriver while the positive volt meter probe is attached to the screwdriver and thus the metal pot.

Posted by: @davee

Probably more importantly, my reading of your test circuit is not the same as Bill's. Bill starts with a 'working' circuit, with stepper moter wired up 'normally', and inserts a multimeter switched to 10A IN SERIES with one of the motor windings.

...

In your case, you are connecting your multimeter, also switched to 10A range, directly cross the chip output pins that will be expecting a motor winding.

Your meter will present a very low resistance .. e.g. wildly guessing the meter needs 200 mV for full scale of 10A, the R = V/I .... R = 0.2 (V) /10 (A) ... R = 20 milliOhms

OMG!  You are totally right and I missed that.  And I don't know how many times I went over that portion of the video.  I thing I didn't recognize the jumble of motor wires as actually being wired up.  After reading your note, I enlarged the image and saw the error of my ways... and then heard Bill say exactly that.

Posted by: @davee

Shorted-Load and Short-to-Ground Protection.

IT WORKS!  🤣 🤣 

Posted by: @davee

I don't know if your motor power supply has any voltage and current controls, but if it has you may INITIALLY wish to (ideally) limit the current, or otherwise reduce its voltage, so that even if the chip does not current limit, the maximum current through the motor is kept within 'reasonable' limits,  whilst you get an approximate setting for the pot ...

I did have it as you suggested.  It's something like this one...

image

and I had it set at 12 volts and to supply no more than 2 amps... which is what the A4988 is suppose to take.  The stepper... is suppose to handle 1.5 amps.

TURNS OUT...

I've re-run the test getting the meter in series with the coil.  Still something is amiss.   As I slowly adjust the pot and coil current gets up to about 0.9 amps... the power supply starts glitching.  I see it hitting its 2 amp limit and the voltage starts dropping, that then the current drops and the voltage jumps back up, cycling in a vicious cycle and making noises that doesn't sound healthy.  I think, I'll play it safe and just use the Calculate Vref and adjust method.

Thanks Dave for pointing out the error of my ways in a nice way!

VBR,

Inq 

3 lines of code = InqPortal = Complete IoT, App, Web Server w/ GUI Admin Client, Access Point Manager, Drag & Drop File Manager, OTA, Performance Metrics, Web Socket Comms, Easy App API, All running on ESP8266...
Even usable on ESP-01S - Quickest Start Guide


Inst-Tech liked
ReplyQuote
DaveE
(@davee)
Honorable Member
Joined: 1 year ago
Posts: 507
 

Hi @inq,

 Good to hear you have made some progress!

 A couple of pseudo-random thoughts, possibly each needing a pinch of salt or two:

RE: Still something is amiss.   As I slowly adjust the pot and coil current gets up to about 0.9 amps... the power supply starts glitching.  I see it hitting its 2 amp limit and the voltage starts dropping, that then the current drops and the voltage jumps back up, cycling in a vicious cycle and making noises that doesn't sound healthy.

I suspect the 'real, physical' current limit for the motor winding 'assumes' it is 'DC', and refers to the simple I2R (W= I squared R) heating effect of passing I amps continuously through a winding with DC resistance of R Ohms. The chip is designed to limit the current, assuming an appropriate pot setting, to  this value ... but it does so by switching current supply on and off.

If the pot is adjusted for an average current equivalent to the coil maximum rating, and clearly there will be no (significant) current flowing from the power supply whilst the PWM switch is 'open', suggesting a somewhat higher than average current must be flowing whilst the PWM switch is closed. I am guessing your bench supply is 'detecting' this 'higher' current peak flow and instigating some kind of protective limiting. Such limiting often has a 'foldback' characteristic, so that once the limit is exceeded, it remains in place until the current falls to a lower value than the limit value. Perhaps, the time when the chips PWM switch is open is able to 'reset' the bench supplies current trip, and so the whole system ends up in an oscillating loop.

I suspect that now you have a functional chip current limit, and it has been adjusted to a 'reasonable' setting, it may be appropriate to set your bench supply to a higher current limit which allows for the peak current demands without tripping. (Of course, any magic smoke remains totally your responsibility!)

I think the PWM nature of this system tends to leave several questions unanswered, regarding the correct current limit setting, as I am dubious if either your multimeter or bench supply will be totally accurate with a pulsed waveform. I haven't looked at the equivalent voltage setting method, but I similarly wonder if it will be a 'true DC' value or if the voltage will be a 'waveform' that your meter tries to average, maybe not very accurately. (This paragraph is over influenced by my permanent cynical approach to all technology .. it may all be perfectly fine .. but with technology, I always assume guilty until I can prove innocent.)

This could be one of those places a 'scope could be 'revealing'. 😉

(And, if you use a mains powered 'scope, be careful not to allow the 'ground' probe connection to short a voltage via the mains earth.)

......

Also remember the heat generation (i.e. how much heat is generated in motor windings) is proportional to the SQUARE of the current. You need the RMS current ... A simple average current can be misleading.

----

I haven't checked the current limits for the chip ... obviously exceeding its ratings will encourage magic smoke ... again peak and average currents can confuse the issue.

----

Of course,depending upon your application, you may be able to keep the 'DC' winding current to rather less than the maximum value ... if the mechanical rotational loading on the rotor is 'low', then a lower current may be sufficient to hold its position.

---------

And as a 'throw away' thought to finish on ... You mention the 100 microFarad capactor on the motor power input ... I am guessing any capacitor in this role is going to get a 'hard life' with relatively high current flow demands .. if you are building this into a more 'permanent' project, I suggest you consider ensuring this capacitor is of the type intended for power supply and similar high current demand positions, with a low ESR to suit. 

--------

Best wishes and good luck, Dave

 


Inq liked
ReplyQuote
Inst-Tech
(@inst-tech)
Reputable Member
Joined: 9 months ago
Posts: 320
 

"I can handle Ohm's law and voltage dividers... I don't think I've ever read/heard "Inductive reactance"  together in the same sentence...  Does that lead to some conclusion???

Not being hardware savvy, I'm simply shooting in the dark... usually these things are hooked up to motor coils.  In this test, I have one pair 1A/1B hooked up to a zero ohm load (current meter) and the second 2A/2B to an infinite load (unconnected).  In my logical mind, that seems like it should back feed into the supplying circuit and make spooky $#!+ happen.  

VBR,

Inq "

Indeed, it does lead to some conclusion as XL ( inductive reactance) affects circuit operation where impedance is involved..But since @DAVEE has already found your problem..This is just FYI... With circuits using PWM or other oscillatory, the impedance of the circuit becomes an issue as frequency goes up : https://www.geeksforgeeks.org/inductive-reactance-formula/   Why is this important?..using metal screwdrivers can induce changes into the magnetic fields created in circuits by currents flowing through inductors, or oscillatory circuits. This can , and will change how the circuits actually perform. However, since that was not really your problem, and the magic smoke didn't come out..Now your on track to experimenting with your A4988...lol

regards,

LouisR

LouisR


Inq liked
ReplyQuote
Inq
 Inq
(@inq)
Honorable Member
Joined: 5 months ago
Posts: 711
Topic starter  
Posted by: @davee

If the pot is adjusted for an average current equivalent to the coil maximum rating, and clearly there will be no (significant) current flowing from the power supply whilst the PWM switch is 'open', suggesting a somewhat higher than average current must be flowing whilst the PWM switch is closed. I am guessing your bench supply is 'detecting' this 'higher' current peak flow and instigating some kind of protective limiting. Such limiting often has a 'foldback' characteristic, so that once the limit is exceeded, it remains in place until the current falls to a lower value than the limit value. Perhaps, the time when the chips PWM switch is open is able to 'reset' the bench supplies current trip, and so the whole system ends up in an oscillating loop.

I think I even understand this.  👍

Posted by: @davee

Of course, any magic smoke remains totally your responsibility!

... and why I'll call it good!  Smoking a $1.40 A4988... no big deal.  Smoking the bench box... priceless.

Posted by: @davee

I am dubious if either your multimeter or bench supply will be totally accurate with a pulsed waveform. I haven't looked at the equivalent voltage setting method, but I similarly wonder if it will be a 'true DC' value or if the

Was exactly my thought... that before I crank-up the robot, I'll use the robot's battery brick to finalize the settings and leave the bench power supply to fight another day.

Posted by: @davee

I am guessing any capacitor in this role is going to get a 'hard life' with relatively high current flow demands .. if you are building this into a more 'permanent' project, I suggest you consider ensuring this capacitor is of the type intended for power supply and similar high current demand positions, with a low ESR to suit. 

I've never read anything like this before.  Can you point me to a link on this topic?  (Bare in mind, I only have the one EE course that they teach to non-EE engineers)... and that was a long time ago.  😆 

VBR,

Inq

3 lines of code = InqPortal = Complete IoT, App, Web Server w/ GUI Admin Client, Access Point Manager, Drag & Drop File Manager, OTA, Performance Metrics, Web Socket Comms, Easy App API, All running on ESP8266...
Even usable on ESP-01S - Quickest Start Guide


Inst-Tech liked
ReplyQuote
Inq
 Inq
(@inq)
Honorable Member
Joined: 5 months ago
Posts: 711
Topic starter  
Posted by: @inst-tech

Why is this important?..using metal screwdrivers can induce changes into the magnetic fields created in circuits by currents flowing through inductors, or oscillatory circuits.

OF COURSE!!! - I even remember this in my one EE course talking about adding an iron core makes a big difference over an air core!  

Thanks - Mind like a steel trap! 🤣 

Are you saying I don't have a magnetic personality? 🤣 

Sorry... couldn't resist!

VBR,

Inq

3 lines of code = InqPortal = Complete IoT, App, Web Server w/ GUI Admin Client, Access Point Manager, Drag & Drop File Manager, OTA, Performance Metrics, Web Socket Comms, Easy App API, All running on ESP8266...
Even usable on ESP-01S - Quickest Start Guide


Inst-Tech liked
ReplyQuote
DaveE
(@davee)
Honorable Member
Joined: 1 year ago
Posts: 507
 

Hi @inq,

 Re: Capacitor selection ... I've never read anything like this before. Can you point me to a link on this topic?

I just did a Google search, and finding good references is harder than might be expected. Much of the market is applicable to switch mode power supplies .. and although there are a large number of chips, etc. to support this area, it tends to be a bit of a 'niche' area from the design point of view - I think a lot of the industry relies on a relatively small pool of 'experts' ... and (theoretically), these are not the kind of people who need the 'simple' explanations, etc. If you are going to make 100 million power supplies, you can give the capacitor manufacturers a ring for a detailed chat ... but if you only need 1, then it is more a 'suck and see' world.

One  general one I found is:

https://www.kyocera-avx.com/docs/techinfo/SMPSCapacitors/Output_Filters.pdf

which might be worth a look to see the kind of language used, but don't expect much..

Avnet have a go, but it doesn't go into any depth:

https://www.avnet.com/wps/portal/abacus/resources/article/understanding-esr-in-electrolytic-capacitors/

Even Wikipedia is a bit of a let down:

https://en.wikipedia.org/wiki/Ripple_(electrical)#Filtering_in_power_supplies

-------

Simplistically, ESR is usually modelled as a resistor in series with a "resistance free" capacitor ... although of course it is actually a characteristic of the intrinisic component.  It 'gets in the way' of the capacitor doing its job, and if there are considerable currents, results in the capacitor getting hotter.

--------

In your case, perhaps the best that can be done is to look for capacitors with descriptions that use words like "Low ESR", "Power Supply", "Decoupling", "High Frequency", "High Ripple Current". Obviously these are 'vague' terms, not a specification, but hopefully an indication of their characteristics.

It is common for such capacitors to be physicaly larger than their 'low current" counterparts with the same capacitance and voltage rating.

--------

Sorry, this is a pathetic excuse for an answer ... maybe others can do better.

Best wishes, Dave


Inst-Tech liked
ReplyQuote
Inst-Tech
(@inst-tech)
Reputable Member
Joined: 9 months ago
Posts: 320
 

@davee I think you hit the proverbial nail on the heat with the comment on ESR as to do with DC filtering, especially with higher frequency found in switching power supplies.. But never the less, capacitors,especially electrolytics, do offer some challenges to making power supplies ripple free, or at least tolerable, and are widely used for that purpose. When it comes to design of circuits for power supplies, there seems to be a wide variety of techniques used for that purpose.. Probably, for the layman, getting into the weeds on capacitor theory and application will only help confuse them even more...lol

Most just want the circuit to work so they can build something.. 

@ing..No, I'm not saying that you don't have a magnetic personality ..I'm saying your a good conductor and have much capacity for learning new stuff...

regards,

LouisR

LouisR


DaveE liked
ReplyQuote