WiFi station mode password

All ESP32 boards running MicroPython.
Target audience: MicroPython users with an ESP32 board.
Post Reply
OutoftheBOTS_
Posts: 847
Joined: Mon Nov 20, 2017 10:18 am

WiFi station mode password

Post by OutoftheBOTS_ » Thu Jul 14, 2022 12:13 am

I have added this line in my Wifi setup
ap.config(essid="ESP32", password="OOTB")
It sets the essid fine but doesn't require a password to connect.

Is there a way to password protect the ESP32 in station mode so that only people with the password can connect to the ESP32

davef
Posts: 811
Joined: Thu Apr 30, 2020 1:03 am
Location: Christchurch, NZ

Re: WiFi station mode password

Post by davef » Thu Jul 14, 2022 12:42 am

[quote ...]ESP32 in station mode[/quote] Think you mean AP mode. There use to be a file in the standard micropython build that when you booted the first time it asked for a password.

Maybe, this helps:

Code: Select all

https://forum.micropython.org/viewtopic.php?t=3669

User avatar
jimmo
Posts: 2754
Joined: Tue Aug 08, 2017 1:57 am
Location: Sydney, Australia
Contact:

Re: WiFi station mode password

Post by jimmo » Thu Jul 14, 2022 12:48 am

OutoftheBOTS_ wrote:
Thu Jul 14, 2022 12:13 am
It sets the essid fine but doesn't require a password to connect.
You also need to set the `security` option in ap.config to tell it which security mode to use.

Code: Select all

ap.config(essid="ESP32", password="OOTB", security=network.AUTH_WPA2_PSK)
(Note: in older firmware this was called "authmode". As of 1.19.1, both options are accepted).

See https://docs.micropython.org/en/latest/ ... LAN.config and https://docs.micropython.org/en/latest/ ... .WLAN.scan

OutoftheBOTS_
Posts: 847
Joined: Mon Nov 20, 2017 10:18 am

Re: WiFi station mode password

Post by OutoftheBOTS_ » Fri Jul 15, 2022 8:22 am

thanks

OutoftheBOTS_
Posts: 847
Joined: Mon Nov 20, 2017 10:18 am

Re: WiFi station mode password

Post by OutoftheBOTS_ » Mon Jul 18, 2022 8:12 am

jimmo wrote:
Thu Jul 14, 2022 12:48 am

Code: Select all

ap.config(essid="ESP32", password="OOTB", security=network.AUTH_WPA2_PSK)
That threw an error

Code: Select all

Traceback (most recent call last):
  File "boot.py", line 4, in <module>
ValueError: unknown config param
MicroPython v1.19.1 on 2022-06-18; ESP32 module with ESP32
Type "help()" for more information.
but this did work

Code: Select all

authmode=network.AUTH_WPA2_PSK

User avatar
jimmo
Posts: 2754
Joined: Tue Aug 08, 2017 1:57 am
Location: Sydney, Australia
Contact:

Re: WiFi station mode password

Post by jimmo » Tue Jul 19, 2022 1:28 am

OutoftheBOTS_ wrote:
Mon Jul 18, 2022 8:12 am
but this did work
Sorry, I said the wrong thing. I should have said that it's been renamed _after_ 1.19.1 (the commit was merged later in the same day).

Post Reply