Introduction: Arduino Control Via a Web Service With Teleduino

Picture of Arduino Control Via a Web Service With Teleduino

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

Picture of 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

Picture of 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

Picture of 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

Picture of 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!


Prodigal_Son (author)2013-02-27

I just wanted to say that you can download an early version of Teleduino Controller for Android devices on Google Play :

And like the info says, if you miss any functions please contact me and I will try to add it in future releases.

Bladder777 (author)Prodigal_Son2016-02-13

hi, how do i get incontact with you?

PiyushA1 (author)2017-02-25

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

help me out.

Tchernyavsky (author)2014-03-22

Hello! I have this problem: Everything works well until the power is in charge of Arduino. But if you turn the power off and back on, the connection to the server Teledyne not happening! The led is burning. If you press the reset button on the Board, then everything begins to work as it should! What you need to do to when power is turned off,then I could then press the button on the Board. Thank you!

KeghamK made it! (author)Tchernyavsky2016-12-14

Hello Tchernyavsky. Most probably your LED is burning because you didn't add a resistor on the GND line of the LED on your bread board. Check my setup.

nathanknz (author)Tchernyavsky2016-02-26

Hi Tchernyavsky. This sounds like a common problem with the early ethernet shields. See

OldHector (author)2016-04-18

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!


СветлинВ (author)2016-03-08

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..

wasimxxl (author)2013-10-28

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

nathanknz (author)wasimxxl2016-02-26

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!

Dr_L (author)2014-03-10

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?

nathanknz (author)Dr_L2016-02-26

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!

bclagett (author)2014-03-21

Can new values for variables (as set temps in a thermostat) be sent to the Arduino?

nathanknz (author)bclagett2016-02-26

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!

buzz.pai (author)2014-10-07

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

and manage presets say Key is offline or invalid.

I had changed 3 keys...

nathanknz (author)buzz.pai2016-02-26

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.

SS_2013 (author)2014-11-02


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.

nathanknz (author)SS_20132016-02-26

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?

ThomasF5 (author)2015-01-04

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?

nathanknz (author)ThomasF52016-02-26

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 :)

eustacius (author)2015-03-09

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

nathanknz (author)eustacius2016-02-26

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?

mosix (author)2015-04-04

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)

nathanknz (author)mosix2016-02-26

Hi mosix. The stability often depends on your internet connection. You could tweak the code to output debug information to the serial port, however we wanted to keep the serial port free for projects.

noel.kuck (author)2015-05-05

I keep getting the following error message:

Teleduino328EthernetClientProxy.ino:15:26: fatal error: Teleduino328.h: No such file or directory

compilation terminated.

Error compiling.

nathanknz (author)noel.kuck2016-02-26

Hi noel.kuck,

This would be the expected behaviour if you hadn't restarted the Arduino software after installed the library. Hope that helps!

Bladder777 (author)2016-02-13


Looks like a great way of control. i read that there will be an addition for the WiFi shield. i just got myself the Mega and the Wifi shield thinking everything is doable either way...i had a look at the sketch and i'm sure it can be structured - but i am extremely new to the code!

Can anyone help me do the same setup using my WiFi shield? Most info i got on the board is that it is a SHIELD MODEL WIFI R3....

Looking forward to your responses!

nathanknz (author)Bladder7772016-02-13

Hi Bladder777,

I'm currently testing a version of the sketch for wifi. I'll get in touch with you to help you out.

Bladder777 (author)nathanknz2016-02-13

i believe you've made contact with me via gmail..

Hope we can get it working and share with the community!

AlinS1 (author)2016-01-07

For wifi features you can use a portable wifi extender with an ethernet port, then you can put your arduino near extender everywhere in the house...

Bladder777 (author)AlinS12016-02-13

can you explain more?

oalharbi3 (author)2015-10-30

Have you tried to link it through wifi instead of eathernet

nathanknz (author)oalharbi32015-10-30

Hi oalharbi3. It's not officially supported (yet), but I understand that people have successfully adapted it to work with the wifi shield. The methods for the Wifi shield are a close match to the ethernet shield so it should be too difficult. We're currently developing an improved library with support for a far greater range of boards, including the ESP8266 and the Raspberry Pi. Please stay tuned!

CarlosC5 (author)2014-10-29


when I run the compilation of the sketch this message:

Tamaño binario del Sketch: 28.978 bytes (de un máximo de 28.672 bytes) Sketch demasiado grande; ver para consejos de como reducirlo.






arduino software version 1.0.6

what i am doing wrong?


