-->
Page 1 of 2

Change Wifi standard b/g/n to make the most output power

PostPosted: Wed Sep 20, 2017 5:33 pm
by MrMU
In the datasheet for the ESP8266 (0a-esp8266ex_datasheet_en.pdf) I see that by changing the WIFI standard between b/g/n the output power is changed.

The speed of transmission is not my first concern, but I want to extend the range.

So these figures out of the datasheet tells me that if I change the standard to B, I will get the most power.

Tx Power
802.11 b: +20 dBm
802.11 g: +17 dBm
802.11 n: +14 dBm
Rx Sensitivity
802.11 b: -91 dbm (11 Mbps)
802.11 g: -75 dbm (54 Mbps)
802.11 n: -72 dbm (MCS7)


Can I change these settings in the Arduino sketch?

Re: Change Wifi standard b/g/n to make the most output power

PostPosted: Wed Sep 20, 2017 9:09 pm
by rudy
Put this at the top of the sketch.

extern "C" {
#include "user_interface.h"
}

Then this to change the setting, typically in setup but it depends on what you are doing.

wifi_set_phy_mode(PHY_MODE_11B)

Let us know how you make out. I'm also often interested in greater range over speed. While what you posted sure makes it look like B is a winner, N is typically claimed to have greater range.

Code: Select allName            Speed    Indoor Range
Wireless AC      1 Gbps      115 Feet
Wireless N     300 Mbps      230 Feet
Wireless G      54 Mbps      125 Feet
Wireless B      11 Mbps      115 Feet

Re: Change Wifi standard b/g/n to make the most output power

PostPosted: Thu Sep 21, 2017 11:53 am
by MrMU
rudy wrote:Put this at the top of the sketch.

extern "C" {
#include "user_interface.h"
}

Then this to change the setting, typically in setup but it depends on what you are doing.

wifi_set_phy_mode(PHY_MODE_11B)

Let us know how you make out. I'm also often interested in greater range over speed. While what you posted sure makes it look like B is a winner, N is typically claimed to have greater range.

Code: Select allName            Speed    Indoor Range
Wireless AC      1 Gbps      115 Feet
Wireless N     300 Mbps      230 Feet
Wireless G      54 Mbps      125 Feet
Wireless B      11 Mbps      115 Feet


Thank you!!
If I do this:

Code: Select all#include <DHT.h>
#include <DHT_U.h>

#include <ESP8266WiFi.h>
#include "espipswitchtoggle.h"

extern "C" {
#include "user_interface.h"
}

const char* ssid = "MySSID";
const char* password = "Mypasssssss";

// Create an instance of the server
// specify the port to listen on as an argument
WiFiServer server(80);


unsigned long timer = 0;
unsigned long firstMillis = 0;
void setup() {
  Serial.begin(115200);
  delay(10);
  pinMode(0, OUTPUT);
  pinMode(2,INPUT);
  pinMode(2, INPUT_PULLUP);
 
 
  // Connect to WiFi network
  Serial.println();
  Serial.println();
  Serial.print("Connecting to ");
  Serial.println(ssid);

  WiFi.softAP(ssid, password);
  IPAddress myIP = WiFi.softAPIP();
  Serial.print("AP IP address: ");
  Serial.println(myIP);
 

 
 
 
  while (WiFi.status() != WL_CONNECTED) {
    delay(500);
    Serial.print(".");
   
  }
  Serial.println("");
  Serial.println("WiFi connected");
 
  // Start the server
  server.begin();
  Serial.println("Server started");

  // Print the IP address
  Serial.println(WiFi.localIP());

  WIFI_set_phy_mode(PHY_MODE_11B);
}

void loop() {


I get this error during compiling:

exit status 1
'WIFI_set_phy_mode' was not declared in this scope

Re: Change Wifi standard b/g/n to make the most output power

PostPosted: Thu Sep 21, 2017 12:57 pm
by rudy
Instead use the following and don't add the include at the top. Also I would think you would want to call this before you connect to your router.

WiFi.setPhyMode(WIFI_PHY_MODE_11B);