The objective of this post is to explain how to connect to an access point using a WiFi Bee board and the pre-loaded firmware that supports AT commands.
The objective of this post is to explain how to connect to an access point using a ESP8266 WiFi Bee board and the pre-loaded firmware that supports AT commands. We will use the Arduino IDE serial monitor to interact with the module. You can check this previous post (ESP8266 WiFi Bee: Testing AT commands) for an introduction to using the AT Commands.
Interaction with the module
After connecting the WiFi Bee and opening the serial monitor, we should have it ready to receive the commands. But, just to confirm, we will first send an AT command. As indicated in figure 1, the output should be OK.
Figure 1 – Output of the AT command.
Next, we will list the available access points, to confirm that the one to which we want to connect is being detected by the WiFi Bee. To do so, send the AT+CWLAP command. You should get an output similar to figure 2, where the APs and some additional information (encryption type, MAC and channel) are shown.
Figure 2 – List of available Access Points and additional information.
So, if your WiFi network is listed, you should be able to connect to it. To connect to a WiFi network, use the following command, replacing the string between quotes with your network credentials: AT+CWJAP=”yourNetworkName”,”yourNetworkPassword” If everything works fine, you should get an OK answer, as indicated in figure 3.
Figure 3 – Connection to an Access Point, using AT commands.
To confirm that we are connected, we will now get the IP of the ESP8266 on the WiFi network. To do so, we just need to send the AT+CIFSR command. As indicated in figure 4, it returns not only the IP address of the device on the network, but also its MAC address.
Figure 4 – Output of the command to get the IP of the ESP8266 on the network.
Finally, we will disconnect from the AP using the AT+CWQAP command. As indicated in figure 5, this command returns OK on success. Also, if we try to get the IP address again, the device will no longer have a valid one assigned.
Figure 5 – Disconnecting from the WiFi network with an AT command.