Configuring the TP-LINK TL-WR702N nano router for Arduino

2015-02-07 Update: Added default WiFi password.

The two most-viewed pages on this site are often the following to Arduino articles:

The first one deals with a bug (?) I found in in the Arduino Ethernet library that prevented it from properly handling multiple incoming connections to the same port. The second was sharing my discovery of the $20 TP-LINK TL-WR702N nano router. It seems I am not the only one not happy that Arduino WiFi shields can be as much as $90, while cheap ethernet shields can be found for around $10.

The TP-LINK can be configured to connect to a WiFi network and then plug in to an Ethernet-only device and link it to the WiFi. Folks use them to get Ethernet printers on WiFi (such as the Lexmark printer I have — the official Ethernet module for it is $50, but I can use this TP-Link and be wireless printing for $20). I use one to get my Arduino on WiFi. Note that the Arduino will not have any control over the WiFi connection and won’t be able to select WiFi

This article is a quick guide to getting the TP-LINK set up for use with the Arduino.

TP-LINK TL-WR702N nano router box.

TP-LINK TL-WR702N nano router box, pictured next to a pen for scale.

1. Buy the TP-LINK WR702N. I got mine from Amazon for $19.99. It comes in a tiny box and is packed almost as nicely as an Apple product.

Inside the box you will find the tiny router (about 2″x2″x.5″), a micro USB cable, an Ethernet cable, and a USB power supply. There is also a mini-CD and a few small quick start guides. The guides are put together very well and have plenty of photos.

On the back of the TP-LINK unit will be the MAC address, but unless you have multiple units, you won’t need to know this.

2. Power up the TP-LINK by either plugging it up with the USB micro cable to a USB port (on your computer or a hub), or via the power supply.

3. The unit will boot up and after a few moments a new wireless network will appear that starts with “TP-LINK_xxxxxx” with the last part being the end of the MAC address of the router. Connect your computer to it. You will be prompted for a WiFi password, which you will find under the tiny barcode on the back of the unit. (It will be the last 8 HEX digits of the Mac address.) Give it a few more moments to connect and get an IP address. (Make sure you aren’t getting an internet connection some other way, like Ethernet. There are also ways to configure this router via Ethernet, but you’ll have to check TL-LINK guides for that.)

4. Open a web browser and go to: tplinklogin.net  It should prompt you for a username and password. You will find these on the back of the router, but they should be admin and admin.

TP-LINK WR702N login

Enter “admin” for the username and “admin” for the password.

5. You should see an admin webpage that is coming from your router. The first thing we need to do is configure the router to connect to your WiFi access point and connect to the internet. Click on Quick Setup under Basic Settings and click Next.

TP-LINK WR702N quick setup

Select Quick Setup.

6. The first screen is to select the Working Mode. We want Client, so choose it then click Next.

TP-LINK WR702N working mode

Select Client mode.

6. Next we will do Wireless Client setup and choose which WiFi network this nano should connect to. You can manually type it all in, but it’s easier to just click the Survey button so it scans for networks that are available. From that list, select your own WiFi network and then you will have an easy spot to enter your WiFi network password.

TP-LINK WR702N wireless client

Click the Survey button to obtain a list of available WiFi networks.

TP-LINK WR702N survey

Select your WiFi network from the list.

TP-LINK WR702N wifi password

Enter the password to your WiFi network.

7. The unit will then reboot and attempt to connect to your WiFi network. When it does, it will begin passing the WiFi connection out to the Ethernet port. To test this, turn off WiFi on your computer, and plug it up to the TP-LINK nano router via the included Ethernet cable. You will need to configure your computer’s Ethernet connection for DHCP. If it is working, after a few moments you will get an IP address assigned to your computer by the nano. Once the connection is made, you can test by going to Google.com or a known-working site.

8. Once you know it’s working, you should update the firmware on the nano to the latest. You can download the firmware here:

http://www.tp-link.us/support/download/?model=TL-WR702N&version=V1

Look for the latest version. It should look something like this:

TP-LINK WR702N firmware

Look for the latest version of the firmware for the TP-LINK TL-WR702N on the TP-LINK website.

Download this .zip file, then extract it somewhere you will be able to find it. It will create a folder with a few files inside, including a “.bin” which is the actual firmware update.

Log back in to tplinklogin.net and go to System Tools and Firmware then browse to the .bin file you just downloaded.

TP-LINK WR702N update

Browse to the .bin file you downloaded and update the firmware.

After it updates, the nano will reboot once again. On mine, this reset all the router settings, and I had to log back in and set it up again. There is probably a better set of steps to do this, but this is how I went through it and took screen shots so that is what I am sharing.

Once this is done, you can unplug and switch your computer back to normal internet connection. Now the TP-LINK can be plugged to power and the Arduino Ethernet shield and you can use the Ethernet library to make connections via your WiFi network.

NOTE: Since the nano requires using a computer and web browser to select which WiFi it connects to, this is not a portable solution. You cannot choose what WiFi to connect with (or the password or anything) from the Arduino. If you wanted to take your Arduino somewhere else and get it online, you would have to have a computer available to connect to the TP-LINK nano and reprogram which WiFi network it connects to. If you have a real WiFi shield for the Arduino, you can do this in software.

I hope these quick notes help…

