/RaspPi-Code

Random Python Code for Raspberry Pi

Primary LanguagePython

RaspPi-Code

1. Raspberry Pi Push Button Video Recorder

The file VideoCamera.py contains the code used for this project. The code will wait for someone to press the button before recording a 10 second video. While the video is recording, a LED will light up to let the user know that it is recording. Once finished, the video will be saved with the current date and time as the filename. To play the video, go to the directory it is stored in from Terminal and type omxplayer "name of video file" and press enter

Components

  • Raspberry Pi 3
  • 330 ohm resistor
  • A Push Button
  • Breadboard
  • Jumper Wires
  • LED
  • Raspberry Pi Camera V2


2. Raspberry Pi Motion Detector/Email Alert System

The file PIRCamera.py contains the code used for this project. The code will initialize a PIR(Passive Infared) sensor that is used to detect motion. If the PIR sensor detects motion, the Raspberry Pi camera will take a photo in the area of motion and email the photo to a specified email address.

The following lines in the file should be modified with the information you will use.
fromAddr = 'Address Sending Email'
toAddr = 'Address Receiving Email'
username = 'Email Address'
password = 'Password'

Components

  • Raspberry Pi 3
  • Jumper Wires
  • PIR Sensor
  • Raspberry Pi Camera V2
  • Breadboard (Optional)


3. Raspberry PI Two Buttons as Input For Camera Control

The file Two Button Camera.py contains the code used for this project. The code will set GPIO pins 17 and 18 as Input with the internal pull up resistors. One button (connected to GPIO 17) records a 10 second video. The other button (connected to GPIO 18) captures a picture. Both video and picture files are saved to the Documents folder with the current date and time as the filename. Since the code contains an infinite loop, it should be run from the Terminal. To end the program press Ctrl + c.


Components

  • Raspberry Pi 3
  • Jumper Wires
  • 2 Press Buttons
  • Raspberry Pi Camera V2
  • Breadboard