rodrigobrantes (author)CarlosC52015-09-24

Hi Carlos, you are compiling a little bit big program than your device is made for. You have to reduce some sentences or avoid some routines.


ikumar5 (author)2014-02-20

got {"status":403,"message":"Key is offline or invalid.","response":[]} this me out kindly...

nathanknz (author)ikumar52014-02-23

Hi ikumar5,

This message means one of two things. First off, please check to ensure that the key you're using is correct. Secondly, please check that your device is connecting successfully. Have you attached an LED to pin 8 to read the status output? This will provide clues as to whether or not the device is connecting to the server ok.

Hope that helps!

ikumar5 (author)nathanknz2014-02-24

thanx nathen it worksn one more thing am using teleduino cotroller app i want to read a sensor data but i am getting struck with that stuf could u help me how to read a data through the app.. this is tha app

nathanknz (author)ikumar52014-02-26

Hi ikumar5,

Great to hear you got it up and running. In regards to your question about the Teleduino Pro app, it's written by a third party and is not directly related to the Teleduino project. Please contact the author of the app with any questions. Thanks!

Dunes2 (author)2014-02-23

Hi, I have a strange problem. Initially everything was looking good, but suddenly the board does not complete the login. It stops after three flashes of the status LED. Regardless of this I get response when i send an instruction.

I even get an OK response when i have unplugged the board!!!

The response looks like this:


I get this regardless of which instruction I send.

In this case I asked for "getAllInputs"...

Any ideas on how this can happen?

Regards from Leif in Sweden

nathanknz (author)Dunes22014-02-23

Hi Leif,

This is definitely strange. I suspect the response you're seeing is a result of a browser cache? It should definitely not return 'OK' if the device is not connected.

Failing after 3 flashes indicates that your device is failing to connect to the server. I would suggest trying a different MAC address (so that your router will see it as a new device), and possibly even trying changing the serverPort value in the sketch (the server listens on ports 53 and 5353).

If you continue to experience trouble, feel free to contact me directly for further diagnosis.

lope12 (author)2013-09-09

Cant upload the sketch to the arduino rev 3
error say:
teleduino was not declared in this scope

what i am doing wrong?

lope12 (author)lope122013-09-09

fix it,it was not in right dir.
Load up ok now.
Next i change the mac address and copy the coded key in place of the zeros. did not change any of the ip numbers or subnet.
but now i cant connect to:{key}&r=getVersion
and yes i change the key.
I know it me lol i am realy new in arduino but love to have this working

Regards Lope 12

lope12 (author)lope122013-09-09

Hi All.
Forget all my questions ask.
it works like a champ now.
i did all ok but ms explorer dont display the text from server, just want me to download or open it.
Use chrome now and all works like it should.

Perfect Thanks
Regards Lope

nathanknz (author)lope122013-09-11

Hi Lope,

Thanks for the confirmation. Great to hear you got it working!


nathanknz (author)lope122013-09-09

Hi Lope12,

That error would occur for one of two reasons:
1) The library is not in the correct libraries folder, or
2) The Arduino software was not restarted after copying the library into the libraries folder

Let me know if you continue to have trouble after checking those two points.


bruiser69 (author)2013-08-01

Sorry I forgot the error message. "Website Declined to show this Webpage"
Most likely cause - Website requires you to log in

What should I see if I can get to site?

Do you know of a customisable webpage that will work with Teleduino to give realtime feedback on input/outputs & allow remote readings and configuration?
The reason I ask is I would like to remotely monitor voltages of a battery bank, get alerts when issues arise & even start/stop a generator if solar input is too low.


nathanknz (author)bruiser692013-08-03

Hi Bruce,

If you use a different browser (such as Google Chrome), or turn off the friendly HTTP error pages in Internet Explorer then you should be able to see the response in full.

I know of people that have successfully integrated with Cosm and ThingSpeak, as well as custom applications for doing monitoring and control. There is also an unofficial Android app available to operating your Teleduino.

bruiser69 (author)2013-08-01

Where can I download the sketch? I can't see a link in the Instructable.

nathanknz (author)bruiser692013-08-01

Hi Bruce.

Thanks for the comment. Once you've installed the library (Step 3) and restarted the application, the sketches are listed under the examples.

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


About This Instructable




Bio: Developer of the telecontrol and telemonitoring system Teleduino, using the Arduino platform.
More by nathanknz:Control Servos over the Internet via Arduino with TeleduinoRead Light Level over the Internet via Arduino with TeleduinoControl a Relay over the Internet via Arduino with Teleduino
Add instructable to: