hello everyone,
i have a project (my first with an esp32 and a Raspberry Pi).
the goal is to detect noise thresholds via a Micro electret. Then send this information via http.
But first I would have to connect my esp 32 to the raspberry pi 5 access point, but with the wifi.h library, when I put the wifi status after trying to connect to the wifi for 10 seconds, I find the code 6.
however when I connect my phone to the raspberry network it works, and when I put my phone in connection sharing and I connect my esp 32 to it in the same way it works too.
6 is means disconnected.
Maybe the connecting process takes more than 10 seconds.
Try the “standard” wifi connection code and check the serial monitor:
#include <Arduino.h>
#include <WiFi.h>
const char* WIFI_SSID = "YOUR_WIFI_SSID";
const char* WIFI_PASS = "YOUR_WIFI_PASS";
void setupWiFi() {
Serial.print("Connecting Wifi");
WiFi.begin(WIFI_SSID, WIFI_PASS);
while (WiFi.status() != WL_CONNECTED) {
Serial.print(".");
delay(100);
}
Serial.println("connected");
Serial.print("IP: ");
Serial.println(WiFi.localIP());
}
void setup() {
Serial.begin(115200);
setupWiFi();
}
void loop() {
}
You said your raspberry runs as an access point.
Isn’t the raspberry connected to your wifi network?
No, my Raspberry is not connected to the wifi network. and yes it is a code like this that I tested. I think the problem must come from an incompatibility between the wifi of my raspberry and the esp 32, I do not know …
Keep in mind that the ESP32 only has 2.4 GHz WiFi.
Try the WiFiScan example and take look if the ESP32 can see your raspi AP.
Thanks for this exaample, so yes the ESP32 can see my AP.
and yes I took this constraint into account, my AP is indeed in 2.4GHz
Enable logging and check the output in the serial monitor:
build_flags = -DCORE_DEBUG_LEVEL=5
UPDATE :
It finally worked, honestly, I can’t really say why. In my case, the last thing I did was remove the password (WPA0). I’ll test later to see if it still works with WPA2, since I don’t really need it. But yeah, I’m a bit puzzled as to why it suddenly worked, especially since I had already tried WPA0 before.
I’m glad you solved it!
I remember if there is a passrphase it must be at least 8 characters long. Maybe your’s was too short?
Oh, I didn’t know that, but no, it was exactly 8 characters, so I don’t think that’s the issue. Thank you very much anyway!