Go Down

Topic: Provisioning with Wifi Nina compatible devices (Read 246 times) previous topic - next topic

gdeflaux

Oct 21, 2020, 12:14 am Last Edit: Oct 21, 2020, 12:15 am by gdeflaux
Hi,

Just sharing a library that allows for a basic provisioning workflow for wifi capable devices requiring the Wifi Nina library: https://gitlab.com/gdeflaux/wifi-nina-provisioning.

The workflow is as follows:
  • The Arduino device is turned into an web server and an access point.
  • You connect to the Arduino Access Point with your computer or mobile phone.
  • You open a browser to http://192.168.4.1.
  • You select the Wifi network you want the Arduino to connect to.
  • You provide the Wifi password.
  • The Arduino device attempts to connect to the selected Wifi network.

Cheers,

pert


Juraj

#2
Oct 21, 2020, 07:47 am Last Edit: Oct 21, 2020, 07:51 am by Juraj
and your recommendation where to store the supplied ssid and password?
or how to store it in the crypto chip available on 'nina boards'?

gdeflaux

and your recommendation where to store the supplied ssid and password?
or how to store it in the crypto chip available on 'nina boards'?
I am actually still investigating this. As I started to develop the library I though that I would store this in the EEPROM, but neither the Nano 33 IoT nor the MKR 1010 have one (I figured afterwards). So I'll be investigating the crypto chip as you mention. Thanks!

Juraj

or WiFiNINA library has storage functions, which store data on esp32 flash.
and of course it is possible to store data in flash of the SAMD with EEPROM emulation library or directly

gdeflaux

or WiFiNINA library has storage functions, which store data on esp32 flash.
and of course it is possible to store data in flash of the SAMD with EEPROM emulation library or directly

Looking the reference page of the library, I don't seem to identify which functions are the ones to store data in the esp32 flash. Could you point out to these functions, please?
Thanks.

Juraj

Looking the reference page of the library, I don't seem to identify which functions are the ones to store data in the esp32 flash. Could you point out to these functions, please?
Thanks.
https://github.com/arduino-libraries/WiFiNINA/blob/master/src/WiFiStorage.h

gdeflaux

Awesome. I suppose this should be enough to store ssid and password of the selected network, making the provisioning workflow complete. Thanks al lot!

gdeflaux

Hi,

I've tried to use the example provided on Wifi Storage without success. Nothing seems to get written to the storage.

I've noticed that the firmware version of the library (1.4.1) is higher than the one on my Arduino Nano (1.3.0). Could that be the issue? I can't update the Nano beyond the v1.3.0 with the Arduino IDE... That's the only thing that I can think of at this point.

Any clues?

pert

I have no idea whether the firmware version is in any way related to your problem, though I do know that OTA features have been added to it in the recent releases.

If you do want 1.4.1, an easy way to get it is to install the hourly build of the Arduino IDE:
https://www.arduino.cc/en/Main/Software#hourly
It doesn't mean you need to switch permanently to using the hourly if you don't like (it's primarily intended for beta testing), but you can just use it once in order to update your firmware, then delete it if you wish.

gdeflaux

If you do want 1.4.1, an easy way to get it is to install the hourly build of the Arduino IDE:
https://www.arduino.cc/en/Main/Software#hourly
It doesn't mean you need to switch permanently to using the hourly if you don't like (it's primarily intended for beta testing), but you can just use it once in order to update your firmware, then delete it if you wish.
That did it! I was able to flash the 1.4.1 firmware on the Nano with the hourly build of the IDE and the storage function seems to work fine now. I'll work on adding the storage of credentials to the provisioning library and report back. Thanks a lot for the tip!

pert

I'm glad to hear it's working now. Thank you for taking the time to post an update. That's useful information.
Regards, Per

Juraj

That did it! I was able to flash the 1.4.1 firmware on the Nano with the hourly build of the IDE and the storage function seems to work fine now. I'll work on adding the storage of credentials to the provisioning library and report back. Thanks a lot for the tip!
the esp8266 WiFiManager can be used to add other parameters for user to set on the page, for example auth tokens for cloud services

gdeflaux

#13
Oct 27, 2020, 10:08 pm Last Edit: Oct 27, 2020, 10:09 pm by gdeflaux
Hi,

I've updated the library. The credentials storage works fine and you can now specify an auth/api key if needed (thanks @Juraj for the idea). The README is also up to date.

Hope this helps.

Cheers,

Go Up