I am really interested in IoT (enthusiastic noob) and I would like to use the arduino board. Here are the steps according to me, with my queries:

  • User goes to example.com/arduino_switch
  • Interacts with an HTML form to toggle an action
  • Sends the data over the Internet (This is the part I have problem understanding)
  • Arduino receives the data point (how can we do this? polling a url or can we actively send it)
  • performs the action (easy to do for me)

Any and all help will be appreciated, even if its just pointing me to the right resources.

  • Check out Xively. You should be able to get something up and running with minimal effort. They have Arduino libraries and example code. Commented Jul 29, 2014 at 10:09
  • Sounds like a good solution, but I was looking at less of a platform(they tend to have a magical black box approach ) :D.
    – kmcodes
    Commented Jul 29, 2014 at 10:11
  • No problems. There are open source projects, but probably overkill. Are you going to use an ethernet board? A lot of people use Heroku and there are quite a few Arduino examples. As for sending stuff over the internet. Unless you can get a public IP for the Arduino, polling is probably the best bet. Check out the HTML GET, POST and PUT messages. Commented Jul 29, 2014 at 10:20

2 Answers 2


kiwiron has a great answer, but I have a few things to add:

  • You don't have to risk security... you can create a VPN to your network or you could just stay inside local LAN. It's just if you want to access it from outside
  • If you can't get a static IP for your network from your ISP, you can use something like No-IP to give you a name like example.no-ip.biz that's easier to remember and it will change the IP when your IP changes. I've used them before...
  • A Raspberry Pi might be a good partner in crime to work with the HTTPS connection with a web server like Nginx and with PHP to run a script. I personally like the Arduino better for interfacing with the actual components since it is 5V and has 40 mA per pin, but it's possible that you could use the GPIO pins on a Pi for your server. This might be a little cheaper since you can remove the ethernet shield and replace that with USB.
  • For the approach of polling a web server, it might be better to have the web server send a GET request to the Arduino and then the Arduino can respond ASAP.

For this, you might want to learn the basics of HTTP headers and try to figure out what goes on behind the scenes.

(how can we do this? polling a url or can we actively send it)

Assuming you're using the Arduino directly, here's roughly what would happen:

  • The client would request the Arduino for the content for the homepage using HTTP requests
  • The Arduino would send the content and close the connection
  • In the HTML there's a little attribute to the form that tells it to send the data via post to response.php. The client hits "submit" and it sends the data via POST to that URL.
  • The Arduino sees that it's sending data to that URL and reads the data and then process it accordingly. The socket is closed.

You have two choices:

  1. The Arduino regularly communicates with an external web server, sending data and asking if there is anything to do. This is the way Mitsubishi heatpumps can be controlled from the web. The advantage is that your internet connection does not need to publish a web server. Drawback is that the communication is slow (being dependent on the polling interval), plus the need for a web server to talk to. For instance, to control your Mitsubishi heatpump, you need to create an account on one of their servers for the purpose.
  2. The Arduino exposes a web interface that is then exposed to the internet. This needs configuration of your internet router and preferably a static IP address on the internet. Security is a problem, and I'm not sure that even the Due can do HTTPS plus some form of authentication. I used this method, but fronted my Arduino with an old laptop running Linux and Apache web server. The laptop does the authentication and HTTPS processing. Advantage is near real-time control; disadvantage is the amount of hardware and configuration required.
  • I feel the first one will meet my needs well (can manage with polling every five minutes). Can you point me to any specific reading material, especially something to learn the process of communicating with a web server and publishing the server.
    – kmcodes
    Commented Jul 29, 2014 at 10:10

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.