Thread: Wireless Surveillance System using Arduino and Zigbee

  1. #1
    Registered User
    Join Date
    Feb 2014
    Posts
    4

    Wireless Surveillance System using Arduino and Zigbee

    I am trying to implement same thing as given in following images:
    Wireless Surveillance System using Arduino and Zigbee-ttl-camera-duino-jpeg
    Wireless Surveillance System using Arduino and Zigbee-wireless-surveillance-jpg




    i m working on "Wireless surveillance system using zigbee".
    But i want to add external PIR motion sensor and wireless zigbee module with Arduino.
    The images are stored in SD card. but my goal is when the PIR detects any motion the image should be stored in memory card (Done in attached code)and then that image should be transferred through zigbee (Zigbee Tx is connected with Rx Pin0 and zigbee Rx is connected with Tx Pin1). PIR sensor output is connected with Pin7 of arduino.
    So what are the additions/modifications do i require for transmitting image on Pin1 in following code.


    I am using this code


    Code:
    // This is a motion-detect camera sketch using the Adafruit VC0706 library.
    // On start, the Arduino will find the camera and SD card and turn
    // on motion detection.  If motion is detected, the camera will
    // snap a photo, saving it to the SD card.
    
    
    
    
    #include <Adafruit_VC0706.h>
    #include <SD.h>
    
    
    
    
    // comment out this line if using Arduino V23 or earlier
    #include <SoftwareSerial.h>         
    
    
    // uncomment this line if using Arduino V23 or earlier
    // #include <NewSoftSerial.h>       
    
    
    
    
    
    
    
    
    // Adafruit SD shields and modules: pin 10
    
    
    #define chipSelect 10
    
    
    
    
    
    
    // Using SoftwareSerial (Arduino 1.0+) or NewSoftSerial (Arduino 0023 & prior):
    #if ARDUINO >= 100
    // On Uno: camera TX connected to pin 2, camera RX to pin 3:
    SoftwareSerial cameraconnection = SoftwareSerial(2, 3);
    // On Mega: camera TX connected to pin 69 (A15), camera RX to pin 3:
    //SoftwareSerial cameraconnection = SoftwareSerial(69, 3);
    #else
    NewSoftSerial cameraconnection = NewSoftSerial(2, 3);
    #endif
    Adafruit_VC0706 cam = Adafruit_VC0706(&cameraconnection);
    
    
    // Using hardware serial on Mega: camera TX conn. to RX1,
    // camera RX to TX1, no SoftwareSerial object is required:
    //Adafruit_VC0706 cam = Adafruit_VC0706(&Serial1);
    
    
    
    
    void setup() {
    
    
      // When using hardware SPI, the SS pin MUST be set to an
      // output (even if not connected or used).  If left as a
      // floating input w/SPI on, this can cause lockuppage.
    #if !defined(SOFTWARE_SPI)
    #if defined(__AVR_ATmega1280__) || defined(__AVR_ATmega2560__)
      if(chipSelect != 53) pinMode(53, OUTPUT); // SS on Mega
    #else
      if(chipSelect != 10) pinMode(10, OUTPUT); // SS on Uno, etc.
    #endif
    #endif
    
    
      Serial.begin(9600);
      Serial.println("VC0706 Camera test");
      
      // see if the card is present and can be initialized:
      if (!SD.begin(chipSelect)) {
        Serial.println("Card failed, or not present");
        // don't do anything more:
        return;
      }  
      
      // Try to locate the camera
      if (cam.begin()) {
        Serial.println("Camera Found:");
      } else {
        Serial.println("No camera found?");
        return;
      }
      // Print out the camera version information (optional)
      char *reply = cam.getVersion();
      if (reply == 0) {
        Serial.print("Failed to get version");
      } else {
        Serial.println("-----------------");
        Serial.print(reply);
        Serial.println("-----------------");
      }
    
    
      // Set the picture size - you can choose one of 640x480, 320x240 or 160x120 
      // Remember that bigger pictures take longer to transmit!
      
      //cam.setImageSize(VC0706_640x480);        // biggest
      cam.setImageSize(VC0706_320x240);        // medium
      //cam.setImageSize(VC0706_160x120);          // small
    
    
      // You can read the size back from the camera (optional, but maybe useful?)
      uint8_t imgsize = cam.getImageSize();
      Serial.print("Image size: ");
      if (imgsize == VC0706_640x480) Serial.println("640x480");
      if (imgsize == VC0706_320x240) Serial.println("320x240");
      if (imgsize == VC0706_160x120) Serial.println("160x120");
    
    
    
    
      //  Motion detection system can alert you when the camera 'sees' motion!
      cam.setMotionDetect(true);           // turn it on
      //cam.setMotionDetect(false);        // turn it off   (default)
    
    
      // You can also verify whether motion detection is active!
      Serial.print("Motion detection is ");
      if (cam.getMotionDetect()) 
        Serial.println("ON");
      else 
        Serial.println("OFF");
    }
    
    
    
    
    
    
    
    
    void loop() {
     if (cam.motionDetected()) {
       Serial.println("Motion!");   
       cam.setMotionDetect(false);
       
      if (! cam.takePicture()) 
        Serial.println("Failed to snap!");
      else 
        Serial.println("Picture taken!");
      
      char filename[13];
      strcpy(filename, "IMAGE00.JPG");
      for (int i = 0; i < 100; i++) {
        filename[5] = '0' + i/10;
        filename[6] = '0' + i%10;
        // create if does not exist, do not open existing, write, sync after write
        if (! SD.exists(filename)) {
          break;
        }
      }
      
      File imgFile = SD.open(filename, FILE_WRITE);
      
      uint16_t jpglen = cam.frameLength();
      Serial.print(jpglen, DEC);
      Serial.println(" byte image");
     
      Serial.print("Writing image to "); Serial.print(filename);
      
      while (jpglen > 0) {
        // read 32 bytes at a time;
        uint8_t *buffer;
        uint8_t bytesToRead = min(32, jpglen); // change 32 to 64 for a speedup but may not work with all setups!
        buffer = cam.readPicture(bytesToRead);
        imgFile.write(buffer, bytesToRead);
    
    
        //Serial.print("Read ");  Serial.print(bytesToRead, DEC); Serial.println(" bytes");
    
    
        jpglen -= bytesToRead;
      }
      imgFile.close();
      Serial.println("...Done!");
      cam.resumeVideo();
      cam.setMotionDetect(true);
     }
    }

  2. #2
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,661
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  3. #3
    Registered User
    Join Date
    May 2009
    Posts
    4,183
    Zigbee is likely way too slow to do Video or even real-time images.

    Tim S.
    "...a computer is a stupid machine with the ability to do incredibly smart things, while computer programmers are smart people with the ability to do incredibly stupid things. They are,in short, a perfect match.." Bill Bryson

  4. #4
    Registered User
    Join Date
    Feb 2014
    Posts
    4
    Quote Originally Posted by Salem View Post

    Salem..Its my last year project n i have only 2 months remaining for final year exam.. My hardware is ready but I am very bad at programming that's why i have posted my post in different forums so that i can get help n i can complete my project in short time...

  5. #5
    Registered User
    Join Date
    Nov 2012
    Posts
    157
    Quote Originally Posted by sohelmalek12 View Post
    Its my last year project n i have only 2 months remaining for final year exam..
    This is a final year project??!what exactly are you taking?? considering the fact that the posted code isn't even yours i understand why such a project was chosen. however,i do not believe it is right for you to graduate if you cannot implement the system you described . I still being in school myself understand how stressful it might be,but i would still hate graduating knowing the qualifications stated on my degree are not in my possession .forgive me if i offend but adding a wireless module to a system that already exists is hardly worthy of final year status.three months should be enough time(more than enough) to figure out how to get it working if you put your mind to it.

    Quote Originally Posted by sohelmalek12 View Post
    My hardware is ready but I am very bad at programming
    your hardware might be ready, but may not be the correct hardware to do what you want to do
    Last edited by africanwizz; 02-12-2014 at 02:32 AM.

  6. #6
    Registered User
    Join Date
    May 2009
    Posts
    4,183
    Found one of the sites likely being plagiarized Build a Basic IR Motion-Sensing Camera with Weekend Projects | MAKE

    Note: plagiarized means using without giving credit!

    Tim S.
    Last edited by stahta01; 02-12-2014 at 02:39 AM.
    "...a computer is a stupid machine with the ability to do incredibly smart things, while computer programmers are smart people with the ability to do incredibly stupid things. They are,in short, a perfect match.." Bill Bryson

  7. #7
    Registered User
    Join Date
    Feb 2014
    Posts
    4
    can any body tell me how to remove my thread????

  8. #8
    Registered User
    Join Date
    May 2009
    Posts
    4,183
    Quote Originally Posted by sohelmalek12 View Post
    can any body tell me how to remove my thread????
    I suggest reading the rules [before posting on any forum in the future]; this site DOES NOT allow thread removals by the regular posters!
    And, normally does NOT do it when requested.

    From http://cboard.cprogramming.com/c-pro...rules-faq.html

    Q: Can I delete my posts / Can I request that posts are deleted when my question is answered?
    A: In general, no.
    From http://cboard.cprogramming.com/c-pro...e-posting.html

    1. Remember this is a public forum. See the Homework Policy for more details about policies on post deletion etc.
    <p>
    From http://cboard.cprogramming.com/c-pro...-homework.html

    Please note that this is a public forum. Posts that include parts of assignments are free for anyone to see. It is board policy to encourage the sharing of information and to help people learn to program. Therefore, we avoid deleting posts. If your question is specific to a certain assignment, be aware that it will be visible to the public, and it is our policy NOT to delete posts. It is possible your work may be copied by others.
    Tim S.
    Last edited by stahta01; 02-12-2014 at 03:43 AM.
    "...a computer is a stupid machine with the ability to do incredibly smart things, while computer programmers are smart people with the ability to do incredibly stupid things. They are,in short, a perfect match.." Bill Bryson

  9. #9
    Registered User
    Join Date
    Feb 2014
    Posts
    4
    Thank You...
    n Sorry for all the things..
    Note that i have written already in my 1st post that "I am trying to implement same thing as given in following images:"
    I am trying to implement this with the help of "www.adafruit.com" and "www.
    makezine.com"
    And i want to transmit camera images through zigbee which are saved in microSD.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Mass Surveillance
    By gemera in forum General Discussions
    Replies: 23
    Last Post: 02-02-2014, 12:56 AM
  2. C and Arduino
    By bamwels in forum C Programming
    Replies: 11
    Last Post: 08-21-2013, 09:20 PM
  3. help in c communication with arduino
    By kapustelis in forum C Programming
    Replies: 8
    Last Post: 02-06-2013, 02:35 AM
  4. arduino
    By Annonymous in forum Tech Board
    Replies: 7
    Last Post: 05-29-2012, 11:13 PM

Tags for this Thread