It seems to me that humidity is getting high in one room in the basement in my house. To monitor the situation temporarily, I would like to build a very small wifi-mesh network to exchange these humidity data to a locally installed raspberry pie server. Most of the time the networking would be in idle state, every some 5 minutes sending the humidity sensor data over mqtt to the server.
What is the simplest code that sets up an esp8266 to connect to an existing wifi network and act as an access point and wifi extender a couple of yards further?
I tried this code:
#include <ESP8266WiFi.h>
#include <ESP8266WebServer.h>
const char* ssid = "SSID_Internet";
const char* password = "qaz12345";
const char* newssid = "SSID_Extender";
const char* newpassword = "qaz12345";
void setup(void){
Serial.begin(115200);
Serial.println("");
// set both access point and station
WiFi.mode(WIFI_AP_STA);
WiFi.softAP(newssid, newpassword);
Serial.print(newssid);
Serial.print(" server ip: ");
Serial.println(WiFi.softAPIP());
WiFi.begin(ssid, password);
int wifi_it = 0;
int wifi_status;
while ((wifi_status = WiFi.status()) != WL_CONNECTED) {
Serial.println("Trying to connect to wifi");
wifi_it++;
delay(500);
}
Serial.println("");
Serial.println("WiFi connected");
Serial.println("IP address: ");
Serial.println(WiFi.localIP());
long rssi = WiFi.RSSI();
Serial.print("Signal strength: ");
Serial.print(rssi);
Serial.println("dBm");
}
void loop(void){
}
It successfully registers the esp8266 to the wifi, sets up an AP, but if I connect to SID_Extender with my mobile phone, the internet traffic is not forwarded further.
There are projects that allows to configure multiple esps in user friendly manner, but I am wondering how to setup such an esp myself.