Network coverage
Summary
Lolin D1 Mini Pro has wireless networking support with the ESP8266 built-in module. It can also act as a WiFi Access Point to which you can connect to communicate with the board, but you can't connect to the Internet through that.
Requirements
- 1 x LOLIN D1 MINI PRO board
- 1 x Micro USB
- Wireless Network
Connect to an existing wireless network
Connect your board to your computer
This step should be easy if you completed the first tutorial.
-
Connect the one end of your micro usb on your board and the other end to your computer.
-
Open PuTTY and select Serial connection type.
-
Use the appropriate Serial Line COM5 (same you did on Tutorial 1, if you don't remember it you can find it through device manager) and speed 115200 and click open.
Connect to the WiFi
Now you should be looking at the PuTTY terminal.
-
Use the following commands to connect your board to your existing wireless network through WiFi. As network name use your WiFi SSID and at password your WiFi password key.
1 2 3 4 5 6
import network sta = network.WLAN(network.STA_IF) sta.active(True) // to activate WiFi connection print(sta.scan()) // to print the available WiFi networks sta.connect("your-network-name", "your-password") sta.active(False) // to disconnect your board from the WiFi. if you want to connect again enter the previous commands
-
Once the board is connected to the network, it will remember it and connect to it every time. To get details about connecting, use
1 2 3
sta.isconnected() // to check if the connection is established (True or False) sta.ifconfig() // check the network settings (IP address, netmask, gateway, DNS) sta.status() // check status
NOTE: If you are doing copy & paste you must use the mouse right click. I would suggest typing the code by yourself to avoid any problems and for practice.
Configure your board as a WiFi access point
You can create a WiFi Access Point where you can connect through your smartphone and communicate with the board. Take in mind that the board has an access point activated on its own before you even set one.
- To configure it as an access point, run this code(use your own name and password)
1 2 3 4 5
import network ap = network.WLAN(network.AP_IF) ap.active(True) // to activate access point connection ap.config(essid="MyAP", authmode=network.AUTH_WPA_WPA2_PSK, password="12345678") // Bare in mind that you password must be more than 7 characters, otherwise the access point will not work ap.active(False) // to disable the access-point
This is the end of Tutorial 3, you should now be able to connect your board to the WiFi and use it as a WiFi Access Point.