Then click “OK” and place the express VI within the while loop.įigure 6: Adding analog input functionality. I called it "Feedback" because, using this function block, we will read in our position values from the internal servo potentiometer. Within the configuration pop-up window, ensure that Channel selected is “A/AI0 (Pin 3)” and give the channel a name. Next, using Quick Drop (CTRL+Space) or selecting the function from myRIO function palette, add “Analog Input” express VI as shown in Figure 6. SERVO MOTOR ARDUINO LABVIEW CODEThis is where we will put all of our code that needs to be executed continuously. Create a while loop with an associated stop button. Open the new VI and switch to the Block Diagram window. You can ignore or even delete the “Main.VI”-it gets created by default as an example for every myRIO project created under this template. Then, create a new VI called “PID Controller.VI” under the myRIO target as shown in Figure 4. I called mine simply “PID.”įinally, make sure the myRIO is plugged in and found, at which point you can click “Finish.”įigure 3: Creating a myRIO project – step 2 Create a New VI On the new pop-up window, select “myRIO Project” and click “Next”.įigure 2: Creating a myRIO project – step 1 Fire up LabVIEW and, on the splash screen, select "Create Project" (alternatively, you can go to File > Create Project). SERVO MOTOR ARDUINO LABVIEW SOFTWARESoftware Creating a LabVIEW Projectįirst, let’s create a LabVIEW project. Therefore, we will empirically determine the center position, ourselves, and then add arbitrary positive and negative offsets for clockwise and counterclockwise travel. Nevertheless, in practice, these values can vary quite drastically, especially with budget servos like the one that we use in this tutorial. Table 2: Servo behavior after customization When customized, it should then move fastest to the left at 1000 μs, to the right at 2000 μs, and remain stationary at 1500 μs (Table 2). Note that these assumptions assume a 50 Hz refresh rate. We said that these devices accept pulse-width modulation (PWM) signals (Figure 1) and follow the standard RC hobby servo protocol.įigure 1: Simple servo control through PWMĪccording to this standard protocol, a regular servo will move to its leftmost position at a pulse length (T ON) of 1000 μs and rightmost at 2000 μs, staying in the middle at 1500 μs (Table 1). Previously, we explained how a servo is controlled and how we bypass the internal controller of the device to control velocity instead of the position. If you are still a student, you should be able to acquire all the software and relevant licenses from your university. In this tutorial, I use NI LabVIEW version 2014 to program the NI myRIO device with the NI LabVIEW PID and Fuzzy Logic Toolkit installed. Customised servo motor which should by now be connected to the Protoboard Accessory.NI myRIO Expansion Port (MXP) Protoboard Accessory (comes pre-packed with myRIO).To follow, you should have the following available and/or installed: SERVO MOTOR ARDUINO LABVIEW HOW TOInstead, it will show you how to implement a simple PID controller. This tutorial is not intended to cover nitty-gritty theoretical details of PID. Using the regular “PID.VI” that ships with the software package, we will be able to solve our challenge of bypassing the original servo controller much more quickly. SERVO MOTOR ARDUINO LABVIEW FULLInstead of writing our PID controller completely from scratch, we will take full control of the NI LabVIEW PID and Fuzzy Logic Toolkit. Using these, you can quickly develop most complex applications for a multitude of engineering and research projects. One of the greatest benefits of the language is the vast array of toolkits, modules, and libraries that are available for it. LabVIEW is a graphical programming language developed by National Instruments. You will need to follow the first part of the series, which discusses the project's hardware, to implement the steps shown below. This is the second article where we build upon our customized servo motor and focus on the programming of the PID controller exclusively. We customize the servo by removing its internal controller and replacing it with a myRIO interface. In this series, we discuss how to implement a simple PID controller using LabVIEW and a hobby DC servo motor.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |