Skip to content


Subversion checkout URL

You can clone with
Download ZIP
A sketch to provide a REST-like interface to the Arduino+Ethernet Shield
C++ PHP Processing CSS C Arduino Python
branch: master



RESTduino is a simple sketch to provide a REST-like interface to the Arduino via the Ethernet Shield. The idea is to allow developers familiar with interacting with REST services with a way to control physical devices using the Arduino (without having to write any Arduino code).

You can see a crude demo video on YouTube here:

Of course some flexibility is traded for this convenience; only basic operations are currently supported:

  • Digital pin I/O (HIGH, LOW and PWM)
  • Analog pin input

Later versions of the sketch may provide additional functionality (servo control, etc.) however if you need more than just basic pin control you're probably better off learning the basics of programming the Arduino and offloading some of your processing to the board itself.

Getting Started

note: Bonjour/Zeroconf required Georg Kaindl's Bonjour/Zeroconf library originally found here:

This library required minor modifications to work with Arduino 1.x, so I have included the modified version here. I'm not sure the best way to include a non-standard dependency in an Arduino github project, so it's here if you need it, and if there's a better way to do this, please let me know :)

First you'll need an Arduino, a Wiznet-based Ethernet shield and the Arduino development tools; here's some links to get you started:

For testing you'll want some hardware to connect to the Arduino (a green LED is enough to get started). Connect the LED between pins 9 and ground (GND).

Load up the sketch (RESTduino.pde) and modify the following lines to match your setup:

byte mac[]={0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED};

This line sets the MAC address of your ethernet board; if your board has one written on it, you should use that instead.

By default RESTduino will use DHCP to configure its IP address, and uses Bonjour/Zeroconf to make itself visible to other clients by name (default name is 'restduino.local').

If you want to use a static address, set the STATICIP flag to 'true' and configure the address by modifying the line below to match your desired address:

byte ip[] = {192,168,1,177};

Now you should be ready to upload the code to your Arduino. Once the upload is complete you can open the "Serial Monitor" to get some debug info from the sketch.

Now you're ready to start talking REST to your Arduino!

To turn on the LED attached to pin #9 (currently case sensitive!):

This will set the pin to the HIGH state and the LED should light. Next try this:

This will use PWM to illuminate the LED at around 50% brightness (valid PWM values are 0-255).

Now if we connect a switch to pin #9 we can read the digital (on/off) value using this URL:

This returns a tiny chunk of JSON containing the pin requested and its current value:


Analog reads are similar; reading the value of Analog pin #1 looks like this:

...and return the same JSON formatted result as above:


Javascript/jQuery Demo

A simple example of how to interface with RESTduino via jQuery is included as DemoApp.html.

This page displays a slider control (via jQuery UI) which when adjusted will set the PWM value of Pin #9 to the value selected by the slider.

If you look at line 19 you can see where the REST URL (you'll need to adjust this for the IP address of your device) is constructed based on the selected value of the slider and on line 22 an AJAX request is executed passing the URL constructed above to the Arduino.

Something went wrong with that request. Please try again.