logo elektroda
logo elektroda
X
logo elektroda

Stepper Motor Control: Direction, Speed, JK86HS78-4802-04 Model, AVR Microcontroller, TB6600 Driver

DRAZEK87 6471 7
ADVERTISEMENT
Treść została przetłumaczona polish » english Zobacz oryginalną wersję tematu
  • #1 16899912
    DRAZEK87
    Level 15  
    Hello

    I decided to explore the knowledge of stepper motor control. How it is built, what its types and applications are known to me, but only the implementation of one of the projects I set up contributed to the deepening of knowledge, especially in the field of its operation with the AVR microcontroller.

    To start the project, I purchased a stepper motor model: JK86HS78-4802-04 with a torque of 4.6Nm; more detailed information is provided below:
    Stepper Motor Control: Direction, Speed, JK86HS78-4802-04 Model, AVR Microcontroller, TB6600 Driver
    Stepper Motor Control: Direction, Speed, JK86HS78-4802-04 Model, AVR Microcontroller, TB6600 Driver
    as it is an 8-wire motor, I present how to connect it; for JK86HS78-4802-05 and JK86HS78-4802-04 it is the same, and the only difference between these models is the axle width where for -05 we have 12.7mm, while in -04 as seen above is 14mm :)

    Due to the driver used, it is the TB6600 driver with max current per phase 4A which looks as follows
    Stepper Motor Control: Direction, Speed, JK86HS78-4802-04 Model, AVR Microcontroller, TB6600 Driver
    I used a bipolar serial connection, but to power it I used a 24V power supply with S-360-24 nominal and 15A capacity;
    Stepper Motor Control: Direction, Speed, JK86HS78-4802-04 Model, AVR Microcontroller, TB6600 Driver
    Theoretically, I would like to remain with this tension for technical reasons of other elements of the project. For example, the control lamps or 24v fans used, which are more easily available and cheaper than models with a nominal 48v voltage. Apart from the very fact of the driver's limitations, where the maximum possible voltage is 42V, which significantly excludes the use of a 48v power supply, although you could use a 36V power supply and 48v fans which usually work from 24 to 52v but only if we would like to improve the performance of the stepper motor, i.e. obtain more torque at higher revs, which translates into an increase in maximum revolutions.

    Moving on to testing, I built a simple controller:
    Stepper Motor Control: Direction, Speed, JK86HS78-4802-04 Model, AVR Microcontroller, TB6600 Driver
    on board with an ATMEGA 8 processor; 16MHz outdoor quartz; 2x16 display, 5-button keyboard, programming interface, LM2596 step-down converter; additional connectors that I will not discuss because they are not the subject of the issue, but the avr program.
    Stepper Motor Control: Direction, Speed, JK86HS78-4802-04 Model, AVR Microcontroller, TB6600 Driver

    The controller is designed to display the current direction of rotation and the current speed at which the motor axis is spinning.
    You can change them via the keyboard: right / left direction; speed from 1 to 100%.
    When choosing the maximum value, the motor does not significantly lose the holding torque, as this parameter plays a key role in the design.
    I would like to choose the engine speed so that I can use its resources to the maximum. Alternatively, during work, calibrate them and save them to the memory of the system, but this is already on "finito" :D
    In addition, it considers the possibilities of slow starting and braking.

    Assuming the initial assumptions, I started to check if there is a ready solution on the web, but I did not find an exhaustive statement, but the project closest to my topic is:
    http://mikrokontrolery.blogspot.de/2011/03/Si...kowy-sterowany-mikrokontrolerem-ATmega16.html

    And in the same way, I decided to check it, modifying it more for myself, which resulted in the engine being able to start and the axis rotation direction to be changed without any problems :)

    Left arrow, the auxiliary diode is off which translates into a low state on the DIR input of the driver.
    Stepper Motor Control: Direction, Speed, JK86HS78-4802-04 Model, AVR Microcontroller, TB6600 Driver
    Right arrow, the auxiliary diode is on which translates into a high state on the DIR input of the driver.
    Stepper Motor Control: Direction, Speed, JK86HS78-4802-04 Model, AVR Microcontroller, TB6600 Driver
    The PUL input, to which the clock waveform is fed, is used for speed control.
    And this is the biggest problem, because the motor turns slowly, jerking because the given frequency from the above design is incorrect for it.
    And hence the question arises what range should be in order to properly control this engine from the lowest to the maximum revolutions: /
    How to determine the maximum speed if I do not have the engine operating characteristics on which we have the "TORQUE / SPEED" graph given as Nm / Hz or Nm / RPM. I would like to add that I do not have a function generator yet to thoroughly examine the frequency range, and even if I already knew it, how correctly the interrupts for the timer should look like, so that the power would change it. Do I understand correctly that one motor step is 1Hz, for the motor above 200Hz it is 1 revolution; giving 400Hz the motor will turn twice as fast; 600Hz x3 etc.
    This is at the outset, any advice is welcome; will be happy to test the posted piece of code.
  • ADVERTISEMENT
  • #2 16900663
    tmf
    VIP Meritorious for electroda.pl
    Jerking may result from full-step steering. In general, it is better to start the engine and brake using ramps and microstep control. It works smoother then. If you don't have a troque / speed chart, then probably only experimental design remains.
    You can use the timer in frequency generator mode to generate steps. The motor probably has a standard number of steps per revolution. Assuming that, for example, it is 200 steps per revolution, then if you give it a DIR of 200 Hz you will get one revolution per second.
  • ADVERTISEMENT
  • #3 16910457
    Jacek Rutkowski
    Level 28  
    Driver TB6600 has the option of micro steps, set its step division to 8 then it will stop jerking and 1600Hz will give one turn per second. In addition, if you want to get a wider range of revolutions without a torque drop, and you do not want to increase the supply voltage, it may turn out that the parallel connection of the windings will give a greater range of revolutions.
    The rise time of the current on the winding depends on its inductance and voltage, and if the voltage does not increase, reducing the inductance will only help.
    Do you have access to an oscilloscope?
  • #4 16911083
    DRAZEK87
    Level 15  
    Taking advantage of the free time, I put the set together and conducted further tests. This time using an oscilloscope.

    Stepper Motor Control: Direction, Speed, JK86HS78-4802-04 Model, AVR Microcontroller, TB6600 Driver

    Based on the author's prescaler settings, I got an interrupt every 976.56Hz (16MHz / 64/256) which looks like this:

    [syntax=c]ISR(TIMER0_OVF_vect)//przerwanie po przepełnieniu timera
    {
    cnt++;
    if (cnt == 100) //eliminacja drgań styków
    {
    readButtons();
    cnt=0;
    }
    if( i == 2)
    {
    predkosc++;
    if (predkosc == 100) // SPEED
    {
    PORTB ^= (1
  • ADVERTISEMENT
  • #5 16912108
    Jacek Rutkowski
    Level 28  
    DRAZEK87 wrote:
    The observations show, as you also write, that increasing the frequency has a better effect on the engine operation, because it works quieter, the movement is more "smooth", it does not jerk.

    I guess buddy, you mean the number of microsteps?
    If you want to get high revolutions> 500 / minute, a DC or BLCD motor with an encoder will be better, or motors with fewer steps per revolution, e.g. 18, but then you will not get smoothness at low revs.
    Specify, buddy DRAZEK87 what speed range and what moment are you interested in ...
  • ADVERTISEMENT
  • #6 16912155
    tmf
    VIP Meritorious for electroda.pl
    DRAZEK87 wrote:
    The observations show, as you also write, that increasing the frequency has a better effect on the engine operation, because it works quieter, the movement is more "smooth", it does not jerk.


    You must have something with the controls. The stepper motor should run smoothly even at low speed. There are mechanical resonances to a certain extent, which can spoil this fluidity at selected frequencies, but as a rule it should not be as you write. There may be several reasons for this. First of all, wrong control - pulses must be given at the same intervals. You use microstep - with what division? What is the selected power loss mode in the controller?
  • #7 16912571
    DRAZEK87
    Level 15  
    Maybe let's approach the topic differently ...
    https://www.youtube.com/watch?time_continue=74&v=sl8cYPr-soY

    We have two stepper motors there. The main motor in this topic and the feed motor. It is difficult for me to determine what the max RPM is there, but from what I have read it is probably 2200RPM, moreover, you can see exactly "ramping". Rapid motor movement could break the thin wire, so slow acceleration and braking is necessary.
    From the video above, it looks like this:
    Stepper Motor Control: Direction, Speed, JK86HS78-4802-04 Model, AVR Microcontroller, TB6600 Driver
    and even though there are several versions of the project: mini, 200mm, 600mm and even bigger, and a lot about it at http://www.ukcnc.net/
    my project is to be different but the principle of operation of the engine is similar ...

    In the projection shown in the movie, the controller is connected to a computer and controlled by software installed on the unit. But in my case, at least initially, the control is to be without a computer. The drivers that I chose at least initially, not necessarily the TB6600, compared to the drivers of the above-mentioned project, are "giants", and the main engine itself is large, but my project requires it.

    The software topic that I am familiar with is the following:
    https://www.elektroda.pl/rtvforum/topic3212515.html
    a DC motor was used there, which you also mention, but it does not expect such high revolutions, and the tension force of the stepper herds.

    I think it will be easier now ... to write software for the controller to achieve the above effect.
  • #8 16913239
    Jacek Rutkowski
    Level 28  
    Only the stepper motor itself has a constant torque dependent on the rotation and it is not possible to easily adjust the tension force on it. You need a torque sensor and control the revolutions on its basis, or use a friction clutch and adjust the tension on it. In the presented video, the tension is regulated by the brake on the fed wire, not the motor ...

Topic summary

The discussion revolves around the control of a JK86HS78-4802-04 stepper motor using an AVR microcontroller and a TB6600 driver. Key points include the importance of microstepping to reduce jerking and improve smoothness during operation, with suggestions to set the TB6600 driver to 8 microsteps for optimal performance. Users discuss the need for proper control signals and timing to achieve smooth operation, as well as the potential for parallel winding connections to enhance speed without sacrificing torque. The conversation also touches on the challenges of achieving high RPMs and the necessity of ramping during acceleration and deceleration to prevent mechanical issues. Additionally, the use of torque sensors or friction clutches for tension adjustment is mentioned as a solution for maintaining consistent torque.
Summary generated by the language model.
ADVERTISEMENT