Skip to content

Step by step of how to configure a Raspberry Pi 3 and all libreries from scratch until use a picamera

Notifications You must be signed in to change notification settings

rafariva/Raspberrry-Pi-3-PiCam-Basic-Config

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

38 Commits
 
 
 
 

Repository files navigation

Raspberry Pi 3

PREPARE YOUR RASPBERRY PI Step by Step Guide

  1. Download the image for your raspberry pi
  2. Download Etcher and install it
  3. Connect an SD card reader with the SD card inside.
  4. Open Etcher and select from your hard drive the Raspberry Pi file (.img or .zip) you wish to write to the SD card.
  5. Select the SD card you wish to write your image to.
  6. Review your selections and click 'Flash!' to begin writing data to the SD card (takes between 5 to 10 minutes).

etcher

CONFIG YOUR RASPI

  1. Update all libraries (takes between 5 to 10 minutes)
sudo apt-get update
sudo apt-get upgrade
sudo apt-get install python3-pip
  1. Alias python3 as default
alias py=python3

on File .bashrc, add: alias py=python3

  1. Run config 'wizard'
sudo raspi-config

raspi_config

Most important configuration

  1. Option 1 (Password). Important if you want to change your password
  2. Option 2 (Network). Usefull to config your wifi network
  3. Option 4 (Localisation). Change your Locale, Timezone and Keyboard Layout
  4. option 5 (Interfacing). In submenu, Enable what you need (PiCamera, SSH**, VNC?)

Then, Restart your RASPI

CONFIG PICAMERA Step by Step Installation

Enable PiCamera inteface from raspi-config

sudo apt-get install python3-picamera

Example Code for taking photo:

import picamera
from time import sleep

camera = picamera.PiCamera()
camera.resolution = (640,480)
#camera.framerate = 24
camera.start_preview()
sleep(0.1)

#camera.annotate_text_size = 50
#camera.annotate_text = "Hello world!"
#camera.image_effect = 'colorswap'
#camera.brightness = 70
#camera.contrast = 50

camera.capture('image.jpg')
camera.stop_preview()

Example Code for Video:

VIEW PHOTO ON CONSOLE more info

  1. Install fbi
sudo apt-get -y install fbi
  1. Common command
#view a single image
fbi -a myphoto.jpg

#view all images
fbi -a *.jpg

#presentation all images every 5secs
fbi -a -t 5 *.jpg

AUTORUN PY

  1. create a sh file (chmod 755)
#!/bin/sh

python3 /home/pi/script.py &
  1. create auto task: sudo crontab -e
  2. add at the end: @reboot sh /home/pi/script.sh
  3. add at the end: @reboot python3 /home/pi/code.py &

For kill process:

  1. Find process (PID): top
  2. kill -i PID

REMOVE OLD FILES

  1. Enter to cron task
sudo crontab -e
  1. Set when to execute, the folder, files and backdays to delete
0 5 * * * sudo find /var/lib/logs -name "*.log" -type f -mtime +5

This mean every day at 5am. remove all .log files with 5 days older from logs folder.

WEBCAMERA MOTION Follow this link: https://www.instructables.com/Raspberry-Pi-Motion-Detection-Security-Camera/

Optional LIBRARIES

pip3 install tensorflow
pip3 install keras
pip3 install requests

pip3 install opencv-python
pip3 install h5py
pip3 install lxml

sudo apt-get install libxml2-dev
sudo apt-get install libxslt-dev
sudo apt-get install libhdf5-serial-dev
sudo apt-get install libatlas-base-dev
sudo apt-get install libwebp6
sudo apt-get install libtiff5
sudo apt-get install libjasper1
sudo apt-get install openexr
sudo apt-get install libqtgui4
sudo apt-get install libqt4-test
sudo apt-get install libgstreamer1.0-0 gstreamer1.0-plugins-base gstreamer1.0-plugins-good gstreamer1.0-plugins-bad gstreamer1.0-plugins-ugly gstreamer1.0-libav gstreamer1.0-doc gstreamer1.0-tools

VNC ACCESS Step by Step Configuration (optional)

Enable VNC inteface from raspi-config

sudo apt-get install realvnc-vnc-server
sudo systemctl start vncserver-x11-serviced.service
sudo systemctl enable vncserver-x11-serviced.service

About

Step by step of how to configure a Raspberry Pi 3 and all libreries from scratch until use a picamera

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published