
How it works
The UNO R4 WiFi has two chips: the RA4M1 that runs your sketch and an ESP32-S3 module that handles Wi-Fi. The WiFiS3 library sends text commands from the RA4M1 to the S3 over a serial link, and the S3 replies with the results. In the simulator a virtual S3 bridge carries out those official WiFiS3 commands for scanning, joining networks, DHCP and DNS, so the sketch is the unchanged ScanNetworks example.
setup() opens Serial at 9600 baud, checks that the Wi-Fi module answers and compares its firmware version with the latest one the library knows. loop() prints Scanning available networks..., calls WiFi.scanNetworks() and prints the count, then one line per network with its number, SSID, signal strength in dBm and encryption type. It ends with the board's MAC address and waits 10 seconds before the next scan.
What to watch
Serial prints a scan report, then the sketch waits 10 seconds before starting the next scan. Select the board to change its virtual networks, and the next scan lists the change. Open Sniffer to see the probe requests the board sends and the responses from each access point.
What's on the bench
- Arduino Uno R4
The code
This Arduino C++ sketch lives in Code; sign in and press Compile & upload to build real firmware for the emulated board.
/* This example prints the board's MAC address, and scans for available WiFi networks using the NINA module. Every ten seconds, it scans again. It doesn't actually connect to any network, so no encryption scheme is specified. Circuit: * Uno R4 WiFi created 13 July 2010 by dlf (Metodo2 srl) modified 21 Junn 2012 by Tom Igoe and Jaymes Dec Find the full UNO R4 WiFi Network documentation here: https://docs.arduino.cc/tutorials/uno-r4-wifi/wifi-examples#scan-networks */ #include <WiFiS3.h> void setup() { //Initialize serial and wait for port to open: Serial.begin(9600); while (!Serial) { ; // wait for serial port to connect. Needed for native USB port only } // check for the WiFi module: if (WiFi.status() == WL_NO_MODULE) { Serial.println("Communication with WiFi module failed!"); // don't continue while (true); } String fv = WiFi.firmwareVersion(); if (fv < WIFI_FIRMWARE_LATEST_VERSION) { Serial.println("Please upgrade the firmware"); } } void loop() { byte mac[6]; // scan for existing networks: Serial.println("Scanning available networks..."); listNetworks(); WiFi.macAddress(mac); Serial.println(); Serial.print("Your MAC Address is: "); printMacAddress(mac); delay(10000); } void listNetworks() { // scan for nearby networks: Serial.println("** Scan Networks **"); int numSsid = WiFi.scanNetworks(); if (numSsid == -1) { Serial.println("Couldn't get a WiFi connection"); while (true); } // print the list of networks seen: Serial.print("number of available networks:"); Serial.println(numSsid); // print the network number and name for each network found: for (int thisNet = 0; thisNet < numSsid; thisNet++) { Serial.print(thisNet); Serial.print(") "); Serial.print(WiFi.SSID(thisNet)); Serial.print(" Signal: "); Serial.print(WiFi.RSSI(thisNet)); Serial.print(" dBm"); Serial.print(" Encryption: "); printEncryptionType(WiFi.encryptionType(thisNet)); } } void printEncryptionType(int thisType) { // read the encryption type and print out the name: switch (thisType) { case ENC_TYPE_WEP: Serial.println("WEP"); break; case ENC_TYPE_WPA: Serial.println("WPA"); break; case ENC_TYPE_WPA2: Serial.println("WPA2"); break; case ENC_TYPE_WPA3: Serial.println("WPA3"); break; case ENC_TYPE_NONE: Serial.println("None"); break; case ENC_TYPE_AUTO: Serial.println("Auto"); break; case ENC_TYPE_UNKNOWN: default: Serial.println("Unknown"); break; } } void printMacAddress(byte mac[]) { for (int i = 0; i < 6; i++) { if (i > 0) { Serial.print(":"); } if (mac[i] < 16) { Serial.print("0"); } Serial.print(mac[i], HEX); } Serial.println(); }
Firmware licence
Notice: this firmware uses the LGPL-licensed Arduino core library
arduino-unor4wifi-wifi-scan.bin is statically linked with ArduinoCore-renesas 1.6.0, in Breadboard's port of its UNO R4 WiFi variant to Renesas FSP 5.3.0. Parts of that core are licensed under the GNU Lesser General Public License, version 2.1 or (at your option) any later version ("the Library"). Breadboard distributes this firmware under terms that permit you to modify the work for your own use and to reverse engineer it for debugging such modifications.
- Relink package: arduino-unor4wifi-wifi-scan-relink.zip (385 KB)
- Corresponding source: ArduinoCore-renesas-1.6.0-fsp53-source.zip (3.7 MB)
- Licence texts and relink instructions
Try this
- Change delay(10000) to delay(3000) and press Compile & upload. The wait between finishing one report and starting the next scan drops to 3 seconds.
- List only strong networks: wrap the per-network printing in if (WiFi.RSSI(thisNet) > -70). The detail rows show only networks stronger than −70 dBm. The total still counts every network found.
- Go further with the UNO R4 access point and HTTP examples, which use the same WiFiS3 library to create a network and exchange web requests.



