Quick Overview

This page gives you a short introduction on how to publish data from your Arduino to a Website in near realtime.
Although this has always been a tricky thing to do, with new standards evolving this has become a surprisingly easy.

There are many ways to publish data to a website from an arduino, i'm going to describe one way that has been very easy and versatile.

So here is the basic principle:

So basically whether you looking from the Arduino side or from the Web side, the way on how you communicate remains the same. That makes it easy to understand and use.
You subscribe to to topics and receive messages that others are sending to that topic, or you publish to topics where others can subcribe to.
As you might figured out, the pattern is not limited to Browers and Arduinos, but i might will come back to that later.

A Web Browser as User Interface?

Well, there might be lots of reasons. There are so many device types you could display data and have human interaction, like 2 line LCD matrix screens with 4 buttons, little ntsc/pal video screens, LEDs, and so on.

But we all (well not all really) have a laptop or anything like it near at hand. And, it is all connected via some sort of internet thingy.

They have big screens, lots of cpu power, mouse, lots of buttons to use (keyboard) and plenty of software that can be used to do all kind of display and interaction.

Furthermore the internet thingy gets more and more standardized, which opens an vast amount of new possibilities to allow interaction not only between devices, but also with humans as well (yes, they still play an important role today, hopefully in the future as well).

Get more specific please...

Basically we will use a Message Broker called Apollo: http://activemq.apache.org/apollo/

To what the Arduino is concerned, we need a common understanding on on how we talk to the Broker, that is where the "MQTT" protocol comes in:

"an open-source protocol specification intended for limited-resource devices on unreliable networks using a publish-subscribe domain"

Furtunately there is a smart guy who wrote a library for the Arduino in order to ease the interaction withe Broker over this protocol, and, the Broker is supporting the the protocol as well. The power of Standards: http://knolleary.net/arduino-client-for-mqtt/

Please appreciate the work of Nick!

Furthermore you need an Ethernet Arduino that has to be compatible with the following library: http://arduino.cc/en/Reference/Ethernet

And, you need a Browser that is supporting the WebSockets standard, most latest releases do it nowadays.

Ok, now nail it down quickly please!

So here is the implementation:

Simple LED on and off

In order to make a proof a concept, we will switch on an off an LED from a Web Browser. There is no further internet thingy needed next to the stuff listed above, as the Browser can directly interact with the Broker without any Webserver or anything like it.

LEDOnOff Screen

Viduino Web Interface

Now you might questioning the LED on and off project, and yes, the whole stack is not needed in order to switch on an off an LED!

But, there is more to come.

Follow the Viduino Web interface here: Viduino Web