UVC Camera Servo Motor Control [P006.1]




https://www.youtube.com/watch?v=pAshFXld2N0


*GitHubhttps://github.com/rdiot/rdiot-p006.1.git


* Parts

- Arduino Yun (ARDUINO-YUN) [B015]

- Logitech HD WebCam C310 (C310) [S084]

- SG90 Camera Mount [B051]

- Tower Pro SG90 Micro Servo (SG90) [D018]  

 

Contents

- Control Interface 


- Source

#include <Bridge.h>
#include <YunServer.h>
#include <YunClient.h>
#include <Servo.h> 
 
YunServer server;

Servo myservo1;
Servo myservo2;

int servoPin_leftright = 9; 
int servoPin_updown = 10; 

int pos_updown_min = 100; 
int pos_updown_max = 150;

int pos_leftright_min = 0;
int pos_leftright_max = 90;

int pos_updown;
int pos_leftright;
int pos_cnt = 5;

void setup() {
  Serial.begin(9600);
  pinMode(13,OUTPUT);
  
  digitalWrite(13, LOW);
  Bridge.begin();
  digitalWrite(13, HIGH);
  
  server.listenOnLocalhost();
  server.begin();

  myservo1.attach(servoPin_leftright); 
  myservo2.attach(servoPin_updown); 

  for(int pos = 0; pos < 65; pos += 1) 
  { 
    myservo1.write(pos);
    pos_leftright = pos;

    delay(100); 
  }

  for(int pos = 150; pos>=100; pos-=1)
  { 
    myservo2.write(pos); 
    pos_updown = pos;
    delay(100); 
  } 
}

void loop() {
  YunClient client = server.accept();
 
  if (client) {
    process(client);
    client.stop();
  }
  delay(50); 
}

void process(YunClient client) {
  String command = client.readStringUntil('/');
 
  if (command == "control") {
    controlCommand(client);
  }
}
 
void digitalCommand(YunClient client) {
  int pin, value;
pin = client.parseInt();
 
  if (client.read() == '/') {
    value = client.parseInt();
    digitalWrite(pin, value);
  } 
  else {
    value = digitalRead(pin);
  }
  client.print(F("Pin D"));
  client.print(pin);
  client.print(F(" set to "));
  client.println(value);
 
  String key = "D";
  key += pin;
  Bridge.put(key, String(value));

}

void controlCommand(YunClient client) {
  String mode = client.readStringUntil('/');
  
  if(mode == "up")
  {
    int temp = pos_updown + pos_cnt;
    if(temp < pos_updown_max)
    {
      myservo2.write(temp); 
      pos_updown = temp;
    }
  }

  if(mode == "down")
  {
   int temp = pos_updown - pos_cnt;
    if(temp > pos_updown_min)
    {
      myservo2.write(temp); 
      pos_updown = temp;
    } 
  }

  if(mode == "right")
  {    
   int temp = pos_leftright - pos_cnt;
    if(temp > pos_leftright_min)
    {
      myservo1.write(temp); 
      pos_leftright = temp;
    }  
  }

  if(mode == "left")
  {
   int temp = pos_leftright + pos_cnt;
    if(temp < pos_leftright_max)
    {
      myservo1.write(temp); 
      pos_leftright = temp;
    }

  }

  client.print(F("Camera "));
  client.print(mode);
  client.print(F(" Current Point X = "));
  client.print(pos_leftright);
  client.print(F(", Current Point Y = "));
  client.print(pos_updown);
}


Posted by RDIoT
|

Logitech HD WebCam C310 (C310) [S084]



https://www.youtube.com/watch?v=q100omG16HQ


* Specs

What you need:

Windows Vista®, Windows® 7 (32-bit or 64-bit) or Windows®  8


Basic requirements:

1 GHz

512 MB RAM or more

200 MB hard drive space

Internet connection

USB 1.1 port (2.0 recommended)


For HD 720p video calling and HD recording:

2.4 GHz Intel® Core™2 Duo

2 GB RAM

200 MB hard drive space

USB 2.0 port

1 Mbps upload speed or higher

1280 x 720 screen resolution


The specs:

HD Video calling (1280 X 720 pixels) with recommended system

HD video capture: Up to 1280 X 720 pixels 

Logitech Fluid Cyrstal™ Technology

Photos: Up to 5 megapixels (software enhanced)

Built-in mic with noise reduction

Hi-Speed USB 2.0 certified (recommended)

Universal clip fits laptops, LCD or CRT monitors

Logitech webcam software:

Pan, tilt, and zoom controls

Video and photo capture

Face tracking

Motion detection


Part Number : PN 960-000585



* Contents

- image capture : fswebcam test.jpg -r 800x600

- real streaming in the web : mipg-streamer & 

 : http://IP:8080/?action=stream


- UVC Camera Preparation

http://linuxtv.org/wiki/index.php/Webcam_Devices teaches us, that there are four types of web cams:

those that have UVC support →Linux UVC driver and tools

those that have GSPCA support →http://linuxtv.org/wiki/index.php/Gspca

those that have out-of-tree support

those that have no Linux support

Then there is the framework Video4Linux and a whole load of applications that work with V4L version 1 and/or version 2.

The Video4Linux2 API: an introduction

http://linuxtv.org/wiki/index.php/Main_Page

V4L2 API Specification



Posted by RDIoT
|

Arduino Yun + Temboo + Google Spreadsheets [P005]








https://youtu.be/JeFmALzTndk


*GitHubhttps://github.com/rdiot/rdiot-p005.git

Posted by RDIoT
|