Arduino Yun Thermostat 2/4: accesing the YUN remotely using NO-IP

The android app that will control the Arduino YUN can send and retrieve data to the yun easily when both are on the same network. We only need to know the IP direction of the arduino YUN. But if we are not on the same network, for example, when we are not at home, then we can not connect with our yun.

To provide remote access to our yun, we need the following:

  • The external IP of our home router.
  • configure our router to forward all the requests  made to the external ip, port 80 (htttp) to our arduino, inside our home network.
  • And optionally, if you don’t wan’t to remember your external ip, or if your internet provider changes it to often, we will use the Dynamic DNS service from NO-IP.

Redirecting the request to the port 80 to our yun.

The steps that we have to do to redirect the requests to the arduino YUN, will depend on the brand and model of our home router. I will show you how to do it on an EchoLife HG553 of Vodafone, but in other routers the stepd will be very similar.

The first step is to access to the control panel. You need to know the ip of the router, in my case, the ip is:

http://192.168.16.1

If you access this url using a web browser, you will be requested to introduce an user and password. In case of this router, the user is “vodafone”, and the password is “vodafone”.

Now, on the left side, you have to go to the menu Firewall->Port forwarding.

You will see a form like the following, where you can add a forwarding rule. Select the service HTTP from the list, and in the “local ip” field introduce the IP of your arduino YUN, like in the following picture:

Redireccion puertos echolife hg553 de vodafone
Port redirection on echolife hg553, Vodafone

Save the changes, and check if your arduino yun is accessible from another network (not your home network), by accessing the following url: http://my_external_ip/

If you don’t know which your external ip is, you can obtain it here:

http://www.whatismyip.com/

Using NO-IP to have a free Dinamic DNS Service.

First, sign up in NO-IP for a free account, and in the main menu, click on “add host”.

Alta en no-ip paso 1
Configuring no-ip step 1

You have to fill the following form:

Alta no-ip paso 2
Alta no-ip paso 2

In the example above, we have created an dynamic dns to access our arduino yun across the internet using http://what_you_want.redirectme.net instead of http://99.99.99.99

Maintaining the free account on NO-IP alive.

The free account of no-ip will expire after 30 days. Because of that, our arduino will take care of update our ip in NO-IP once per day. We will do that using shell scripts on the Arduino YUN executed periodically.

This will help too in case our internet provider changes our external ip very often.

¿How to obtain our external ip with php?

That is not very difficult. We will use the following snippet of php code:

function retrieve_external_ip() {
$i = do_Curl("http://ipecho.net/plain");
return $i;
}

And to do the update in NO-Ip, we will call the following web service:

function update_both_ips($ip, $link) {
 $aux = "http://" . USER_NO_IP . ":" . PASSWORD_NO_IP . "@dynupdate.no-ip.com/nic/update?hostname=" . HOST_NAME_NO_IP . "&myip=" . $ip;
 $r = do_Curl($aux);logi("Result: " . $r);

Please, double check that you can access your arduino yun with your home network, and outside your home network before proceeding with the next steps.

5 thoughts on “Arduino Yun Thermostat 2/4: accesing the YUN remotely using NO-IP

Leave a Reply

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>

Powered by sweet Captcha