orchardaudio
Posts: 97
Joined: Wed Feb 03, 2016 11:19 pm
Contact: Website Facebook Twitter

How to permanently set wifi power

Sun Apr 21, 2019 7:34 pm

Hello,

I am using the Rpi's built in wifi.

I am using the following command:

Code: Select all

sudo iwconfig wlan0 txpower 10
Then I run:

Code: Select all

sudo iwconfig
and see the following:

Code: Select all

Mode:Managed  Frequency:2.452 GHz  Access Point: 9C:3D:CF:EA:70:7F
Bit Rate=52 Mb/s   Tx-Power=10 dBm...
This is telling me that power setting is working and I also see a reduction in the bit rate.

After a reboot or power down the power returns to 31dBm, is there a way to set the power to 10dBm permentantly so that the setting survives reboots and power downs?

Thanks;
Leo
~~Orchard Audio~~
How do you like them apples?
www.orchardaudio.com
www.facebook.com/orchardaudio

Andyroo
Posts: 2952
Joined: Sat Jun 16, 2018 12:49 am
Location: Lincs U.K.

Re: How to permanently set wifi power

Sun Apr 21, 2019 9:07 pm

The Pi has very very little memory that survives a reboot - all that has been released is documented here - but to save your time only 8 of the 66 32-byte words have documentation and WiFi power is not one of them and everything else comes off the boot media.

The best bet is to create a simple Bash script and call it from Cron on reboot.
Need Pi spray - these things are breeding in my house...

orchardaudio
Posts: 97
Joined: Wed Feb 03, 2016 11:19 pm
Contact: Website Facebook Twitter

Re: How to permanently set wifi power

Sun Apr 21, 2019 9:17 pm

Andyroo wrote:
Sun Apr 21, 2019 9:07 pm
The Pi has very very little memory that survives a reboot - all that has been released is documented here - but to save your time only 8 of the 66 32-byte words have documentation and WiFi power is not one of them and everything else comes off the boot media.

The best bet is to create a simple Bash script and call it from Cron on reboot.
How do I make the script that runs at bootup?
~~Orchard Audio~~
How do you like them apples?
www.orchardaudio.com
www.facebook.com/orchardaudio

epoch1970
Posts: 2805
Joined: Thu May 05, 2016 9:33 am
Location: Paris, France

Re: How to permanently set wifi power

Sun Apr 21, 2019 9:31 pm

orchardaudio wrote:
Sun Apr 21, 2019 9:17 pm
How do I make the script that runs at bootup?
Add “iwconfig wlan0 txpower 10” (no quotes, no sudo in front) to /etc/rc.local
This is a system provided shell script that is executed at boot and can run simple tasks.
"S'il n'y a pas de solution, c'est qu'il n'y a pas de problème." Les Shadoks, J. Rouxel

Andyroo
Posts: 2952
Joined: Sat Jun 16, 2018 12:49 am
Location: Lincs U.K.

Re: How to permanently set wifi power

Sun Apr 21, 2019 9:38 pm

You could also edit cron entries. Start the editor with

Code: Select all

crontab -e
I use nano as thats the simplest to use

Add a line along the lines of

Code: Select all

@reboot /home/pi/wifilow.sh &
Have a look at https://www.raspberrypi.org/documentati ... ge/cron.md for a quick guide.

Chapter 11 of this PDF has lots of start and stop bits. If you find it handy please buy a paperback copy to support the foundation :D
Need Pi spray - these things are breeding in my house...

orchardaudio
Posts: 97
Joined: Wed Feb 03, 2016 11:19 pm
Contact: Website Facebook Twitter

Re: How to permanently set wifi power

Mon Apr 22, 2019 10:36 pm

epoch1970 wrote:
Sun Apr 21, 2019 9:31 pm
Add “iwconfig wlan0 txpower 10” (no quotes, no sudo in front) to /etc/rc.local
This is a system provided shell script that is executed at boot and can run simple tasks.

I had edited the rc.local file it with

Code: Select all

sudo iwconfig wlan0 txpower 10
It is working are you sure you don't need sudo at the front of it for the rc.local file?
~~Orchard Audio~~
How do you like them apples?
www.orchardaudio.com
www.facebook.com/orchardaudio

epoch1970
Posts: 2805
Joined: Thu May 05, 2016 9:33 am
Location: Paris, France

Re: How to permanently set wifi power

Mon Apr 22, 2019 10:58 pm

Sure.
"S'il n'y a pas de solution, c'est qu'il n'y a pas de problème." Les Shadoks, J. Rouxel

Return to “Advanced users”