Iot network
The HvA provides an IoT network called iotroam
. In order to connect to this network we need to register the device it's mac address
.
How to find a mac address
The MAC address (Physical Address) is listed as series of 12 digits across six pairs (00:1A:C2:7B:00:47
, for example)
Windows
- Goto Settings > wifi
- Click hardware properties
- Find Physical address (MAC)
Troubleshooting
Make sure you have turned off random hardware addresses
Settings > wifi
Mac(book)
- Goto
Preferences > network
- Click Advanced…
- Find Wi-Fi Address
iOS
- Goto Settings > wifi
- Click on the on the connected network
- Find Wi-Fi Address
Troubleshooting
Make sure you have Private Address toggled off
Arduino board
Getting the address
- Upload the following sketch to your board:
#ifdef ESP32 #include <WiFi.h> #else #include <ESP8266WiFi.h> #endif void setup(){ Serial.begin(9600); // Make sure your serial monitor is set to 9600 baud Serial.println(); Serial.print("ESP Board MAC Address: "); Serial.println(WiFi.macAddress()); } void loop(){ }
- After running the code you should be able to see something similar to this in your serial monitor (Tools > serial monitor)
- After a teacher has registered the MAC address to the iotroam network you should be able to connect. Upload the following sketch to verify your device is able to connect
#ifdef ESP32 #include <WiFi.h> #else #include <ESP8266WiFi.h> #endif void setup(){ Serial.begin(9600); Serial.println(); WiFi.begin("iotroam", "loislane"); while (WiFi.status() != WL_CONNECTED) { delay(500); Serial.print("."); } Serial.println(WiFi.localIP()); } void loop(){ }
- After running and uploading the code from step 3 you should get an output showing an IP address similar to
Troubleshooting
The serial monitor does not show any output
Baud rate: Make sure you have selected the correct baud rate. This should be the same value as set in Serial.begin([value])
Opened serial monitor after uploading: Sometimes you open the serial monitor after you uploaded the code. The text has already been printed, you just missed it. There are two possible solutions to this while having the serial monitor open
- Reupload the code
- Press the tiny reset button on the device
Install `Wifi.h` and `ESP8266WiFi.h`
Install the `Wifi.h`
This library should be installed by default but in case it wasn’t you can install it yourself
- Goto Tools > Manage libraries
- Search for
Wifi by Arduino
Installing the `ESP8266WiFi.h`
Follow https://randomnerdtutorials.com/how-to-install-esp8266-board-arduino-ide/
Multiple libraries were found for "WiFi.h"
Fix found at https://github.com/1amchris/WiFi32.h
Raspberry
- Create a new file on the desktop called
get-mac.py
- Add the following code to the file
def getEthName(): # Get name of the Ethernet interface try: for root,dirs,files in os.walk('/sys/class/net'): for dir in dirs: if dir[:3]=='enx' or dir[:3]=='eth': interface=dir except: interface="None" return interface def getMAC(interface='eth0'): # Return the MAC address of the specified interface try: str = open('/sys/class/net/%s/address' %interface).read() except: str = "00:00:00:00:00:00" return str[0:17] ethName=getEthName() ethMAC=getMAC(ethName) print(f"MAC address for {ethName}: {ethMAC}")
- Open a terminal
- Run