Thursday, 16 February 2017

HOW TO MAKE A MOBI CAM STAND WITH ARDUINO| CAM AND BT INTERFACE



This project is base on Arduino microcontroller. this video explain how to make a mobile camera stand using servos and drafter. we make a 4 leg camera stand which is controlled by Arduino using Bluetooth module and interface mobile cam with web browser using IP CAM software.

COMPONENT REQUIRED FOR PROJECT:
(1)- A drafter
(2)- two servo motors
(3)- Arduino pro mini microcontroller
(4)- Bluetooth HC05 module
(5)- bicycle spokes
(6)- bolt and screws

Software required for this project:

(1)- Arduino IDM
(2)- Proteus for circuit design
(3)- Bluetooth serial controller for android devices
(4)- IP CAM app for android

Arduino coding:

#include<Servo.h>
#include<SoftwareSerial.h>
#include <Wire.h>
Servo myservo1;
Servo myservo2;
SoftwareSerial myserial(10,11);// rx and tx
uint8_t temp = 'x';
int i = 0, l = 0;
unsigned int val1, val2, sin_wave[251], sin_wave1[251];

void setup() {
  Serial.begin(9600);
  myserial.begin(9600); // BT begin here
  while(!myserial)
  {
    ;
  }
Serial.println("welcom igen to camera stand");
myservo1.attach(5);           // servo tilt motion
myservo2.attach(6);           // servo pan motion


 for (int k = 623; k <= 873; k++)
  {
    float angle = TWO_PI * k / 1500;        //here 1500 is the max number of steps
    val2 = (sin(angle)) * (180);
    val1 = (sin(angle)) * (70);
    val2 += 89;
    val1 += 35;
    sin_wave[k - 623] = val1;
    sin_wave1[k - 623] = val2;
  }

  myservo1.write(180 - sin_wave[100]);
  myservo2.write(180 - sin_wave1[100]);
  i=129,l=129;                              //align head in middle
  }

void loop() {
  if(myserial.available()>0)           // checking for connection with BT
  {
    temp=myserial.read();
    Serial.print("you got serial data:   ");
    Serial.println(temp);
   }


if (int(temp)>=97)
{

switch(temp)
{
  case 's':                     // tilt down motion
   for (; (i <= 250 && (temp != 'q' || temp == 'w' )); i++)
            {
              myservo1.write(180 - sin_wave[i]);
              delay(10);
            }
            break;

   case 'w':                  // tilt up motion
            for (; (i >= 0 && (temp != 'q' || temp == 's')); i--)
            {
              myservo1.write(180 - sin_wave[i]);
              delay(10);
            }
            break;

    case 'a':                   // pan left motion
            for (; (l <= 250 && (temp != 'q' || temp == 'a')); l++)
            {
              myservo2.write(180 - sin_wave1[l]);
              delay(10);
            }
         
            break;
      case 'd':                   // pan right motion
            for (; (l >= 0 && (temp != 'q' || temp == 'd')); l--)
            {
              myservo2.write(180 - sin_wave1[l]);
              delay(10);
            }
            break;

      case 'v':                // moving pan to middle portion
             for (; (l <= 100 && (temp != 'q' )); l++)
                {
                  myservo1.write(180 - sin_wave1[l]);
                  delay(10);
                }

              for (; (l >= 100 && (temp != 'q' )); l--)
                {
                  myservo2.write(180 - sin_wave1[l]);
                  delay(10);
                }
            break;
}
}

else
{
  myservo1.write(int(temp));          // taking value from bt app
  delay(10);
}
}


My title page contents

No comments:

Post a Comment