Connect a MKR1000 to the Campus WiFi

If you haven’t already done so, please read the getting started guide for the MKR1000

This tutorial only applies to staff and students studying at Cardiff Metropolitan University, and also likely only applies to Llandaff Campus – please contact your IT department if you need support if you are based elsewhere.

ABX00004_front_2

At the time of writing I don’t have a solution to get the MKR1000 connected to the Eduroam network – this is because Eduroam is a WPA2 encrypted network utilising a certificate as authentication. On a normal laptop, computer or mobile phone you will at some point have accepted the certificate to be installed on your device as an automated process – probably the first time you logged in – and then never had to think about it again. Getting the certificate on a microcontroller is a bit more tricky and I haven’t worked out how you do this just yet.

Fortunately, there is another network available on campus and this is a bit more accessible. It behaves a bit more like a domestic wifi router, but it does require that devices are registered on the network first.

Registration:

If you are using one of Fab-Cre8’s MKR1000’s, the chances are that it has already been registered.

The network we can connect to is called “media” and the password is “Conn3ctM3!”. But you also need to register the device with IT – this is an automated process but it requires that we know the devices MAC address. The MAC Address is a unique identification number devices hold that is usually designated at the time of manufacture. The MKR1000 actually has this number detailed on a sticker over the microcontrollers EMF shielding – but if for some reason it happens to be missing, we end up in a chicken and egg like situation as we can’t get on the network without the MAC address and the library examples only show the MAC address of a connected device! Fortunately it is easy to print the address using functions from the library:

If necessary, copy and paste the code below into the Arduino IDE. This will reveal the MAC address on the MKR1000. Make sure that the MKR1000 is selected from the Board: menu, and you have selected the usb com port in the Port: menu:

// A simple sketch to reveal the MKR1000's MAC address
// 
// Aidan Taylor, Fab-Cre8
// 2018

#include 
#include 

void setup() {
  //Initialize serial and wait for port to open:
  Serial.begin(9600);
  while (!Serial) {
    ; // wait for serial port to connect.
  }

  // Print the MAC address:
  byte mac[6];
  WiFi.macAddress(mac);
  Serial.print("MAC address: ");
  Serial.print(mac[5], HEX);
  Serial.print(":");
  Serial.print(mac[4], HEX);
  Serial.print(":");
  Serial.print(mac[3], HEX);
  Serial.print(":");
  Serial.print(mac[2], HEX);
  Serial.print(":");
  Serial.print(mac[1], HEX);
  Serial.print(":");
  Serial.println(mac[0], HEX);
}

void loop() {
  // Print the MAC address every 10 seconds:
  delay(10000);
  byte mac[6];
  WiFi.macAddress(mac);
  Serial.print("MAC address: ");
  Serial.print(mac[5], HEX);
  Serial.print(":");
  Serial.print(mac[4], HEX);
  Serial.print(":");
  Serial.print(mac[3], HEX);
  Serial.print(":");
  Serial.print(mac[2], HEX);
  Serial.print(":");
  Serial.print(mac[1], HEX);
  Serial.print(":");
  Serial.println(mac[0], HEX);
}

Upload the sketch and open the Serial Monitor to reveal the output. This is the output from one of the Fab-Cre8 boards:

macaddr

Now we need to register the device. Navigate to the following link: https://study.cardiffmet.ac.uk/IT/Pages/flash-console.aspx

registration

Choose “Register Your Devices

Enter the MAC address of the MKR1000 along with your University credentials

That’s it, you are done registering and now you can connect to the media network.

 

Connection:

The quickest way to test things are up and running is to use an example from the WiFi101 library. Open Arduino if you haven’t already done so and navigate to the top of the screen or window to open the File menu. Select Examples and locate the WiFi101 examples, and from this menu select ConnectWithWPA, this will open a new sketch:

connectMedia

Notice this window has two tabs – in order to set up the WiFi credentials, click on the arduino_secrets.h tab. In this tab, enter media as the SSID and Conn3ctM3! as the password:

Secrets

Now upload this sketch and open the Serial Monitor. If the MKR1000 is able to connect, you should see an appropriate prompt in the serial monitor window.

If you are having trouble connecting, please get in touch!

Aidan Taylor, Fab-Cre8

2018