Project showcase
EasyWifi for MKR1010 & Nano33 IOT / WifiNINA

EasyWifi for MKR1010 & Nano33 IOT / WifiNINA © GPL3+

EasyWifi setup: Enter, Store & Forget Wifi credentials, No need to keep Wifi-credentials in your code. Uses FlashStorage and CaptivePortal AP

  • 492 views
  • 0 comments
  • 0 respects

Components and supplies

About this project

EasyWiFi

Setup WIFI on your Arduino MKR devices requires some preparation and secure information mostly stored in your arduino-secret.h files.

This library makes it easy: one time credentials entry, connect & forget. no need to code it in your.ino or.h file

GitHub

The EasyWiFi library can be found on GitHub : https://github.com/javos65/EasyWifi-for-MKR1010

Here it will be maintained, check the GitHub for the latest repository.

Library

Besides the EasyWiFi.h inclusion, this project requires the WifiNINA.h libraries. Be sure to use the latest version (1.4.+) as older version don't support the flash storage very well.

The library has some debug switches in EasyWiFi.ccp that you can turn on to look by the serial-interface for debugging info : #define DBGON (for general debug) and #define DBGON_X (for packet info)

Class Functions

EasyWiFi is a new Class, where you have the following function calls:

Class EasyWiFi
{
public:
EasyWiFi();
void start();
byte erase();
byte apname(char * name);
void seed(int value);

.start() is the main function, this follows the following procedure:

  • 1. read credentials from Flash drive (uBlox NINA W10 module)
  • 2. (if no credentials, us pre-programmed ones, this is still available)
  • 3.> Try to Log into WiFi Network,
  • 3a. if connection is ok, start returns to your program
  • 3b. if no connection, start opens a Captive Portal by means of an Access Point.
  • 4. log into this AP, and open the portal: enter your credentials and submit.
  • 5. credentials are saved to Flash drive, and try to login : step 3.>

There is no max retries or timeout, if no correct credentials are entered, AP will stay alive... sorry -> ADAPTED !!

.erase() : erases your credentials from Flash Drive

.apname() : set custom name of your Portal Access point

.seed() : set the seed of the Cypher algorithm

Color RGB led

The RGB led on the WifiNina module shows WiFi status indication (Mkr1010 only):

  • GREEN: Connected
  • BLUE: (Stored) Credentials found, connecting...
  • YELLOW: No Stored Credentials found, connecting...
  • PURPLE: Can't connect, opening AP for credentials input
  • CYAN: Client connected to AP, wait for credentials input...
  • RED: Not connected / Can't connect, .start() is stopped, return to program

Cyphering

storing the data on the Flash drive will create a file with byte/character content. This file stays on your MKR1010 module, even if you reprogram the part, so theoretically its there forever. To avoid unwanted reading of your password and SSID, its Cyphered a little bit. Its not a crypto-proof algorithm, but it hustles the characters into a unreadable content.

In the examples of this library there is a ".ino" code example how to read and write the crypto file.

Captive Portal

The trick with the AP is that its forcing the connecting Smartphone to open the Portal Webpage. For more info on this feature, see my other Project on this topic:

Hackster.IO: captive-portal-for-wifi-ap

To be improved:

Improvements in progress:

  • Build in Max time-out for number of WiFi connect retries (done)
  • Add RGB led coloring during WiFi setup (done)
  • Build function to set the AP WiFi channel
  • Build function to define your own storage filename
  • Extend the stored IP to a known priority-list, and match these with the found WiFi-networks for easier access by dynamic location use of your Arduino
  • Implement more complex cyphering or crypto.
  • Make the library compliant with other WiFi shield : issue is the storage function that is by example not able on the MKR1000 series
  • Test the project on Arduino Nano 33 with uBlox Nina, test on ESP32 shields - done, works, but no RGB led.

Code

EasyWiFi Library
Arduino Library and example code

Comments

Similar projects you might like

MQTT Protocol with ThingsBoard Cloud Using Arduino MKR1010

Project tutorial by Ahmad Radhy

  • 1,924 views
  • 0 comments
  • 6 respects

Captive Portal for WiFi AP

Project in progress by JayV

  • 8,768 views
  • 2 comments
  • 7 respects

The Badland Brawler - RC Monster Truck with Arduino

Project tutorial by Jithin Sanal

  • 16,877 views
  • 21 comments
  • 121 respects

Cimini

Project tutorial by Johan_Ha

  • 1,229 views
  • 0 comments
  • 3 respects

MKR1000 WiFi Robot

Project showcase by Arduino_Genuino

  • 40,698 views
  • 12 comments
  • 64 respects

Send a Message on Discord

by Rémi Sarrailh and madnerd

  • 20,651 views
  • 3 comments
  • 13 respects
Add projectSign up / Login