Arduino Forum

Products => Arduino Yún => Topic started by: ssci on Sep 20, 2013, 08:28 pm

Title: How to Disable WiFi
Post by: ssci on Sep 20, 2013, 08:28 pm
In some countries, it is prohibited to use WiFi without a government permit (certification). If you live in such country, this memo can help you.

You may think it is very easy to disable WiFi interface using the OpenWRT bare control panel LuCi.
http://arduino.local/cgi-bin/luci/admin/network/wireless

However, you will be noticed that Yun will reboot every 60 seconds if the WiFi interface is disabled. This behavior is intended by the Yun developer. You have to bypass or "fool" the WiFi detection function in Yun. This requires a small modification to the Yun's Linux part.

Here is an Arduino sketch to make such modification.
https://gist.github.com/sgk/6641198
https://gist.github.com/sgk/6641198/raw/c6c36b2c8a9d62036b11335f6515ce3c5ce03ee6/PatchYun.ino

After successfully compiling and running the sketch on Yun, just open a Serial Monitor. You will see messages like "Paching..." and "...Done.". If you see a blue LED to light without flashing, the modification is successful. The sketch does following changes.



I filed an issue for this, and I hope Yun will have this functionality in the next release.
https://github.com/arduino/linino/issues/5
Title: Re: How to Disable WiFi
Post by: federicofissore on Sep 20, 2013, 08:46 pm
Thank you Shigeru  8)
Title: Re: How to Disable WiFi
Post by: federicofissore on Sep 21, 2013, 06:44 pm
We added a note and a link to the sketch in the product page
Title: Re: How to Disable WiFi
Post by: ssci on Sep 23, 2013, 07:38 am
Thank you!
Title: Re: How to Disable WiFi
Post by: simon_schvartzman on Sep 23, 2013, 05:03 pm
Shigeru , I'm not clear as what should I do if I want to be able to switch between WiFi enabled and WiFi disabled .

In other words lets say i want the user to send a command from the console, at initialization time, to decide if the connection is going to be by Wireless (WiFi enabled) or Cable (WiFi disabled).

Many thanks in advance for your help.
Title: Re: How to Disable WiFi
Post by: federicofissore on Sep 23, 2013, 05:08 pm
Shigeru's patch is good for disabling wifi in countries where we still lack proper certification and make the patch resist a factory reset. It's not a general approach for disabling wifi.

If you want to control wifi status, take a look at this post for instructions on how to disable/re-enable it: http://forum.arduino.cc/index.php?topic=188821.msg1399080#msg1399080
Title: Re: How to Disable WiFi
Post by: simon_schvartzman on Sep 23, 2013, 05:20 pm
Federico, thanks for your prompt answer. I guess I lack enough (Linux?) experience to understand how to edit the file as suggested on the Post. Besides, is it possible to do it under program control? Could you give some guidelines as how should it be done?

Once again many thanks for your support.
Title: Re: How to Disable WiFi
Post by: federicofissore on Sep 23, 2013, 05:27 pm
Connect to you yun via SSH (using putty or ssh, depending on your OS) then issue
opkg update
opkg install nano
nano is a text editor. Issue nano /etc/rc.local and so forth
Title: Re: How to Disable WiFi
Post by: simon_schvartzman on Sep 23, 2013, 05:44 pm
Federico, per your response, as I will need to connect the Yun to another computer it is my understanding that I won't be able to do it (WiFi enable/disable) just under Yun's own control. Am I correct?

Thanks
Title: Re: How to Disable WiFi
Post by: federicofissore on Sep 23, 2013, 05:45 pm
Sorry I missed that: can you rephrase it?
Title: Re: How to Disable WiFi
Post by: simon_schvartzman on Sep 23, 2013, 06:06 pm
My whole point is that I want to be able to enable/disable the WiFi 100% under control of the Arduino sketch running on the Yun.

Hope is clear now.
Title: Re: How to Disable WiFi
Post by: federicofissore on Sep 23, 2013, 06:11 pm
I think you could issue "wifi down" (use runShellProgram). I've never used it though
Title: Re: How to Disable WiFi
Post by: simon_schvartzman on Sep 29, 2013, 12:33 am
Federico, many thanks for the Hint, I tried it and works like a charm!

        p.runShellCommand("wifi down");  //disconnect wifi to save energy

When I want to use the WiFi again is just a matter of sending:

       p.runShellCommand("wifi up");  //connect wifi before transmitting


Savings of 30 mA !!!
Title: Re: How to Disable WiFi
Post by: LoFiCase on Oct 07, 2013, 01:10 am
Hello,
The Yun is my very first in the arduino world,its been pretty fun and a great experience so far.
The unit works great but when i ran this patch I can't seem to get Wifi working anymore so the patch works a charm shutting it off.

Now after spending some time reading I realized its not a practical way of disabling it and feeling a bit embarrassed about it  :P
So here I am.I tried all 3 methods of resetting but it seems to be written to a part of (flash?) memory that dosen't get reset.

Instead of like how it was before the patch (blue wlan led flashing) it stays solid blue even after all resets and wifi don't work
and appears disabled in the logon page when using ethernet.

At first I was wanting to shut it off since I was wanting to experiment on the ethernet side, now that i done some of that was wanting to turn wifi back on to give that a go.

So my question is could some kind person make a reverse patch or a way to get wifi going again?  :smiley-roll-sweat:
Here i am breaking stuff already lol anyways I would be greatful  :)
Title: Re: How to Disable WiFi
Post by: federicofissore on Oct 09, 2013, 10:19 am
You can try replacing file /lib/firstboot/20_reset_clear_jffs with the one you can download from here
https://github.com/arduino/linino/blob/master/trunk/package/base-files/files/lib/firstboot/20_reset_clear_jffs
Then issue a factory reset (press the wlan rst button for more than 30 seconds)
Title: Re: How to Disable WiFi
Post by: LoFiCase on Oct 09, 2013, 11:44 am
Thank you! its much appreciated

cheers
Title: Re: How to Disable WiFi
Post by: armadillo66 on May 14, 2014, 12:28 am
After run the patch is imposible to go back
Title: Re: How to Disable WiFi
Post by: federicofissore on May 14, 2014, 10:00 am
@armadillo66 if you wish to go back, you can reflash the board http://arduino.cc/en/Main/Software#toc8
Title: Re: How to Disable WiFi
Post by: Fluvius on Nov 22, 2016, 05:01 pm
Very useful solution for who has to save energy and want just to use ethernet cable.
Title: Re: How to Disable WiFi
Post by: fsenftle on Feb 28, 2019, 05:39 pm
Please let me know if there's anyway to turn off the Arduino Yun WiFi.
I need to do this under the Arduino IDE with windows 7 (not LINUX).
After trying all suggestions from different posts/forums.
None worked as after 5 minutes the WiFi is enabled again.
None of these suggestions worked:
https://forum.arduino.cc/index.php?topic=189105.0
https://gist.github.com/sgk/6641198
https://gist.githubusercontent.com/sgk/6641198/raw/c6c36b2c8a9d62036b11335f6515ce3c5ce03ee6/PatchYun.ino

Please advise which forum I can ask this on, etc.
Your advise is greatly appreciated.