alfkoehn / CO2_monitor

An open-source CO2 monitor helping to ensure a healthy environment in a class room and slowing down the spread of the corona SARS-CoV-2 virus.
https://github.com/alfkoehn/CO2_monitor
43 stars 8 forks source link

must wifi be "nailed" to station mode? #3

Closed ber-red closed 3 years ago

ber-red commented 3 years ago

When i used your .ino, my esp board connected to my WLAN correctly but showed up as Access point "ESP-nnnnnn" as well. (to be more specific: i was able to connect to that WLAN without password, port scan shows port 80 open then, but my browser only shows a blank page).

So i started reading some docs. Station Class documentation says "Switching the module to Station mode is done with begin function"

This corrosponds with your code WiFi.begin() but later the doc says ... "... It is possible that calling begin will result in the module being in STA + softAP mode if the module was previously placed into AP mode."

I assume this is the effect i ran into (board was brand-new, never used it before). reading this i added an additional line

WiFi.mode(WIFI_STA)

After compiling and installing this i do not see the ESP-nnnnnn Access point anymore.

As i am not very familiar with coding nor am i sure if this is a general issue or just an "Einzelfall" and my "solution" ist correct, please have a look at it and let me know. (I did not try out if the AP reappears if i remove the WiFi.mode(WIFI_STA) line later, just left it in my .ino file)

PS: I like your CO2 project very much - was a starting point to get into coding and IOT as well and look forward to your chart.js snippets

alfkoehn commented 3 years ago

Well spotted, thanks again for your feedback!

Being new to Arduino, I have just learned that one should do as you suggested (explicitly setting the esp8266 to be a wifi client), and I have already used that in another project, but completely forgotten to include it here, will do so now! Thanks :)