13

I have an Arduino board connected to a Wifi network which have internet access. What I want is, I need to contact this Arduino board from any other network without the help of port forwarding in the home network of Arduino. Currently what I am doing is to make the Arduino ping to my web server in every two second interval, which isn't practical I believe.

How do device like smart wifi LED lights connect to Internet? We are able to operate them with our mobile phone without any port forwarding or any other router configuration adjustments, right? How do they do it?

  • Look at CoAP, and maybe some other IoT protocols. – Sean Houlihane Jul 28 '17 at 13:27
9

In order to avoid the need to be on a network which allows inbound traffic, you need to connect outbound to a server which will relay requests from clients which also make outbound connections to it.

This in essence is like the model of a communication satellite. Both the user's computer or phone or whatever, and the IoT device, maintain links "up" to this server in the cloud, and it takes each message which comes up on one side and sends it down on the other, and vice versus.

There are many possible ways to implement such a server. One that is currently trendy is to make it be an MQTT Broker. In MQTT, clients (both the IoT device and user devices) make outbound connections to the broker, and the broken shares messages which are "published" on a "topic" by one client to all clients which have "subscribed" to that "topic" topic.

  • Because there is already a connection established, the broker can send unsolicited traffic down it without any polling-interval latency

  • To keep the connections established, occasional keep-alive traffic is sent

  • If the connection breaks there are rules for trying to re-establish it

  • Essentially, noticeable latency only occurs if the broker tries to relay a message down, and the connection turns out to be broken and not yet repaired, in which case the message would be delayed until re-connection is accomplished. (There options for holding messages, dropping them etc).

| improve this answer | |
  • 1
    MQTT all the way. Thanks for the clue Chris. NodeJS+MQTT is the way to go. – Jithesh Kt Sep 7 '17 at 5:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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