Arduino Control Via a Web Service With Teleduino




Introduction: Arduino Control Via a Web Service With Teleduino

About: Developer of the telecontrol and telemonitoring system Teleduino, using the Arduino platform.

Convert your Arduino into a sofisticated web control platform using Teleduino.

Teleduino is both a product and a service. Once the Teleduino sketch has been loaded on your Arduino (the 'product'), it then connects to the Teleduino server awaiting your instruction from anywhere in the world via the internet (the 'service').

Typically there are no firewall changes required, and if your network supports DHCP then no network configuration is needed on the device. Easy!

The Teleduino platform allows you to perform the following with your Arduino, all via the internet:

  • Reset, ping, get version, get uptime, get free memory.
  • Define pin modes, set digital outputs, set analog outputs, read digital inputs, read analog inputs, or read all inputs with a single API call.
  • Define up to 2 'banks' (4 for the Mega) of shift registers. Each 'bank' can contain up to 32 cascaded shift registers, giving a total of 512 digital outputs (1024 for the Mega).
  • Shift register outputs can be set, or merged, and expire times can be set on merges (you could set an output(s) high for X number of milliseconds).
  • Define, and read and write from serial port (4 for the Mega).
  • Read and write from EEPROM.
  • Define and position up to 6 servos (48 for the Mega).
  • Set preset values for the above functions, which get set during boot. Preset values are stored in the first 178 bytes of the EEPROM (413 for the Mega).

Just imagine what you can do. The possibilities are endless. What makes it even better? The process is quick and easy.

This tutorial will guide you through creating a Status LED for your device, then obtaining and uploading the Teleduino library/sketch to your ethernet enabled Arduino Uno (or equivalent).

To complete this tutorial you need:

  • Arduino Uno / Mega (or equivalent)
  • Ethernet Sheild (Wiznet based)
  • LED
  • 1K Resistor (or similar)

This is our first tutorial and will be adding neat project tutorials for achieving specific tasks.

If you get stuck on any of the steps, or if you feel that there is a step that could be explained better, please leave a comment so that we can improve things.


Step 1: Obtain Unique API Key

In order to uniquely identify your device on the Teleduino server, you need to obtain a unique API key.

This API key needs to be loaded into the Arduino sketch (explained in Step 4).

Your key will be sent to you by email within a few minutes of being requested.

To request a key, hop over to (please bear with us while the nice looking site is being built!)


Step 2: Add Status LED to Arduino

While your Teleduino device is booting, it flashes codes out the Status LED. This is so that you can keep an eye on what's happening, and it also makes troubleshooting easier if you're having trouble getting connected.

The different status codes are:
1 flash - Initialising
2 flashes - Starting network
3 flashes - Connecting to server
4 flashes - Authenticated
5 flashes - Session already exists for supplied key (sometimes happens after a quick restart - will work on next auto-restart)
6 flashes - Invalid or unauthorised key
10 flashes - Connection dropped

The Status LED is preconfigured on digital pin 8 of the Arduino board. In order to see status codes being flashed, we need an LED connected.

Solder the 1K resistor onto the flat-edge side of the LED. You may wish to shorten the leads (as per image) .

Bend the leads for the resistor / LED so that they are spaced far enough apart for the resistor lead to fit in the GND port, and the LED lead to fit in the pin 8 port (as per image). Trim any excess lead so that it looks nice and tidy.

Connect your masterpiece to your Arduino.

Nice work!

Step 3: Download Teleduino Library

Teleduino comes in the form of a library for your Arduino IDE (the software that you use to write/upload sketches to your Arduino). The library is written for versions 1.0 and 1.0.1 of the IDE (the latest versions at the time of writing).

Download the library from for the Uno version, or for the Mega version.

Once downloaded, open up the archive and you'll see a folder called 'Teleduino328' ('Teleduino2560' for the Mega). Copy this folder to the 'libraries' folder of your Arduino IDE installation.

Important Note: If you have the Arduino software open at this point, you will need to close it and restart it. If you don't, the library will not be available and you'll get compilation errors!

Good job!

Step 4: Upload Sketch to the Arduino

Now for the moment we've all been waiting for. Time to make some magic happen and upload the Teleduino sketch to your Arduino.

Please note that the unique API key from Step 1 is required to proceed.

Open up the Arduino IDE. Click 'File' -> 'Examples' -> 'Teleduino328' -> 'TeleduinoEthernetClientProxy'. This will open up the sketch that we'll be using.

Near the top of the file you'll see some network configuration variables. If you're feeling adventurous you can play with these, but the default should work fine. The only thing we recommend changing is the MAC address declaration, even if it's just a matter of changing the last byte to something like 0x01. MAC addresses must be unique on your network (which is why we recommend you change it from the default). If you are setting up two or more Teleduino devices, you must ensure their MAC addresses are different.

The one thing that must be set is the unique key. See the attached image as a reference. By default they are set to a bunch of zeros. To make it easier, when you receive your unique API key, you'll also receive a URL to a tool which outputs your key in a format that can be copied and pasted into the sketch.

