Home
Blog
Go Back
TECHNOLOGY
|
8
Min
Updated On
September 27, 2024

Driving A Step Motor Using LabVIEW FPGA Module

Introduction to Stepper Motors

Stepper motors are the motors that operate with very precise signals. They change the angular position step by step with the pulse signals applied to the motor input. The stepper motors, which convert digital inputs into analog rotational motion, are also known as "digital machines"

To drive the stepper motor, the bobbins of the stepper motor are energized with electronic switching. The rotor moves and stops across the energized bobbin. This is called the full step. In half steps, two bobbins are energized together, and the rotor moves half a step by standing between two bobbins. If you want the motor to turn for a long time, you have to energize the bobbins one by one during the cycle. Figure 1 shows the stepper motor structure.

Diagram of stepper motors internal structure
Figure 1: internal structure of stepper motors

Applications of Stepper Motors

We use stepper motor-driven systems in many areas such as printers, 3D printers, CNC machines, hard disk drives. Stepper motors in various sizes are shown in Figure 2.

Types of stepper motor
Figure 2: Types of stepper motor

The stepper motor is a motor that provides position and speed control at high accuracy. They are ideal for applications that require fast positioning at short distances, high torque and low vibration at low speeds.

Driving Stepper Motors with NI myRIO

This application explains how to drive stepper motor using NI myRIO. The input signal required to run the stepper motor is generated using NI myRIO, and the code generated in the LabVIEW block diagram can also be monitored with the front panel of LabVIEW. Figure 3 shows the block diagram of the application.

Figure 3 : Block diagram of the application.

Components Used

The following materials are used in this application:

• NI-myRIO
• ACROME Power Box
• NEMA17-HS5005
• 1000-line incremental rotary encoder
• TB6560 stepper motor driver
• 24V Power Supply

In many applications stepper motors are controlled with open loop. There is no need for a feedback. Position calculations are based on the number of pulses in the input signal. However, since stepper motors are not ideal structures, the calculated position in stepping situations can be wrong. In order to avoid such a situation in this application, an incremental encoder was used together with a stepper motor, so the feedback was received via the motor.

Types of Stepper Motors

Stepper motors have different types of structures. Permanent magnet stepper motors, variable reluctance stepper motors, hybrid stepper motors, linear stepper motors, etc. In this application, hybrid NEMA 17 stepper motor is preferred.

Figure 4: NEMA17 stepper motors

Hybrid stepper motors have permanent magnets in their rotors. These motors are called hybrids because the working principle is the combination of permanent magnet stepper motors and variable reluctance stepper motors. Stator's core structures are very similar to variable reluctance stepper motors, but winding connections are different. These motors perform better than permanent magnet stepper motors when they are used for features such as step stability, speed and torque.

Using the TB6560 Stepper Motor Driver

In the application, the TB6560 was used as a stepper motor driver. TB6560 can limit the motor power to the switches on it and it can change the number of steps per pulse.

TB6560 stepper motor driver
Figure 5: TB6560 stepper motor driver

Controlling Stepper Motor with NI-myRIO and LabVIEW

The pulse signal generated by NI-myRIO to drive the stepper motor was connected to the CLK + pin of the TB6560 driver. To use the NI-myRIO's FPGA, you must use the LabVIEW FPGA Module. For this, a program was designed in the FPGA section of the LAbVIEW project. By generating the pulse signal from myRIO; the speed of the motor has been changed by turning the DIO8 pin ON / OFF during variable periods. CW pin of the TB6560 driver was connected to the DIO9 pin of myRIO to be able to determine the direction of the stepper motor. The motor changes direction according to the ON-OFF state of the DIO9 pin. The ENA+ pin on the TB6560 driver is not used to stop the motor. The Stop button in the LabVIEW program is used to hold itself at a certain torque when the motor is stopped, and the CLK signal pin is turned OFF when the Stop button is activated.

Motor drive section of the LabVIEW FPGA program
Figure 6: Motor drive section of the LabVIEW FPGA program

The encoder on the back of the motor outputs a square wave signal from 2 separate channels. The encoder signal sends 1000 lines of data in a full turn of the motor. The LabVIEW-FPGA code, which detects the rising and falling edges of the square wave, reads the data in detail. The full rotation of the motor is equivalent to 4000 encoder steps. In this way, it is possible to make very precise positioning.

Encoder signal read section of the LabVIEW FPGA program
Figure 7: Encoder signal read section of the LabVIEW FPGA program

There are control inputs and buttons on the front side of the LabVIEW FPGA program. OnTimeX indicates the ON duration of the generated square wave. TotalTime is the period of the square wave. Motor speed can be adjusted by changing TotalTime

Note that TotalTime must be greater than OnTimeX.

08
Figure 8: OnTime & TotalTime

Stop button stops the motor. The CW button changes the direction of the motor. Encoder Count (Base) shows the encoder value instantly. The "stop" button stops the program.

09
Figure 9: Front panel of the LabVIEW FPGA program

Author

Serhan Argun
R&D Manager

Discover Acrome

Acrome was founded in 2013. Our name stands for ACcessible RObotics MEchatronics. Acrome is a worldwide provider of robotic experience with software & hardware for academia, research and industry.