Translate

Saturday

Count to Three

Just like a programmer starts off printing "HELLO WORLD" on the screen, in LabVIEW you can start off by learning to count to three. It's not easy or intuitive to find a way to count between two numbers. The key words are "Quotient & Remainder." On the Block Diagram hit CTRL and then SPACEBAR at the same time to pull up the Quick Drop dialog box. Type in Quotient & Remainder. It should find it by just typing in Quo....
Now add a While Loop around the Quotient & Remainder.

 

We will use the iteration (i) terminal from the while loop to show the current loop count. The iteration terminal starts with zero on the first sequence. We connect a wire from the iteration (i) terminal to the X input of the Quotient& Remainder.



We need to add an upper limit number to the Y input of the Quotient & Remainder.  So Right-Click your mouse over the Y input and Create a Constant.  We want this vi to count from 0 to 3.  Put a 4 in the constant box.  The output will count from 0 to 3 because the first count will be the zero and the fourth count will be the number 3.

Right-click on the upper right output connector of the Quotient & Remainder and create an Indicator.  This numeric indicator will be shown on the Front Panel.  This is where the numbers will be seen.  If you want to use this number for another operation, just add a wire and connect to another vi, or a graph, etc.

You will need to add a Stop button to the front panel for this example and wire it to the Stop if True function of the While Loop at the lower right hand corner.  Let's also slow it down a little so we can see the operation working.  Add a Wait Until Next ms Multiple icon with 500 as a constant wait time.

Hit run and watch the numeric indicator count from 0 to 3 on the Front Panel.  Hit the Stop button to end the process.

Thanks for learning how to Count To Three using LabVIEW with me.  Feel free to leave a comment.



Wednesday

LabVIEW & Arduino

Labview By Fairweather, Ian (EDT)/ Brumfield, Anne (EDT) (Google Affiliate Ad)
Arduino or compatible device

Install the NI-VISA drivers.

Install JKI VI Package Manager (VIPM) Community Edition (Free).
Install the LabVIEW Interface for Arduino as described here.

Connect your Arduino to your PC as described in here.

Load the LabVIEW Interface for Arduino Firmware onto your Arduino as described in here.
   
Once you have everything loaded into the Arduino, attach an LED to pin 9 and build a VI in LabVIEW that will turn on the LED with a switch from the Front Panel of LabVIEW.


Download this vi here:  BasicArduino3.vi


See my new site:  www.labviewtest.com/

Sunday

Website scraping with LabVIEW

Scrape or retrieve data from a website using LabVIEW. This is also called data harvesting or data extraction from websites.

One difficulty is finding good HTML data to scrape. Most data like stock quotes have been replaced with dynamic data that doesn't have a clear and consistent text strings that can be searched.

Here is an example that opens a URL website, reads the HTML, picks out a string keyword and displays the data after that keyword. I've chosen a weather site that has a consistent keyword like "temp"> and the page is dedicated to only one city. So the number after "temp"> will be that city's temperature.


This vi will be great for any instrument attached to a network with a web-page to access.

Use the data socket open and then read to capture all the raw text of the webpage.  Then use a string match pattern to search through the text to find the matching strings before the data that you want to scrape.  The example show searches through the text of the webpage to find "temp">.


More details can be found here.

Monday

STEP #4 "HELLO WORLD" using LabVIEW

So you've completed STEP #1 Get LabVIEW and you've worked through the examples given in the tutorials. 
Then you followed STEP #2 Get an Arduino
You checked out your Arduino and now you are ready to program the LIFA files onto the Arduino with STEP #3 Load LIFA.

You need a way to test that everything is connected and working. 
You also need to get familiar with both LabVIEW and Arduino together.

Your first LabVIEW project needs to be something very simple and easy to understand. 
Most programming languages and starter circuits always have a "HELLO WORLD" to learn from.

Controlling an LED with an on-screen switch would be an easy way you can interface the on-screen controls of the LabVIEW Front Panel with the real-world LED connected to an output of the Arduino.

