Instructables

Control Servos over the Internet via Arduino with Teleduino

Picture of Control Servos over the Internet via Arduino with Teleduino
Servos have many uses and can be a lot of fun to play around with. Something that can be heaps of fun is taking control of up to six servos over the internet! Just imagine the possibilities.

This process is made really simple using the Teleduino sketch for your ethernet enabled Arduino. Haven't heard of Teleduino? That's cool, you may want to take a look at Arduino Control via a Web Service with Teleduino to get yourself started. It's designed to be quick and easy for rapid development.

This tutorial will guide you through the process of attaching a servo to your Arduino, and provide some example Teleduino API call to:
  • Define a servo instance
  • Set the position of a servo
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.

Let's go!
 
Remove these adsRemove these ads by Signing Up

Step 1: Parts Needed and Circuit Diagram

Parts Needed
You need the following parts to complete this tutorial:
  • Ethernet enabled Arduino with the Teleduino sketch loaded
  • Breadboard (optional, but makes prototyping much easier)
  • Dedicated 5V power supply for the servo(s) (optional, but recommended because servos can draw high current causing your Arduino to reset)
  • Servo
  • Some hookup wire

Circuit Diagram
The circuit is pretty simple, but sometimes a picture can paint a thousand words! Take a look at the attached circuit diagram to see how to connect the servo to the Arduino board and external power source.

Step 2: Put Circuit Together

The image shows the circuit put together using hookup wire and a breadboard. Compare this against the circuit diagram in the previous step to help put your own circuit together.
Do a quick Google search to work out the pin-out for your particular servo.
For the servo used in the tutorial: yellow = signal, red = 5V, black = GND.
Any available digital pin on the Arduino can be used, just make sure you take note of which pin you connect it to so that you can reference it in the API calls later in the tutorial.

Step 3: Control Servo via the Teleduino API

Here are some example API calls that you can use to define and position your servo(s). You need to replace {key} with the unique API key you obtained when you completed the instructable Arduino Control via a Web Service with Teleduino. Simply put the URLs into your browser's address bar and you should see some magic happen!

Define a servo on digital pin 2 (Must be done prior to positioning a servo. 'servo=0' means servo instance 0, possible values are 0 - 5, 'pin=2' means digital pin 2):
http://us01.proxy.teleduino.org/api/1.0/328.php?k={key}&r=defineServo&servo=0&pin=2

Set the position of servo 0 to 15 ('servo=0' means servo instance 0, 'position=15' means the position to set, possible values are 0 - 180):
http://us01.proxy.teleduino.org/api/1.0/328.php?k={key}&r=setServo&servo=0&position=15

Set the position of servo 0 to 175 ('servo=0' means servo instance 0, 'position=175' means the position to set, possible values are 0 - 180):
http://us01.proxy.teleduino.org/api/1.0/328.php?k={key}&r=setServo&servo=0&position=175

Manage Presets
Sometimes it can be handy to have the servos defined when the device starts. This means that you don't need to run the defineServo method via the API prior to controlling a servo. To manage the presets of your device, go to http://www.teleduino.org/tools/manage_presets.php?k={key}.

Pretty neat, huh?

Step 4: Further Reading

Controlling servos is just a very simple example of what can be achieved by using the Teleduino Arduino library/sketch.

There are several other tutorials posted here on Instructables. SImply search for 'Teleduino' and see what you can find!

To view the full API reference manual, take a look at http://www.teleduino.org/rtfm/api/328.php.

Have fun!
pmartins114 months ago

What is the API call I use to control the servo with the Manage Presets Tool?

nathanknz (author)  pmartins114 months ago

Hi pmartins11,

The Manage Presets tool is for defining the servo pins and the initial servo position that will be set when the device starts up. You would then use API calls to change the position of the servo.

Thanks for trying out Teleduino!

member011 year ago
I got the LED Teleduino Instructable working fine but got stuck when it came to the Servo controls over Teleduino. It would drop out and lose connection periodically unlike the LED that worked every time. I think this is down to me not using a dedicated power supply for the servo and the Ardunio wigging out. I am getting a switchable DC power supply tomorrow and will test and update.
nathanknz (author)  member011 year ago
Hi member01,

Thanks for your comment. I believe your findings would be correct - you will most likely require a separate DC power supply for the servos.

Have fun with your projects!
mapache1011 year ago
It worked like a charm! thank you.