Elektroda.com
Elektroda.com
X

Arduino driver A4988 and NEMA 17

5661 25
This content has been translated » The original version can be found here
  • Level 3  
    Hello!

    Recently I bought these NEMA 17 0.51 Nm engines
    And the Stepstick RAMPS A4988 RepRap driver
    Engine control works but not exactly as it should. The engine squeaks and vibrates terribly during operation (unless this is the first time I have such an engine in my hands :) ). It's spinning very slowly even though it was supposed to spin at a fairly high speed. Anyone know how to speed it up and eliminate this squeaking and vibrations?

    Code (example from some page):

    [syntax=c]// --- Commande d'un StepStick/Driver A4988 ----------------------
    // A4988_Test.ino
    //
    // Commande d'un moteur pas-à-pas à l'aide d'un pilote A4988 avec
    // Arduino.
    //
    // Un projet www.mchobby.be (vente de kit et composant)
    // Meurisse D. - Licence CC-SA-BY
    //
    // Un tutoriel http://mchobby.be/wiki/index.php?title=A4988
    // Ou Acheter un StepStick A4988
    // http://shop.mchobby.be/product.php?id_product=349
    //

    #define pinEnable 4 // Activation du driver/pilote
    #define pinStep 3 // Signal de PAS (avancement)
    #define pinDir 2 // Direction


    void setup(){
    Serial.begin(9600);
    Serial.println("Test A4988");

    pinMode( pinEnable, OUTPUT );
    pinMode( pinDir , OUTPUT );
    pinMode( pinStep , OUTPUT );
    }

    void loop(){
    int i = 0;

    digitalWrite( pinDir , HIGH); // Direction avant
    digitalWrite( pinStep , LOW); // Initialisation de la broche step

    // Avance de 200 pas
    for( i=0; i
    Do you have a problem with Arduino? Ask question. Visit our forum Arduino.
  • Level 33  
    Probably low current efficiency, because you power the motor with arduino. You need an external power supply. What exactly is this engine?
  • Level 3  
    Wojciech. wrote:
    Probably low current efficiency, because you power the motor with arduino. You need an external power supply. What exactly is this engine?


    Slinik is NEMA 17 0.51 Nm. I tried with an external power supply the meter shows 12.49V but after connecting to the control room its pins are 0.5V - 1V the motor does not react: /
  • Level 36  
    Mimal9999 wrote:

    The engine squeaks and vibrates terribly during operation (unless this is the first time I have such an engine in my hands :) ). It's spinning very slowly even though it was supposed to spin at a fairly high speed. Anyone know how to speed it up and eliminate this squeaking and vibrations?

    delay (0.00001);

    When the stepper squeaks it means it loses steps (loses commutation) due to too high pulsing frequency.
    You will see a similar effect (lost steps) when the engine fails to overcome the load; say due to low current.

    In pulse formation for stepstick you have:
    delay (0.00001); // ?? !!!
    According to your calculations, what should be the pulse frequency and how fast turnovers are expected?
    Note that the pulse duration + pause between them should be long enough for the motor to rotate the rotor by 1.8 degrees. Otherwise it will happen that the engine has not finished yet and has already been given the next one.
    Stepper motors are usually low speed. For higher revolutions a process of acceleration and deceleration called 'ramping' is required. Find suitable libraries on the internet for their use.

    Regarding current:
    Before connecting the motor to the stepstick, set it to the appropriate current suited to your motor. The potentiometer on the board is used for this. The process of setting the current is given in many online sources, or download the manual from the distributor. Here you have to be careful because not all driver / stepstick boards have the same size resistor built in, and the procedure for determining the reference voltage depends on it. Search and read until you understand this issue.

    e marcus
  • Level 3  
    I gave this delay a test to see if the speed is changing but I changed it right away, in the end because I got lost a bit, can you use this engine "like a dc engine"? I mean, don't give him the number of steps, just keep him spinning all the time. It has to be used for a robot on another forum I was advised to buy such engines and that it would work (before I used dc engines but the driver burned). So first I must start with the fact that the engine starts and then develop higher speeds. I will only add that the first time the engine was spinning and then suddenly stopped and I do not know what's going on: /
  • Level 11  
    In turn:
    1 how do you power the engine?
    2 connections checked?
    3 potentiometer on the stepstick set?
  • Level 36  
    Mimal9999 wrote:
    I gave this delay a test to see if the speed is changing but I changed it right away, in the end because I got lost a bit, can you use this engine "like a dc engine"?
    /

    Yes of course..
    After all, it is a kind of DC motor (!).
    Rather model your tests on this example:
    http://howtomechatronics.com/tutorials/arduin...-stepper-motor-with-a4988-driver-and-arduino/
    Follow these tips if you haven't burned anything yet ...
    A more thorough description of this driver / (stepstick is the name of the clone of the same system with any changes, however, the basic function is the same), you can find on the Pololu website:
    https://www.pololu.com/product/1182
    Here is the video clip of the current limit setting process. The procedure is the same for everyone, but the value of the voltage setting may differ, as it was earlier:
    https://www.youtube.com/watch?feature=player_embedded&v=89BHS9hfSUk

    e marcus
  • Level 9  
    Hi, I wanted to connect to the topic. I am at the stage of buying engines for the A4988 driver.

    I found this engine:
    https://abc-rc.pl/product-pol-8253-Silnik-kro...NEMA17-KS42STH40-1204A-4kg-cm-1-68A-40mm.html

    4 kg / cm
    1.68
    Movement angle: 0.9 degrees
    Steps per turnover: 200
    Cable length: 70cm
    Holding moment: 0.39 N / m
    Insulation resistance 100M - Min. 500V DC
    500V AC dielectric strength for 1 minute

    I would like to ask for an opinion if this driver can handle it.
  • Level 36  
    nono91 wrote:
    Hi, I wanted to connect to the topic. I am at the stage of buying engines for the A4988 driver.

    I found this engine:
    https://abc-rc.pl/product-pol-8253-Silnik-kro...NEMA17-KS42STH40-1204A-4kg-cm-1-68A-40mm.html

    4 kg / cm
    1.68
    Movement angle: 0.9 degrees
    Steps per turnover: 200
    Cable length: 70cm
    Holding moment: 0.39 N / m
    Insulation resistance 100M - Min. 500V DC
    500V AC dielectric strength for 1 minute

    I would like to ask for an opinion if this driver can handle it.


    Maybe it is in reverse relationship:
    You choose the size of engines depending on the needs of the project, and then you use the appropriate driver for them (the driver seems to be ..) Your 'pairing' is not optimally accurate.
    For proper operation, these motors will draw current (?) 1.7A; while the maximum load capacity of these drivers is 1.0 A max. and up to 1.5A using heat sinks on the same chip, or possibly 2A with forced cooling fan.
    A better solution would be to use similar tiles with DRV8825.
    Usually a suitable heat sink is included with the purchase.

    Also: This list above was probably made by someone not very familiar with the subject.
    The moment: - in the general definition: it is Force times (*) shoulder; therefore it can be expressed as e.g. KGm (KG * m), KGcm, Nm, Ncm etc.
    There is a close conversion from standard units to IS units.
    1 Nm = 0.102 KGm
    https://www.unitconverters.net/moment-of-force-converter.html
    The second main and misleading error is the angle of rotation (!?).
    And here is also the close relationship between the angle of rotation and the number of steps per turn:
    360 / angle of rotation = number of steps per revolution.
    If you enter 200 steps / rev, then from the bill it will be an engine with a step of 1.8 and not 0.9 .
    It would not be a mistake but an oversight if only 1.8 engine (200 steps) were commercially available in this size (NEMA17). but those with smaller rotation angles are also produced: - 0.9 (400 steps / rev).
    The rest of the parameters do not matter.

    At this stage, it would be useful to know the resistance of the motor coils (number of ohms), or sometimes the voltage value is given.
    This allows you to design the size and type of the power supply.
    For details, read the relevant literature ....

    e marcus
  • Level 9  
    Thanks for the answer, I took the parameters directly from the store. I agree that I do it in the wrong order. But well, the above mentioned stepsticks already bought (long time ago) and arduino cnc shield. That's why I'm looking for the right engines for the parts I bought. I was guided by the fact that the maximum current passing through the stepstick (with cooling) is just 2A, and this motor, however, has a little less. Unfortunately, there is often no description of the parameters of these engines. Can you recommend a specific engine?
  • Level 36  
    nono91 wrote:

    I was guided by the fact that the maximum current passing through the stepstick (with cooling) is just 2A, and this motor, however, has a little less. Unfortunately, there is often no description of the parameters of these engines. Can you recommend a specific engine?


    Sellers often provide incomplete or incorrect / contradictory technical information about the equipment sold (!)
    You have a different engine model on offer than the one on the engine indicates. In this case, this discrepancy is not big.
    If you have to believe that you will get what you buy (what you pay for), it is basically not a bad choice.
    More detailed information for these models can be found here:

    http://3dmodularsystems.com/en/motors/271-nem...pper-motor-for-scalar-family-3d-printers.html

    https://www.hotmcu.com/reprap-40mm-stepper-motor-p-214.html?cPath=8
    Since you have purchased these stepsticks, use them with heat sinks (!) And adjust the current for 1.2A - 1.3A before installing them.
    The adjustment method is trivially simple, but pay attention to the value of the measuring resistor on the board. Not all 'clones' of this construction have the same resistor on which the determination of the reference voltage on the stepstick depends.
    More detailed information can be found here:
    https://www.pololu.com/product/1182
    entitled : Current limiting
    - Setting the Current Limit on Pololu Motor Driver Carrier (video)

    e marcus
  • Level 2  
    I also have the NEMA 1.7 A set and A4988 stepsticks. Yesterday I regulated them at 1.20 V - this is the maximum value that I can set (I read that Chinese controllers have a blockade of just 1.2 volts so as not to burn them). Unfortunately, I can't spin the engine at all. Zero reaction on his part. Anyone know what the problem is? Is it the fault of the stepstick and too low reference voltage for this motor (according to the formula should be 1.34V)?
  • Level 11  
    You confuse voltage with tension. Upload a diagram and layouts.
  • Level 36  
    qavr wrote:
    You confuse voltage with tension. Upload a diagram and layouts.


    I do not think that the author confuses these concepts ...
    This is the procedure for these systems; setting the current limit by the reference voltage obtained from a simple formula.
    VREF = 8?Imax?Rcs
    Imax - motor current for one coil
    Rcs - current sensor resistance;

    Nevertheless, it would be advisable to provide more information regarding your motors, stepsticks, and power supply method and parameters.

    Not all commercially available stepper control systems are the same, despite the fact that they look similar and are clones (non-identical copies) of the original Polol design.

    They differ in the value of the measuring resistors for current, and therefore the size of the voltage ref. it must be adapted for this system, for which adjustment of the potentiometer is required.
    Even the original manufactured by Pololu may differ ...
    Here is an example:
    Arduino driver A4988 and NEMA 17
    Chinese may have other values, which is not insignificant ...

    e marcus
  • Level 2  
    Forgive me for delay.
    I use the kit purchased from the ABC RC website (https://abc-rc.pl/pl/products/zestaw-elektroniki-reprap-ramps-mega2560-ch340-r3-a4988-4szt-drukarka-3d-7211.html).
    The parts are:
    Arduino Mega CH340 clone,
    RAMPS 1.4 RepRap controller,
    Stepsticki: (https://abc-rc.pl/pl/products/sterownik-silnika-krokowego-a4988-stepstick-drukarki-3d-reprap-cnc-6332.html) Mine are red, although apparently it depends only on the lot )
    Resistors on them are R100,
    Nema 17 42HB34F08AB 1.7A stepper motors (https://abc-rc.pl/pl/products/silnik-krokowy-nema17-42hb34f08ab-1-70-36mm-8252.html).

    I use a borrowed power supply because I haven't bought one yet. Of course I set it to 12 V.
    Arduino driver A4988 and NEMA 17 .
    I noticed that by adjusting the current on the stepsticks, my LCD display stopped working. Earlier - at the beginning it fired nicely
    Arduino driver A4988 and NEMA 17
    in a moment:
    Arduino driver A4988 and NEMA 17
    Arduino driver A4988 and NEMA 17

    Now no ants are showing up, it's okay.
  • Level 36  
    xChrislinex wrote:
    Forgive me for delay.
    I am using a set purchased from the ABC RC website
    The parts are:

    Stepsticki: (https://abc-rc.pl/pl/products/sterownik-silnika-krokowego-a4988-stepstick-drukarki-3d-reprap-cnc-6332.html) Mine are red, although apparently it depends only on the lot )
    Resistors on them are R100, (*)
    Nema 17 42HB34F08AB 1.7A stepper motors (https://abc-rc.pl/pl/products/silnik-krokowy-nema17-42hb34f08ab-1-70-36mm-8252.html). (**).


    It looks like you are not reading datasheets for your hardware ..
    Ad (**) Motors: The given 1.7 A current applies to the current consumption of both coils, which would be important in choosing the size of the power supply.
    We use the current value to adjust the driver (stepstick) for one coil.
    The more accurate parameters of your engines are:

    Size: 42 * 42mm
    Motor depth: 34mm
    Shaft diameter: 5mm
    Shaft length: 20mm
    2 Phase 4 wires
    Weight: 350g
    Step angel: 1.8 degree / step
    Rated voltage: 4.83V
    Current: 0.84 A / phase
    Resistance: 5.75 O / phase
    Inductance: 9.3mH / phase
    Holding torque: 2.8kg.cm
    Insulation class: B.

    Ad (*) If the measuring resistors in the stepsticks are 0.1 ohms, then from the previous formula (see page 9 datasheet A4988) the reference voltage will be 0.67V.
    In addition, assuming that the control will be in full-step control, the maximum current can be taken from 71% ratio (see table 2 p. 17).
    By setting the maximum current at a higher level than required, it will cause unnecessary waste of energy used to heat the elements in the circuit. Stepsticks have thermal protection against overload and short circuit, which does not mean that there is an open field for any load on the system.

    e marcus
  • Level 3  
    Even after such a long time, my problem could not be solved. After a while I just gave it up :D After refreshing the topic somehow I felt like resuming the project, but I do not want to keep playing with those drivers that I think are extremely resistant, so I decided to buy something else. I was thinking about drv8825, I heard that they are much better than described above. Is this a good choice? Can he buy something else? I don't limit myself, I'm just interested in not having fun for the next two years ;) My set has not changed, the engines remained those on the subject. I really only mean front and rear control and speed (continuous operation). Anyone have any checked drivers? best regards ;)
  • Level 36  
    Mimal9999 wrote:
    ..... somehow I felt like resuming the project, but I don't want to keep playing with those drivers that I think are extremely resistant, so I decided to buy something else. I was thinking about drv8825, I heard that they are much better than described above. Is this a good choice? Can he buy something else?


    Choosing to buy the 'better' ones is just as good as the ones you already have.
    Whatever you buy, following the same procedure as before, they will all be 'resistant' (!)
    DRV8825 have not much advantage over A4988; they have a wider range of microstepping and give the possibility of a slightly higher load current. None of these assets have significant application in your requirements ...
    You do not need 1/32 microstepping, and setting the maximum current for your motor freely falls within the A4988 range (even without using additional forced cooling of the driver board).

    The important parameters for your engine [Model: KS42STH40-1204A) are:
    o Standard Voltage: 3.6V
    o Phase current: 1.2A
    o Phase resistance: 3 ohm

    The rest doesn't mean much at the moment.

    If you start anything, you first need to set / (adjust the potentiometer) the maximum current for the motor, which is initially and theoretically 1.2A
    From your relationship it follows that the control will be full-step, so this current can be reduced to 71% of full load (see post above). At this resultant A4988 current will feel 'free' ...

    If the symptom of the engine's operation is its slowness, then the reasons should be sought in its control (Program), and the motor voltage level too low.
    The characteristic 'squeaking' of the engine is a symptom of lost steps and 'breaking' of synchronization.

    Note the three parameters presented above and their close relationship under Ohm's Law.
    The motor supply voltage has no direct effect on its rotational speed, which is the result of the frequency of pulsing steps, but a higher voltage accelerates the 'jump' by another step, so it is possible to increase the frequency of their pulsing, which results in 'clean' (without losing steps) increased RPM turnover.
    The actual motor supply voltage from the power supply should be several times higher than what the datasheet gives as' Standard Voltage '. There are applications that are even 30x higher.
    The limitation here may be the type / type of the chip of the driver board itself.
    DRV 8825 allows power supply up to 45V; while A4988 only allows 35V.

    Considering your poor enthusiasm in this direction, my time is certainly meaninglessly lost here ...

    e marcus
  • Level 3  
    My, admittedly, poor enthusiasm is due to the fact that on every other forum everyone writes exactly the same, and the engine, if it did not move, does not move any further. I've already bought about 20 drivers, so it's impossible that all of them were damaged. I don't think I got it wrong. The manufacturer on the site gave the motor current 1A, my current driver has R100 resistors which, as I read is equal to 0.1ohm. The formula is then Vref = 1A * 8 * 0.1 = 0.8V. For your assumption that the motor current is 1.2A the result is 0.96V which I also checked. I powered from the battery (shown in the picture) 11.1V then I tried from the laptop adapter (20V 3.96A). New controller removed from the foil, motor connected in accordance with the markings on the controller (cable colors according to the manufacturer's website). I may have mistaken something, but I don't think so, because I've probably checked everything.
    Arduino driver A4988 and NEMA 17 Arduino driver A4988 and NEMA 17 Arduino driver A4988 and NEMA 17
  • Level 36  
    Mimal9999 wrote:
    ..... in every other forum everyone writes exactly the same, and the engine does not move any more. I've already bought about 20 drivers, so it's impossible that all of them were damaged.




    On the basis of only these observations, you answered yourself where the error was.

    Mimal9999 wrote:

    I don't think I got it wrong. (??)

    The manufacturer on the site gave the motor current 1A, my current driver has R100 resistors which, as I read is equal to 0.1ohm. The formula is then Vref = 1A * 8 * 0.1 = 0.8V


    This template applies to A4988, while on the attached photos you are using DRV8825. It's a bit mixed up .... (there will be a different formula for this module).

    Since your given engine and driver parameters correspond exactly to the example (demo) on the website of the original manufacturer of these modules - Pololu:
    https://www.pololu.com/product/2133

    Scroll to the bottom of this page (just over the halfway point) and find the title ' Current limiting '
    Directly below the chapter title is the link (picture) to the video-clip; - follow the whole process, read the rest of the description.
    A lot will be explained ..... (I hope ...?)

    A simplified version of the program used in this 'demo' can be found here:
    https://www.pololu.com/blog/484/video-setting...limit-on-pololu-stepper-motor-driver-carriers

    e marcus
  • Level 3  
    I have watched, read and tried the enty once and it actually works :D I set 0.5v on the potentiometer in DRV8825 controllers (even though I bought them at the auction as A4988 and I thought it was just a different color, so I didn't even check - my error). I checked all 4 controllers on 4 engines and they all work well. Tomorrow I will sit at the computer and check if they really work (speed, direction etc.) I don't know why it didn't work before since I set hundreds of times 0.5v. could it be due to the fact that this time the modules were powered externally, not directly from arduino? Many thanks for your help and patience ;)
  • Level 9  
    Hi I bought a NEMA 17HS4401 (1.5A) motor + A4988 stepstik. I used a 19V 2.37A laptop power supply and a 100 microF capacitor.
    Reading the different forums, the stepstika setting should look either according to the pattern as in the post above, i.e. (in my case):
    Vref = 1.5A * 8 * 0.1 = 1.2V

    or according to another theory this stepstick has Rcs = 0.050 ? or newer = 0.068 ? so it should be:
    Vref = 1.5A * 8 * 0.068 = 0.816 V

    Not sure, I set this lower value. The engine was running but the stepstick was buzzing strangely. After some time I saw sparks next to VMOT, GND pins. I checked the connections several times and everything is correct.

    After disconnecting all cables from the stepsitka and connecting only the power supply, there is probably a short circuit because the diode at the connector from the power supply flashes. Did the stepstik burn? How so what did I do wrong?

    Arduino driver A4988 and NEMA 17
    Arduino driver A4988 and NEMA 17 Arduino driver A4988 and NEMA 17
  • Level 36  
    nono91 wrote:

    Not sure, I set this lower value. The engine was running but the stepstick was buzzing strangely. After some time I saw sparks next to it pins VMOT, GND. I checked the connections several times and everything is correct.

    After disconnecting all cables from the stepsitka and connecting only the power supply, there is probably a short circuit because the diode at the connector from the power supply flashes. Did the stepstik burn? How so what I did wrong ?


    These questions can be answered by a person who looked (over his shoulder) or on his hands what you did ...
    nono91 wrote:

    Someone can help me?

    Are you expecting someone to buy you a new stepstick?

    By reading carefully all the posts above in this thread, you would probably find the reason for the 'spark / spark gap'.

    e marcus
  • Level 2  
    Vref voltage now does not matter too much, but it is better to set in the middle trimmers. Connect the + 5 volt contacts S1, S2 and the motor will run smoother. Check the correct connections as for the charge you have on arduino if you have Glbr 0.9 or 1.1 then connect the pins from arduino to A4988 step and dir
    The current you want to set on the trimerku he regulates the holding force of the motor between the steps I have already eaten three by shyld what I bought were mixed paths on the PCB good luck in connecting and testing
  • Level 9  
    emarcus wrote:
    Are you expecting someone to buy you a new stepstick?

    No, I'm counting on some advice not to spoil the next one. In the meantime, I'm also waiting for DRV8825, which has higher performance.