This project performs the scanning of WiFi hotspots nearby, lists them in a ring, shows available network profiles and connects to a chosen hotspot.
In LabVIEW, some Bluetooth functionalities are available by default. However no such functions are available for WiFi. This project provides this functionality and can access the computers wireless adapter using netsh (network shell) commands.
1. LabVIEW 2012 (or compatible)
2. Computer with wireless adapter
1. Run Main.VI.
2. Verify that your desired hotspot already has a network profile. For more details see references.
The following WiFi Library may also suit your Needs:
WiFi Library
WiFi Library for LabVIEW - Discussion Forums - National Instruments
https://forums.ni.com/t5/Example-Program-Drafts/WiFi-Library-for-LabVIEW/ta-p/3736625
How to connect to a Wireless WIFI Network from the Command line in Windows 7 - Scott Hanselman
https://www.hanselman.com/blog/HowToConnectToAWirelessWIFINetworkFromTheCommandLineInWindows7.aspx
WiFi Library for LabVIEW - Discussion Forums - National Instruments
https://forums.ni.com/t5/Example-Program-Drafts/WiFi-Library-for-LabVIEW/ta-p/3736625
Example code from the Example Code Exchange in the NI Community is licensed with the MIT license.
This example requires that the SSID to which you want to connect already have a profile. It would be a great - and I mean GREAT! - improvement if your example could survey the wifi neighborhood, select an SSID, create a profile from scratch (including the password) and then connect to it. It looks like "netsh wlan" does not support this functionality directly. One way to do it is to take an existing profile, edit it as an XML or TXT file, including insertion of unencrypted password, and save as a new profile. Doable but cumbersome. A better approach would be a LV wrapper around MS WLAN API, but I suspect that that would be a big project...
Thanks a lot for your input! I will add that functionality when I have time.
My plan is to create a "WiFi Library" out of this at a later date
I have created a WiFi Library in the meantime, which includes many commonly used wireless tasks.
It is also possible to connect to hotspots which do not have any profile yet.
WiFi Library
WiFi Library for LabVIEW - Discussion Forums - National Instruments
https://forums.ni.com/t5/Example-Program-Drafts/WiFi-Library-for-LabVIEW/ta-p/3736625
Hello Eric,
Nice library Thank You!. I had one problem, I could not connect to a hot spot that didn't have a profile already. In your last post you say it is possible to connect hotspots which do not have any profile yet, is that a typo or maybe I am using the example program incorrectly? After showing the networks I select the network I want and enter in password. I then hit connect and get the message "Connection request was completed successfully" in the log window. But my wifi icon in windows does not show it being connected(I tried pinging from command line as well). I go to the windows WIFI connection manager, it says it is "Connecting" but is also prompting me for password. I double checked password and even copied it from Labview gui and pasted it in the windows connection manger and was able to connect through windows. Any suggestions?
Eric,
I have an update, I think I figured out what I was doing wrong. When the GUI starts up it re initializes all the controls to default value, I didnt notice and when I selected the WIFI hotspot I wanted I didn't re-enter password. I just connected and I believe it created a profile without a password. When I finally noticed the password control was blank, I entered the password and hit connect again. It still did not connect, so I deleted the profile and tried again and it connected to hotspot. I suspect that the profiles cannot not be overwritten the must be deleted first and then recreated. It seems to work well now and I tested on both windows 7 and 10 machines. Thanks for the great examples and library! Very useful code and it works as advertised.
HI Eric,
I tried running your WiFi Library Example.vi on Windows 10, but while it said "Connected", Windows was NOT connected to the wireless network. Also, it said "Connected" whether or not I gave the correct password. Can you help?
Thanks!