Page 1 of 1

Wifimanager for Raspberry PI

Posted: Wed Jan 31, 2018 11:20 pm
by mc9625
Actually I've tried to start a discussion about this topic on the "network" forum, but maybe it wasn't the right place, so I try to write it here.

Here is the suggestion: I've found a very clever mechanism implemented for ESP8266 devices to let their users to easily connect to a new wireless network. It's a library called wifimanager, you could easily find it on GitHub. They way it works is rather brilliant actually.
When the ESP8266 starts it tries to connect to a wireless network with the information stored in the program code. If it doesn't succeed, it turns into AP mode, creates an open wireless network. At this point the user can easily connect to this network and through the captive portal, hosted on the ESP8266 device, he can select his home network from the ones discovered by the board, insert the correct credentials and at this point the device reboots and connect to the wifi network.

I find this behaviour very smart and convenient for an headless device, such a typical IOT project that could be implemented even with a PI ZERO W for instance.

Would it be difficult to implement such behaviour on RASPBIAN? Actually I think it's so clever that it deserves to be considered as a default mechanism for wifi set up. If a simple (relatively) device like the ESP8266 is able to do it, it should be possible for the PI.

I would really love to contact someone from the RASPBIAN development team and suggest to implement it, or discuss about this possibility.


Re: Wifimanager for Raspberry PI

Posted: Thu Feb 01, 2018 12:30 am
by PhatFil
you can do it, make a pot of coffee, stretch your googling fingers and consider that its not that tricky,

1) you need to set up a default fall back ip address for when/if the dhcp service fails to issue a license/addy (AP Server ip) ... ck_profile

2) then one way would be to run a script after startup that executes ifconfig and analyses its output for the fallback ip ( hint grep)

If it finds the fall back (AP SERVER) ip then you want it to start up a small web server to serve the AP page/pages you want ;)

so its a script to test one thing (is string1 (the AP server ip addy) contained in string2 (output from ifconfig))
and then if so execute a web server program.

have fun..
*edit this wont start it as an actual AP server, just a puter on your net with a known ip and serving some pages on port 80 .

you can use a pi as an AP and there are already many better written howto's on that subject already.. just meld the 2 solutions together..

Re: Wifimanager for Raspberry PI

Posted: Thu Feb 01, 2018 8:03 am
by mc9625
thanks PhatFil, I am not very good in linux scripting, but I will try to find a solution, but actually the real point of my Post was that such an easy process SHOULD be implemented by default in Raspbian, mainly to be used by absolute beginners (like me). I know I could easily change the wpa_supplicant file on the SD, or pass trough a wireless network on my phone for instance and so on. There are a lot of other solutions, easier for me than spending hours trying to figure out how to do it, but that's not the point.
Nowadays there are thousands of iot projects that have a PI as core, we really need a solution to make this little device really "mobile".

Re: Wifimanager for Raspberry PI

Posted: Thu Feb 01, 2018 12:03 pm
by davesteele
It's been done. Take a look at Comitup.

Re: Wifimanager for Raspberry PI

Posted: Thu Feb 01, 2018 3:36 pm
by mc9625
Dave this is exactly what I meant. Excellent. Why it can't be asked to the raspbian team to, at least, evaluate the chance to include it by default in the distro. I think that there should be some changes here and there maybe, but it would really make the first boot a lot easier for a lot of people. Thanks anyway.

Re: Wifimanager for Raspberry PI

Posted: Thu Feb 01, 2018 3:42 pm
by n67
A lot of posters on forums like this don't understand the value of having something built-in and ready-to-go. If you read the book "The Unix Haters Guide" (often referred to as UHG) (*), you will see this mindset referred to as "Well, you could do that". I.e., it is a mindset that says that whenever anyone states that it would be good if something were built-in, it gets rephrased in the mind as "I need to do X. Can you help me do X?"

The relevance of the above paragraph to this thread should be obvious.

(*) And if you haven't, you should. Note that I love Unix and have been using it for eons, but I think the book makes a lot of good points. One that a lot of posters on this forum would do well to take heed of.

Re: Wifimanager for Raspberry PI

Posted: Thu Feb 01, 2018 4:12 pm
by mc9625
I see, I know this kind of mindset. But fortunately there's still a lot of people that love to share what they have achieved. For others is only a kind of egocentric attitude. Sounds to me something like "I've done it spending hours of my life studying and spitting blood on the keyboard, and you want to steel my precious work, you bastard leech...".
But that implies that the others have done nothing with their lives and are searching only for prepared meals.
Well I've spent hours and spitted blood learning other skills for instance. And even if my IT knowledge is not strictly "vertical" none can master every branch of IT.
I would really love to have a team with a programmer, a designer, a network specialist, an engineer, a rocket scientist, and so on, but unfortunately most of the time is it only me, trying to cover all the roles, maybe because is only for a small WE project and I really can't, nor I would, learn everything to be the best designer, the super skilled developer, the master of the network protocols...

So yes, I agree with you, but this is why I keep hoping to see such clever solutions spread around and made available for everyone.

My 2 cents

P.S. I will read that book! :D