I have quite a lot of experience with Arduino but have recently been faced with a challenge that has stumped me. The project is to create a robot that can be controlled from a separate network than it is on. I had the idea of using the Yun board to receive the values. Does anyone know a way I could have a computer send data to a Yun on a different network? (Maybe through a website?)

  • What are the separate networks, how are they connected? Commented Apr 23, 2015 at 6:28
  • 1
    One is my home network, and the other is a network at my workplace. Otherwise they are not connected
    – Em Eldar
    Commented Apr 23, 2015 at 6:30
  • 2
    This is a very open ended question. What have you tried or have in mind to try? Add some more details and you may get a better response.
    – linhartr22
    Commented Apr 23, 2015 at 20:13

3 Answers 3


I have accomplished this, first by reading this article on controlling a Yun through a web-browser on the same network. From there it was a matter of allowing my Yun to be accessed externally (setting up port-forwarding on my router) and changing a few lines of code to reflect the new location reference.

All the necessary files and code are included under the heading "Project Files" in the above link and no modification is needed to get it working within the same network. That said, I had to convert the two .jpg files to .png (and change the filenames in index.html) - I don't know why they wouldn't show up in my browser.

In brief:

The Yun hosts a webpage (index.html) which contains some indicators and control inputs. These objects are linked to the 32u4 using Bridge and the REST API - nothing special. The bulk of the html code is for visual purposes, and the actual REST calls are nice and simple.

What is good is that the webpage can be accessed from anywhere with the right jiggery-pokery, and with a little more determination can be hosted from anywhere.

External Access

Once you have that working, you need to do the following to allow access externally. I tested this using my smartphone - disconnected from my home WiFi of course - to ensure the link was over the Internet, not intranet.

1) Set up port forwarding and a static IP for the Yun. This is the fundamental step if you simply want to control your Yun over the Internet. However, I can't actually tell you how to do this because I don't know what equipment you have! Information is all over Google for setting up both DHCP static IP and port forwarding.

2) Get a static IP from your ISP for your home/work, or set up a Dynamic DNS service (these people offer it free, but I've never actually needed to use an external service). Most commercial ISPs tend to dish out static IPs, but that's no guarantee that yours will.

3) Access your Yun with a browser via: http://YOUR.IP.ADD.RES:PORT/arduino/<SketchName>.

External Hosting

If you want to host the webpage on something other than the Yun, you can! You will of course need a server to host this, either your work's central server or an external hosting service. You'll need to change some more lines in the code:

1) In the Yun sketch change server.ListenOnLocalhost(); to server.noListenOnLocalhost(); - the subtle difference is the 'no', and is essential for external control. Sorry, that's incorrect without a little more explanation than is required at the moment to answer your original question.

2) In the .html file, you need to change each instance of:

server = "/arduino/<SOMETHING>";


server = "YOUR.IP.ADD.RES:PORT/arduino/<SOMETHING>";

If you have the REST password set to ON then you have to incorporate the username/password in there too:

server = "username:[email protected]:PORT/arduino/<SOMETHING>";

There are three occurences in the original file, so be sure to catch them all.

3) When making changes to the .html file, make sure you re-upload it to the external host, not the Yun - that mistake took me hours to figure out.

A little more...

While searching for the URL of the article in the opening paragraph I found this atricle on a similar theme. It looks to have plenty of information although I haven't read it yet fully yet; I've been busy writing an answer on Stack Exchange. External Access should be no different, and if you want the 'External Hosting' version you just need to find any line that references the 'server' as "/arduino/..." and change it to "YOUR.IP.ADD.RES:PORT/arduino...".


You havent mentioned what exactly your robot does, for now I am going to assume it is something as simple as switching on a light etc and not something like a rover.

The easiest way would be to make the YUN read from a db (like mysql, etc.) and depending on the value perform a task.

For example, you could have a row called light, if the value of it is 1 then turn on the light else turn off the light

The problem you are going to face is the power consumption as you will constantly be polling from the database. You could also look into push notifications ( I am not sure if it is applicable here)

You could also look into creating a private VPN and connecting the YUN and your other devices to it and then control it.


Basically your yun is a linux box with a arduino connected to it on port /dev/ttyATH0.
If you know linux that should answer all your questions about what is possible. I have setup my own bridge and communicate via html to my robot using cgi script and lua.
I have demoed this on a web contest and you can see it in action on this video from 15:25 onwards https://www.youtube.com/watch?v=q0CnB7Yzpfg&index=3&list=PLCSjf7QmP3TCOLIw0lMPbwHtKrO-nwfKG

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.