CONTROL STEPPER MOTOR SPEED WITH LABVIEW AND ARDUINO

19,146

135

12

About: I ain't no physicist, but I knows what matters. :p By the way, I'm an Electronic Engineer . Interested in Electronic Hobby's and DIY Projects . I'm Focusing mostly on Simulations of Projects and Further mor...

I Made this in Proteus

u CONTROL STEPPER MOTOR SPEED WITH LABVIEW AND ARDUINO...!! wolaa

Step 1: This Tutorial Is:

> Using Labview to interface Arduino to PC via USB port.

> Using Labview to send data that describes Motor Speed to Arduino without any toolkits.

> Solving the problem of Arduino serial port hanging.

> Using Arduino to generate Stepping pulses.

> Using Arduino Mega’s Serial port 1 to show stepper motors speed on a serial LCD.

The best way to interface Arduino to PC is via its USB port. Arduino uses virtual Serial COM port to interface its USB connector to PC. At the same time Arduino uses its USB to interface its own serial (USART) port…. Bravo Arduino!!!

To send data to Arduino from your computer just connect it to USB port and use a program that can deal with computers serial port. This program can be Aeduino Serial port monitor, MIKRO C Serial terminal tool, PIC MP-LAB, or a program you establish. The one you build on yourself can be made by using a programming language like C, C#, C++, Python, Basic, NI-LABVIEW… etc.

Your own program not only has the advantage of interfacing the port, but performing a specific mission you need in your project as well. And so I do down here.

Step 2: In Labview (any Version) Establish the Following Front Panel

Step 3: Establish the Following Block Diagram. (click to Enlarge)

Step 4: And Here Is the Another Case of (if) Statement.

Step 5: This Virtual Instrument:

>> Starts communication with Arduino.

>> Detects if there is a change in control knob value.

>> If there is a change it sends the new value to Arduino.

>> Else, it clears serial port Input/output register to avoid data overflow and serial port overloading.

>> When pressing STOP, it sends “0” (brake or hold order) to Arduino.

Step 6: Arduino Code

Step 7: This Arduino Sketch:

Checks if labview sent a new value.If there is a new value, it converts it into integer byte with the same value.This integer byte represents the delay interval used in stepping sequence. That, the greater the delay the lower the speed and vice versa.Else, Arduino continue running the motor at current speed. This prevents the processor from overloading the serial port and pushes it to avoid Arduino Serial port hanging… Bravo ;)

Calculates motor speed from its resolution and delay intervals between steps as following:

Rpm = (60 x 1000 x step angle) / (360 x (delay m.sec))

Rpm = (1000 x step angle) / (6 x (delay in msec))

I used a 1.8 deg/step motor in this project and so:

Rpm = 300 / (delay in msec)

Sends the calculated motor speed to another Serial port of Arduino Mega to show if our code works

Step 8:

I simulated this tutorial with PROTEUS and worked perfectly.

In real application, it controlled my stepper motor perfectly on the long run.

Step 9: Proteus File

Enjoy.. :)

Share

    Recommendations

    • Make it Glow Contest 2018

      Make it Glow Contest 2018
    • Big and Small Contest

      Big and Small Contest
    • PCB Contest

      PCB Contest

    12 Discussions

    0
    None
    SciD

    1 year ago

    In the figures under Steps 3 and 4 I see a LabVIEW icon that looks like a blue backward pointing arrow with a smaller arrow joined under it and pointing down. (It's just above the "Equal To?" icon. just inside the while loop.)

    What is that? I've looked everywhere.

    Also, I am new to Arduino and LabVIEW (bought the Sparkfun Kit).

    If I get this, I load the INO file into the Arduino using the standard Arduino software kit, and then run the LabVIEW code, yes?

    Great instructable by the way. Your showing me that I should use a "modularized code approach" (some LaVIEW code, some Arduino INO) saved me a lot of grief.

    I was trying to do it all in LabVIEW alone, and it was painful

    Thanks.

    1 reply
    0
    None
    joony786SciD

    Reply 1 year ago

    Thanks for such appreciation , fell free to contact me . I'm hear for u Guys..!!
    as for this icon did u know close loop? serch about that u will find your answe.!! more u dig more u find .

    0
    None
    joony786SciD

    Reply 1 year ago

    contact me at joon786@gmail.com

    0
    None
    sya'banS

    1 year ago

    Why i canot open .pdsprj extension file fro my proteus 7.0?

    3 replies
    0
    None
    joony786sya'banS

    Reply 1 year ago

    use this link http://autometronicschool.blogspot.com/2015/12/free-download-proteus-v83-sp2-with.html

    0
    None
    joony786sya'banS

    Reply 1 year ago

    use proteus 8.3 or higher. lower version doesn't support thnks.

    0
    None
    sya'banSjoony786

    Reply 1 year ago

    Thanks Joony very much, Now i used proteus 8,6 and fixed it,

    If you share vi labview design, I will feel more happy wkwkwk

    0
    None
    AhmedF114

    1 year ago

    COMPIM ???!!!

    0
    None
    AhmedF114

    1 year ago

    hardware connections!! please

    0
    None
    CiprianC8

    2 years ago

    how to configure proteus to comunicate with labview? ciprian_clipea@yahoo.com if you may help

    0
    None
    MuhammadA759

    2 years ago

    i would ask if i want to send data from 2 motors or more using lapview to arduino how can i do this ??