First, I would like to make a clarification. This article makes use of the terms free software and open source interchangeably, although some people distinguish between the two.
The term free software can be misleading--it does not refer to price (as in "free beer") but to freedom of use (as in "free to copy and distribute.")
The term open source usually means more than just making the source code available--it means the software license legally allows you to modify and redistribute the source code without paying any fees, royalties, or even notifying the original author. Open source software under the GNU Public License (GPL), for example, allows you to do practically anything you want with the software, except for preventing others from freely using it and accessing the source code as well.
The philosophy of free and open source software is that you should be free to use, copy, modify, enhance, and share the software for any suitable purpose. Generally, you can obtain open source software "for free" as well (free of charge), although many companies have made a business of selling and supporting free software.
So what is the big deal about open source? First, consider the benefit you have already received from open source software, possibly without realizing it. Almost the entire Internet architecture is based on open source software protocols, such as TCP/IP, HTTP, and HTML. Many web servers run on the open source Linux operating system, considered by those who use it to be the most stable operating system ever. Powerful programming languages such as Java, Perl, Python, and GNU C are also open source. With almost any open source software, because you have access to the source code, you can learn more about how it works, or modify the code for your own particular purposes.
Open source software's origins can be traced to the GNU project, which was an initiative a couple of decades ago to provide open source UNIX® alternatives to expensive and closed systems (GNU is an acronym for "GNU is Not UNIX"). See the Free Software’s Foundation website for more details (http://www. fsf.org). The motivation for most open source software is usually not profit-driven; instead, it is utility-driven; that is, people create open source software because they simply need it and find it useful for a particular project. Then, by making the software and its source freely available, others in turn can enhance and modify the software with more features or for other uses.
The alternative to open source software, of course, is proprietary and closed-source software. Proprietary software usually hides the source code because the company selling the software wants to protect their ability to continue to sell the software without someone else easily creating a free open source version. Should all software be open source? Of course not. Anyone who creates software should be able to choose whether to sell and support it commercially and keep the source code hidden. There is nothing inherently wrong with proprietary software; rather, the point is that there is much that is right about open source software that can coexist with proprietary software.
Consider a final note about open source software: Contrary to popular perception, open source software is generally not in the public domain. That is, the authors of open source software still own the copyright on the code. The difference with proprietary software is in the licensing: open source licenses protect your freedom to use and share the code, while most commercial licenses are generally designed to restrict this freedom.
While it does not seem likely that we will see an open-source version of LabVIEW any time soon (although I would highly support such a move), I believe there is much that LabVIEW developers stand to benefit and learn from the open source movement. Why? Because LabVIEW is extremely solution-oriented, and because most LabVIEW developers spend their time solving software and system integration challenges. By sharing our discoveries, solutions, and our code, we collectively have the opportunity to create much more powerful utilities, tools, and applications that would be difficult for a single entity or organization to do. To once again exemplify, Linux (which was created by hundreds of developers collaborating all over the world) is a worthy rival to Windows NT, created by one company. The point here is not to debate which OS is better, but rather to point out that the open source development can and has created a software system that rivals that of the world's largest and most powerful software organizations (Microsoft).
In a sense, much of the open source philosophy is not new among many LabVIEW developers. The Info-LabVIEW discussion list has many contributors who frequently and graciously offer to share their code freely with others who have similar challenges. National Instruments has long provided a large online library of free examples and free open source instrument drivers for LabVIEW. To the same end, this technical journal, LabVIEW Technical Resource, enables its authors to regularly present complex conceptual material and distribute freely on the LTR Resource CD their own original LabVIEW code, as well as code that originated with others in the LabVIEW community that they have enhanced and built upon. I think there is an opportunity to continue this collaboration and produce complete open source toolkits and applications.
When I authored the book "Internet Applications in LabVIEW," I was struck by the number of large-scale, widely-accepted open source software systems that were being used in nonLabVIEW development environments. As LabVIEW gains more acceptance and an ever growing following of developers, it makes sense to examine ways in which collaborative, open source development of more generic tools can help a wide range of developers. Consider some of the following needs that I have perceived:
- More drivers for LabVIEW on Linux.
- IMAQ capability for nonWindows operating systems.
- Easy web control of VIs.
- Database access from LabVIEW.
- Enterprise connectivity of LabVIEW to other systems, including Java, JMS, Perl, XML, and others.
- Add-on toolkits and utilities for using LabVIEW in non-instrumentation applications.
You probably have your own wish list and your own particular application needs. While you can always pay a software consulting company to create your solution or wait and see if NI includes your wish in the next version of LabVIEW, I believe there is an opportunity to create reusable, powerful, free, and open source tools by a collaborative effort on the part of the LabVIEW community. As an example and token of my colleagues and my own contribution, we have developed three utilities (LabVNC, LabSQL, and LabPerl) as open source free tools that I encourage you to use, modify, share, and enhance.
A large-scale collaborative LabVIEW open source development effort does require some organization and planning. My hope is that this article will serve as a catalyst to developers who would like to participate in such an effort. As a beginning, I have set up a website, called the LabVIEW Open Source Tools (LOST) initiative at http://jeffreytravis.com/lost. Please visit the site to obtain updated information, to download open source tools, or to submit your own ideas or open source projects. Eventually, if there is enough interest and developers, websites such as SourceForge (http:// sourceforge.net) can be used to support version control, documentation, and project management.
More than simply addressing open source, this article provides actual code and an idea of the usefulness of open source tools. On this issue’s LTR Resource CD or on the LOST website you can find the following utilities:
- LabVNC--Remote Java applet, web control of VIs using the VNC protocol.
- LabSQL--Database access from LabVIEW using ADO.
- LabPerl--LabVIEW and Perl connectivity.
These tools are in the very beginning stages (call them Beta versions if you like), but because they are open source, they are free and all the source code is provided so you can enhance, modify, and hack them to your heart’s content. Just to be sure to share your efforts with the rest of us so we all can benefit!
LabVNC (Virtual Network Computing) is a cross-platform, open source utility that uses the open-source VNC protocol to allow you to instantly turn any VI into a Java applet, which will allow you to do remote control over the web. No programming or modification of your VI code is necessary. The Java applets can always preserve exactly what any VI looks like, because they are based on the frame images of the VI. LabVNC is a secure, easy, and free tool for web-based remote control of any VI's front panel.
VNC has been traditionally used as a remote-desktop control application (such as pcAnywhere®) and has been ported to numerous platforms. For more information about VNC, go to http://www.realvnc.com/. With LabVNC, our goal was to allow remote web-based control of a single VI, rather than the entire desktop. By leveraging the open source code in VNC, and using some existing modifications of VNC, we were able to create modifications in LabVIEW and C++ (DLLs) to provide this functionality for LabVIEW users.
Figure 1: Relationships Between LabVIEW, the Web Browser, and LabVNC Server
As Figure 1 illustrates, you simply install LabVNC server in the same directory as LabVIEW, tell it which VI you want to share, and remote users can instantly access it over the web with full remote control capabilities. A password (challenge-response authentication) allows you to safeguard access. Encryption (SSH) is currently being developed and incorporated into LabVNC by Graeme Cloughley at Rayodyne.
The following steps briefly summarize how LabVNC works:
1. LabVNC is a combination of VIs and DLLs that are installed on the server machine.
2. Once LabVNC server is launched, any VI can be selected for sharing over the network, using the LabVNC Control Panel.
3. LabVNC has a web server built into it that runs on port 5800.
4. When a remote web browser connects to LabVNC, a challenge-response authentication system is used to authenticate the remote user.
5. The LabVNC server uses the Remote Frame Buffer (RFB) protocol to serve a Java applet.
6. The LabVNC server detects changes to the VI front panel and sends those image changes to the remote Java applet.
7. On the client, mouse and keyboard events are detected, and sent back to the server, so that they are processed as if they occurred at the server.
8. The end effect gives the remote user a "virtual presence" at the VI.
Figure 2: LabVNC Java Client Running on a Psion Handheld Device
The current LabVNC version works on any Windows server (a Linux server is under development). The remote client can be any Java-based browser. This includes even handheld devices such as the Psion EPOC or PalmOS®. Figure 2 illustrates a VI being controlled through a Psion handheld device. The LabVIEW server is on a remote machine (this illustration courtesy of Rayodyne).LabVNC was created by Jeffrey Travis, Graeme Cloughley, and Scott Gerlach (Rayodyne). You can get the latest version of LabVNC at http://jeffreytravis.com/lost or at http://jeffreytravis.com/lost/labvnc.html. If you would like to contribute to LabVNC development, please contact us.
Figure 3: The LabSQL VI Palette
LabSQL is a collection of VIs that uses the Microsoft ADO object collection in LabVIEW so you can connect to almost any database, perform SQL queries, and manipulate records. Essentially, it is a collection of VIs that acts as a wrapper for ADO properties and methods.
Because LabSQL is currently based on Microsoft’s ADO, it only works on Windows. Eventually, we would like to see JDBC support added to LabSQL so it can run on nonWindows operating systems. LabSQL was created by Chris Roth from Premise Development Corporation with modifications and documentation by Jeffrey Travis.
Figure 4: Using LabSQL to Run an SQL Query
LabPerl is a cross-platform API for letting LabVIEW and Perl communicate. It consists of some LabVIEW VIs and two Perl module (.pm) files that allow Perl functions to call LabVIEW VIs, pass data, and vice versa. Perl is an open source, powerful scripting language that runs most of the web's CGI scripts. You should be somewhat familiar with Perl (http://www.perl.org) before trying to use LabPerl.
In LabPerl, Perl and LabVIEW communicate locally via TCP. Functions are provided on the LabVIEW side to read and write strings to Perl, and a Perl package (LabVIEW_Comm.pm) is provided to pass strings back and forth to LabVIEW. The code is very simple, but it is a starting point for creating applications in which you want Perl, for example, to run test scripts that call LabVIEW VIs to get data acquisition results. LabPerl was created by George Castle, Steven Mattison, Holley Tondre, and Jeffrey Travis from Rayodyne. It runs on all the platforms LabVIEW and Perl run on (Windows, Linux, and Mac® OS).
Open Source software represents a real and powerful movement among developers worldwide today. As LabVIEW developers and enthusiasts, we can benefit from working collaboratively on open source projects that will give the community powerful, useful, and quality software. Current versions of the LabVNC and LabSQL toolsets are available on this issue’s LTR Resource CD. LabPERL will soon be available for download at http://jeffreytravis.com/lost.
LabVIEW Technical Resource TM (LTR) is the leading independent source of LabVIEW-specific information. Each LTR issue presents powerful tips and techniques and includes a Resource CD packed with VIs, Utilities, Source Code, and Documentation.
Jeffrey Travis has over 11 years of software development experience. He is the author of LabVIEW For Everyone (2nd ed., Prentice-Hall, 2001), Internet Applications in LabVIEW (2000, Prentice-Hall), and the LabVIEW Internet Applications Course. Jeffrey provides consulting and training services through his company, Jeffrey Travis Studios (http://jeffreytravis.com). He can be reached at firstname.lastname@example.org.
The Info-LabVIEW mailing list is an internet mailing list for the discussion of the use of LabVIEW.