Wi-Fi Problems with QT Py ESP32-C3

For Adafruit customers who seek help with microcontrollers

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Post Reply
User avatar
blakejohnson86
 
Posts: 4
Joined: Thu Nov 24, 2022 3:38 pm

Wi-Fi Problems with QT Py ESP32-C3

Post by blakejohnson86 »

I'm running MicroPython, and the same code, which works on a Pico W is not working on the QT Py ESP32-C3. In my case here, I can see the APs, but I can't connect to them.

I've tried multiple versions of MicroPython, and I've tried multiple APs.
I've also tried CircutPython and using the Arduino IDE directly.

Reading this bug report ( https://github.com/espressif/arduino-esp32/issues/6430 ), it noted some people had some success with changing the transmit power, but that's not working for me either.

This bug report ( https://github.com/orgs/micropython/discussions/10524 ) is purely MicroPython based, which is also relevant to the errors I'm seeing in MicroPython.

CircutPython just bombs with "ConnectionError: Unknown failure 2"

Just about every suggestion in these issues I've tried in one way or another.

I'm pretty stuck at the moment. Any input would be appreciated.

Basic code as follows:

Arduino:

Code: Select all

void setup()
{
    Serial.begin(115200);
    while(!Serial){delay(100);}

    // We start by connecting to a WiFi network

    Serial.println();
    Serial.println("******************************************************");
    Serial.print("Connecting to ");
    Serial.println(ssid);

    WiFi.begin(ssid, password);
    WiFi.setTxPower(WIFI_POWER_8_5dBm);

    while (WiFi.status() != WL_CONNECTED) {
        delay(500);
        Serial.print(".");
    }

    Serial.println("");
    Serial.println("WiFi connected");
    Serial.println("IP address: ");
    Serial.println(WiFi.localIP());
}

MicroPython:

Code: Select all

import time
import network
import urequests
station = network.WLAN(network.STA_IF)
station.active(True)

# Network settings
wifi_ssid = "MY_SSID"
wifi_password = "MY_PASSWORD"
url = "http://wifitest.adafruit.com/testwifi/index.html"

print("Scanning for WiFi networks, please wait...")
authmodes = ['Open', 'WEP', 'WPA-PSK' 'WPA2-PSK4', 'WPA/WPA2-PSK']
for (ssid, bssid, channel, RSSI, authmode, hidden) in station.scan():
  print("* {:s}".format(ssid))
  print("   - Channel: {}".format(channel))
  print("   - RSSI: {}".format(RSSI))
  print("   - BSSID: {:02x}:{:02x}:{:02x}:{:02x}:{:02x}:{:02x}".format(*bssid))
  print()

# Continually try to connect to WiFi access point
while not station.isconnected():
    # Try to connect to WiFi access point
    print("Connecting...")
    station.connect(wifi_ssid, wifi_password)
    time.sleep(10)

# Display connection details
print("Connected!")
print("My IP Address:", station.ifconfig()[0])
CircutPython:

Code: Select all

import os
import ipaddress
import wifi
import socketpool

print()
print("Connecting to WiFi")

#  connect to your SSID
wifi.radio.connect(os.getenv('CIRCUITPY_WIFI_SSID'), os.getenv('CIRCUITPY_WIFI_PASSWORD'))

print("Connected to WiFi")

pool = socketpool.SocketPool(wifi.radio)

#  prints MAC address to REPL
print("My MAC addr:", [hex(i) for i in wifi.radio.mac_address])

#  prints IP address to REPL
print("My IP address is", wifi.radio.ipv4_address)

#  pings Google
ipv4 = ipaddress.ip_address("8.8.4.4")
print("Ping google.com: %f ms" % (wifi.radio.ping(ipv4)*1000))

User avatar
mikeysklar
 
Posts: 12454
Joined: Mon Aug 01, 2016 8:10 pm

Re: Wi-Fi Problems with QT Py ESP32-C3

Post by mikeysklar »

Can you try the static buffer recommendation from the arduino-esp32 issue #6430 which seems to be working for people.
@SuGlider Ok, so, calling WiFi.mode(WIFI_STA) after WiFi.useStaticBuffers(true) and before WiFi.begin(...) seems to be repeatedly working for the WiFiClientSecure sketch.

User avatar
blakejohnson86
 
Posts: 4
Joined: Thu Nov 24, 2022 3:38 pm

Re: Wi-Fi Problems with QT Py ESP32-C3

Post by blakejohnson86 »

Thank you, but unfortunately, that does not help. It just does the same thing it's been doing.

Code: Select all

void setup()
{
    Serial.begin(115200);
    while(!Serial){delay(100);}

    // We start by connecting to a WiFi network

    Serial.println();
    Serial.println("******************************************************");
    Serial.print("Connecting to ");
    Serial.println(ssid);

    WiFi.useStaticBuffers(true);
    WiFi.mode(WIFI_STA);
    WiFi.begin(ssid, password);

    while (WiFi.status() != WL_CONNECTED) {
        delay(500);
        Serial.print(".");
    }

    Serial.println("");
    Serial.println("WiFi connected");
    Serial.println("IP address: ");
    Serial.println(WiFi.localIP());
}

Code: Select all

******************************************************
Connecting to <NETWORK>
..............................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................******************************************************

User avatar
mikeysklar
 
Posts: 12454
Joined: Mon Aug 01, 2016 8:10 pm

Re: Wi-Fi Problems with QT Py ESP32-C3

Post by mikeysklar »

Thank you for trying that.

What is the AP you are connecting to?

It might be necessary to swap this C3 for a S2 or S3 model. Would you be amenable to that?

User avatar
blakejohnson86
 
Posts: 4
Joined: Thu Nov 24, 2022 3:38 pm

Re: Wi-Fi Problems with QT Py ESP32-C3

Post by blakejohnson86 »

I have a ESP32-S3 and that works fine. It's only this ESP32-C3 model which does not.

I've tried Ubiquiti APs and Android hotspots. WPA2 / WPA2+WPA3.

Swapping would be fine, as I have no attachment to a chip that does not function as it should.

User avatar
mikeysklar
 
Posts: 12454
Joined: Mon Aug 01, 2016 8:10 pm

Re: Wi-Fi Problems with QT Py ESP32-C3

Post by mikeysklar »

Since your ESP32-S3 is working fine I would recommend taking up the replacement or refund option. You can e-mail [email protected] with your order# to start that process. They will need a link to this forum thread.

On last thing you can check on the AP. The Ubiquiti Unify 6 has a minimum data rate setting that needs to be set.
unchecked the "enable minimum data rate control" found in the Unifi Controller Settings--> Wireless Networks --> 'network name' --> 802.11 RATE AND BEACON CONTROLS

User avatar
blakejohnson86
 
Posts: 4
Joined: Thu Nov 24, 2022 3:38 pm

Re: Wi-Fi Problems with QT Py ESP32-C3

Post by blakejohnson86 »

You can e-mail [email protected] with your order# to start that process.
Does this option exist if I bought it from Microcenter?

Regarding the Ubiquiti question, it's also a problem when tethering to an Android AP. But, that said, "Minimum Data Rate Control" option appears to not be an issue in this case.

User avatar
mikeysklar
 
Posts: 12454
Joined: Mon Aug 01, 2016 8:10 pm

Re: Wi-Fi Problems with QT Py ESP32-C3

Post by mikeysklar »

Just a minor correction. The minimum data rate needs to be "unset" on the Ubiquiti routers.

I find the Ad-hoc APs to be problematic in their own ways. The ESP32-C3 has been a tricky one to pin down why it does not play well with all APs.

Please contact [email protected] and include the Microcenter question. I'm not 100% sure in this case, but if it is something could be a design issue Adafruit handles the returns in house.

Post Reply
Please be positive and constructive with your questions and comments.

Return to “Microcontrollers”