Why for example would you NOT want the Wi-Fi to reconnect on failure? What is the point? Yet, that does seem to be the default scenario, particularly odd when it comes to the Pi Zero – which has no option BUT to use WIFI.
I generally attach Raspberry Pi devices to the Internet via a hardwired Ethernet as connectivity is very important to me – not much point in having a super-duper setup miles away only to discover you can no longer talk to it, right?
Yet that is EXACTLY the scenario people will no doubt stumble onto when getting their new spiffy Pi Zero – I’m not going to say low cost because by the time you realise you need a USB hub and WIFI adaptor the price suddenly shoots up towards the cost of competing devices.
However, having had my Pi Zero sitting on the shelf for some time and having now received more than one WIFI dongle (including one with a decent external aerial) I thought I’d give it a go. The little number you see here on the right was £2.59 from Hong Kong and is in keeping with the low cost of the Pi Zero. I also spent £5.59 in the UK on a cheap powered USB hub because article after article suggested that running the WIFI without a hub was not a good idea (since verified and further backs up my doubts about the benefit of having a Pi Zero in the first place).
So I took an old-fashioned Pi B and set that up with Wi-Fi (without the hub) – copied the FLASH from its rather large original SD to a micro SD and plugged it into the Pi Zero. Plugged in the cheap USB powered adaptor – plugged the WIFI dongle into that and applied power.
Worked a treat. Lovely. Tried without the hub, no joy. But of course this is when people normally stop only to discover often days or weeks later that this is NOT a good enough solution. I did note that very occasionally the Pi Zero would reset – the cause of this was a very long, thin USB power lead – funny that this never had been a problem with the Pi2 – but shortening the lead very definitely solved the problem.
So with everything working, To test reliability, I simply pulled the Wi-Fi dongle out – and put it back in. The Wi-Fi was DEAD. After 5 minutes still no connection. So I rebooted the Pi and back came the connection. The next test was to pull the power to the router (does anyone REALLY live in a place where none of this EVER goes wrong?). Router back on – waited 5 minutes and… sure enough – absolutely NO Wi-Fi.
I started to scour the web – BOY are there some convoluted solutions out there – one might suggest some were written by sadists. Come on guys – this is a tool, not life itself – something SIMPLE is needed.
And so it was I stumbled onto this page.
Here’s the important bit – no new files. I was talking to the Pi via winSCP and of course as Pi user you don’t have permission to wipe your nose so I made a slight mod to the Pi connection – in winSCP, under advanced, SFTP I put “sudo /usr/lib/sftp-server” into the SFTP SERVER panel – and reconnected – this gave me elevated control to actually let me edit files without needing a degree in Linux using one of the many awful command line editors therein.
As per the link above..
In /etc/network/interfaces I put:
iface wlan0 inet manual
iface default inet dhcp
I saved that and rebooted – all was ok. I pulled the WIFI dongle out – winSCP griped. I plugged it back in, 1 minute later, winSCP reconnected automatically. I turned off the router – winSCP griped. I turn the router back on – just over a minute later, winSCP reconnected automatically.
Now why isn’t that the default setting?
For my next trick – in Debian Jessie and with the graphical interface set up, I tried swapping routers – I have 3 access points as my home has lots of thick walls. I swapped from one to the other and was asked for a password. Ok, fair enough. But then when swapping back to the original, I was asked for the password again. WHAT?? I’d already given it the password, why would it want it again?
Well it turns out that all is ok as the graphical interface had actually saved both settings in /etc/wpa_supplicant/wpa_supplicant.conf
I’ve obviously altered my two SSIDs and passwords. I guess you could put as many of these as you like in here manually.
Lovely. It really is worth asking however, is it really worth the saving of having a Zero when it needs a USB lead and hub for it to be of any use, not needed with a P2 which is also faster.. or one of the alternatives out there. There is also no 3.5mm jack for audio on the Pi Zero.
Still at least I can now use this for something…
IanChilton on Twitter just sent me this link – which I have to say on the surface of it is pretty damned interesting for the Pi Zero – any thoughts on this? The price is stunning and it would seem to be JUST what the Pi Zero needs? Does not seem to come with a power adaptor – but it does have a little hole for one in the back!
So.. do we actually NEED to use WiFi in the ZERO or is this a viable and practical alternative?
By the way if you see that 4 port USB hub I photographed above on Ebay – avoid it – we were sitting watching TV tonight when the little plug-in-the-wall power supply that came with it – blew up!!