From 04:00 PM CDT – 08:00 PM CDT (09:00 PM UTC – 01:00 AM UTC) Tuesday, April 16, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

Example Code

Tetrix Prime Balancing Beam Code using LabVIEW

Products and Environment

This section reflects the products and operating system used to create the example.

To download NI software, including the products shown below, visit ni.com/downloads.

    Software

  • LabVIEW

Code and Documents

Attachment

Description

Note: NI is no longer updating Data Dashboard and the Data Dashboard download is no longer available on the App Store nor Google Play. Consider using WebVIs ​​​​​​​ for your LabVIEW-based web application needs.

 

Overview
I have improved the code from the VIPM to use for the Tetrix Prime Balancing Beam MyRio demo.


Description
It is an balancing beam with a ball on it and you can set the position of where you want the ball.


Requirements

Software

  1. LabVIEW 2012 (or compatible)
  2. MyRio software

Hardware

  1. Tetrix Prime for MyRio
  2. MyRio
  3. Tablet
  4. PC

 

Steps to Implement or Execute Code

  1. Download the code
  2. Download the code from VIPM 
  3. Open the LVProject
  4. Open the main code(Balance Arm Main.vi)
  5. Change the variables(arm range and center point offset, see below)
  6. Run it
  7. Get your Ipad/Android tablet and create a Data Dashboard or download mine(import the lvdd to Itunes)

Arm Range and Center Point Offset

To change the variables, you have to get the minimum and maximum PWM values.

To get them, run the Control Arm directly.vi and set it to a value that is the maximum on your installation,

then also get the minimum and the center(the main beam is horizontal). You can enter the center value directly into center point offset control(main),

but the other control is a bit harder:

  1. Calculate the difference between the center and the min/max, they should be almost the same
  2. divide the value by 100, because the maximum PID outcome is 100 and -100
  3. enter it into the control
  4. if it goes to the wrong end, add/remove a negative sign

Then it should work, if it oscillates for too long or something, change the PID values.

 

Additional Information or References
VI Block Diagram

1.png

 **This document has been updated to meet the current required format for the NI Code Exchange.**

Example code from the Example Code Exchange in the NI Community is licensed with the MIT license.