Created: 2012-03-22 16:51
Updated: 2017-05-26 06:30

ArduinoEthernetCom: Simple communication between Arduinos and Browsers

The ArduinoEthernetCom library was created to simplify communication between Arduinos and browsers without requiring Flash or Java or drivers or anything else.

ArduinoEthernetCom allows you to create a simple server on an Ethernet-enabled Arduino (i.e. an Arduino with an Ethernet shield, or an ArduinoEthernet) by uploading a tiny sketch to the device, and then stream data into the browser over an Ethernet connection. You can see an example running live on GitHub here.

To read more about streaming data to your computer over an Ethernet cable, read this blog post.


ArduinoEthernetCom is Copyright 2012 (c) by the Concord Consortium and is distributed under any of the following licenses:

Using the library

// Define an ArduinoEthernetCom with optional options
var arduinoEthernetCom = new ArduinoEthernetCom(_options_);

// Define one or more observers to be notified each time the data updates
var dataDidUpdate = function(data) {
  var pinA0Value = data.A0;           // data is returned as a hash of values
  graph(pinA0Value)                   // do whatever


// start polling the Arduino, calling all the observers each time with data

// some time later

// this will grab the current values of the pins. This is probably not as useful
// as the start() method, which continually polls the data.


You can pass a hash of options to ArduinoEthernetCom, e.g. var arduinoEthernetCom = new ArduinoEthernetCom({frequency: 2, generate_random_data: true});

  • arduino_server_ip:
  • frequency:
    • Frequency of data collection in Hertz. Default: 4 (i.e. we will request data 4 times a second)
  • delay_time:
    • Alternative way of defining frequency, in ms. Default: None, the above already defines 250 ms
  • generate_random_data:
    • If true, random floating voltages will be generated for all 6 pins. This means you don't need to connect an Arduino, so it can be used for testing. Default: false
  • callback_function_name:
    • The function called by the Arduino's script to send JSON-P data. This shouldn't be changed unless the sketch is modified. Default: arduinoEthernetComCallback

Using this with an Arduino on a web page

  1. Upload the server sketch located at Arduino/JSONPSensorServer.ino to the Arduino. This will start a server running at If you need to use a different IP address, you must modify the sketch.
  2. Plug the Arduino into the computer with an Ethernet cable. Wait about 30 seconds for the server to boot up.
  3. Use the ArduinoEthernetCom library to get data from the Arduino.
Cookies help us deliver our services. By using our services, you agree to our use of cookies Learn more