wifi and internet connection

All ESP8266 boards running MicroPython.
Official boards are the Adafruit Huzzah and Feather boards.
Target audience: MicroPython users with an ESP8266 board.
Post Reply
sscro
Posts: 2
Joined: Mon May 10, 2021 4:32 pm

wifi and internet connection

Post by sscro » Mon May 10, 2021 7:10 pm

hello there! useless to say I'm pretty new to MicroPython: my questions speak for themselves...
I set a ESP8266 D1 pro to scan and test functionality of few wifi AP's in the building.
I need to test both wifi connection and internet availability in separate way .
Basically the system works except the following:

Code: Select all

oldtime = utime.ticks_ms()
        station.active(True)
        station.connect(SSID, PW)        
        try:   
            while not station.isconnected():
                p2.off()
                lapse = utime.ticks_diff(utime.ticks_ms(), oldtime)/1000
                if lapse > 20:
                    raise Exception("niente WiFi")  
                continue
            if station.isconnected():
                lista[FLAG+1]="WIFI_SI"
                msg1="wifi connesso"
                pingo()                               
        except Exception as e: 
            msg1="niente wifi"
            lista[FLAG+1]="WIFI_NO"
            pingo()
            station.disconnect()    
            p2.on()
if I disconnect the internet cable from the AP while its wifi is active, the sta_if routine says that wifi is not available; on the other hand, sta_if.scan() shows the wifi ssid.
I'm sure I'm wrong somewhere but: where?
thanks
sauro

sscro
Posts: 2
Joined: Mon May 10, 2021 4:32 pm

Re: wifi and internet connection

Post by sscro » Wed May 12, 2021 2:25 pm

ok, I sorted it out by testing few different Access Point.
When disconnected from the main router, few of them release an IP to connect to while other don't.
So, only in the first case ESP8266 is able to establish a wifi connection.
thanks anyway to those 28 braves that kindly read my post! :D

Post Reply