12 thoughts on “Configuring the TP-LINK TL-WR702N nano router for Arduino

  1. ranjoy

    Hey Allen,

    Was going through your tutorial and was a great one. I am new to Arduino and would like to ask few questions. Would be great if you can help. I am interested in finding the surrounded mobile devices (essentially Mac ID). I was reading that wifi shield has the capability to do the same. Can this nano router wil be able to do the same. I just want to find out if a device has come to the proximity.

    Thanks for any help, and for a great tutorial .

    Ranjoy

    Reply
    1. Allen Huffman Post author

      No, you would not be able to do this using an Ethernet-WiFi bridge device like this TP-Link. The Arduino only sees it as a connected Ethernet port with an IP address, so you have no API control over looking for networks, or even connecting to different ones with passwords supplied by the Arduino. You would need a WiFi shield for that.

      Reply
  2. Mike Klamkin

    Hey! Thanks for the helpful article. Do you know if this will work the same with an mr3020 coupled with a 3g/4g usb stick? I’m looking to send flight telemetry data to an IoT cloud (probably sparkfun data). I have also considered replacing the arduino with an esp8266 and connecting to the tplink using I2C.

    Also, does this notify me by email when somebody responds? If not, please email me at mike@klamkin.com

    Reply
      1. Mike Klamkin

        Essentially, I’m looking to send data from an arduino nano to an external server, connected via cellular network(3g/4g) for unlimited range (as long as it is in range of a tower)

        Reply
        1. Allen Huffman Post author

          This TP-Link device is just an Ethernet/WiFi router. If you had an Ethernet port on your hardware, it would help it connect to a WiFi network, but that’s all.

          Reply
        2. Allen Huffman Post author

          Someone else commented and is using a cellular access point (like a MiFi). If you used something like that, you could make the TP-LINK connect to the hotspot, and use an Ethernet shield on the Arduino. There are 3G/4G cellular shields made for Arduino, though, and it might be cheaper to go with one of those rather than use an Ethernet shield, TP-LINK router, plus hotspot.

          Reply
  3. blkmst

    I need to send Get method to a web server and i need to use the ethernet shield and connect it to a hotspot using TL-WR702N.
    what should i change in the code of the ethernet shield ? should i put the ssid and password of the hotspot? or the router ?
    anyhelp in my code ?

    Reply
    1. Allen Huffman Post author

      You will not have any control over SSID, etc. when using Ethernet Shield->TP-LINK. You configure the TP-LINK to connect (SSID, password), and then it just passes through TCP/UDP/IP from the Ethernet.

      At home, I have a TP-LINK that is configured to get on my home WiFi network. I can now plug this TP-LINK in to *any* device in my house with an Ethernet port and it can talk “Ethernet” but go through my WiFi. (Arduino, Ethernet printer, Raspberry Pi).

      It is not flexible (you cannot configure SSID/password from the Arduino/device) but it is cheap :)

      Reply
      1. blkmst

        Thanks for the reply :)

        so if i’m using this code for example :

        #include
        #include

        // Enter a MAC address for your controller below.
        // Newer Ethernet shields have a MAC address printed on a sticker on the shield
        byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };
        // if you don’t want to use DNS (and reduce your sketch size)
        // use the numeric IP instead of the name for the server:
        //IPAddress server(74,125,232,128); // numeric IP for Google (no DNS)
        char server[] = “XXXXXXXX”; // name address for Google (using DNS)

        // Set the static IP address to use if the DHCP fails to assign
        IPAddress ip(192, 168, 0, 177);

        // Initialize the Ethernet client library
        // with the IP address and port of the server
        // that you want to connect to (port 80 is default for HTTP):
        EthernetClient client;

        void setup() {
        // Open serial communications and wait for port to open:
        Serial.begin(9600);
        while (!Serial) {
        ; // wait for serial port to connect. Needed for native USB port only
        }

        // start the Ethernet connection:
        if (Ethernet.begin(mac) == 0) {
        Serial.println(“Failed to configure Ethernet using DHCP”);
        // try to congifure using IP address instead of DHCP:
        Ethernet.begin(mac, ip);
        }
        // give the Ethernet shield a second to initialize:
        delay(1000);
        Serial.println(“connecting…”);

        // if you get a connection, report back via serial:
        if (client.connect(server, 80)) {
        Serial.println(“connected”);
        // Make a HTTP request:
        client.println(“GET XXXXXX/aaa.php HTTP/1.1”);

        client.println(“Connection: close”);
        client.println();
        } else {
        // if you didn’t get a connection to the server:
        Serial.println(“connection failed”);
        }
        }

        void loop() {
        // if there are incoming bytes available
        // from the server, read them and print them:
        if (client.available()) {
        char c = client.read();
        Serial.print(c);
        }

        // if the server’s disconnected, stop the client:
        if (!client.connected()) {
        Serial.println();
        Serial.println(“disconnecting.”);
        client.stop();

        // do nothing forevermore:
        while (true);
        }
        }

        it should remain the same ? all i need to do is to connect the ethernet shield to the wr702n via cable and connect the wr702n to phone hotspot ? and configure it to client mode ?

        Reply
        1. Allen Huffman Post author

          I can’t verify the Sketch, but if it’s just a normal Ethernet sketch, you are correct. The TP-LINK will just be bridging the Ethernet connection to WiFi (as configured in the TP-LINK). It is transparent. If you configure the TP-LINK to connect to your access point (password, etc.), anything you plug in to the TP-LINK via Ethernet will be on that access point.

          Reply

Leave a Reply