Dark Light

Pan-Tilt controlled by using 1Sheeld+ and Cellphone Leave a comment

Pan-Tilt controlled by using 1Sheeld+ and Cellphone

In this project I will introduce to you a Pan-Tilt controlled by Cell Phone.
All movements of the cell phone are reproduced in the pan-tilt device via Bluetooth.
The assembly is very simple using an Arduino R3 (or similar) and two shields over it.
I started this project thinking about a device to support newbies in home astronomy giving them an easy way to indicate the right position for the telescope to find out in the sky any planet, star or constelation.
You just need use this device as a sky pointer together with apps like Sky Map.
Very easy and fun!

The items used in this experiment
المواد المستخدمة في التجربة يمكنكم اضافتها الى سلة مشترياتكم مباشرة من هنا

The assembly is very simple with no soldering and few wirings.
Follow the next steps:

  • Put 1Sheeld board over the Arduino board.
  • Put the Motor Driver Shield over the 1Sheeld board.
  • Connect the cable of Tilt axis in the Motor Shield plug (Servo 1).
  • Connect the cable of Pan axis in the Motor Shield plug (Servo 2).

According with their developers, “1Sheeld turns your smartphone into 40 different Arduino shields”.
This shield is very interesting because you can connect an Arduino board via Bluetooth to a celular phone and use all its available sensors.
The connection is simple and you have all necessary libraries available for Arduino.
In this way you can reduce the time you need for your prototypes and decide if you want go ahead or if you need to update something.
After final results you can convert the prototype on a final product applying traditional components and sensors.
For the first use of 1Sheeld you need to download its library to the folder where the Arduino IDE is installed in your computer and in your cell phone you need to install the 1Sheeld App (for Android) or 1Sheeld App (for iPhone).


  • 1Sheeld can run in background and then you can run also another app simultaneously.
  • If you want more information about this shield, visit the 1Sheeld site.

Programming and Setup
The program is very simple.
With the library of Orientation of 1Sheeld, the Arduino program will read the axis X and Y of your cell phone and translate them to the angular position of each servo motor.
One important detail is each cell phone can have a different origin/reference for the axles X, Y, Z.
Due this I have put an statement on setup routine of Arduino to make the “zero” reference according with the positioning of you cell phone.
At starting, you need to put the cell phone on horizontal position aligned with the Pan-Tilt device and then press the reset button of Arduino (you also can press the reset button of the Motor Shield because it is on the top with an easier access).
After this step the Pan-Tilt is already referenced to follow the position of your cell phone !
Move the phone and see the corresponding movements into the servos.

Next Steps
This project can be the base of further applications.
Examples for future developments:
• With the app Sky Map it will be possible to automatize the positioning of a home telescope.
• It can be converted on a personal “follow me camera” to capture images or videos as personal camera-man.

Arduino Code

        Pan-Tilt Controlled by Cell Phone
  (Application supported by 1SHEELD-Android for Arduino UNO)
  PS: X-axis ranges from 0 to 360 degrees, Y-axis ranges from -180 to 180 degrees
  and Z-axis ranges from -90 to 90 degrees.



#include <OneSheeld.h>    // Include 1Sheeld Library
#include <Servo.h>        // Include Servo Library

Servo myservoX;           // Create servo object to control Orientation X
Servo myservoY;           // Create servo object to control Orientation Y

float angleX, angleXi, angleY;
float angleYi = -35;      // This value must be set with a trial to align the "zero" angle of your Tilt. In my case I used -35 for compensation.
boolean k = true;

void setup()


  myservoX.attach(9);    // Servo2 (in the Motor Shield) of Axix X (PAN)  - connected to Analogic Pin 09 of Arduino
  myservoY.attach(10);   // Servo1 (in the Motor Shield) of Axix Y (TILT) - connected to Analogic Pin 10 of Arduino


void loop()

  angleX = -OrientationSensor.getX();
  angleX = angleX - angleXi + 90;
  if (angleX < 0) {
    angleX = angleX + 360;
  if (angleX > 360) {
    angleX = angleX - 360;
  angleX = constrain(angleX, 0, 180);


  angleY = -OrientationSensor.getY();
  angleY = 180 - (angleY - angleYi);
  angleY = constrain(angleY, -30, 150);


void readAngleXi(float xAxis, float yAxis, float zAxis)
  if (k) {
    angleXi = -xAxis;
    k = false;


Leave a Reply

Your email address will not be published. Required fields are marked *