You can start by adding a switch, a stop button and an indicator LED to your first front panel.  You can also add these items from the Block Diagram.
The Block Diagram shows the connection details of my Arduino Clone.  Your settings may very depending on what Arduino device you have connected.  You can always find the com port in your control panel, Hardware manager of Windows.  Plug your Arduino into the USB jack and see what com port is listed when it connects.



STEP #2 Get an Arduino, or equivalent

The first equipment you will need is an Arduino UNO or compatible device.  Here are photos of my Arduino which is smaller than the normal Arduino UNO.  This is a clone Arduino.  Arduino's come in many different packages, shapes and sizes.  Choose which bests works for your situation.

I bought the small board on the left from http://www.adafruit.com/ and the red board connected is the USB to

Arduino board I bought from http://www.sparkfun.com/products/9716
The board on the right is just a block of LED's and a pushbutton connected to the Arduino as outputs and inputs.


I used the USB board and connected it to a proto-board with a 10uf and 16MHz ceramic resonator which creates an Arduino compatable device.



 And here is the original Arduino UNO R3 which has the USB circuit already installed.

UNO R3


All of these devices can be used to interface with LabView.

STEP #3 LabVIEW Interface for Arduino Setup Procedure

Setting up the LabVIEW Interface for Arduino (LIFA) is a six step process that you will only need to complete once you get LabVIEW setup on your computer and you have an Arduino or compatible device.  Please follow the instructions below to start creating applications with the LabVIEW Interface for Arduino. LabVIEW Interface for Arduino Setup Procedure

Nice overview of using Labview-and-Arduino

Wednesday

INTRODUCTION TO THE PROJECT

My goal for this project is to fully utilize the free LabVIEW Student version and a relatively in-expensive Arduino microcontroller to build a test/troubleshooting box.

My first project is a test box for a simple multiplexer circuit. The circuit inputs are a clock signal and three switch inputs. The output is several LED's.

I want LabVIEW to control the clock input. I want to be able to turn the clock on and off, and also step through a clock sequence with a touch of a button.

I want LabVIEW to control the three switch controls from on-screen.

And the LED's should also be displayed on-screen and no physical LED's needed.

Hepefully all can be done with only the Student version of LabVIEW and the Arduino microcontroller.

If this simple task works, it will justify the cost of the full version of LabVIEW.

Tuesday

Top 5 Reasons LabVIEW Makes You More Productive When Using Arduino

Top 5 Reasons LabVIEW Makes You More Productive When Using Arduino

The Arduino microcontroller is a low-cost electronics prototyping platform. With the LabVIEW Interface for Arduino Toolkit you can leverage the power of the LabVIEW Graphical Programming environment to interface with the Arduino in a whole new dimension. Learn how the LabVIEW features listed below will help you increase productivity when using Arduino.

Arduino with LabView

LabVIEW is a National Instruments software package that provides a graphical programming language for interfacing the Arduino micorcontroller.

Check out the NI website for more information:  Use Arduino I/O With LabVIEW

The Arduino is an easy to configure, low-cost microcontroller with many built-in functions like:
  • Digital and analog inputs and outputs, PWM pulse width modulations, I2C communications, and SPI serial communications.
  • Loop rates: USB tethered (200 Hz) and wireless (25 Hz)
  • Open Arduino sketch and toolkit VIs help you customize functionality
The FIFA I/O engine sketch is loaded on Arduino to establish communications with LabVIEW

Friday

LabVIEW for Amazon Associates

LabVIEW can be used to generate links for Amazon Associates.
The Concatenate Strings function can be used to combine elements of the link and combine them all together with an HTML String output.  This output was used to create this link below.

LabVIEW 2009 Student Edition

The inputs are the products ASIN number, your Amazon Associates ID number.  If you don't have one, feel free to use mine.
Also enter the text to be shown as a underlined link.  For different items you want to create links for, you will just need to change the ASIN and Text data.  Hit Run, then copy the link from the HTML String into your blog post.  It will look like the link above.



  LabVIEW_2010 vi :  AMAZONassociates1.vi