Arduino Uno Network, Username, and Password with Wifi Shield

I'm part of a group project in which we're trying to connect an arduino to a wifi network requiring you to input a username as well as password and network name. While this is very easy to do on a laptop, we've been having a lot of trouble coding this into the arduino. we've tried using both a wifi shield and an ethernet shield, and our best guess is that we need to add another line of code into the following code referring to the user name. Any help would be greatly appreciated.

char ssid = "myNetwork"; // your network SSID (name)
char pass = "myPassword"; // your network password

int status = WL_IDLE_STATUS;
IPAddress server(74,125,115,105); // Google

// Initialize the client library
WiFiClient client;

void setup() {
Serial.println("Attempting to connect to WPA network...");
Serial.print("SSID: ");

status = WiFi.begin(ssid, pass);
if ( status != WL_CONNECTED) {
Serial.println("Couldn't get a wifi connection");
// don't do anything else:

our best guess is that we need to add another line of code into the following code referring to the user name.

You probably need to quit guessing.

What is the user name for? Connecting to a wireless network does not require anything more than knowing the network ID and the password.

There is nothing in that snippet that expects a user to enter a user name, password, or network name. In fact, network name and network password appear to hardcoded (though redacted).

If the Arduino is to be able to connect to any wireless network, there needs to be code in setup that gets a network name and network password BEFORE calling WiFi.begin().

Thanks for responding, I should have been more clear initially. We want to have the password, network name, and username hard coded into the code. The network name and password will replace the "myNetwork" and "myPassword" section in the code. The network we are trying to connect to is a campus network, and requires a campus login to access, so in addition to having network and password, we also require a username. Do you have any thoughts on this? Thank you for your help.

Do you have any thoughts on this?

No. A wifi network does not need a user name to connect to it. There may be something running on the network that prevents access to data without a user name, but that is not something that the Arduino will (initially) deal with.

The network name and password will replace the "myNetwork" and "myPassword" section in the code.

So, where is the code where you actually do that? Getting a user name should be identical.

I think the question is fine - this is a common scenario. The same thing happens in the case of the guest wifi at my workplace and with public hotspots at coffee shops, etc. Instead of just requiring 2 authentication pieces one must provide 3. I’m sure this is well known to networking experts but I lack the networking lingo to name this kind of network setup and hence don’t really know what to search for.

I wish someone had an answer. I just started out with Arduino and went for something with wifi capability. At home I’m fine but when I spoke to another Arduino hobbyist at the office he said “you won’t be able to connect to the office guest wifi” because of the username addition.

Is that really the answer?

Is that really the answer?

Connecting to the network and using the network are two different things. Connecting to the network requires knowing the network identity and the network pass phrase. It does not require any user ID or password.

Using the network cares nothing about the network identity or the network pass phrase, but does require, apparently, a user ID (and password?).

Exactly how to supply them depends on exactly how the network is requiring them, which you haven't described (well enough).

You might be running into WPA/WPA2 Enterprise used by large institutions with IT departments.

Well basically, once the arduino has logged into the WiFi network, you will need to send form data to get past the campus login.

So the http data you need to send will look something like this:

GET /program.htm?username=XXXXXXX&password=YYYYYYHTTP/1.1

Now if the campus login form that appears in your web browser uses the POST method to send data to the web server then you are in trouble because, as far as I have been able to determine, arduino wifi shields + arduino libraries can’t handle POST data, they can ONLY handle GET data like the above.

To determine what names you need to use in place of ‘username’ and ‘password’, view the html source in your web browser once you have the campus login form in your web browser.

Copy the html source and past it into Microsoft Expression Web (which can be downloaded for free).

There are 3tabs at the bottom ‘design’, ‘split’ and ‘code’.

Click ‘code’ tab.

The login form will appear as it does in your web browser, click on the edit field where you enter your campus username.

Click on the ‘code’ tab and the html that produces that edit field will be highligted or the carret will be positioned in it.

The html code will look something like this <input type=‘text’…name=’@@@@@@’>.

Replace ‘XXXXXXX’ in the http request above with what ever @@@@@@ is.

Now repeat this process for the password field.

<input type=‘password’…name="######">

Replace YYYYYYY above with whatever ###### is.

Also follow the html up until you see <form…method=‘XXXX’…>

You will see either ‘GET’ or ‘POST’

If ‘POST’ then you are stuffed - because Arduino + WiFi shields can’t do POST as far as I am aware.

The above assumes that you campus does not require security tokens to be uploaded with the login details much like ADSL modems require.

Copy the html source and past it into Microsoft Expression Web (which can be downloaded for fee).

The last time I checked, the fee was $0.00.

The last time I checked, the fee was $0.00.

It was meant to be free not fee.....typo