ArduGate- Web Gateway for Arduino

ArduGate is a web gateway for Arduino. It makes interactions between in-browser JavaScript and Arduino possible. It is made up of a serial-to-HTTP gateway, some JavaScript routines performing communication with AJAX and an agent sketch running on Arduino. This makes developing a up-stream application for Arduino that runs on any platform with a browser a lot easier.
Arduino is connected to the computer running ArduGate via USB, bluetooth, Xbee or any kind of serial communication. ArduGate runs as a standalone HTTP deamon, serving on port 8880 by default, and works as a gateway between Arduino and the web world.
Right now access to following Arduino APIs/objects are implemented in JavaScript:
  • pinMode
  • digitalRead/digitalWrite
  • analogRead/analogWrite
  • EEPROM (read/write)
  • Servo (attach/detach/read/write)
  • Wire (begin/requestFrom/beginTransmission/endTransmission/read/write)
Getting Started
To get started using ArduGate with Arduino, please follow these steps:
  1. Download and extract ArduGate files
  2. Find the agent sketch (agent.ino) in the distribution, build it and download to Arduino board
  3. Run ArduGate.exe. In the opening window, click “Open Demo Page” button.
  4. In the demo page, choose the correct COM port which Arduino is connected to, and click Connect.
  5. You are ready to play with Arduino in your browser with the demo page.
ArduGate Demo Page


The key concept is using JavaScript inside the web browser to interact with Arduino. Here are several demostrating JavaScript code clips. You will find the code similar to that in an ordinary Arduino sketch.

Blinking LED

<script language="javascript" src="serial.js"></script>
<script language="javascript" src="arduino.js"></script>
<script language="javascript">
var port = "COM18";
var ledOn = false;

self.setInterval(blink, 1000);

function StartBlink()
    if (!Connect(port, 57600)) {
        alert("Error connecting with Arduino on " + port);
    pinMode(13, OUTPUT);

function StopBlink()

function blink()
    if (connected) {
        digitalWrite(13, ledOn ? HIGH : LOW);
        ledOn= !ledOn;

<input type="button" value="Start" onClick="StartBlink()" />
<input type="button" value="Stop" onClick="StopBlink()"/>

Accessing EEPROM

/* write a byte of 0x80 to EEPROM at address 0xA0*/
var address = 0xA0;
var data = 0x80;
if (EEPROM.write(addr, data))
 /* success, now read back from EEPROM */
 data =;

Controlling a servo

/* create servo object */
var myServo = new Servo();
/* attach servo to pin 3 */
/* set servo angle */
/* get servo angle */
var angle =;
alert("Current angle is " + angle);

Accessing I2C

function WriteI2C(address, data)

function ReadI2C(address)
 // request 1 byte
 Wire.requestFrom(address, 1);
 var ret =;
 if (ret == null) alert("Error reading I2C");
 return ret;


Currently ArduGate works on Windows and Linux (only Ubuntu is tested). The Windows version comes as application with a window, while the Linux version and upcoming MAC OS X version is command line interface.
ArduGate running on Ubuntu Linux

ArduGate running on Windows

ArduGate is going to be ported to embedded Linux, so it will be able to run on some routers. A long-term goal is to port the serial-to-HTTP gateway to iOS and Android which will be very exciting.


Source Code

The ArduGate source code is distributed under GPLv2 license. It is hosted on SourceForge, including the serial-to-HTTP gateway which is developed as a feature of MiniWeb, the agent sketch for Arduino, and the JavaScript libraries which provide simplified access to Arduino.
The subversion repository:
svn checkout svn://