Difference: InternetAccess (5 vs. 6)

Revision 62020-06-04 - UliRaich

Line: 1 to 1
 
META TOPICPARENT name="WebHome"

Internet access

Once we have collected data from the sensors we want to get access to them. This can be accomplished most easily by transferring the data over the Internet. Most of the time we also want to plot the data in some form or another. Often it is also desired to see real time data.

WiFi

Changed:
<
<
Before doing anything on the Internet we must first connect the ESP32 to the WiFi network. The module:
>
>
The WeMos D1 mini ESP32 CPU board offers WiFi access implementing a TCP/IP and full 802.11 b/g/n Wi-Fi MAC protocol (see the ESP32 data sheet) and the ESP32 port of MicroPython offers a network module with the necessary access functions.

Before looking into the WEB server we must first make sure we have Internet access through WiFi.The following screen dump shows an interactive MicroPython session where WiFi access is granted:

wifi_connect.jpg

All you need to do is putting in the correct ssid for your WiFi network and the corresponding password. Of course you do not want to type all this each time you connect to your network and for this reason a wifi_connect.py module is already included in your MicroPython binary.

  https://afnog.iotworkshop.africa/pub/IoT_Course_English/InternetAccess/wifi_connect_public.py.txt
Changed:
<
<
provides all necessary functions to do this. It first connects to WiFi as a station interface and print the IP address it is connected to. If it is already connected it simply returns. Once connected it gets the current time from the NTP time server and sets up the ESP32 real time clock. You can get the current GMT time with gmtTime() or CET time with cetTime(). The module is already included in the MicroPython binary.
>
>
provides all necessary functions to do this. It first connects to WiFi as a station interface and prints the IP address it is connected to. If it is already connected it simply returns. Once connected it gets the current time from the NTP time server and sets up the ESP32 real time clock. You can get the current GMT time with gmtTime() or CET time with cetTime(). The module is already included in the MicroPython binary.
  wifi_connect.png
Line: 19 to 25
  Since I cannot know the SSID and password of your WiFi network, connect() will only work for my private network. You can however pass your SSID and password as parameters:
connect(ssid="YourSSID",password="YourWiFiPasswword")

Changed:
<
<
You can get the IP address allocate with
>
>
You get the IP address allocate with
  getIPAddress().

An FTP server

Line: 42 to 48
 
META FILEATTACHMENT attachment="wifi_connect.png" attr="" comment="" date="1588844762" name="wifi_connect.png" path="wifi_connect.png" size="31594" user="UliRaich" version="1"
META FILEATTACHMENT attachment="dateString.png" attr="" comment="" date="1591014614" name="dateString.png" path="dateString.png" size="21043" user="UliRaich" version="1"
META FILEATTACHMENT attachment="wifi_connect_public.py.txt" attr="" comment="" date="1591035847" name="wifi_connect_public.py.txt" path="wifi_connect_public.py.txt" size="3254" user="UliRaich" version="2"
Added:
>
>
META FILEATTACHMENT attachment="wifi_connect.jpg" attr="" comment="" date="1591258916" name="wifi_connect.jpg" path="wifi_connect.jpg" size="107973" user="UliRaich" version="1"
 
This site is powered by the TWiki collaboration platform Powered by PerlCopyright © 2008-2024 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback