Camera

Design
 The main components used to develop the camera are:
1.      Raspberry Pi
2.      2.8” TFT Touchscreen
3.      Portable power supply
4.      Push Button
5.      Wi-Fi Dongle
6.      Camera Module


Our design for the camera system was as follows:

Implementation
This is how the camera was construction:
      1. Connect camera module to raspberry pi.

      2. Simple python script written that takes a photo.
                   call (("raspistill -tl 0 -w 320 -h 320 -o image.jpg"),shell = True)
   
      3. Connect push button to raspberry pi - +3.3V connected to pin 1 on RPi
                                                                    GPIO is connected to pin 16 on RPi
                                                                    Ground is connected to pin 6 on RPi







Image of button connected to RPi - 100nF capacitor is also connected between 1 and 2 on the above diagram to prevent the button from bouncing when selected.



      4. Simple script written that waits for a button press and then takes a photo.
                         while True:
                                    if(GPIO.input(23)==False):
                                                call (("raspistill -tl 0 -w 320 -h 320 -o image.jpg"),shell = True)

       5.   Create a script that would create a GUI that can contain buttons and show images when a photo is taken.



      6. Combined previous prototypes into one application. This allowed photos to be taken by pressing the push button and displaying it on the GUI.

     7. Effects can be added to the image add the -ifx [effect] as part of the call command used to take a photo. i.e. to include a sketch effect you could use the following command:
                            call (("raspistill -tl 0 -ifx sketch -w 320 -h 320 -o image.jpg"),shell = True)

8.       Create prototype script to work out how to upload photos to Facebook.

              token - this is an access token generated enabling this application to post on behave of the user.
              This token is used to create a connection to Facebook.
           
              graph.put_photo() -  is used to upload photo to Facebook.

              Useful link to Graph API and how to generate token:
              https://developers.facebook.com/docs/graph-api/quickstart

9.       Implement functionality to post photos to Facebook. This is done by pressing the Facebook button then taking a photo. The photo should automatically upload the photo to Facebook.



10.       Create prototype script to work out how to upload photos to Twitter.


                 consumer_key, consumer_secret, access_token, access_token_secret are all required to                  create a connection to twitter.

     Useful link used to help set up connection: https://pypi.python.org/pypi/twython

11.       Implement functionality to post photos to Twitter. This is done by pressing the Twitter button then taking a photo. The photo should automatically upload the photo to Twitter.



12.   Add a timer button and timer functionality to program. This will allow a timer to be set (select time from dropdown menu) and a delay will occur with this time before a photo is taken.


13.   Add a button that will allow previous photos to be viewed.

14.   Add a shutdown button that will completely shut down the system.

15.   The touchscreen was added to create a portable camera system.



16. Desktop shortcut created that will run the app by double clicking on it.
      To do so, do the following:
                > create blank file on desktop and give it a name i.e. app.desktop
                > add the following content:

                            Name: can be anything you wish to call the app
                            Icon: The location of an image you wish to be the shortcuts icon
                            Exec: command used to execute the python script

After saving the file, double clicking on the shortcut on the desktop should run the app.


17. GUI Image of completed application


18. A link to the source code and desktop shortcut can be found here:  https://www.dropbox.com/sh/4gly17lep8j2u1g/_jAjhIZLR3

Features
 The main features of the camera are:
1.       Take a photo and view it on the screen after photo has been taken
2.       Add one of many different effects
3.       Upload photo to Facebook
4.       Upload photo to Twitter
5.       Set a timer before taking a photo
6.       Look through previously taken photos
7.       Shutdown the system

No comments:

Post a Comment