Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save sageworksstudio/b0954d2d6cfac7d4a00e776953324a2c to your computer and use it in GitHub Desktop.
Save sageworksstudio/b0954d2d6cfac7d4a00e776953324a2c to your computer and use it in GitHub Desktop.
Raspberry Pi and PiCam setup (headless)

Headless Raspberry Pi

Note: This assumes you've already flashed an SD card. In this gist I used Jesse Stretch Lite.

  1. After flashing the sd card, create and add a blank file named "ssh" to the /boot partition. This will turn on ssh when the Pi boots. Also create and add a file called "wpa_supplicant.conf" to the /boot partition as well. Configure the contents of the wpa_supplicant.conf file like this: {See This Gist}

  2. Insert your sd card into the Pi and boot the Pi. From a remote machine find your Pi's IP address using a tool like Fing.

  3. After logging in, run these commands:

    $ sudo apt-get update // update your apt repo

    $ sudo apt-get upgrade// upgrade your pi

    $ sudo apt-get install git// install git

    $ git clone https://github.com/silvanmelchior/RPi_Cam_Web_Interface.git // install PiCam software

    $ cd RPi_Cam_Web_Interface //cd into the repo you just downloaded

    $ ./install.sh // install the PiCam software

  4. Complete the setup. When asked which subdirectory, the default is html, but you can use any name here you like. I shoce "camera". When asked to reboot choose "no".

  5. Run: $ sudo raspi-config and turn on the camera. While you're here you can change any other settings.

  6. Reboot.

  7. Setup Motion:

Set motion to start as a daemon.

$ `sudo nano /etc/default/motion`

Change: start_motion_daemon=no to start_motion_daemon=yes and save.

set up a log folder somewhere where the "motion" user can write log files (because you'll likely get errors if the motion user tries to log files to /var/log/motion as is the default:

$ `cd` // change to your home directory

$ `sudo mkdir motion-logs` // make the motion logs directory

$ `sudo chown pi:motion motion-logs` // set pi as owner and motion as group

$ `sudo chmod -R 775 motion-logs` // make sure pi and motion can read/write/execute
  1. Reboot

  2. Use your web browser to brows to your PiCam interface, possibly http://192.168.0.x/camera and start motion detection. Note: If you are also ssh'd into the Pi you will likely see errors that Motion can't write to the log file.

  3. In your browser interface, open motion settings and click "show all".

  4. Change the motion log file path to folder you created in step 7 above. Likely: /home/pi/motion-logs

  5. Save settings and restart the camera. You shouldn't get any errors writing logs and a new log file will appear in your logs directory.

This tutorial was created using the help of this Instructable made by FunguyPro.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment