How to give your Arduino Ethernet shield wireless capability

in Arduino, wireless by DP | 42 comments

Connecting your Arduino to the internet is cool, but it’s even cooler to connect over WiFi. Luca explains how to connect your Arduino Ethernet shield to a cheap WiFi router to give it WiFi access.

Sometimes however it could be easier (and maybe cheaper!) to connect an Arduino to the Wi-fi network using your ethernet shield in conjunction with a wireless router.

I found the TL-WR702N nano router by TP-LINK that, with a cost of about 20€ on eBay, can work also as a wireless client: in this mode the router acts like a “bridge” between the device connected to its ethernet port and a Wi-fi network.

This entry was posted in Arduino, wireless and tagged , , .

Comments

  1. Squonk says:

    Yes, and if you buy a TL-WR703N for about the same price (or its global export RoHS/CE/FCC compliant sister product, the slightly larger TL-MR3020), you get an additional USB host port where you can connect the Arduino directly without needing the Ethernet shield. For this purpose though, you have to replace the original firmware by OpenWrt, but it is pretty easy.

    Actually, you can even use the free Ethernet port to get wired Ethernet access…

    I recorded a few videos describing the setup:
    http://www.youtube.com/playlist?list=PL4f_8Do1Z2EpyXm_wdCD5YM3V0KUQj4uj&feature=view_all

  2. David says:

    You can put openwrt on this same router and either use a usb serial connector or wire up the serial port to provide wifi without the ethernet shield too…
    It is a neat little lnux box. I have not yet used mine for anything yet though…

  3. Nial Pearce says:

    THAT! Is cool!!!! Want one!

  4. Jim Narem says:

    Check out the openwrt wiki for the TL-WR703N at http://wiki.openwrt.org/toh/tp-link/tl-wr703n.

    It’s got a serial port (internal) that you could connect to the arduino, that saves a LOT
    of code space on the AVR side instead of having the TCP/IP stack or even the USB code.

    Using one of the many atmega32u4 breakout boards instead of the arduino ecosystem
    is a lot more efficient in the long run. The AVR board ends up cheaper and using LUFA
    and a USB cable gets you to the TL-WR703N and the internet.

  5. Squonk says:

    You need to know that the TL-WR703N USB only supports high-speed devices reliably, so you need to add a (passive) hub to connect to an Arduino permanently.

    It is also possible to cycle the USB power from the router.

    I added the ability to flash the Arduino board directly from the TL-WR703N router web admin:

    http://www.youtube.com/watch?v=GZZvfJBuopc

    • Sleepwalker3 says:

      Presumably if you connected to the ‘Internal serial port’, then high speed wouldn’t be an issue, is that correct? Does the TL-WR702 also have that internal serial port than can be hacked into?

      • Squonk says:

        The TL-WR702N probably has the same serial port as the TL-WR703N, but it is 2.7V only and you get Linux and U-Boot console in the way… First one is not to dificult to get rid off if you compile your own firmware, but not the second one… It also requires above-the-average soldering skills, given the tiny pad size and their capability to lift off from PCB easily :)

      • Sleepwalker3 says:

        Thanks. Soldering skills are certainly no problem, HRHS trained, plenty of decent gear, etc. etc. and more years than I care to admit ;) Interfacing 2.7V is no issue, essentially Hardware no issue, firmware on the other hand… um… Maybe I’ll just stick with the Ethernet link – lol.

  6. Brandon says:

    If you want a prettier, and more compact, solution you can use one of the shields from these guys: http://diysandbox.com/

    • Squonk says:

      Prettier? I guess beauty is subjective… I prefer a plastic rounded case than a bare PCB, if not from a pure hacker point of view :)

      As for compactness, the TL-WR702N is only 57 x 57 x 18mm, so about the size of an Arduino Pro…

      And for the price of the “Hydrogen” Wifi shield ($75 + $39.29 shipping to my place), you can get 5x TL-WR703N routers!!!

  7. kmmankad says:

    Interesting.
    I was actually trying to make my laptop act as a LAN-to-Wifi Bridge (just for a few project demos,not actual use),but couldnt get it to work as intended.

    Anyone here tried that?

    • Rohit de Sa says:

      Pretty easy actually. If you use Windows go to the adapters page. (Windows 7: Control Panel\Network and Internet\Network Connections). Select the two adapters you want to bridge, right click and select ‘Bridge adapters’.

      We used to use this method to play multi-player games when no one had a router and there were desktop PCs around. One laptop would be the ‘server’ and would create an Ad-Hoc WiFi net to which other laptops would connect. One of these laptops would connect to a desktop. The WiFi and wired ethernet adapters would be bridged on this laptop. So now, even the desktop would be able to get onto the same network *through* the laptop.

  8. Frank says:

    I did the same just yesterday and i had to set the router to ‘client mode’ to connect it to my main router’s wifi, bridge mode didn’t work. Anyone encountered the same issue?

    • cde says:

      Bridge mode is not the same as Client mode. Bridge mode is like WDS, extending a wireless network, as if both your router and the main router were one. In Client mode, your router is like a computer connecting to a wireless network. Not all routers support bridge mode (especially inter-company devices)

  9. Kris Lee says:

    +1 for the TL-WR703N

    OpenWRT WiKi says about TL-WR702N that “… it only has 2MB flash and 16MB RAM (for both Chinese and International versions), and therefore will not be supported in OpenWRT.”.

    I actually bought one for me today because it was only €16 on eBay (and not €30 it was few months ago).

    @Squonk

    Thank you very much for the OpenWRT Arduino flashing tip and the video demonstration!

    • Squonk says:

      Thank you!

      @Kris Lee: I am looking for hi-res TL-WR702N PCB pictures. If you have a chance, could you please post them somewhere… Preferably here in the forum on on OpenWrt one…

  10. Richie says:

    I use the IOGear GWU627, same idea – cheap and tiny. Only issue is that you need a PC to setup the WiFi link (once).

  11. WJCarpenter says:

    The TPLink web site says this is the smallest wireless router in the world. It certainly is small, but I don’t think that claim is quite true. I have an Edimax BR-6258n, which I think is somewhat smaller. (It comes in red or black. I got the red one because I assume it’s faster.)

    The BR-6258n also uses mini USB for power, but I don’t know if it also does data over that connection, as the TL-WR702N seems to do. But in any case, the BR-6258n is not supported by either DD-Wrt or OpenWrt.

    (But the BR-6258n is a great device for its intended purpose. I always have it in my computer bag for those times when I am stuck in a hotel room with only wired internet.)

    • WJCarpenter says:

      FWIW, I think I’ve confirmed no data over USB for the BR-6258n. When I plug it into my Linux machine, no new USB devices show up in “lsusb”.

  12. Squonk says:

    Even if the BR-6258n is marginally smaller (51 x 42 x 17 mm vs. 57 x 57 x 18 mm), the TL-WR702/3N is much nicer aesthetically… Why do you assume that your red BR-6258n is faster, because Ferraris are red? ;) The TL-WR702n isn’t supported by OpenWrt/DD-Wrt (only 2MB Flash capacity) and it doesn’t provide data over the miniUSB connector either. But the TL-WR703N does, over the additional full USB socket: this is why it such an interesting device, only competing with the Hame MPR-A1 with smaller RAM capacity, an odd cigar-like shape, but with built-in 1800 mAH LiOn battery for $19… The Hame MPR-A2 has more memory and bigger battery, but is more expensive and even ugglier!

    • Sleepwalker3 says:

      Squonk, don’t you know that Red always goes faster? ;) But what you really have to do is put some racing stripes on it, then it will go really fast! These look like nice little units, good info to have, thanks.

  13. Nico says:

    Thanks for posting this project.

    I’m using Arduino Uno R3, Ethernet shield and TP-Link TL-MR3020 (switch at WISP mode). I’m having trouble connecting.

    There are 3 types of connections: PPPoE, Dynamic IP and Static IP. Which one did you use? How do you figure out what IP address to use in the Arduino pde program? I’m using the Arduino 23 IDE.

    Thanks in advance.

  14. Somebody says:

    The cost of the Ethernet Shield plus the modem isn’t that much cheaper than the cost of a WiFi shield. What a ridiculous idlot you are.

  15. Alexius says:

    To “Somebody”:
    I already had arduino and the ethernet shield and moved to a new appartament with wifi only. Am I an idiot for spending $15 for a wireless bridge? Wifi shield would cost me around five times more.

    You Sir, are the idiot.

  16. Sean says:

    Squonk, I have a WR-710N from TP-Link. I bought it specifically to do what you mentioned. however, I am having trouble finding the software upgrade you mentioned. did you remove it from OpenWrt? can you email me a copy?

    I am using the Arduino Uno R3 inside another product enclosure and do not have space to put the wireless shields or Ethernet shields. I really need this software upgrade, so any help you can offer is appreciated.

    Sean

  17. Sleepwalker3 says:

    The link seems fine to me and the WR-710 page is there also
    http://wiki.openwrt.org/toh/tp-link/tl-wr710n

  18. Sean says:

    Thanks ! Sleepwalker3.

    I managed to get OpenWrt installed on WR710N, which is similar to WR703N, but with 2 Ethernet and 1 USB. My goal is to use the USB to connect to Uno. However, I am not sure how to achieve that. can anyone help?

    I was able to config the WR710N to use it as client. I can use the Ethernet port to go to internet with my PC, but cannot get to internet with the USB port. I did not see the USB port as an interface on the setup page.

  19. Sleepwalker3 says:

    Not something I have any expertise with. I’d suggest you follow the links (in Blue below the photo) to Luca’s site and see if that helps you. Squonk also posted a link to a Video which may help. Other than that, maybe Squonk or one of the others may be able to assist. You best bet in that case would be to join up to the forum (if you aren’t already), search there for stuff on openWRT and/or WR703N, WR710N, etc. and if that doesn’t help, try posting a question on the forum, or go to the WRT site, where I’m sure they’ll have a forum.

  20. Squonk says:

    @Sean,

    I am no t sure of what you try to achieve: apparently, you successfully configured OpenWRT to access the Internet from a PC using one Ethernet port. However, I don’t understand what you ar etrying to do with the USB: there are some IP implementation running over USB (see my 13-year old guide K), but this requires a driver on the other side, here the Uno, but there is no such thing.

    Your best chance would be to use the USB between Uno and WR701N as a virtual COM port (“CDC-ACM”) and use a serial to Ethernet bridge on OpenWrt, like the “ser2net” package:
    https://forum.openwrt.org/viewtopic.php?id=50258
    https://www.youtube.com/watch?v=_OVRr69Apl0

  21. Sleepwalker3 says:

    Depending on what you are trying to do and what the WR710N has inside, it might be possible to access the serial port inside the WR710N (if it has them like one of the other WR… devices). I saw a post about this somewhere on DP a while back.

  22. Sean says:

    Thanks Squonk and Sleepwalker! this will give me something to work on.

    What I want to do eventually is to use the TP router as web server and talk to the Arduino via USB, so that we can control the Arduino from web interface.

    At this point I thought it’s a good idea to test the USB from my PC connected to the TP router, to make sure the connection works before I move on the Arduino. Is this a good idea? Once I use the USB to connect the TP router to Arduino, I will have no access to Arduino board so I can’t really test it.

  23. Samotage says:

    these are awesome little OpenWrt boxes, and I’ve used a bunch in various projects. :D

    My recipie is this,

    I have the Arduino bare as, with the serial port connected to the OpenWrt box.

    I then use ser2net that translates the serial into TCP packets.

    Configure this to some port on the OpenWrt, and you may telnet localhost and have access to the Arduino to send and receive serial data when logged into the OpenWrt device over ssh.

    The trick is to disable the internal console of the OpenWrt, very important and can be done in the initab scripts.

    You can then write a Lua script to communicate to the Arduino and then communicate over Http to somewhere. Have a look at the SEGbox code I use on the GitHub

    https://github.com/samotage/Aiko/tree/master/SEGbox

    Or alternately, you could probably Nat the telnet to somewhere else and get so,me other computer to talk to us using the codes of your choice.

    I have found this OpenWrt based approach to be rock steady, because there are resources to handle the TCP/IP stack which Arduino simply does not have.

    Have fun
    Sam, @samotage

  24. Sean says:

    Hello Samotage, thanks so much for your comment.

    I have managed to installed the ser2net, but cannot telnet to the router. can you tell me how to disable the internal console of the OpenWrt? I am not techie, so lacks very basic knowledge.

    also how to Configure this to some port on the OpenWrt?

    I have seen someone using kmod-usb-acm but cannot install it on my openwrt router.

    thanks in advance.

    Sean

  25. Sean says:

    I was trying to following this link: http://www.cse.dmu.ac.uk/~sexton/ENGD2003/openwrt/arduino%20teensy%20openwrt.html

    I tried to install kmod-usb-acm, but failed and was given the following message:

    Installing kmod-usb-acm (3.18.9-1) to root…
    Downloading http://downloads.openwrt.org/snapshots/ … r71xx.ipk.
    Collected errors:
    * opkg_conf_parse_file: /etc/opkg.conf:12: Ignoring invalid line: `echo 1 > /sys/devices/virtual/gpio/gpio8/value’
    * satisfy_dependencies_for: Cannot satisfy the following dependencies for kmod-usb-acm:
    * kernel (= 3.18.9-1-792159c4f2ca33ce0f449e2cb5ff60df) *
    * opkg_install_cmd: Cannot install package kmod-usb-acm.

    on my openwrt, under software I was able to find:
    kernel 3.18.9-1-c9cbf9d8143d4e8cea685fa8e35541b6

    can someone help?

  26. Samotage says:

    There are some tricks to this ;)

    You will need to ssh into the Wrt over ethernet.

    Figure out what your internal serial port is, this varies from device to device.

    The openwrt.org for this device should help!

    Then go to

    /etc

    First edit inittab, contents should be like:

    ::sysinit:/etc/init.d/rcS S boot
    ::shutdown:/etc/init.d/rcS K stop
    #tts/0::askfirst:/bin/ash –login
    ttyS0::askfirst:/bin/ash –login

    where the tts/0 or what ever the internal serial port is called needs to be commented out.

    Then edit ser2net.conf

    There will be likely a lot of guff… Kill it all, and make sure your Arduino Baud rate is set so. Then define the serial port device (from above) with the following to make it right for your device

    # This line for internals
    2000:raw:0:/dev/tts/0:38400

    Once this is done, you can reboot the WRT then ssh back into it and telnet localhost 2000

    Note 2000 is the port I choose for this malarkey.

    For this, no silly USB drivers are required. You will need to look up your device
    http://wiki.openwrt.org/toh/start#tp-link

    And find the headers for the internal serial port. FWIW, for this stuff USB sucks big time.

    Sam, @samotage

    Then

  27. Sean says:

    Sam, thank you so much!

    This is really going to help, and I will test it out tomorrow.

    my device is TL-710N US version 1.0

    Here is the link: http://wiki.openwrt.org/toh/tp-link/tl-wr710n

    does it mean that the internal serial port is ttyS0?

    Best regards,

    Sean

  28. Samotage says:

    Who knows?

    The best way is to hook up the Arduino, have it spit out stuff.

    Then ssh into it and cat the various serial ports till you have a winner!

    Sam, @samotage

  29. Sean says:

    Sam – I am happy to report that after some trial and error, I was able to make connection to the Arduino via the TP router. Specifically I use Ethernet port to connect my computer to the TP router, which acts as wireless client on my home network. The Arduino box was connected via USB port to the Router.

    I really appreciate your help in getting me through this. the reason it took me so long is because I really lack basic understanding and cannot follow your instructions until now.

    now I want to control it slightly differently as follows:

    my computer is connected to the Home router directly via Ethernet port
    TP router is connected to my Home router via wifi as client
    Arduino box connected to the TP router via USB port

    I thought it could be simple but I cannot get into the router box anymore via ssh.

    in this case, how should I set up the TP router with Openwrt?

  30. Samotage says:

    …and now the fun begins.

    Sam, @samotage

  31. Sean says:

    well, I tried to configure the network part and seem to have made it worse. now the router is no longer available. I can’t access the router anymore. I even tried in the safemode but still cannot get in. is there any hope to recover or this box is wasted?

    thanks in advance.

    Sean

Leave a Comment

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Notify me of followup comments via e-mail. You can also subscribe without commenting.