DIY : Raspberry + Camera + Touch screen + External battery
Welcome in this page which presents a DIY project of camera based on a raspberry pi.
raspi_cam raspi_cam raspi_cam
raspi_cam raspi_cam raspi_cam

What you need

All these products can be found easily on the web (ebay, amazon, ...).
But you will need a link for the raspberry case, because we need one which can be used without its top and a link for the lcd touch screen.

Software

  • We have to install a raspbian image with the driver for the lcd touch screen, and you can find this here.


  • Create, in /home/pi the directory Picts. This is where the script photos.py will save the pictures.


  • Create and save the script photos.py in /home/pi.
    # script photo.py
    
    from Tkinter import *
    
    import os
    import datetime
    import pygame
    from pygame.locals import *
    
    
    def prendPhoto():
            global start
            global it
            global photo
            global filename
    
    
            now = datetime.datetime.now()
            timeString = now.strftime("%Y-%m-%d_%H:%M:%S")
            filename = "Picts/photo_" + timeString
            command = "raspistill -w 920 -h 520  -t 1 -q 100 -o " + filename + ".jpg"
            os.system(command)
            fond = pygame.image.load(filename +".jpg").convert()
            fond = pygame.transform.scale(fond,(460,260))
            fenetre.blit(fond,(10,0))
            pygame.display.flip()
    
    
    
    def Clic(event):
            prendPhoto()
    
    
    
    pygame.init()
    
    fenetre = pygame.display.set_mode((480,260))
    
    
    
    
    pygame.display.flip()
    
    continuer = 1
    while continuer:
            for event in pygame.event.get():
                    if event.type == pygame.QUIT:
                            sys.exit()
                    if event.type == MOUSEBUTTONDOWN:
                            if event.button ==1:
                                    prendPhoto()
                    if event.type == pygame.KEYDOWN:
                            if event.key == pygame.K_ESCAPE:
                                    sys.exit()
    
  • Execute raspi-config to autostart in lxde, and enable the camera.
  • And last step, we have to autostart photos.py :
    Edit the file : /etc/xdg/lxsession/LXDE/autostart and add at the end of this file :
    @lxterminal -e “sudo python /home/pi/photos.py”
compteur internet