Most of the devices you own can connect to Wi-Fi, but your Arduino sits on its lonesome. If you want to add Wi-Fi to Arduino projects, you can do so with an Arduino Wi-Fi module, a Wi-Fi shield, or in some cases even an Arduino board that comes with Wi-Fi built in. In this guide, we’ll show you how to wire up a Wi-Fi module and instruct it to connect to Wi-Fi.
There are several ways to add Wi-Fi to an Arduino project and depending on your needs, you might not need a separate board at all. Some Arduino boards like the Arduino Uno WiFi have Wi-Fi capabilities out of the box. However, most Arduino boards do not, so if you want to connect them to the internet, you’ll need a separate Arduino Wi-Fi module.
You can still find some Arduino Wi-fi shields around, although the product has been officially retired. Barring that, the easiest way to add Wi-Fi to Arduino projects is with an Arduino Wi-Fi module like the ESP8266. These microcontrollers can be flashed with a variety of custom firmware that give you a ton of power over how to connect to the internet.
For this guide, we’re going to keep things as simple as possible (Wi-Fi connections can get very complicated, very quickly) and simply show how to send commands to your ESP8266 that will connect it to your Wi-Fi network. This will make this guide a little different than typical Arduino guides, and we’ll learn more about the Arduino IDE and the tools it contains.
While there are many Arduino Wi-Fi projects that use a variety of methods to connect to the internet, we’re going to use an Arduino Wi-Fi module to add Wi-Fi support to a board that doesn’t already have it. As such, here’s what you’ll need:
![]() |
|
![]() |
|
![]() |
|
![]() |
|
![]() |
|
![]() |
Your ESP8266 module should come with the proper firmware already flashed to it, which will make the process of connecting it to your Wi-Fi network relatively simple. With that in mind, we’ll wire up the project first, and then discuss the commands to connect it to Wi-Fi.
For this project, we’ll be using the Arduino to communicate with the ESP8266, which means we’ll be making use of the transmitting and receiving pins to communicate with the Arduino Wi-Fi module. To hook everything up, connect these wires:
With these wires in place, your Arduino Uno will be able to pass commands from the Serial monitor in the Arduino IDE over to the ESP8266. This will let you send commands that connect it to Wi-Fi from your computer. Move on to the next section to learn more about how this works.
For this guide, we’ll be communicating with the ESP8266 directly, so instead of uploading a sketch to your Arduino, upload the default blank sketch that new Arduino files come with (or copy the code below). This will clear out any instructions you currently have running on your Arduino, so you can start fresh.
1 2 3 4 5 6 7 8 9 |
void setup() { // put your setup code here, to run once: } void loop() { // put your main code here, to run repeatedly: } |
Now, with the Arduino still connected via USB to the Arduino IDE, head to Tools > Serial monitor. Unlike past projects, this time you’ll need to change a couple of options in the window that appears. Click the dropdown that usually reads “Newline” and change it to “Both NL & CR.” Next, change the baud rate from 9,600 to 115,200. This will allow your Serial monitor to communicate directly with the ESP8266.
Now, you can test the connection to see if everything is working properly. To do this, type the following command:
1 |
AT |
In response, you should see “OK” in the Serial monitor. If you see this, you can now send any of the AT commands that the ESP8266 supports. This will allow you to manually connect the Arduino Wi-Fi module to a network.
To connect to your Wi-Fi network, use the following command:
1 |
AT+CWJAP_CUR="[ssid]","[password" |
Be sure to replace [ssid] and [password] with your own Wi-Fi network’s name and password. Once you send this command to your Arduino Wi-Fi module this way, you should see a readout in the Serial monitor that looks like this:
1 2 3 4 |
WIFI CONNECTED WIFI GOT IP OK |
Your ESP8266 is now connected to your Wi-Fi network. If you want to find out what Wi-Fi address your Arduino Wi-Fi module is now at, issue the following command:
1 |
AT+CIFSR |
This should return your device’s network IP address, as well as the MAC address for your Arduino Wi-Fi module. Try using more of the supported AT commands to extend the functionality of your Arduino Wi-Fi projects.