Once your key is set, connect your Arduino (if you haven't already), ensure the correct serial port is selected, and click 'Upload'. All going well the sketch will compile and upload.


Step 5: Sample API Calls and Further Reading

By this stage you should have a functional Teleduino device. Connect up an ethernet cable, supply power, and your device should connect to the Teleduino server. Follow the Status LED to watch the connection process.

During normal operation, the Status LED will do a quick pulse every 5 seconds of inactivity. This is the server checking in on the device to make sure everything is happy.

So, you've got a connected Teleduino. Now what? I bet you want to do some cool stuff with it, right? Let's start with a couple of really simple API calls. These API calls will tell you what version of the Teleduino firmware you're running, and the uptime of your device (in milliseconds).

Try out the following URLs (replace {key} with your unique API key):
For the Uno:{key}&r=getVersion{key}&r=getUptime
For the Mega:{key}&r=getVersion{key}&r=getUptime

Pretty neat, huh?

This is where we end the tutorial. We are continuing to add further tutorials which explain how to achieve specific tasks using the Teleduino platform. These tutorials are:
If you want to dive right in yourself, you can view the full API reference manual at

Your comments and questions are welcome and appreciated.

Have fun!



  • Fix It! Contest

    Fix It! Contest
  • Tiny Home Contest

    Tiny Home Contest
  • Metalworking Contest

    Metalworking Contest

92 Discussions

I am getting this error: {"status":403,"message":"Key is offline or invalid.","response":[]}

help me out.

Hi Nathan, thanks for this project and excellent tutorials, just what I was looking for...

I am using the Teleduino service with a cheap clone UNO, Ethernet Shield and relay board. Much to my surprise after some set up I had no problems getting the response:


However, after a few minutes, during which I am opening and closing relays quite happily, the Shield seems to lose its connection and I go back to this:

{"status":403,"message":"Key is offline or invalid.","response":[]}

Getting the connection back involves resetting either the shield or the UNO, either will work. Then it operates for another few minutes. Once it loses connection, I never get it back without a reset, then it invariably comes back within a few seconds.

I have read around all kinds of posts with solutions like adding capacitors, cutting tracks, setting heartbeats etc. In most cases this was because the power had gone down to the device which is not my situation.

Can you please point me in the right direction?

Much appreciated!


Hi, when I start the teleduino controller Pro app in my Samsung Vibrant I get always the error message 1101: cannot download. The same app is functioning OK with my tablet Lenovo. I don't get it how is it possible..

can any one help me please ??

i wont to use arduino in my project ..
i wont ardino send alarm to my androin phone 'by internet ' whin the Bell home is ring
What are the pieces that will I need ??
remember by internet no IRir no blotooth
thank you

1 reply

Hi wasimxxl. There are many 'Arduino' ways to do this. The current implementation of Teleduino doesn't support 'push', however an upcoming version certainly will. Stay tuned!

The ethernet shield is based on the W5100 ic. By any chance, was anyone able to make teleduino work using the much cheaper ENC28J60 ethernet controller chip?

1 reply

Hi Dr_L. I haven't seen any successful examples using the ENC28J60 yet, however there is a new firmware in the works which will be versatile enough to hopefully provide a mechanism for this. Stay tuned!

Hi bclagett. With the current version this is not that easy to achieve. There is a completely new revision of the firmware in the works which will provide the ability for people to customise their requirements. Stay tuned!

Excuse me why my UNO LED just blink 6 times....

and manage presets say Key is offline or invalid.

I had changed 3 keys...

1 reply

Hi buzz.pai. 6 flashes means that the API key configured into the sketch is invalid. This could potentially be caused by a copy/paste error when loading the key in? Please try again and advise if the problem persists.


Need help. The link LED on the W5200 ethernet shield is always red. The Led on pin 8 blinks: 1, 1-2. That is all that is happening. Please assist in resolving. Thank you.

1 reply

Hi SS_2013. Did you ever get this working? I'm not sure if the W5200 is compatible with the W5100. Has anyone else successfully used the W5200?

I was able to get the first URL to work, but the second and all related to LED control on next steps give me the following error message.

{"status":400,"message":"Invalid request syntax. Visit http:\/\/ for protocol reference.","response":[]}

I input the string you reference with my key inserted as show below (and shown in quotes so you can see the syntax)


Any ideal what I can do to correct this?

1 reply

Hi ThomasF5,

The key you've provided in the above example is only 31 characters, but should be 32 characters. Your problem was likely caused by a simple copy/paste error. I would recommend you register for a new key because the one you've displayed above is now public knowledge on the internet :)

hi, can anyone tell me how to use set serial, get serial, define serial and flush serial?? what im trying to do is that i want my teleduino to read the serial (im using mega 2560). i tried to define it first, then get serial but i get only empty. i dont know if i did it wrong or what. can help? or send me tutorial link for that. thanks

1 reply

Hi eustacius,

It sounds like you've got the right idea from the API perspective. In regards to receiving the serial data, is the device that you're trying to collect the data from connected to the 'RX' pin and communicating as the same baud rate you defined in the defineSerial API call?

It's a very good idea, but it's to much instable.... You could send also on the serial monitor the connection status, not only on the led (pin 8)