How to connect to WiFi without hardcoding the credentials in Espruino Pico? #4403
Replies: 1 comment
-
Posted at 2017-03-22 by @gfwilliams Hi, What I'd suggest is that soon after power-on you detect if the button is pressed, and if it is you put the WiFi module into access point mode with You can then create a webserver which serves up a page where the wifi credentials are entered - and you can store those credentials using Then, when you boot up without the button pressed, read credentials using Either that, or if this is a toy and it needs controlling (but not an internet connection) you could just always make it create its own access point rather than connecting to another network? Posted at 2017-03-22 by sureshkm Got it! Thank you so much :) Posted at 2017-03-22 by sureshkm oh.. i see an 'erase' method in the 'FlashEEPROM' object. I think, i will delete the content once used. Posted at 2017-03-22 by @gfwilliams You could just store the Wifi credentials in RAM so that they are lost on power-off if that is a real concern? However I imagine the vast majority of consumer electronics will store your WiFi details in plain text :) Posted at 2017-03-22 by sureshkm You are right. We should be careful :) I could run a HTTP server, but is it possible for me to run a HTTPS server? Posted at 2017-03-22 by @gfwilliams I don't think it is possible at the moment. However, if you're connecting over a WEP access point the ESP8266 has created, that is itself encrypted so I think the chances of snooping are pretty much zero. Posted at 2017-03-22 by sureshkm Sure. Thank you! I'm giving a try now. Posted at 2017-03-23 by sureshkm @gfwilliams I'm able to store the credentials in the FlashEEPROM, but i lose the data as i reboot. I can get the expected value from the left side panel but not in my code that is on the right side of IDE. Is it non-volatile or volatile memory? Posted at 2017-03-23 by @gfwilliams FlashEEPROM should definitely be non-volatile. Just try some simple code:
then reboot and try to read it:
Posted at 2017-03-23 by sureshkm Thank you! @gfwilliams I had the following defensive code that caused the issue. It does not work because 'f.read(0) ' is a typed array and condition failed to assign a value.
This works perfectly fine
|
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Posted at 2017-03-22 by sureshkm
Hi @gfwilliams and friends,
I've a Toy that has Espruino Pico with ESP8266 WiFi module. I could connect to the WiFi by hard coding the SSID & PWD. But i would like to present this Toy to a few of my friends. How would i make sure the WiFi connection can be done more user friendly way ? That means my friends can't hard code the credentials. Please suggest me how can this be done? Thank you!
Beta Was this translation helpful? Give feedback.
All reactions